!function(t){if("function"==typeofbootstrap)bootstrap("nedb",t);elseif("object"==typeofexports)module.exports=t();elseif("function"==typeofdefine&&define.amd)define(t);elseif("undefined"!=typeofses){if(!ses.ok())return;ses.makeNedb=t}else"undefined"!=typeofwindow?window.Nedb=t():global.Nedb=t()}(function(){vart;returnfunction(t,e,n){functionr(n,o){if(!e[n]){if(!t[n]){varu="function"==typeofrequire&&require;if(!o&&u)returnu(n,!0);if(i)returni(n,!0);thrownewError("Cannot find module '"+n+"'")}vara=e[n]={exports:{}};t[n][0].call(a.exports,function(e){vari=t[n][1][e];returnr(i?i:e)},a,a.exports)}returne[n].exports}for(vari="function"==typeofrequire&&require,o=0;o<n.length;o++)r(n[o]);returnr}({1:[function(t,e,n){!function(t){functione(t,e){if(t.indexOf)returnt.indexOf(e);for(varn=0;n<t.length;n++)if(e===t[n])returnn;return-1}t.EventEmitter||(t.EventEmitter=function(){});varr=n.EventEmitter=t.EventEmitter,i="function"==typeofArray.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=10;r.prototype.setMaxListeners=function(t){this._events||(this._events={}),this._events.maxListeners=t},r.prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||i(this._events.error)&&!this._events.error.length))throwarguments[1]instanceofError?arguments[1]:newError("Uncaught, unspecified 'error' event.");if(!this._events)return!1;vare=this._events[t];if(!e)return!1;if("function"==typeofe){switch(arguments.length){case1:e.call(this);break;case2:e.call(this,arguments[1]);break;case3:e.call(this,arguments[1],arguments[2]);break;default:varn=Array.prototype.slice.call(arguments,1);e.apply(this,n)}return!0}if(i(e)){for(varn=Array.prototype.slice.call(arguments,1),r=e.slice(),o=0,u=r.length;u>o;o++)r[o].apply(this,n);return!0}return!1},r.prototype.addListener=function(t,e){if("function"!=typeofe)thrownewError("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",t,e),this._events[t])if(i(this._events[t])){if(!this._events[t].warned){varn;n=void0!==this._events.maxListeners?this._events.maxListeners:o,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),console.trace())}this._events[t].push(e)}elsethis._events[t]=[this._events[t],e];elsethis._events[t]=e;returnthis},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){varn=this;returnn.on(t,functionr(){n.removeListener(t,r),e.apply(this,arguments)}),this},r.prototype.removeListener=function(t,n){if("function"!=typeofn)thrownewError("removeListener only takes instances of Function");if(!this._events||!this._events[t])returnthis;varr=this._events[t];if(i(r)){varo=e(r,n);if(0>o)returnthis;r.splice(o,1),0==r.length&&deletethis._events[t]}elsethis._events[t]===n&&deletethis._events[t];returnthis},r.prototype.removeAllListeners=function(t){return0===arguments.length?(this._events={},this):(t&&this._events&&this._events[t]&&(this._events[t]=null),this)},r.prototype.listeners=function(t){returnthis._events||(this._events={}),this._events[t]||(this._events[t]=[]),i(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}}(t("__browserify_process"))},{__browserify_process:3}],2:[function(t,e,n){functionr(t){returntinstanceofArray||Array.isArray(t)||t&&t!==Object.prototype&&r(t.__proto__)}functioni(t){returntinstanceofRegExp||"object"==typeoft&&"[object RegExp]"===Object.prototype.toString.call(t)}functiono(t){if(tinstanceofDate)return!0;if("object"!=typeoft)return!1;vare=Date.prototype&&a(Date.prototype),n=t.__proto__&&a(t.__proto__);returnJSON.stringify(n)===JSON.stringify(e)}t("events"),n.isArray=r,n.isDate=function(t){return"[object Date]"===Object.prototype.toString.call(t)},n.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},n.print=function(){},n.puts=function(){},n.debug=fu
"undefined"!=typeofconsole&&(e?console.error&&console.error(e):console[t]&&a(n,function(e){console[t](e)}))}]))}};u.log=x("log"),u.dir=x("dir"),u.memoize=function(t,e){varn={},r={};e=e||function(t){returnt};vari=function(){vari=Array.prototype.slice.call(arguments),o=i.pop(),u=e.apply(null,i);uinn?o.apply(null,n[u]):uinr?r[u].push(o):(r[u]=[o],t.apply(null,i.concat([function(){n[u]=arguments;vart=r[u];deleter[u];for(vare=0,i=t.length;i>e;e++)t[e].apply(null,arguments)}])))};returni.memo=n,i.unmemoized=t,i},u.unmemoize=function(t){returnfunction(){return(t.unmemoized||t).apply(null,arguments)}},u.times=function(t,e,n){for(varr=[],i=0;t>i;i++)r.push(i);returnu.map(r,e,n)},u.timesSeries=function(t,e,n){for(varr=[],i=0;t>i;i++)r.push(i);returnu.mapSeries(r,e,n)},u.compose=function(){vart=Array.prototype.reverse.call(arguments);returnfunction(){vare=this,n=Array.prototype.slice.call(arguments),r=n.pop();u.reduce(t,n,function(t,n,r){n.apply(e,t.concat([function(){vart=arguments[0],e=Array.prototype.slice.call(arguments,1);r(t,e)}]))},function(t,n){r.apply(e,[t].concat(n))})}};var_=function(t,e){varn=function(){varn=this,r=Array.prototype.slice.call(arguments),i=r.pop();returnt(e,function(t,e){t.apply(n,r.concat([e]))},i)};if(arguments.length>2){varr=Array.prototype.slice.call(arguments,2);returnn.apply(this,r)}returnn};u.applyEach=h(_),u.applyEachSeries=y(_),u.forever=function(t,e){functionn(r){if(r){if(e)returne(r);throwr}t(n)}n()},"undefined"!=typeoft&&t.amd?t([],function(){returnu}):"undefined"!=typeofn&&n.exports?n.exports=u:i.async=u}()}(e("__browserify_process"))},{__browserify_process:3}],11:[function(t,e){e.exports.BinarySearchTree=t("./lib/bst"),e.exports.AVLTree=t("./lib/avltree")},{"./lib/avltree":12,"./lib/bst":13}],12:[function(t,e){functionn(t){this.tree=newr(t)}functionr(t){t=t||{},this.left=null,this.right=null,this.parent=void0!==t.parent?t.parent:null,t.hasOwnProperty("key")&&(this.key=t.key),this.data=t.hasOwnProperty("value")?[t.value]:[],this.unique=t.unique||!1,this.compareKeys=t.compareKeys||o.defaultCompareKeysFunction,this.checkValueEquality=t.checkValueEquality||o.defaultCheckValueEquality}vari=t("./bst"),o=t("./customUtils"),u=t("util");t("underscore"),u.inherits(r,i),n._AVLTree=r,r.prototype.checkHeightCorrect=function(){vart,e;if(this.hasOwnProperty("key")){if(this.left&&void0===this.left.height)throw"Undefined height for node "+this.left.key;if(this.right&&void0===this.right.height)throw"Undefined height for node "+this.right.key;if(void0===this.height)throw"Undefined height for node "+this.key;if(t=this.left?this.left.height:0,e=this.right?this.right.height:0,this.height!==1+Math.max(t,e))throw"Height constraint failed for node "+this.key;this.left&&this.left.checkHeightCorrect(),this.right&&this.right.checkHeightCorrect()}},r.prototype.balanceFactor=function(){vart=this.left?this.left.height:0,e=this.right?this.right.height:0;returnt-e},r.prototype.checkBalanceFactors=function(){if(Math.abs(this.balanceFactor())>1)throw"Tree is unbalanced at node "+this.key;this.left&&this.left.checkBalanceFactors(),this.right&&this.right.checkBalanceFactors()},r.prototype.checkIsAVLT=function(){r.super_.prototype.checkIsBST.call(this),this.checkHeightCorrect(),this.checkBalanceFactors()},n.prototype.checkIsAVLT=function(){this.tree.checkIsAVLT()},r.prototype.rightRotation=function(){vart,e,n,r,i=this,o=this.left;returno?(t=o.right,i.parent?(o.parent=i.parent,i.parent.left===i?i.parent.left=o:i.parent.right=o):o.parent=null,o.right=i,i.parent=o,i.left=t,t&&(t.parent=i),e=o.left?o.left.height:0,n=t?t.height:0,r=i.right?i.right.height:0,i.height=Math.max(n,r)+1,o.height=Math.max(e,i.height)+1,o):this},r.prototype.leftRotation=function(){vart,e,n,r,i=this,o=this.right;returno?(t=o.left,i.parent?(o.parent=i.parent,i.parent.left===i?i.parent.left=o:i.parent.right=o):o.parent=null,o.left=i,i.parent=o,i.right=t,t&&(t.parent=i),e=i.left?i.left.height:0,n=t?t.height:0,r=o.right?o.right.height:0,i.height=Math.max(e,n)+1,o.height=Math.max(r,i.height)+1,o):this},r.prototype