!function(){vart=function(e){varn=newt.Index;returnn.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.7.2",t.utils={},t.utils.warn=function(t){returnfunction(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){returnvoid0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){vart=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeofe)thrownewTypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){varn=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||deletethis.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){vare=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){returntinthis.events},t.tokenizer=function(e){if(!arguments.length||null==e||void0==e)return[];if(Array.isArray(e))returne.map(function(e){returnt.utils.asString(e).toLowerCase()});varn=t.tokenizer.seperator||t.tokenizer.separator;returne.toString().trim().toLowerCase().split(n)},t.tokenizer.seperator=!1,t.tokenizer.separator=/[\s\-]+/,t.tokenizer.load=function(t){vare=this.registeredFunctions[t];if(!e)thrownewError("Cannot load un-registered function: "+t);returne},t.tokenizer.label="default",t.tokenizer.registeredFunctions={"default":t.tokenizer},t.tokenizer.registerFunction=function(e,n){ninthis.registeredFunctions&&t.utils.warn("Overwriting existing tokenizer: "+n),e.label=n,this.registeredFunctions[n]=e},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){ninthis.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){varn=e.label&&e.labelinthis.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){varn=newt.Pipeline;returne.forEach(function(e){vari=t.Pipeline.registeredFunctions[e];if(!i)thrownewError("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){vare=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);vari=this._stack.indexOf(e);if(-1==i)thrownewError("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);vari=this._stack.indexOf(e);if(-1==i)thrownewError("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){vare=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(vare=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(varo=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void0!==o&&""!==o);s++);void0!==o&&""!==o&&e.push(o)}returne},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){returnthis._stack.map(function(e){returnt.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void0;vari=this.list;if(!i)returnthis.list=newt.Vector.Node(e,n,i),this.length++;if(e<i.idx)returnthis.list=newt.Vector.Node(e,n,i),this.length++;for(varr=i,o=i.next;void0!=o;){if(e<o.idx)returnr.next=newt.Vector.Node(e,n,o),this.length++;r=o,o=o.next}returnr.next=newt.Vector.Node(e,n,o),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)returnthis._magnitu