UNPKG

itemsjs

Version:

Created to perform fast search on small json dataset (up to 1000 elements).

1 lines 67.5 kB
(function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,t.itemsjs=e()}})(function(){var T,K=Math.max,G=Math.min;return function(){function s(d,e,r){function t(l,n){if(!e[l]){if(!d[l]){var i="function"==typeof require&&require;if(!n&&i)return i(l,!0);if(o)return o(l,!0);var _=new Error("Cannot find module '"+l+"'");throw _.code="MODULE_NOT_FOUND",_}var a=e[l]={exports:{}};d[l][0].call(a.exports,function(e){var o=d[l][1][e];return t(o||e)},a,a.exports,s,d,e,r)}return e[l].exports}for(var o="function"==typeof require&&require,n=0;n<r.length;n++)t(r[n]);return t}return s}()({1:[function(e,t){"use strict";t.exports=e("./src/index")},{"./src/index":7}],2:[function(e,t){"use strict";function o(e){if(this.words=[],e)if(Symbol&&Symbol.iterator&&void 0!==e[Symbol.iterator]){const t=e[Symbol.iterator]();for(let e=t.next();!e.done;)this.add(e.value),e=t.next()}else for(let t=0;t<e.length;t++)this.add(e[t])}o.prototype.fromWords=function(e){const t=Object.create(o.prototype);return t.words=e,t},o.prototype.add=function(e){this.resize(e),this.words[e>>>5]|=1<<e},o.prototype.flip=function(e){this.resize(e),this.words[e>>>5]^=1<<e},o.prototype.clear=function(){this.words.length=0},o.prototype.remove=function(e){this.resize(e),this.words[e>>>5]&=~(1<<e)},o.prototype.isEmpty=function(){const e=this.words.length;for(let t=0;t<e;t++)if(0!==this.words[t])return!1;return!0},o.prototype.has=function(e){return 0!=(this.words[e>>>5]&1<<e)},o.prototype.checkedAdd=function(e){this.resize(e);const t=this.words[e>>>5],o=t|1<<e;return this.words[e>>>5]=o,(o^t)>>>e},o.prototype.trim=function(){let e=this.words.length;for(;0<e&&0===this.words[e-1];)e--;this.words=this.words.slice(0,e)},o.prototype.resize=function(e){for(let t=this.words.length;t<e+32>>>5;t++)this.words[t]=0},o.prototype.hammingWeight=function(e){return e-=1431655765&e>>>1,e=(858993459&e)+(858993459&e>>>2),16843009*(252645135&e+(e>>>4))>>>24},o.prototype.hammingWeight4=function(e,t,o,r){return e-=1431655765&e>>>1,t-=1431655765&t>>>1,o-=1431655765&o>>>1,r-=1431655765&r>>>1,e=(858993459&e)+(858993459&e>>>2),t=(858993459&t)+(858993459&t>>>2),o=(858993459&o)+(858993459&o>>>2),r=(858993459&r)+(858993459&r>>>2),e=252645135&e+(e>>>4),t=252645135&t+(t>>>4),o=252645135&o+(o>>>4),r=252645135&r+(r>>>4),16843009*(e+t+o+r)>>>24},o.prototype.size=function(){let e=0;const t=this.words.length,o=this.words;for(let r=0;r<t;r++)e+=this.hammingWeight(o[r]);return e},o.prototype.array=function(){const e=Array(this.size());let o=0;const t=this.words.length;for(let r,n=0;n<t;++n)for(r=this.words[n];0!=r;){const s=r&-r;e[o++]=(n<<5)+this.hammingWeight(0|s-1),r^=s}return e},o.prototype.forEach=function(e){const t=this.words.length;for(let o,r=0;r<t;++r)for(o=this.words[r];0!=o;){const n=o&-o;e((r<<5)+this.hammingWeight(0|n-1)),o^=n}},o.prototype[Symbol.iterator]=function*(){const e=this.words.length;for(let o,r=0;r<e;++r)for(o=this.words[r];0!=o;){const e=o&-o;yield(r<<5)+this.hammingWeight(0|e-1),o^=e}},o.prototype.clone=function(){const e=Object.create(o.prototype);return e.words=this.words.slice(),e},o.prototype.intersects=function(e){const t=G(this.words.length,e.words.length);for(let o=0;o<t;++o)if(0!=(this.words[o]&e.words[o]))return!0;return!1},o.prototype.intersection=function(e){const t=G(this.words.length,e.words.length);let o=0;for(;o+7<t;o+=8)this.words[o]&=e.words[o],this.words[o+1]&=e.words[o+1],this.words[o+2]&=e.words[o+2],this.words[o+3]&=e.words[o+3],this.words[o+4]&=e.words[o+4],this.words[o+5]&=e.words[o+5],this.words[o+6]&=e.words[o+6],this.words[o+7]&=e.words[o+7];for(;o<t;++o)this.words[o]&=e.words[o];const r=this.words.length;for(o=t;o<r;++o)this.words[o]=0;return this},o.prototype.intersection_size=function(e){const t=G(this.words.length,e.words.length);let o=0;for(let r=0;r<t;++r)o+=this.hammingWeight(this.words[r]&e.words[r]);return o},o.prototype.new_intersection=function(e){const t=Object.create(o.prototype),r=G(this.words.length,e.words.length);t.words=Array(r);let n=0;for(;n+7<r;n+=8)t.words[n]=this.words[n]&e.words[n],t.words[n+1]=this.words[n+1]&e.words[n+1],t.words[n+2]=this.words[n+2]&e.words[n+2],t.words[n+3]=this.words[n+3]&e.words[n+3],t.words[n+4]=this.words[n+4]&e.words[n+4],t.words[n+5]=this.words[n+5]&e.words[n+5],t.words[n+6]=this.words[n+6]&e.words[n+6],t.words[n+7]=this.words[n+7]&e.words[n+7];for(;n<r;++n)t.words[n]=this.words[n]&e.words[n];return t},o.prototype.equals=function(e){const t=G(this.words.length,e.words.length);for(let o=0;o<t;++o)if(this.words[o]!=e.words[o])return!1;if(this.words.length<e.words.length){const t=e.words.length;for(let o=this.words.length;o<t;++o)if(0!=e.words[o])return!1}else if(e.words.length<this.words.length){const t=this.words.length;for(let o=e.words.length;o<t;++o)if(0!=this.words[o])return!1}return!0},o.prototype.difference=function(e){const t=G(this.words.length,e.words.length);let o=0;for(;o+7<t;o+=8)this.words[o]&=~e.words[o],this.words[o+1]&=~e.words[o+1],this.words[o+2]&=~e.words[o+2],this.words[o+3]&=~e.words[o+3],this.words[o+4]&=~e.words[o+4],this.words[o+5]&=~e.words[o+5],this.words[o+6]&=~e.words[o+6],this.words[o+7]&=~e.words[o+7];for(;o<t;++o)this.words[o]&=~e.words[o];return this},o.prototype.difference2=function(e){const t=G(this.words.length,e.words.length);let o=0;for(;o+7<t;o+=8)e.words[o]=this.words[o]&~e.words[o],e.words[o+1]=this.words[o+1]&~e.words[o+1],e.words[o+2]=this.words[o+2]&~e.words[o+2],e.words[o+3]=this.words[o+3]&~e.words[o+3],e.words[o+4]=this.words[o+4]&~e.words[o+4],e.words[o+5]=this.words[o+5]&~e.words[o+5],e.words[o+6]=this.words[o+6]&~e.words[o+6],e.words[o+7]=this.words[o+7]&~e.words[o+7];for(;o<t;++o)e.words[o]=this.words[o]&~e.words[o];for(o=this.words.length-1;o>=t;--o)e.words[o]=this.words[o];return e.words=e.words.slice(0,this.words.length),e},o.prototype.new_difference=function(e){return this.clone().difference(e)},o.prototype.difference_size=function(e){const t=G(this.words.length,e.words.length);let o=0,r=0;for(;r<t;++r)o+=this.hammingWeight(this.words[r]&~e.words[r]);for(const t=this.words.length;r<t;++r)o+=this.hammingWeight(this.words[r]);return o},o.prototype.change=function(e){const t=G(this.words.length,e.words.length);let o=0;for(;o+7<t;o+=8)this.words[o]^=e.words[o],this.words[o+1]^=e.words[o+1],this.words[o+2]^=e.words[o+2],this.words[o+3]^=e.words[o+3],this.words[o+4]^=e.words[o+4],this.words[o+5]^=e.words[o+5],this.words[o+6]^=e.words[o+6],this.words[o+7]^=e.words[o+7];for(;o<t;++o)this.words[o]^=e.words[o];for(o=e.words.length-1;o>=t;--o)this.words[o]=e.words[o];return this},o.prototype.new_change=function(e){const t=Object.create(o.prototype),r=K(this.words.length,e.words.length);t.words=Array(r);const n=G(this.words.length,e.words.length);let s=0;for(;s+7<n;s+=8)t.words[s]=this.words[s]^e.words[s],t.words[s+1]=this.words[s+1]^e.words[s+1],t.words[s+2]=this.words[s+2]^e.words[s+2],t.words[s+3]=this.words[s+3]^e.words[s+3],t.words[s+4]=this.words[s+4]^e.words[s+4],t.words[s+5]=this.words[s+5]^e.words[s+5],t.words[s+6]=this.words[s+6]^e.words[s+6],t.words[s+7]=this.words[s+7]^e.words[s+7];for(;s<n;++s)t.words[s]=this.words[s]^e.words[s];const i=this.words.length;for(s=n;s<i;++s)t.words[s]=this.words[s];const d=e.words.length;for(s=n;s<d;++s)t.words[s]=e.words[s];return t},o.prototype.change_size=function(e){const t=G(this.words.length,e.words.length);let o=0,r=0;for(;r<t;++r)o+=this.hammingWeight(this.words[r]^e.words[r]);const n=this.words.length>e.words.length?this:e,s=n.words.length;for(;r<s;++r)o+=this.hammingWeight(n.words[r]);return o},o.prototype.toString=function(){return"{"+this.array().join(",")+"}"},o.prototype.union=function(e){const t=G(this.words.length,e.words.length);let o=0;for(;o+7<t;o+=8)this.words[o]|=e.words[o],this.words[o+1]|=e.words[o+1],this.words[o+2]|=e.words[o+2],this.words[o+3]|=e.words[o+3],this.words[o+4]|=e.words[o+4],this.words[o+5]|=e.words[o+5],this.words[o+6]|=e.words[o+6],this.words[o+7]|=e.words[o+7];for(;o<t;++o)this.words[o]|=e.words[o];if(this.words.length<e.words.length){this.resize((e.words.length<<5)-1);const o=e.words.length;for(let r=t;r<o;++r)this.words[r]=e.words[r]}return this},o.prototype.new_union=function(e){const t=Object.create(o.prototype),r=K(this.words.length,e.words.length);t.words=Array(r);const n=G(this.words.length,e.words.length);let s=0;for(;s+7<n;s+=8)t.words[s]=this.words[s]|e.words[s],t.words[s+1]=this.words[s+1]|e.words[s+1],t.words[s+2]=this.words[s+2]|e.words[s+2],t.words[s+3]=this.words[s+3]|e.words[s+3],t.words[s+4]=this.words[s+4]|e.words[s+4],t.words[s+5]=this.words[s+5]|e.words[s+5],t.words[s+6]=this.words[s+6]|e.words[s+6],t.words[s+7]=this.words[s+7]|e.words[s+7];for(;s<n;++s)t.words[s]=this.words[s]|e.words[s];const i=this.words.length;for(s=n;s<i;++s)t.words[s]=this.words[s];const d=e.words.length;for(s=n;s<d;++s)t.words[s]=e.words[s];return t},o.prototype.union_size=function(e){const t=G(this.words.length,e.words.length);let o=0;for(let r=0;r<t;++r)o+=this.hammingWeight(this.words[r]|e.words[r]);if(this.words.length<e.words.length){const t=e.words.length;for(let r=this.words.length;r<t;++r)o+=this.hammingWeight(0|e.words[r])}else{const t=this.words.length;for(let r=e.words.length;r<t;++r)o+=this.hammingWeight(0|this.words[r])}return o},t.exports=o},{}],3:[function(e,t,o){(function(){var e=Math.log,r=Math.floor,n=function(e){var t=new n.Index;return t.pipeline.add(n.trimmer,n.stopWordFilter,n.stemmer),e&&e.call(t,t),t};n.version="1.0.0",n.utils={},n.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),n.utils.asString=function(e){return void 0===e||null===e?"":e.toString()},n.EventEmitter=function(){this.events={}},n.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();if("function"!=typeof t)throw new TypeError("last argument must be a function");e.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},n.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var o=this.events[e].indexOf(t);this.events[e].splice(o,1),this.events[e].length||delete this.events[e]}},n.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)})}},n.EventEmitter.prototype.hasHandler=function(e){return e in this.events},n.tokenizer=function(e){return arguments.length&&null!=e&&void 0!=e?Array.isArray(e)?e.map(function(e){return n.utils.asString(e).toLowerCase()}):e.toString().trim().toLowerCase().split(n.tokenizer.separator):[]},n.tokenizer.separator=/[\s\-]+/,n.tokenizer.load=function(e){var t=this.registeredFunctions[e];if(!t)throw new Error("Cannot load un-registered function: "+e);return t},n.tokenizer.label="default",n.tokenizer.registeredFunctions={default:n.tokenizer},n.tokenizer.registerFunction=function(e,t){t in this.registeredFunctions&&n.utils.warn("Overwriting existing tokenizer: "+t),e.label=t,this.registeredFunctions[t]=e},n.Pipeline=function(){this._stack=[]},n.Pipeline.registeredFunctions={},n.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&n.utils.warn("Overwriting existing registered function: "+t),e.label=t,n.Pipeline.registeredFunctions[e.label]=e},n.Pipeline.warnIfFunctionNotRegistered=function(e){var t=e.label&&e.label in this.registeredFunctions;t||n.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},n.Pipeline.load=function(e){var t=new n.Pipeline;return e.forEach(function(e){var o=n.Pipeline.registeredFunctions[e];if(o)t.add(o);else throw new Error("Cannot load un-registered function: "+e)}),t},n.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){n.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},n.Pipeline.prototype.after=function(e,t){n.Pipeline.warnIfFunctionNotRegistered(t);var o=this._stack.indexOf(e);if(-1==o)throw new Error("Cannot find existingFn");++o,this._stack.splice(o,0,t)},n.Pipeline.prototype.before=function(e,t){n.Pipeline.warnIfFunctionNotRegistered(t);var o=this._stack.indexOf(e);if(-1==o)throw new Error("Cannot find existingFn");this._stack.splice(o,0,t)},n.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1==t||this._stack.splice(t,1)},n.Pipeline.prototype.run=function(e){for(var t,o=[],r=e.length,n=this._stack.length,s=0;s<r;s++){t=e[s];for(var i=0;i<n&&(t=this._stack[i](t,s,e),void 0!==t&&""!==t);i++);void 0!==t&&""!==t&&o.push(t)}return o},n.Pipeline.prototype.reset=function(){this._stack=[]},n.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return n.Pipeline.warnIfFunctionNotRegistered(e),e.label})},n.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},n.Vector.Node=function(e,t,o){this.idx=e,this.val=t,this.next=o},n.Vector.prototype.insert=function(e,t){this._magnitude=void 0;var o=this.list;if(!o)return this.list=new n.Vector.Node(e,t,o),this.length++;if(e<o.idx)return this.list=new n.Vector.Node(e,t,o),this.length++;for(var r=o,s=o.next;void 0!=s;){if(e<s.idx)return r.next=new n.Vector.Node(e,t,s),this.length++;r=s,s=s.next}return r.next=new n.Vector.Node(e,t,s),this.length++},n.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e,t=this.list,o=0;t;)e=t.val,o+=e*e,t=t.next;return this._magnitude=Math.sqrt(o)},n.Vector.prototype.dot=function(e){for(var t=this.list,o=e.list,r=0;t&&o;)t.idx<o.idx?t=t.next:t.idx>o.idx?o=o.next:(r+=t.val*o.val,t=t.next,o=o.next);return r},n.Vector.prototype.similarity=function(e){return this.dot(e)/(this.magnitude()*e.magnitude())},n.SortedSet=function(){this.length=0,this.elements=[]},n.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},n.SortedSet.prototype.add=function(){var e,t;for(e=0;e<arguments.length;e++)t=arguments[e],~this.indexOf(t)||this.elements.splice(this.locationFor(t),0,t);this.length=this.elements.length},n.SortedSet.prototype.toArray=function(){return this.elements.slice()},n.SortedSet.prototype.map=function(e,t){return this.elements.map(e,t)},n.SortedSet.prototype.forEach=function(e,t){return this.elements.forEach(e,t)},n.SortedSet.prototype.indexOf=function(e){for(var t=0,o=this.elements.length,n=o-t,s=t+r(n/2),i=this.elements[s];1<n;){if(i===e)return s;i<e&&(t=s),i>e&&(o=s),n=o-t,s=t+r(n/2),i=this.elements[s]}return i===e?s:-1},n.SortedSet.prototype.locationFor=function(e){for(var t=0,o=this.elements.length,n=o-t,s=t+r(n/2),i=this.elements[s];1<n;)i<e&&(t=s),i>e&&(o=s),n=o-t,s=t+r(n/2),i=this.elements[s];return i>e?s:i<e?s+1:void 0},n.SortedSet.prototype.intersect=function(e){for(var t=new n.SortedSet,o=0,r=0,s=this.length,i=e.length,d=this.elements,a=e.elements;!0&&!(o>s-1||r>i-1);){if(d[o]===a[r]){t.add(d[o]),o++,r++;continue}if(d[o]<a[r]){o++;continue}if(d[o]>a[r]){r++;continue}}return t},n.SortedSet.prototype.clone=function(){var e=new n.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},n.SortedSet.prototype.union=function(e){var t,o,r;this.length>=e.length?(t=this,o=e):(t=e,o=this),r=t.clone();for(var n=0,s=o.toArray();n<s.length;n++)r.add(s[n]);return r},n.SortedSet.prototype.toJSON=function(){return this.toArray()},n.Index=function(){this._fields=[],this._ref="id",this.pipeline=new n.Pipeline,this.documentStore=new n.Store,this.tokenStore=new n.TokenStore,this.corpusTokens=new n.SortedSet,this.eventEmitter=new n.EventEmitter,this.tokenizerFn=n.tokenizer,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},n.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},n.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},n.Index.load=function(e){e.version!==n.version&&n.utils.warn("version mismatch: current "+n.version+" importing "+e.version);var t=new this;return t._fields=e.fields,t._ref=e.ref,t.tokenizer(n.tokenizer.load(e.tokenizer)),t.documentStore=n.Store.load(e.documentStore),t.tokenStore=n.TokenStore.load(e.tokenStore),t.corpusTokens=n.SortedSet.load(e.corpusTokens),t.pipeline=n.Pipeline.load(e.pipeline),t},n.Index.prototype.field=function(e,t){var t=t||{},o={name:e,boost:t.boost||1};return this._fields.push(o),this},n.Index.prototype.ref=function(e){return this._ref=e,this},n.Index.prototype.tokenizer=function(e){var t=e.label&&e.label in n.tokenizer.registeredFunctions;return t||n.utils.warn("Function is not a registered tokenizer. This may cause problems when serialising the index"),this.tokenizerFn=e,this},n.Index.prototype.add=function(e,t){var o={},r=new n.SortedSet,s=e[this._ref],t=!(t!==void 0)||t;this._fields.forEach(function(t){var n=this.pipeline.run(this.tokenizerFn(e[t.name]));o[t.name]=n;for(var s,d=0;d<n.length;d++)s=n[d],r.add(s),this.corpusTokens.add(s)},this),this.documentStore.set(s,r);for(var d=0;d<r.length;d++){for(var i=r.elements[d],a=0,l=0;l<this._fields.length;l++){var p=this._fields[l],_=o[p.name],c=_.length;if(c){for(var h=0,g=0;g<c;g++)_[g]===i&&h++;a+=h/c*p.boost}}this.tokenStore.add(i,{ref:s,tf:a})}t&&this.eventEmitter.emit("add",e,this)},n.Index.prototype.remove=function(e,t){var o=e[this._ref],t=!(t!==void 0)||t;if(this.documentStore.has(o)){var r=this.documentStore.get(o);this.documentStore.remove(o),r.forEach(function(e){this.tokenStore.remove(e,o)},this),t&&this.eventEmitter.emit("remove",e,this)}},n.Index.prototype.update=function(e,t){var t=!(t!==void 0)||t;this.remove(e,!1),this.add(e,!1),t&&this.eventEmitter.emit("update",e,this)},n.Index.prototype.idf=function(t){var o="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,o))return this._idfCache[o];var r=this.tokenStore.count(t),n=1;return 0<r&&(n=1+e(this.documentStore.length/r)),this._idfCache[o]=n},n.Index.prototype.search=function(t){var o=this.pipeline.run(this.tokenizerFn(t)),r=new n.Vector,s=[],d=this._fields.reduce(function(e,t){return e+t.boost},0),i=o.some(function(e){return this.tokenStore.has(e)},this);if(!i)return[];o.forEach(function(t,o,i){var a=1/i.length*this._fields.length*d,l=this,p=this.tokenStore.expand(t).reduce(function(o,s){var d=l.corpusTokens.indexOf(s),p=l.idf(s),_=1,c=new n.SortedSet;if(s!==t){var h=K(3,s.length-t.length);_=1/e(h)}-1<d&&r.insert(d,a*p*_);for(var g=l.tokenStore.get(s),u=Object.keys(g),f=u.length,y=0;y<f;y++)c.add(g[u[y]].ref);return o.union(c)},new n.SortedSet);s.push(p)},this);var a=s.reduce(function(e,t){return e.intersect(t)});return a.map(function(e){return{ref:e,score:r.similarity(this.documentVector(e))}},this).sort(function(e,t){return t.score-e.score})},n.Index.prototype.documentVector=function(e){for(var t=this.documentStore.get(e),o=t.length,r=new n.Vector,s=0;s<o;s++){var i=t.elements[s],d=this.tokenStore.get(i)[e].tf,a=this.idf(i);r.insert(this.corpusTokens.indexOf(i),d*a)}return r},n.Index.prototype.toJSON=function(){return{version:n.version,fields:this._fields,ref:this._ref,tokenizer:this.tokenizerFn.label,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},n.Index.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},n.Store=function(){this.store={},this.length=0},n.Store.load=function(e){var t=new this;return t.length=e.length,t.store=Object.keys(e.store).reduce(function(t,o){return t[o]=n.SortedSet.load(e.store[o]),t},{}),t},n.Store.prototype.set=function(e,t){this.has(e)||this.length++,this.store[e]=t},n.Store.prototype.get=function(e){return this.store[e]},n.Store.prototype.has=function(e){return e in this.store},n.Store.prototype.remove=function(e){this.has(e)&&(delete this.store[e],this.length--)},n.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},n.stemmer=function(){var e={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},t={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},o="[aeiouy]",r="[^aeiou]"+"[^aeiouy]*",n=o+"[aeiou]*",s=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,i=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*/,d=/^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$/,a=/^([^aeiou][^aeiouy]*)?[aeiouy]/,l=/^(.+?)(ss|i)es$/,p=/^(.+?)([^s])s$/,_=/^(.+?)eed$/,c=/^(.+?)(ed|ing)$/,h=/.$/,g=/(at|bl|iz)$/,u=/([^aeiouylsz])\1$/,f=/^[^aeiou][^aeiouy]*[aeiouy][^aeiouwxy]$/,y=/^(.+?[^aeiou])y$/,m=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,b=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,k=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,j=/^(.+?)(s|t)(ion)$/,v=/^(.+?)e$/,S=/ll$/,x=/^[^aeiou][^aeiouy]*[aeiouy][^aeiouwxy]$/;return function(o){var r,n,w,A,z,F,O;if(3>o.length)return o;if(w=o.substr(0,1),"y"==w&&(o=w.toUpperCase()+o.substr(1)),A=l,z=p,A.test(o)?o=o.replace(A,"$1$2"):z.test(o)&&(o=o.replace(z,"$1$2")),A=_,z=c,A.test(o)){var E=A.exec(o);A=s,A.test(E[1])&&(A=h,o=o.replace(A,""))}else if(z.test(o)){var E=z.exec(o);r=E[1],z=a,z.test(r)&&(o=r,z=g,F=u,O=f,z.test(o)?o+="e":F.test(o)?(A=h,o=o.replace(A,"")):O.test(o)&&(o+="e"))}if(A=y,A.test(o)){var E=A.exec(o);r=E[1],o=r+"i"}if(A=m,A.test(o)){var E=A.exec(o);r=E[1],n=E[2],A=s,A.test(r)&&(o=r+e[n])}if(A=b,A.test(o)){var E=A.exec(o);r=E[1],n=E[2],A=s,A.test(r)&&(o=r+t[n])}if(A=k,z=j,A.test(o)){var E=A.exec(o);r=E[1],A=i,A.test(r)&&(o=r)}else if(z.test(o)){var E=z.exec(o);r=E[1]+E[2],z=i,z.test(r)&&(o=r)}if(A=v,A.test(o)){var E=A.exec(o);r=E[1],A=i,z=d,F=x,(A.test(r)||z.test(r)&&!F.test(r))&&(o=r)}return A=S,z=i,A.test(o)&&z.test(o)&&(A=h,o=o.replace(A,"")),"y"==w&&(o=w.toLowerCase()+o.substr(1)),o}}(),n.Pipeline.registerFunction(n.stemmer,"stemmer"),n.generateStopWordFilter=function(e){var t=e.reduce(function(e,t){return e[t]=t,e},{});return function(e){if(e&&t[e]!==e)return e}},n.stopWordFilter=n.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),n.Pipeline.registerFunction(n.stopWordFilter,"stopWordFilter"),n.trimmer=function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")},n.Pipeline.registerFunction(n.trimmer,"trimmer"),n.TokenStore=function(){this.root={docs:{}},this.length=0},n.TokenStore.load=function(e){var t=new this;return t.root=e.root,t.length=e.length,t},n.TokenStore.prototype.add=function(e,t,o){var o=o||this.root,r=e.charAt(0),n=e.slice(1);return r in o||(o[r]={docs:{}}),0===n.length?(o[r].docs[t.ref]=t,void(this.length+=1)):this.add(n,t,o[r])},n.TokenStore.prototype.has=function(e){if(!e)return!1;for(var t=this.root,o=0;o<e.length;o++){if(!t[e.charAt(o)])return!1;t=t[e.charAt(o)]}return!0},n.TokenStore.prototype.getNode=function(e){if(!e)return{};for(var t=this.root,o=0;o<e.length;o++){if(!t[e.charAt(o)])return{};t=t[e.charAt(o)]}return t},n.TokenStore.prototype.get=function(e,t){return this.getNode(e,t).docs||{}},n.TokenStore.prototype.count=function(e,t){return Object.keys(this.get(e,t)).length},n.TokenStore.prototype.remove=function(e,t){if(e){for(var o=this.root,r=0;r<e.length;r++){if(!(e.charAt(r)in o))return;o=o[e.charAt(r)]}delete o.docs[t]}},n.TokenStore.prototype.expand=function(e,t){var o=this.getNode(e),r=o.docs||{},t=t||[];return Object.keys(r).length&&t.push(e),Object.keys(o).forEach(function(o){"docs"===o||t.concat(this.expand(e+o,t))},this),t},n.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(e,r){"function"==typeof T&&T.amd?T(r):"object"==typeof o?t.exports=r():e.lunr=r()}(this,function(){return n})})()},{}],4:[function(e,t){"use strict";var o=e("./../vendor/lodash"),r=e("./helpers"),n=e("fastbitset"),s=function(e,t){var s=this;t=t||{},this.items=e,this.config=t,this.facets=r.index(e,o.keys(t)),this._items_map={},this._ids=[];var d=1;o.map(e,function(e){s._ids.push(d),s._items_map[d]=e,e._id=d,++d}),this.ids_map={},e&&e.forEach(function(e){e.id&&e._id&&(s.ids_map[e.id]=e._id)}),this._bits_ids=new n(this._ids)};s.prototype={items:function(){return this.items},bits_ids:function(e){return e?new n(e):this._bits_ids},internal_ids_from_ids_map:function(e){var t=this;return e.map(function(e){return t.ids_map[e]})},index:function(){return this.facets},get_item:function(e){return this._items_map[e]},search:function(e,t){var n=this.config;t=t||{};var s=o.clone(this.facets);s.not_ids=r.facets_ids(s.bits_data,e.not_filters,n);var i=r.input_to_facet_filters(e,n),d=r.matrix(this.facets,i);return s.bits_data_temp=d.bits_data_temp,o.mapValues(s.bits_data_temp,function(e,r){o.mapValues(s.bits_data_temp[r],function(e,o){t.query_ids&&(s.bits_data_temp[r][o]=t.query_ids.new_intersection(s.bits_data_temp[r][o])),t.test&&(s.data[r][o]=s.bits_data_temp[r][o].array())})}),s.ids=r.facets_ids(s.bits_data_temp,e.filters,n),s}},t.exports=s},{"./../vendor/lodash":9,"./helpers":6,fastbitset:2}],5:[function(e,t){"use strict";var o=e("./../vendor/lodash"),r=e("lunr"),n=function(e,t){var n=this;t=t||{},t.searchableFields=t.searchableFields||[],this.items=e,this.idx=r(function(){this.field("name",{boost:10});var e=this;o.forEach(t.searchableFields,function(t){e.field(t)}),this.ref("_id"),t.isExactSearch&&(this.pipeline.remove(r.stemmer),this.pipeline.remove(r.stopWordFilter))});var s=1;o.map(e,function(e){e._id=s,++s,n.idx.add(e)}),this.store=o.mapKeys(e,function(e){return e._id})};n.prototype={search_full:function(e,t){var o=this;return this.search(e,t).map(function(e){return o.store[e]})},search:function(e,t){var r=this;if(!e&&!t)return this.items?this.items.map(function(e){return e._id}):[];var n;return e&&(n=o.map(this.idx.search(e),function(e){var t=r.store[e.ref];return t})),t instanceof Function&&(n=(n||this.items).filter(t)),n.map(function(e){return e._id})}},t.exports=n},{"./../vendor/lodash":9,lunr:3}],6:[function(e,t){"use strict";var o=e("./../vendor/lodash"),r=e("fastbitset"),n=function(e){try{return JSON.parse(JSON.stringify(e))}catch(t){return e}},s=function(e){return e.replace(/^[\s_]+|[\s_]+$/g,"").replace(/[_\s]+/g," ").replace(/^[a-z]/,function(e){return e.toUpperCase()})},i=function(e,t){var n={};return o.mapValues(t,function(t){if(Array.isArray(t[0])){var s=new r([]),i=[];o.mapValues(t,function(t){var o=t[0],r=t[1];i.push(o),s=s.new_union(e.bits_data[o][r]),n[o]=s})}}),n},d=function(e,t,r){var n=1;return o.mapValues(e.bits_data_temp,function(e,i){var d,a,l,p;r[i]&&(d=r[i].order,a=r[i].sort,l=r[i].size,p=r[i].title);var _=o.chain(e).toPairs().map(function(e){var o=[];return t&&t.filters&&t.filters[i]&&(o=t.filters[i]),{key:e[0],doc_count:e[1].array().length,selected:-1!==o.indexOf(e[0])}}).value();return _="term"===a?o.orderBy(_,["selected","key"],["desc",d||"asc"]):o.orderBy(_,["selected","doc_count","key"],["desc",d||"desc","asc"]),_=_.slice(0,l||10),{name:i,title:p||s(i),position:n++,buckets:_}})};t.exports.input_to_facet_filters=function(e,t){var r=[];return o.mapValues(e.filters,function(e,n){if(e&&e.length)if(!1!==t[n].conjunction)o.mapValues(e,function(e){r.push([n,e])});else{var s=[];o.mapValues(e,function(e){s.push([n,e])}),r.push(s)}}),o.mapValues(e.not_filters,function(e,t){e&&e.length&&o.mapValues(e,function(e){r.push([t,"-",e])})}),r},t.exports.facets_ids=function(e,t){var n=new r([]),s=0;return o.mapValues(t,function(t,o){t.forEach(function(t){++s,n=n.new_union(e[o][t])})}),0==s?null:n},t.exports.clone=n,t.exports.humanize=s,t.exports.index=function(e,t){t=t||[];var n={data:{},bits_data:{},bits_data_temp:{}},s=1;return e=o.map(e,function(e){return e._id||(e._id=s,++s),e}),o.chain(e).map(function(e){return t.forEach(function(t){if(e)if(n.data[t]||(n.data[t]={}),Array.isArray(e[t]))e[t].forEach(function(o){e[t]&&(!n.data[t][o]&&(n.data[t][o]=[]),n.data[t][o].push(parseInt(e._id)))});else if("undefined"!=typeof e[t]){var o=e[t];n.data[t][o]||(n.data[t][o]=[]),n.data[t][o].push(parseInt(e._id))}}),e}).value(),n.data=o.mapValues(n.data,function(e,t){return n.bits_data[t]||(n.bits_data[t]={},n.bits_data_temp[t]={}),o.mapValues(e,function(e,s){var i=o.sortBy(e);return n.bits_data[t][s]=new r(i),i})}),n},t.exports.combination_indexes=i,t.exports.matrix=function(e,t){var n=o.clone(e);t=t||[],o.mapValues(n.bits_data,function(e,t){o.mapValues(n.bits_data[t],function(e,o){n.bits_data_temp[t][o]=n.bits_data[t][o]})});var s,d=i(e,t);return o.mapValues(t,function(e){if(!Array.isArray(e[0])){var t=e[0],o=e[1];s=s&&n.bits_data_temp[t][o]?n.bits_data_temp[t][o].new_intersection(s):s&&!n.bits_data_temp[t][o]?new r([]):n.bits_data_temp[t][o]}}),s&&o.mapValues(n.bits_data_temp,function(e,t){o.mapValues(n.bits_data_temp[t],function(e,o){n.bits_data_temp[t][o]=n.bits_data_temp[t][o].new_intersection(s)})}),o.mapValues(t,function(e){if(3===e.length&&"-"===e[1]){var t=e[0],r=e[2],s=n.bits_data_temp[t][r].clone();o.mapValues(n.bits_data_temp,function(e,t){o.mapValues(n.bits_data_temp[t],function(e,o){n.bits_data_temp[t][o]=n.bits_data_temp[t][o].new_difference(s)})})}}),o.mapValues(n.bits_data_temp,function(e,t){o.mapValues(n.bits_data_temp[t],function(e,r){o.mapValues(d,function(e,o){o!==t&&(n.bits_data_temp[t][r]=n.bits_data_temp[t][r].new_intersection(e))})})}),n},t.exports.getBuckets=d,t.exports.getFacets=d,t.exports.mergeAggregations=function(e,t){return o.mapValues(n(e),function(e,o){e.field||(e.field=o);var r=[];t.filters&&t.filters[o]&&(r=t.filters[o]),e.filters=r;var n=[];return t.not_filters&&t.not_filters[o]&&(n=t.not_filters[o]),t.exclude_filters&&t.exclude_filters[o]&&(n=t.exclude_filters[o]),e.not_filters=n,e})}},{"./../vendor/lodash":9,fastbitset:2}],7:[function(e,t){"use strict";var o=e("./lib"),r=e("./helpers"),n=e("./fulltext"),s=e("./facets");t.exports=function(e,t){t=t||{};var i;!1!==t.native_search_enabled&&(i=new n(e,t));var d=new s(e,t.aggregations);return{search:function(n){return n=n||{},n.aggregations=r.mergeAggregations(t.aggregations,n),o.search(e,n,t,i,d)},similar:function(t,r){return o.similar(e,t,r)},aggregation:function(r){return o.aggregation(e,r,t,i,d)},reindex:function(o){e=o,i=new n(e,t),d=new s(e,t.aggregations)}}}},{"./facets":4,"./fulltext":5,"./helpers":6,"./lib":8}],8:[function(e,t){"use strict";var o=e("./../vendor/lodash"),r=e("./helpers"),n=e("fastbitset");t.exports.search=function(e,o,s,i,d){o=o||{};var a=parseInt(o.per_page||12),l=parseInt(o.page||1);if(!1===s.native_search_enabled&&(o.query||o.filter))throw new Error("\"query\" and \"filter\" options are not working once native search is disabled");var p,_,c=0,h=new Date().getTime(),g=d.bits_ids();if(o._ids)p=new n(o._ids),_=o._ids;else if(o.ids)_=d.internal_ids_from_ids_map(o.ids),p=new n(_);else if(i&&(o.query||o.filter)){var u=new Date().getTime();_=i.search(o.query,o.filter),c=new Date().getTime()-u,p=new n(_)}var f=new Date().getTime(),y=d.search(o,{query_ids:p});f=new Date().getTime()-f,p&&(g=p),y.ids&&(g=g.new_intersection(y.ids)),y.not_ids&&(g=g.new_difference(y.not_ids));var w=g.array(),m=w.map(function(e){return d.get_item(e)}),b=!1,k=new Date().getTime(),j=0;if(o.sort)m=t.exports.sorted_items(m,o.sort,s.sortings);else if(_){w=_.filter(function(e){return g.has(e)});var v=w.slice((l-1)*a,l*a);m=v.map(function(e){return d.get_item(e)}),b=!0}b||(m=m.slice((l-1)*a,l*a)),j=new Date().getTime()-k;var S=new Date().getTime()-h;return{pagination:{per_page:a,page:l,total:w.length},timings:{total:S,facets:f,search:c,sorting:j},data:{items:m,aggregations:r.getBuckets(y,o,s.aggregations)}}},t.exports.sorted_items=function(e,t,r){return r&&r[t]&&(t=r[t]),t.field?o.orderBy(e,t.field,t.order||"asc"):e},t.exports.similar=function(e,t,r){for(var n,s=r.per_page||10,d=r.minimum||0,a=r.page||1,l=0;l<e.length;++l)if(e[l].id==t){n=e[l];break}if(!r.field)throw new Error("Please define field in options");for(var i=r.field,p=[],_=0;_<e.length;++_)if(e[_].id!==t){var c=o.intersection(n[i],e[_][i]);c.length>=d&&(p.push(e[_]),p[p.length-1].intersection_length=c.length)}return p=o.orderBy(p,["intersection_length"],["desc"]),{pagination:{per_page:s,page:a,total:p.length},data:{items:p.slice((a-1)*s,a*s)}}},t.exports.aggregation=function(e,o,n,s,i){var d=o.per_page||10,a=o.page||1;if(o.name&&(!n.aggregations||!n.aggregations[o.name]))throw new Error("Please define aggregation \"".concat(o.name,"\" in config"));var l=r.clone(o);if(l.page=1,l.per_page=0,!o.name)throw new Error("field name is required");n.aggregations[o.name].size=1e4;var p=t.exports.search(e,l,n,s,i),_=p.data.aggregations[o.name].buckets;return{pagination:{per_page:d,page:a,total:_.length},data:{buckets:_.slice((a-1)*d,a*d)}}}},{"./../vendor/lodash":9,"./helpers":6,fastbitset:2}],9:[function(e,Ce,Be){(function(Pt){(function(){"use strict";function eo(e){"@babel/helpers - typeof";return eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eo(e)}(function(){function to(o,n,e){switch(e.length){case 0:return o.call(n);case 1:return o.call(n,e[0]);case 2:return o.call(n,e[0],e[1]);case 3:return o.call(n,e[0],e[1],e[2]);}return o.apply(n,e)}function oo(o,t){for(var s=-1,r=null==o?0:o.length;++s<r&&!1!==t(o[s],s,o););return o}function ro(s,t){for(var e,i=-1,d=null==s?0:s.length,n=0,o=[];++i<d;)e=s[i],t(e,i,s)&&(o[n++]=e);return o}function no(s,t){var i;if(i=null!=s&&s.length){if(t===t)t:{i=-1;for(var r=s.length;++i<r;)if(s[i]===t)break t;i=-1}else t:{i=e;for(var r=s.length,d=-1;++d<r;)if(i(s[d],d,s)){i=d;break t}i=-1}i=-1<i}return i}function so(s,t){for(var e=-1,r=null==s?0:s.length,n=Array(r);++e<r;)n[e]=t(s[e],e,s);return n}function io(s,t){for(var e=-1,r=t.length,n=s.length;++e<r;)s[n+e]=t[e];return s}function o(s,t,e){for(var r=-1,n=null==s?0:s.length;++r<n;)e=t(e,s[r],r,s);return e}function ao(o,t){for(var e=-1,r=null==o?0:o.length;++e<r;)if(t(o[e],e,o))return!0;return!1}function e(e){return e!==e}function r(o){return function(t){return null==t?ye:t[o]}}function i(o,t){var e=o.length;for(o.sort(t);e--;)o[e]=o[e].c;return o}function n(o,t){return so(t,function(t){return[t,o[t]]})}function s(o){return function(t){return o(t)}}function a(o,t){return so(t,function(t){return o[t]})}function lo(o,t){return o.has(t)}function l(o){var s=-1,e=Array(o.size);return o.forEach(function(o,t){e[++s]=[t,o]}),e}function t(o){var t=Object;return function(e){return o(t(e))}}function p(o){var n=-1,e=Array(o.size);return o.forEach(function(o){e[++n]=o}),e}function _(o){var n=-1,e=Array(o.size);return o.forEach(function(o){e[++n]=[o,o]}),e}function h(e){if(Dt(e)&&!lr(e)&&!(e instanceof u)){if(e instanceof g)return e;if(Yt.call(e,"__wrapped__"))return At(e)}return new g(e)}function d(){}function g(o,t){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=ye}function u(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function c(o){var t=-1,e=null==o?0:o.length;for(this.clear();++t<e;){var r=o[t];this.set(r[0],r[1])}}function f(o){var t=-1,e=null==o?0:o.length;for(this.clear();++t<e;){var r=o[t];this.set(r[0],r[1])}}function y(o){var t=-1,e=null==o?0:o.length;for(this.clear();++t<e;){var r=o[t];this.set(r[0],r[1])}}function w(o){var t=-1,e=null==o?0:o.length;for(this.__data__=new y;++t<e;)this.add(o[t])}function m(e){this.size=(this.__data__=new f(e)).size}function b(s,t){var d=lr(s),l=!d&&ar(s),p=!d&&!l&&pr(s),_=!d&&!l&&!p&&hr(s);if(d=d||l||p||_){for(var l=s.length,h=String,i=-1,a=Array(l);++i<l;)a[i]=h(i);l=a}else l=[];var c,h=l.length;for(c in s)!t&&!Yt.call(s,c)||d&&("length"==c||p&&("offset"==c||"parent"==c)||_&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ft(c,h))||l.push(c);return l}function k(o,t,e){var r=o[t];Yt.call(o,t)&&Wt(r,e)&&(e!==ye||t in o)||x(o,t,e)}function j(o,t){for(var e=o.length;e--;)if(Wt(o[e][0],t))return e;return-1}function v(o,t){return o&&et(t,ue(t),o)}function S(o,t){return o&&et(t,ie(t),o)}function x(o,t,e){"__proto__"==t&&vo?vo(o,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):o[t]=e}function A(s,t,r,e,o,n){var i,d=1&t,a=2&t;if(r&&(i=o?r(s,e,o,n):r(s)),i!==ye)return i;if(!Ut(s))return s;if(!(e=lr(s))){var p=or(s),l="[object Function]"==p||"[object GeneratorFunction]"==p;if(pr(s))return X(s,d);if("[object Object]"!=p&&"[object Arguments]"!=p&&(!l||o)){if(!Le[p])return o?s:{};i=gt(s,p,d)}else if(i=a||l?{}:"function"!=typeof s.constructor||mt(s)?{}:Ko(fo(s)),!d)return a?ot(s,S(i,s)):tt(s,v(i,s))}else if(i=ht(s),!d)return Z(s,i);if(n||(n=new m),o=n.get(s))return o;if(n.set(s,i),cr(s))return s.forEach(function(o){i.add(A(o,t,r,o,s,n))}),i;if(_r(s))return s.forEach(function(d,e){i.set(e,A(d,t,r,e,s,n))}),i;var a=4&t?a?lt:at:a?ie:ue,g=e?ye:a(s);return oo(g||s,function(d,e){g&&(e=d,d=s[e]),k(i,e,A(d,t,r,e,s,n))}),i}function z(o,s){var e=[];return Ho(o,function(r,t,n){s(r,t,n)&&e.push(r)}),e}function F(s,t,e,r,n){var o=-1,i=s.length;for(e||(e=ut),n||(n=[]);++o<i;){var d=s[o];0<t&&e(d)?1<t?F(d,t-1,e,r,n):io(n,d):r||(n[n.length]=d)}return n}function O(o,t){return o&&Go(o,t,ue)}function E(o,t){return ro(t,function(t){return Bt(o[t])})}function I(o,t){t=Q(t,o);for(var e=0,r=t.length;null!=o&&e<r;)o=o[vt(t[e++])];return e&&e==r?o:ye}function C(o,t,e){return t=t(o),lr(o)?t:io(t,e(o))}function P(n){if(null==n)n=n===ye?"[object Undefined]":"[object Null]";else if(jo&&jo in Object(n)){var t=Yt.call(n,jo),e=n[jo];try{n[jo]=ye}catch(e){}var r=po.call(n);t?n[jo]=e:delete n[jo],n=r}else n=po.call(n);return n}function N(e){return Dt(e)&&"[object Arguments]"==P(e)}function V(d,t,e,g,y){if(d===t)t=!0;else if(null==d||null==t||!Dt(d)&&!Dt(t))t=d!==d&&t!==t;else t:{var o=lr(d),u=lr(t),i=o?"[object Array]":or(d),a=u?"[object Array]":or(t),i="[object Arguments]"==i?"[object Object]":i,a="[object Arguments]"==a?"[object Object]":a,c="[object Object]"==i,u="[object Object]"==a;if((a=i==a)&&pr(d)){if(!pr(t)){t=!1;break t}o=!0,c=!1}if(a&&!c)y||(y=new m),t=o||hr(d)?st(d,t,e,g,V,y):it(d,t,i,e,g,V,y);else{if(!(1&e)&&(o=c&&Yt.call(d,"__wrapped__"),i=u&&Yt.call(t,"__wrapped__"),o||i)){d=o?d.value():d,t=i?t.value():t,y||(y=new m),t=V(d,t,e,g,y);break t}if(a){e:if(y||(y=new m),o=1&e,i=at(d),u=i.length,a=at(t).length,u==a||o){for(c=u;c--;){var w=i[c];if(o?!(w in t):!Yt.call(t,w)){t=!1;break e}}if((a=y.get(d))&&y.get(t))t=a==t;else{a=!0,y.set(d,t),y.set(t,d);for(var s=o;++c<u;){var w=i[c],b=d[w],_=t[w];if(g)var h=o?g(_,b,w,t,d,y):g(b,_,w,d,t,y);if(h===ye?b!==_&&!V(b,_,e,g,y):!h){a=!1;break}s||(s="constructor"==w)}a&&!s&&(e=d.constructor,g=t.constructor,e!=g&&"constructor"in d&&"constructor"in t&&!("function"==typeof e&&e instanceof e&&"function"==typeof g&&g instanceof g)&&(a=!1)),y["delete"](d),y["delete"](t),t=a}}else t=!1;}else t=!1}}return t}function W(s,t){var e=t.length,r=e;if(null==s)return!r;for(s=Object(s);e--;){var d=t[e];if(d[2]?d[1]!==s[d[0]]:!(d[0]in s))return!1}for(;++e<r;){var d=t[e],o=d[0],l=s[o],i=d[1];if(d[2]){if(l===ye&&!(o in s))return!1;}else if(d=new m,void 0===ye?!V(i,l,3,void 0,d):1)return!1}return!0}function R(e){return"function"==typeof e?e:null==e?fe:"object"==eo(e)?lr(e)?M(e[0],e[1]):L(e):he(e)}function B(o,s){var e=-1,r=Tt(o)?Array(o.length):[];return Ho(o,function(n,t,o){r[++e]=s(n,t,o)}),r}function L(o){var t=dt(o);return 1==t.length&&t[0][2]?bt(t[0][0],t[0][1]):function(e){return e===o||W(e,t)}}function M(o,t){return wt(o)&&t===t&&!Ut(t)?bt(vt(o),t):function(e){var r=ne(e,o);return r===ye&&r===t?oe(e,o):V(t,r,3)}}function U(o,d,g){var e=-1;return d=so(d.length?d:[fe],s(pt())),o=B(o,function(o){return{a:so(d,function(t){return t(o)}),b:++e,c:o}}),i(o,function(r,t){var e;t:{e=-1;for(var n=r.a,o=t.a,d=n.length,i=g.length;++e<d;){var a;e:{a=n[e];var c=o[e];if(a!==c){var u=a!==ye,f=null===a,w=a===a,m=Jt(a),k=c!==ye,j=null===c,S=c===c,x=Jt(c);if(!j&&!x&&!m&&a>c||m&&k&&S&&!j&&!x||f&&k&&S||!u&&S||!w){a=1;break e}if(!f&&!m&&!x&&a<c||x&&u&&w&&!f&&!m||j&&u&&w||!k&&w||!S){a=-1;break e}}a=0}if(a){e=e>=i?a:a*("desc"==g[e]?-1:1);break t}}e=r.b-t.b}return e})}function D(o){return function(t){return I(t,o)}}function q(e){return nr(kt(e,void 0,fe),e+"")}function J(o){if("string"==typeof o)return o;if(lr(o))return so(o,J)+"";if(Jt(o))return $o?$o.call(o):"";var r=o+"";return"0"==r&&1/o==-Ht?"-0":r}function $(n,t){var e=n;return e instanceof u&&(e=e.value()),o(t,function(o,t){return t.func.apply(t.thisArg,io([o],t.args))},e)}function H(e){return Rt(e)?e:[]}function Q(o,t){return lr(o)?o:wt(o,t)?[o]:sr(re(o))}function X(o,t){if(t)return o.slice();var e=o.length,e=uo?uo(e):new o.constructor(e);return o.copy(e),e}function Y(o){var t=new o.constructor(o.byteLength);return new go(t).set(new go(o)),t}function Z(o,t){var e=-1,r=o.length;for(t||(t=Array(r));++e<r;)t[e]=o[e];return t}function et(s,t,e){var d=!e;e||(e={});for(var n=-1,o=t.length;++n<o;){var l=t[n],i=ye;i===ye&&(i=s[l]),d?x(e,l,i):k(e,l,i)}return e}function tt(o,t){return et(o,er(o),t)}function ot(o,t){return et(o,tr(o),t)}function rt(o){return function(){var t=arguments;switch(t.length){case 0:return new o;case 1:return new o(t[0]);case 2:return new o(t[0],t[1]);case 3:return new o(t[0],t[1],t[2]);case 4:return new o(t[0],t[1],t[2],t[3]);case 5:return new o(t[0],t[1],t[2],t[3],t[4]);case 6:return new o(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new o(t[0],t[1],t[2],t[3],t[4],t[5],t[6]);}var e=Ko(o.prototype),t=o.apply(e,t);return Ut(t)?t:e}}function nt(g,t,e,r,n,o,w,i,a,c){function f(){for(var y=arguments.length,v=Array(y),d=y;d--;)v[d]=arguments[d];if(A){var F=(Yt.call(h,"placeholder")?h:f).placeholder;var V;for(V=v.length,d=0;V--;)v[V]===F&&++d;V=d}if(r){for(var m=A,d=-1,k=v.length,I=n.length,S=-1,x=r.length,z=zo(k-I,0),E=Array(x+z),m=!m;++S<x;)E[S]=r[S];for(;++d<I;)(m||d<k)&&(E[n[d]]=v[d]);for(;z--;)E[S++]=v[d++];v=E}if(o){for(var P=A,d=-1,k=v.length,I=-1,S=w.length,x=-1,z=o.length,m=zo(k-S,0),E=Array(m+z),P=!P;++d<m;)E[d]=v[d];for(m=d;++x<z;)E[m+x]=o[x];for(;++I<S;)(P||d<k)&&(E[m+w[I]]=v[d++]);v=E}if(y-=V,A&&y<c){for(V=v,k=-1,I=V.length,S=0,d=[];++k<I;)x=V[k],(x===F||"__lodash_placeholder__"===x)&&(V[k]="__lodash_placeholder__",d[S++]=k);F=t,V=f.placeholder,I=(k=8&F)?d:ye,d=k?ye:d,S=k?v:ye,v=k?ye:v,F=(F|(k?32:64))&~(k?64:32),4&F||(F&=-4),v=[g,F,e,S,I,v,d,i,a,c-y],y=nt.apply(ye,v);t:for(d=g.name+"",k=Ro[d],I=Yt.call(Ro,d)?k.length:0;I--;)if(S=k[I],x=S.func,null==x||x==g){d=S.name;break t}return k=h[d],"function"==typeof k&&d in u.prototype?g===k?d=!0:(d=Zo(k),d=!!d&&g===d[0]):d=!1,d&&rr(y,v),y.placeholder=V,v=F,V=g+"",F=nr,d=xt,k=(k=V.match(Oe))?k[1].split(Se):[],v=d(k,v),(d=v.length)&&(k=d-1,v[k]=(1<d?"& ":"")+v[k],v=v.join(2<d?", ":" "),V=V.replace(ke,"{\n/* [wrapped with "+v+"] */\n")),F(y,V)}if(F=l?e:this,V=_?F[g]:g,y=v.length,i)for(d=v.length,k=Fo(i.length,d),I=Z(v);k--;)S=i[k],v[k]=ft(S,d)?I[S]:ye;else p&&1<y&&v.reverse();return s&&a<y&&(v.length=a),this&&this!==Te&&this instanceof f&&(V=b||rt(V)),V.apply(F,v)}var s=128&t,l=1&t,_=2&t,A=24&t,p=512&t,b=_?ye:rt(g);return f}function st(d,t,a,r,n,o){var e=1&a,i=d.length,p=t.length;if(i!=p&&!(e&&p>i))return!1;if((p=o.get(d))&&o.get(t))return p==t;var p=-1,c=!0,s=2&a?new w:ye;for(o.set(d,t),o.set(t,d);++p<i;){var l=d[p],_=t[p];if(r)var h=e?r(_,l,p,t,d,o):r(l,_,p,d,t,o);if(h!==ye){if(h)continue;c=!1;break}if(s){if(!ao(t,function(i,t){if(!lo(s,t)&&(l===i||n(l,i,a,r,o)))return s.push(t)})){c=!1;break}}else if(l!==_&&!n(l,_,a,r,o)){c=!1;break}}return o["delete"](d),o["delete"](t),c}function it(s,d,_,r,n,o,c){switch(_){case"[object DataView]":if(s.byteLength!=d.byteLength||s.byteOffset!=d.byteOffset)break;s=s.buffer,d=d.buffer;case"[object ArrayBuffer]":if(s.byteLength!=d.byteLength||!o(new go(s),new go(d)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Wt(+s,+d);case"[object Error]":return s.name==d.name&&s.message==d.message;case"[object RegExp]":case"[object String]":return s==d+"";case"[object Map]":var i=l;case"[object Set]":if(i||(i=p),s.size!=d.size&&!(1&r))break;return(_=c.get(s))?_==d:(r|=2,c.set(s,d),d=st(i(s),i(d),r,n,o,c),c["delete"](s),d);case"[object Symbol]":if(Jo)return Jo.call(s)==Jo.call(d);}return!1}function at(e){return C(e,ue,er)}function lt(e){return C(e,ie,tr)}function pt(){var e=h.iteratee||se,e=e===se?R:e;return arguments.length?e(arguments[0],arguments[1]):e}function _t(o,t){var s=o.__data__,r=eo(t);return("string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t)?s["string"==typeof t?"string":"hash"]:s.map}function dt(s){for(var t=ue(s),e=t.length;e--;){var r=t[e],n=s[r];t[e]=[r,n,n===n&&!Ut(n)]}return t}function ct(o,t){var e=null==o?ye:o[t];return(!Ut(e)||Zt&&Zt in e?0:(Bt(e)?_o:Me).test(St(e)))?e:ye}function ht(o){var t=o.length,e=new o.constructor(t);return t&&"string"==typeof o[0]&&Yt.call(o,"index")&&(e.index=o.index,e.input=o.input),e}function gt(o,s,e){var r=o.constructor;return"[object ArrayBuffer]"===s?Y(o):"[object Boolean]"===s||"[object Date]"===s?new r(+o):"[object DataView]"===s?(s=e?Y(o.buffer):o.buffer,new o.constructor(s,o.byteOffset,o.byteLength)):"[object Float32Array]"===s||"[object Float64Array]"===s||"[object Int8Array]"===s||"[object Int16Array]"===s||"[object Int32Array]"===s||"[object Uint8Array]"===s||"[object Uint8ClampedArray]"===s||"[object Uint16Array]"===s||"[object Uint32Array]"===s?(s=e?Y(o.buffer):o.buffer,new o.constructor(s,o.byteOffset,o.length)):"[object Map]"===s?new r:"[object Number]"===s||"[object String]"===s?new r(o):"[object RegExp]"===s?(s=new o.constructor(o.source,ze.exec(o)),s.lastIndex=o.lastIndex,s):"[object Set]"===s?new r:"[object Symbol]"===s?Jo?Object(Jo.call(o)):{}:void 0}function ut(e){return lr(e)||ar(e)||!!(bo&&e&&e[bo])}function ft(o,t){var n=eo(o);return t=null==t?9007199254740991:t,!!t&&("number"==n||"symbol"!=n&&Fe.test(o))&&-1<o&&0==o%1&&o<t}function yt(o,t,e){if(!Ut(e))return!1;var r=eo(t);return!("number"==r?!(Tt(e)&&ft(t,e.length)):!("string"==r&&t in e))&&Wt(e[t],o)}function wt(o,t){if(lr(o))return!1;var e=eo(o);return"number"==e||"symbol"==e||"boolean"==e||null==o||Jt(o)||we.test(o)||!je.test(o)||null!=t&&o in Object(t)}function mt(o){var t=o&&o.constructor;return o===("function"==typeof t&&t.prototype||Ze)}function bt(o,t){return function(e){return null!=e&&e[o]===t&&(t!==ye||o in Object(e))}}function kt(t,e,r){return e=zo(e===ye?t.length-1:e,0),function(){for(var n=arguments,o=-1,s=zo(n.length-e,0),i=Array(s);++o<s;)i[o]=n[e+o];for(o=-1,s=Array(e+1);++o<e;)s[o]=n[o];return s[e]=r(i),to(t,this,s)}}function jt(s){var t=0,e=0;return function(){var r=Oo(),n=16-(r-e);if(!(e=r,0<n))t=0;else if(800<=++t)return arguments[0];return s.apply(ye,arguments)}}function vt(o){if("string"==typeof o||Jt(o))return o;var r=o+"";return"0"==r&&1/o==-Ht?"-0":r}function St(e){if(null!=e){try{return Xt.call(e)}catch(e){}return e+""}return""}function xt(n,t){return oo(ge,function(r){var e="_."+r[0];t&r[1]&&!no(n,e)&&n.push(e)}),n.sort()}function At(o){if(o instanceof u)return o.clone();var t=new g(o.__wrapped__,o.__chain__);return t.__actions__=Z(o.__actions__),t.__index__=o.__index__,t.__values__=o.__values__,t}function zt(e){return(null==e?0:e.length)?F(e,1):[]}function Ft(o){var t=null==o?0:o.length;return t?o[t-1]:ye}function Ot(e){return null==e?e:Eo.call(e)}function Et(e){return e=h(e),e.__chain__=!0,e}function It(o,t){return t(o)}function Ct(e,t){return(lr(e)?oo:Ho)(e,pt(t,3))}function Nt(s,i){function d(){var e=arguments,t=i?i.apply(this,e):e[0],o=d.cache;return o.has(t)?o.get(t):(e=s.apply(this,e),d.cache=o.set(t,e)||o,e)}if("function"!=typeof s||null!=i&&"function"!=typeof i)throw new TypeError("Expected a function");return d.cache=new(Nt.Cache||y),d}function Vt(o){if("function"!=typeof o)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!o.call(this);case 1:return!o.call(this,t[0]);case 2:return!o.call(this,t[0],t[1]);case 3:return!o.call(this,t[0],t[1],t[2]);}return!o.apply(this,t)}}function Wt(o,t){return o===t||o!==o&&t!==t}function Tt(e){return null!=e&&Mt(e.length)&&!Bt(e)}function Rt(e){return Dt(e)&&Tt(e)}function Bt(e){return!!Ut(e)&&(e=P(e),"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}function Mt(e){return"number"==typeof e&&-1<e&&0==e%1&&9007199254740991>=e}function Ut(o){var t=eo(o);return null!=o&&("object"==t||"function"==t)}function Dt(e){return null!=e&&"object"==eo(e)}function qt(e){return"string"==typeof e||!lr(e)&&Dt(e)&&"[object String]"==P(e)}function Jt(e){return"symbol"==eo(e)||Dt(e)&&"[object Symbol]"==P(e)}function $t(o){if(!o)return[];if(Tt(o))return qt(o)?Ue.test(o)?o.match(Ie)||[]:o.split(""):Z(o);if(ko&&o[ko]){o=o[ko]();for(var n,e=[];!(n=o.next()).done;)e.push(n.value);return e}return n=or(o),("[object Map]"==n?l:"[object Set]"==n?p:ae)(o)}function Kt(e){return e?(e=ee(e),e===Ht||e===-Ht?1.797693134