fuzzball
Version:
Fuzzy string matching algorithms and utilities, port of the TheFuzz Python library.
2 lines (1 loc) • 47.5 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).fuzzball=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t={exports:{}},r=Math.floor,n=Math.max,o=Math.min,_calculateRatio=function(e,t){return t?2*e/t:1},_arrayCmp=function(e,t){var r,n,a,i,s,c;for(s=[e.length,t.length],r=i=0,c=o(n=s[0],a=s[1]);0<=c?i<c:i>c;r=0<=c?++i:--i){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return n-a},_has=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a=function(){function SequenceMatcher(e,t,r,n){this.isjunk=e,null==t&&(t=""),null==r&&(r=""),this.autojunk=null==n||n,this.a=this.b=null,this.setSeqs(t,r)}return SequenceMatcher.prototype.setSeqs=function(e,t){return this.setSeq1(e),this.setSeq2(t)},SequenceMatcher.prototype.setSeq1=function(e){if(e!==this.a)return this.a=e,this.matchingBlocks=this.opcodes=null},SequenceMatcher.prototype.setSeq2=function(e){if(e!==this.b)return this.b=e,this.matchingBlocks=this.opcodes=null,this.fullbcount=null,this._chainB()},SequenceMatcher.prototype._chainB=function(){var e,t,n,o,a,i,s,c,u,l,f,p,h,v;for(e=this.b,this.b2j=t={},o=l=0,p=e.length;l<p;o=++l)n=e[o],(_has(t,n)?t[n]:t[n]=[]).push(o);if(i={},a=this.isjunk)for(f=0,h=(v=Object.keys(t)).length;f<h;f++)a(n=v[f])&&(i[n]=!0,delete t[n]);if(u={},s=e.length,this.autojunk&&s>=200)for(n in c=r(s/100)+1,t)t[n].length>c&&(u[n]=!0,delete t[n]);return this.isbjunk=function(e){return _has(i,e)},this.isbpopular=function(e){return _has(u,e)}},SequenceMatcher.prototype.findLongestMatch=function(e,t,r,n){var o,a,i,s,c,u,l,f,p,h,v,d,_,y,g,m,b,$,j,k,w;for(o=(m=[this.a,this.b,this.b2j,this.isbjunk])[0],a=m[1],i=m[2],f=m[3],s=(b=[e,r,0])[0],c=b[1],u=b[2],h={},l=_=e;e<=t?_<t:_>t;l=e<=t?++_:--_){for(d={},y=0,g=($=_has(i,o[l])?i[o[l]]:[]).length;y<g;y++)if(!((p=$[y])<r)){if(p>=n)break;(v=d[p]=(h[p-1]||0)+1)>u&&(s=(j=[l-v+1,p-v+1,v])[0],c=j[1],u=j[2])}h=d}for(;s>e&&c>r&&!f(a[c-1])&&o[s-1]===a[c-1];)s=(k=[s-1,c-1,u+1])[0],c=k[1],u=k[2];for(;s+u<t&&c+u<n&&!f(a[c+u])&&o[s+u]===a[c+u];)u++;for(;s>e&&c>r&&f(a[c-1])&&o[s-1]===a[c-1];)s=(w=[s-1,c-1,u+1])[0],c=w[1],u=w[2];for(;s+u<t&&c+u<n&&f(a[c+u])&&o[s+u]===a[c+u];)u++;return[s,c,u]},SequenceMatcher.prototype.getMatchingBlocks=function(){var e,t,r,n,o,a,i,s,c,u,l,f,p,h,v,d,_,y,g,m,b,$,j,k,w,O;if(this.matchingBlocks)return this.matchingBlocks;for(y=[[0,h=($=[this.a.length,this.b.length])[0],0,v=$[1]]],d=[];y.length;)t=(j=y.pop())[0],e=j[1],n=j[2],r=j[3],o=(k=g=this.findLongestMatch(t,e,n,r))[0],s=k[1],(l=k[2])&&(d.push(g),t<o&&n<s&&y.push([t,o,n,s]),o+l<e&&s+l<r&&y.push([o+l,e,s+l,r]));for(d.sort(_arrayCmp),a=c=f=0,_=[],m=0,b=d.length;m<b;m++)i=(w=d[m])[0],u=w[1],p=w[2],a+f===i&&c+f===u?f+=p:(f&&_.push([a,c,f]),a=(O=[i,u,p])[0],c=O[1],f=O[2]);return f&&_.push([a,c,f]),_.push([h,v,0]),this.matchingBlocks=_},SequenceMatcher.prototype.getOpcodes=function(){var e,t,r,n,o,a,i,s,c,u,l,f;if(this.opcodes)return this.opcodes;for(n=o=0,this.opcodes=t=[],s=0,c=(u=this.getMatchingBlocks()).length;s<c;s++)e=(l=u[s])[0],r=l[1],a=l[2],i="",n<e&&o<r?i="replace":n<e?i="delete":o<r&&(i="insert"),i&&t.push([i,n,e,o,r]),n=(f=[e+a,r+a])[0],o=f[1],a&&t.push(["equal",e,n,r,o]);return t},SequenceMatcher.prototype.getGroupedOpcodes=function(e){var t,r,a,i,s,c,u,l,f,p,h,v,d,_,y;for(null==e&&(e=3),(t=this.getOpcodes()).length||(t=[["equal",0,1,0,1]]),"equal"===t[0][0]&&(f=(v=t[0])[0],i=v[1],s=v[2],c=v[3],u=v[4],t[0]=[f,n(i,s-e),s,n(c,u-e),u]),"equal"===t[t.length-1][0]&&(f=(d=t[t.length-1])[0],i=d[1],s=d[2],c=d[3],u=d[4],t[t.length-1]=[f,i,o(s,i+e),c,o(u,c+e)]),l=e+e,a=[],r=[],p=0,h=t.length;p<h;p++)f=(_=t[p])[0],i=_[1],s=_[2],c=_[3],u=_[4],"equal"===f&&s-i>l&&(r.push([f,i,o(s,i+e),c,o(u,c+e)]),a.push(r),r=[],i=(y=[n(i,s-e),n(c,u-e)])[0],c=y[1]),r.push([f,i,s,c,u]);return!r.length||1===r.length&&"equal"===r[0][0]||a.push(r),a},SequenceMatcher.prototype.ratio=function(){var e,t,r,n;for(e=0,t=0,r=(n=this.getMatchingBlocks()).length;t<r;t++)e+=n[t][2];return _calculateRatio(e,this.a.length+this.b.length)},SequenceMatcher.prototype.quickRatio=function(){var e,t,r,n,o,a,i,s,c,u,l;if(!this.fullbcount)for(this.fullbcount=r={},a=0,s=(u=this.b).length;a<s;a++)r[t=u[a]]=(r[t]||0)+1;for(r=this.fullbcount,e={},n=0,i=0,c=(l=this.a).length;i<c;i++)t=l[i],o=_has(e,t)?e[t]:r[t]||0,e[t]=o-1,o>0&&n++;return _calculateRatio(n,this.a.length+this.b.length)},SequenceMatcher.prototype.realQuickRatio=function(){var e,t,r;return r=[this.a.length,this.b.length],_calculateRatio(o(e=r[0],t=r[1]),e+t)},SequenceMatcher}(),i={exports:{}};!function(t,r){(function(){var e,r,n,o,a,i,s,c,u,l,f,p,h,v,d;n=Math.floor,l=Math.min,r=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,o,a,i){var s;if(null==o&&(o=0),null==i&&(i=r),o<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);o<a;)i(t,e[s=n((o+a)/2)])<0?a=s:o=s+1;return[].splice.apply(e,[o,o-o].concat(t)),t},i=function(e,t,n){return null==n&&(n=r),e.push(t),v(e,0,e.length-1,n)},a=function(e,t){var n,o;return null==t&&(t=r),n=e.pop(),e.length?(o=e[0],e[0]=n,d(e,0,t)):o=n,o},c=function(e,t,n){var o;return null==n&&(n=r),o=e[0],e[0]=t,d(e,0,n),o},s=function(e,t,n){var o;return null==n&&(n=r),e.length&&n(e[0],t)<0&&(t=(o=[e[0],t])[0],e[0]=o[1],d(e,0,n)),t},o=function(e,t){var o,a,i,s,c,u;for(null==t&&(t=r),c=[],a=0,i=(s=function(){u=[];for(var t=0,r=n(e.length/2);0<=r?t<r:t>r;0<=r?t++:t--)u.push(t);return u}.apply(this).reverse()).length;a<i;a++)o=s[a],c.push(d(e,o,t));return c},h=function(e,t,n){var o;if(null==n&&(n=r),-1!==(o=e.indexOf(t)))return v(e,0,o,n),d(e,o,n)},f=function(e,t,n){var a,i,c,u,l;if(null==n&&(n=r),!(i=e.slice(0,t)).length)return i;for(o(i,n),c=0,u=(l=e.slice(t)).length;c<u;c++)a=l[c],s(i,a,n);return i.sort(n).reverse()},p=function(e,t,n){var i,s,c,f,p,h,v,d,_;if(null==n&&(n=r),10*t<=e.length){if(!(c=e.slice(0,t).sort(n)).length)return c;for(s=c[c.length-1],f=0,h=(v=e.slice(t)).length;f<h;f++)n(i=v[f],s)<0&&(u(c,i,0,null,n),c.pop(),s=c[c.length-1]);return c}for(o(e,n),_=[],p=0,d=l(t,e.length);0<=d?p<d:p>d;0<=d?++p:--p)_.push(a(e,n));return _},v=function(e,t,n,o){var a,i,s;for(null==o&&(o=r),a=e[n];n>t&&o(a,i=e[s=n-1>>1])<0;)e[n]=i,n=s;return e[n]=a},d=function(e,t,n){var o,a,i,s,c;for(null==n&&(n=r),a=e.length,c=t,i=e[t],o=2*t+1;o<a;)(s=o+1)<a&&!(n(e[o],e[s])<0)&&(o=s),e[t]=e[o],o=2*(t=o)+1;return e[t]=i,v(e,c,t,n)},e=function(){function Heap(e){this.cmp=null!=e?e:r,this.nodes=[]}return Heap.push=i,Heap.pop=a,Heap.replace=c,Heap.pushpop=s,Heap.heapify=o,Heap.updateItem=h,Heap.nlargest=f,Heap.nsmallest=p,Heap.prototype.push=function(e){return i(this.nodes,e,this.cmp)},Heap.prototype.pop=function(){return a(this.nodes,this.cmp)},Heap.prototype.peek=function(){return this.nodes[0]},Heap.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},Heap.prototype.replace=function(e){return c(this.nodes,e,this.cmp)},Heap.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},Heap.prototype.heapify=function(){return o(this.nodes,this.cmp)},Heap.prototype.updateItem=function(e){return h(this.nodes,e,this.cmp)},Heap.prototype.clear=function(){return this.nodes=[]},Heap.prototype.empty=function(){return 0===this.nodes.length},Heap.prototype.size=function(){return this.nodes.length},Heap.prototype.clone=function(){var e;return(e=new Heap).nodes=this.nodes.slice(0),e},Heap.prototype.toArray=function(){return this.nodes.slice(0)},Heap.prototype.insert=Heap.prototype.push,Heap.prototype.top=Heap.prototype.peek,Heap.prototype.front=Heap.prototype.peek,Heap.prototype.has=Heap.prototype.contains,Heap.prototype.copy=Heap.prototype.clone,Heap}(),t.exports=e}).call(e)}(i);var s=i.exports;var c=function arrayMap$2(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o},u=Array.isArray,l="object"==typeof e&&e&&e.Object===Object&&e,f=l,p="object"==typeof self&&self&&self.Object===Object&&self,h=f||p||Function("return this")(),v=h.Symbol,d=v,_=Object.prototype,y=_.hasOwnProperty,g=_.toString,m=d?d.toStringTag:void 0;var b=function getRawTag$1(e){var t=y.call(e,m),r=e[m];try{e[m]=void 0;var n=!0}catch(e){}var o=g.call(e);return n&&(t?e[m]=r:delete e[m]),o},$=Object.prototype.toString;var j=b,k=function objectToString$1(e){return $.call(e)},w=v?v.toStringTag:void 0;var O=function baseGetTag$5(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?j(e):k(e)};var z=function isObjectLike$5(e){return null!=e&&"object"==typeof e},C=O,S=z;var A=function isSymbol$4(e){return"symbol"==typeof e||S(e)&&"[object Symbol]"==C(e)},x=u,M=A,I=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,E=/^\w*$/;var P=function isKey$3(e,t){if(x(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!M(e))||(E.test(e)||!I.test(e)||null!=t&&e in Object(t))};var q=function isObject$3(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},H=O,L=q;var R,T=function isFunction$2(e){if(!L(e))return!1;var t=H(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},B=h["__core-js_shared__"],W=(R=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+R:"";var F=function isMasked$1(e){return!!W&&W in e},D=Function.prototype.toString;var N=function toSource$2(e){if(null!=e){try{return D.call(e)}catch(e){}try{return e+""}catch(e){}}return""},U=T,G=F,K=q,Q=N,V=/^\[object .+?Constructor\]$/,Z=Function.prototype,J=Object.prototype,X=Z.toString,Y=J.hasOwnProperty,ee=RegExp("^"+X.call(Y).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var te=function baseIsNative$1(e){return!(!K(e)||G(e))&&(U(e)?ee:V).test(Q(e))},re=function getValue$1(e,t){return null==e?void 0:e[t]};var ne=function getNative$6(e,t){var r=re(e,t);return te(r)?r:void 0},oe=ne(Object,"create"),ae=oe;var ie=function hashClear$1(){this.__data__=ae?ae(null):{},this.size=0};var se=function hashDelete$1(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ce=oe,ue=Object.prototype.hasOwnProperty;var le=function hashGet$1(e){var t=this.__data__;if(ce){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ue.call(t,e)?t[e]:void 0},fe=oe,pe=Object.prototype.hasOwnProperty;var he=oe;var ve=ie,de=se,_e=le,ye=function hashHas$1(e){var t=this.__data__;return fe?void 0!==t[e]:pe.call(t,e)},ge=function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=he&&void 0===t?"__lodash_hash_undefined__":t,this};function Hash$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hash$1.prototype.clear=ve,Hash$1.prototype.delete=de,Hash$1.prototype.get=_e,Hash$1.prototype.has=ye,Hash$1.prototype.set=ge;var me=Hash$1;var be=function listCacheClear$1(){this.__data__=[],this.size=0};var $e=function eq$2(e,t){return e===t||e!=e&&t!=t},je=$e;var ke=function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(je(e[r][0],t))return r;return-1},we=ke,Oe=Array.prototype.splice;var ze=ke;var Ce=ke;var Se=ke;var Ae=be,xe=function listCacheDelete$1(e){var t=this.__data__,r=we(t,e);return!(r<0)&&(r==t.length-1?t.pop():Oe.call(t,r,1),--this.size,!0)},Me=function listCacheGet$1(e){var t=this.__data__,r=ze(t,e);return r<0?void 0:t[r][1]},Ie=function listCacheHas$1(e){return Ce(this.__data__,e)>-1},Ee=function listCacheSet$1(e,t){var r=this.__data__,n=Se(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function ListCache$4(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache$4.prototype.clear=Ae,ListCache$4.prototype.delete=xe,ListCache$4.prototype.get=Me,ListCache$4.prototype.has=Ie,ListCache$4.prototype.set=Ee;var Pe=ListCache$4,qe=ne(h,"Map"),He=me,Le=Pe,Re=qe;var Te=function isKeyable$1(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Be=function getMapData$4(e,t){var r=e.__data__;return Te(t)?r["string"==typeof t?"string":"hash"]:r.map},We=Be;var Fe=Be;var De=Be;var Ne=Be;var Ue=function mapCacheClear$1(){this.size=0,this.__data__={hash:new He,map:new(Re||Le),string:new He}},Ge=function mapCacheDelete$1(e){var t=We(this,e).delete(e);return this.size-=t?1:0,t},Ke=function mapCacheGet$1(e){return Fe(this,e).get(e)},Qe=function mapCacheHas$1(e){return De(this,e).has(e)},Ve=function mapCacheSet$1(e,t){var r=Ne(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function MapCache$3(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache$3.prototype.clear=Ue,MapCache$3.prototype.delete=Ge,MapCache$3.prototype.get=Ke,MapCache$3.prototype.has=Qe,MapCache$3.prototype.set=Ve;var Ze=MapCache$3,Je=Ze;function memoize$1(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var memoized=function(){var r=arguments,n=t?t.apply(this,r):r[0],o=memoized.cache;if(o.has(n))return o.get(n);var a=e.apply(this,r);return memoized.cache=o.set(n,a)||o,a};return memoized.cache=new(memoize$1.Cache||Je),memoized}memoize$1.Cache=Je;var Xe=memoize$1;var Ye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/\\(\\)?/g,tt=function memoizeCapped$1(e){var t=Xe(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ye,(function(e,r,n,o){t.push(n?o.replace(et,"$1"):r||e)})),t})),rt=c,nt=u,ot=A,at=v?v.prototype:void 0,it=at?at.toString:void 0;var st=function baseToString$1(e){if("string"==typeof e)return e;if(nt(e))return rt(e,baseToString$1)+"";if(ot(e))return it?it.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t},ct=st;var ut=u,lt=P,ft=tt,pt=function toString$1(e){return null==e?"":ct(e)};var ht=function castPath$2(e,t){return ut(e)?e:lt(e,t)?[e]:ft(pt(e))},vt=A;var dt=function toKey$4(e){if("string"==typeof e||vt(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t},_t=ht,yt=dt;var gt=function baseGet$3(e,t){for(var r=0,n=(t=_t(t,e)).length;null!=e&&r<n;)e=e[yt(t[r++])];return r&&r==n?e:void 0},mt=Pe;var bt=Pe,$t=qe,jt=Ze;var kt=Pe,wt=function stackClear$1(){this.__data__=new mt,this.size=0},Ot=function stackDelete$1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},zt=function stackGet$1(e){return this.__data__.get(e)},Ct=function stackHas$1(e){return this.__data__.has(e)},St=function stackSet$1(e,t){var r=this.__data__;if(r instanceof bt){var n=r.__data__;if(!$t||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new jt(n)}return r.set(e,t),this.size=r.size,this};function Stack$2(e){var t=this.__data__=new kt(e);this.size=t.size}Stack$2.prototype.clear=wt,Stack$2.prototype.delete=Ot,Stack$2.prototype.get=zt,Stack$2.prototype.has=Ct,Stack$2.prototype.set=St;var At=Stack$2;var xt=Ze,Mt=function setCacheAdd$1(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},It=function setCacheHas$1(e){return this.__data__.has(e)};function SetCache$1(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new xt;++t<r;)this.add(e[t])}SetCache$1.prototype.add=SetCache$1.prototype.push=Mt,SetCache$1.prototype.has=It;var Et=SetCache$1,Pt=function arraySome$1(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1},qt=function cacheHas$1(e,t){return e.has(t)};var Ht=function equalArrays$2(e,t,r,n,o,a){var i=1&r,s=e.length,c=t.length;if(s!=c&&!(i&&c>s))return!1;var u=a.get(e),l=a.get(t);if(u&&l)return u==t&&l==e;var f=-1,p=!0,h=2&r?new Et:void 0;for(a.set(e,t),a.set(t,e);++f<s;){var v=e[f],d=t[f];if(n)var _=i?n(d,v,f,t,e,a):n(v,d,f,e,t,a);if(void 0!==_){if(_)continue;p=!1;break}if(h){if(!Pt(t,(function(e,t){if(!qt(h,t)&&(v===e||o(v,e,r,n,a)))return h.push(t)}))){p=!1;break}}else if(v!==d&&!o(v,d,r,n,a)){p=!1;break}}return a.delete(e),a.delete(t),p};var Lt=h.Uint8Array,Rt=$e,Tt=Ht,Bt=function mapToArray$1(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r},Wt=function setToArray$1(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Ft=v?v.prototype:void 0,Dt=Ft?Ft.valueOf:void 0;var Nt=function equalByTag$1(e,t,r,n,o,a,i){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Lt(e),new Lt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Rt(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Bt;case"[object Set]":var c=1&n;if(s||(s=Wt),e.size!=t.size&&!c)return!1;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var l=Tt(s(e),s(t),n,o,a,i);return i.delete(e),l;case"[object Symbol]":if(Dt)return Dt.call(e)==Dt.call(t)}return!1};var Ut=function arrayPush$1(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},Gt=u;var Kt=function baseGetAllKeys$1(e,t,r){var n=t(e);return Gt(e)?n:Ut(n,r(e))};var Qt=function arrayFilter$1(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a},Vt=function stubArray$1(){return[]},Zt=Object.prototype.propertyIsEnumerable,Jt=Object.getOwnPropertySymbols,Xt=Jt?function(e){return null==e?[]:(e=Object(e),Qt(Jt(e),(function(t){return Zt.call(e,t)})))}:Vt;var Yt=function baseTimes$1(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n},er=O,tr=z;var rr=function baseIsArguments$1(e){return tr(e)&&"[object Arguments]"==er(e)},nr=z,or=Object.prototype,ar=or.hasOwnProperty,ir=or.propertyIsEnumerable,sr=rr(function(){return arguments}())?rr:function(e){return nr(e)&&ar.call(e,"callee")&&!ir.call(e,"callee")},cr=sr,ur={exports:{}};var lr=function stubFalse(){return!1};!function(e,t){var r=h,n=lr,o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,i=a&&a.exports===o?r.Buffer:void 0,s=(i?i.isBuffer:void 0)||n;e.exports=s}(ur,ur.exports);var fr=/^(?:0|[1-9]\d*)$/;var pr=function isIndex$2(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&fr.test(e))&&e>-1&&e%1==0&&e<t};var hr=function isLength$3(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},vr=O,dr=hr,_r=z,yr={};yr["[object Float32Array]"]=yr["[object Float64Array]"]=yr["[object Int8Array]"]=yr["[object Int16Array]"]=yr["[object Int32Array]"]=yr["[object Uint8Array]"]=yr["[object Uint8ClampedArray]"]=yr["[object Uint16Array]"]=yr["[object Uint32Array]"]=!0,yr["[object Arguments]"]=yr["[object Array]"]=yr["[object ArrayBuffer]"]=yr["[object Boolean]"]=yr["[object DataView]"]=yr["[object Date]"]=yr["[object Error]"]=yr["[object Function]"]=yr["[object Map]"]=yr["[object Number]"]=yr["[object Object]"]=yr["[object RegExp]"]=yr["[object Set]"]=yr["[object String]"]=yr["[object WeakMap]"]=!1;var gr=function baseIsTypedArray$1(e){return _r(e)&&dr(e.length)&&!!yr[vr(e)]};var mr=function baseUnary$2(e){return function(t){return e(t)}},br={exports:{}};!function(e,t){var r=l,n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,a=o&&o.exports===n&&r.process,i=function(){try{var e=o&&o.require&&o.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=i}(br,br.exports);var $r=gr,jr=mr,kr=br.exports,wr=kr&&kr.isTypedArray,Or=wr?jr(wr):$r,zr=Yt,Cr=cr,Sr=u,Ar=ur.exports,xr=pr,Mr=Or,Ir=Object.prototype.hasOwnProperty;var Er=function arrayLikeKeys$1(e,t){var r=Sr(e),n=!r&&Cr(e),o=!r&&!n&&Ar(e),a=!r&&!n&&!o&&Mr(e),i=r||n||o||a,s=i?zr(e.length,String):[],c=s.length;for(var u in e)!t&&!Ir.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||xr(u,c))||s.push(u);return s},Pr=Object.prototype;var qr=function isPrototype$1(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Pr)};var Hr=function overArg$1(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Lr=qr,Rr=Hr,Tr=Object.prototype.hasOwnProperty;var Br=T,Wr=hr;var Fr=function isArrayLike$3(e){return null!=e&&Wr(e.length)&&!Br(e)},Dr=Er,Nr=function baseKeys$1(e){if(!Lr(e))return Rr(e);var t=[];for(var r in Object(e))Tr.call(e,r)&&"constructor"!=r&&t.push(r);return t},Ur=Fr;var Gr=function keys$3(e){return Ur(e)?Dr(e):Nr(e)},Kr=Kt,Qr=Xt,Vr=Gr;var Zr=function getAllKeys$1(e){return Kr(e,Vr,Qr)},Jr=Object.prototype.hasOwnProperty;var Xr=function equalObjects$1(e,t,r,n,o,a){var i=1&r,s=Zr(e),c=s.length;if(c!=Zr(t).length&&!i)return!1;for(var u=c;u--;){var l=s[u];if(!(i?l in t:Jr.call(t,l)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var h=!0;a.set(e,t),a.set(t,e);for(var v=i;++u<c;){var d=e[l=s[u]],_=t[l];if(n)var y=i?n(_,d,l,t,e,a):n(d,_,l,e,t,a);if(!(void 0===y?d===_||o(d,_,r,n,a):y)){h=!1;break}v||(v="constructor"==l)}if(h&&!v){var g=e.constructor,m=t.constructor;g==m||!("constructor"in e)||!("constructor"in t)||"function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m||(h=!1)}return a.delete(e),a.delete(t),h},Yr=ne(h,"DataView"),en=qe,tn=ne(h,"Promise"),rn=ne(h,"Set"),nn=ne(h,"WeakMap"),on=O,an=N,sn="[object Map]",cn="[object Promise]",un="[object Set]",ln="[object WeakMap]",fn="[object DataView]",pn=an(Yr),hn=an(en),vn=an(tn),dn=an(rn),_n=an(nn),yn=on;(Yr&&yn(new Yr(new ArrayBuffer(1)))!=fn||en&&yn(new en)!=sn||tn&&yn(tn.resolve())!=cn||rn&&yn(new rn)!=un||nn&&yn(new nn)!=ln)&&(yn=function(e){var t=on(e),r="[object Object]"==t?e.constructor:void 0,n=r?an(r):"";if(n)switch(n){case pn:return fn;case hn:return sn;case vn:return cn;case dn:return un;case _n:return ln}return t});var gn=At,mn=Ht,bn=Nt,$n=Xr,jn=yn,kn=u,wn=ur.exports,On=Or,zn="[object Arguments]",Cn="[object Array]",Sn="[object Object]",An=Object.prototype.hasOwnProperty;var xn=function baseIsEqualDeep$1(e,t,r,n,o,a){var i=kn(e),s=kn(t),c=i?Cn:jn(e),u=s?Cn:jn(t),l=(c=c==zn?Sn:c)==Sn,f=(u=u==zn?Sn:u)==Sn,p=c==u;if(p&&wn(e)){if(!wn(t))return!1;i=!0,l=!1}if(p&&!l)return a||(a=new gn),i||On(e)?mn(e,t,r,n,o,a):bn(e,t,c,r,n,o,a);if(!(1&r)){var h=l&&An.call(e,"__wrapped__"),v=f&&An.call(t,"__wrapped__");if(h||v){var d=h?e.value():e,_=v?t.value():t;return a||(a=new gn),o(d,_,r,n,a)}}return!!p&&(a||(a=new gn),$n(e,t,r,n,o,a))},Mn=z;var In=function baseIsEqual$2(e,t,r,n,o){return e===t||(null==e||null==t||!Mn(e)&&!Mn(t)?e!=e&&t!=t:xn(e,t,r,n,baseIsEqual$2,o))},En=At,Pn=In;var qn=q;var Hn=function isStrictComparable$2(e){return e==e&&!qn(e)},Ln=Hn,Rn=Gr;var Tn=function matchesStrictComparable$2(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}},Bn=function baseIsMatch$1(e,t,r,n){var o=r.length,a=o,i=!n;if(null==e)return!a;for(e=Object(e);o--;){var s=r[o];if(i&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<a;){var c=(s=r[o])[0],u=e[c],l=s[1];if(i&&s[2]){if(void 0===u&&!(c in e))return!1}else{var f=new En;if(n)var p=n(u,l,c,e,t,f);if(!(void 0===p?Pn(l,u,3,n,f):p))return!1}}return!0},Wn=function getMatchData$1(e){for(var t=Rn(e),r=t.length;r--;){var n=t[r],o=e[n];t[r]=[n,o,Ln(o)]}return t},Fn=Tn;var Dn=gt;var Nn=ht,Un=cr,Gn=u,Kn=pr,Qn=hr,Vn=dt;var Zn=function baseHasIn$1(e,t){return null!=e&&t in Object(e)},Jn=function hasPath$1(e,t,r){for(var n=-1,o=(t=Nn(t,e)).length,a=!1;++n<o;){var i=Vn(t[n]);if(!(a=null!=e&&r(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&Qn(o)&&Kn(i,o)&&(Gn(e)||Un(e))};var Xn=In,Yn=function get$1(e,t,r){var n=null==e?void 0:Dn(e,t);return void 0===n?r:n},eo=function hasIn$1(e,t){return null!=e&&Jn(e,t,Zn)},to=P,ro=Hn,no=Tn,oo=dt;var ao=function identity$2(e){return e};var io=gt;var so=function baseProperty$1(e){return function(t){return null==t?void 0:t[e]}},co=function basePropertyDeep$1(e){return function(t){return io(t,e)}},uo=P,lo=dt;var fo=function baseMatches$1(e){var t=Wn(e);return 1==t.length&&t[0][2]?Fn(t[0][0],t[0][1]):function(r){return r===e||Bn(r,e,t)}},po=function baseMatchesProperty$1(e,t){return to(e)&&ro(t)?no(oo(e),t):function(r){var n=Yn(r,e);return void 0===n&&n===t?eo(r,e):Xn(t,n,3)}},ho=ao,vo=u,_o=function property$1(e){return uo(e)?so(lo(e)):co(e)};var yo=function baseIteratee$1(e){return"function"==typeof e?e:null==e?ho:"object"==typeof e?vo(e)?po(e[0],e[1]):fo(e):_o(e)};var go=function createBaseFor$1(e){return function(t,r,n){for(var o=-1,a=Object(t),i=n(t),s=i.length;s--;){var c=i[e?s:++o];if(!1===r(a[c],c,a))break}return t}}(),mo=Gr;var bo=Fr;var $o=function createBaseEach$1(e,t){return function(r,n){if(null==r)return r;if(!bo(r))return e(r,n);for(var o=r.length,a=t?o:-1,i=Object(r);(t?a--:++a<o)&&!1!==n(i[a],a,i););return r}}((function baseForOwn$1(e,t){return e&&go(e,t,mo)})),jo=Fr;var ko=A;var wo=function compareAscending$1(e,t){if(e!==t){var r=void 0!==e,n=null===e,o=e==e,a=ko(e),i=void 0!==t,s=null===t,c=t==t,u=ko(t);if(!s&&!u&&!a&&e>t||a&&i&&c&&!s&&!u||n&&i&&c||!r&&c||!o)return 1;if(!n&&!a&&!u&&e<t||u&&r&&o&&!n&&!a||s&&r&&o||!i&&o||!c)return-1}return 0};var Oo=c,zo=gt,Co=yo,So=function baseMap$1(e,t){var r=-1,n=jo(e)?Array(e.length):[];return $o(e,(function(e,o,a){n[++r]=t(e,o,a)})),n},Ao=function baseSortBy$1(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e},xo=mr,Mo=function compareMultiple$1(e,t,r){for(var n=-1,o=e.criteria,a=t.criteria,i=o.length,s=r.length;++n<i;){var c=wo(o[n],a[n]);if(c)return n>=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index},Io=ao,Eo=u;var Po=function baseOrderBy$1(e,t,r){t=t.length?Oo(t,(function(e){return Eo(e)?function(t){return zo(t,1===e.length?e[0]:e)}:e})):[Io];var n=-1;t=Oo(t,xo(Co));var o=So(e,(function(e,r,o){return{criteria:Oo(t,(function(t){return t(e)})),index:++n,value:e}}));return Ao(o,(function(e,t){return Mo(e,t,r)}))},qo=u;var Ho=function orderBy(e,t,r,n){return null==e?[]:(qo(t)||(t=null==t?[]:[t]),qo(r=n?void 0:r)||(r=null==r?[]:[r]),Po(e,t,r))};var Lo,Ro={_intersect:function _intersect(e,t){if(!e||!t||0===e.length||0===t.length)return[];if(e.length<100&&t.length<100)return e.filter((e=>t.includes(e)));const r=new Set(t);return e.filter((e=>r.has(e)))},_intersectWith:function _intersectWith(e,t,r){return e&&t&&0!==e.length&&0!==t.length?e.filter((e=>t.some((t=>r(e,t))))):[]},_difference:function _difference(e,t){if(!e)return[];if(!t||0===t.length)return e.slice();if(e.length<100&&t.length<100)return e.filter((e=>!t.includes(e)));const r=new Set(t);return e.filter((e=>!r.has(e)))},_differenceWith:function _differenceWith(e,t,r){return e?t&&0!==t.length?e.filter((e=>!t.some((t=>r(e,t))))):e.slice():[]},_uniq:function _uniq(e){return e&&0!==e.length?1===e.length?e.slice():[...new Set(e)]:[]},_uniqWith:function _uniqWith(e,t){if(!e||0===e.length)return[];if(1===e.length)return e.slice();const r=[];e:for(let n=0;n<e.length;n++){const o=e[n];for(let e=0;e<r.length;e++)if(t(o,r[e]))continue e;r.push(o)}return r},_partialRight:function _partialRight(e){const t=Array.prototype.slice.call(arguments,1);return function(){const r=Array.prototype.slice.call(arguments);return e.apply(this,r.concat(t))}},_forEach:function _forEach(e,t){if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++)t(e[r],r);else{const r=Object.keys(e);for(let n=0;n<r.length;n++)t(e[r[n]],r[n])}},_isArray:Array.isArray};try{Lo="undefined"!=typeof Intl&&void 0!==Intl.Collator?Intl.Collator("generic",{sensitivity:"base"}):null}catch(e){void 0!==typeof console&&console.warn("Collator could not be initialized and wouldn't be used")}var To,Bo=function leven(e,t,r){var n=[],o=[],a=r&&Lo&&r.useCollator,i=1;if(r&&r.subcost&&"number"==typeof r.subcost&&(i=r.subcost),e===t)return 0;var s,c,u,l,f=Array.from(e),p=Array.from(t),h=f.length,v=p.length;if(0===h)return v;if(0===v)return h;for(var d=0,_=0;d<h;)o[d]=f[d].codePointAt(0),n[d]=++d;if(a)for(;_<v;)for(s=p[_].codePointAt(0),u=_++,c=_,d=0;d<h;d++)l=0===Lo.compare(String.fromCodePoint(s),String.fromCodePoint(o[d]))?u:u+i,u=n[d],c=n[d]=u>c?l>c?c+1:l:l>u?u+1:l;else for(;_<v;)for(s=p[_].codePointAt(0),u=_++,c=_,d=0;d<h;d++)l=s===o[d]?u:u+i,u=n[d],c=n[d]=u>c?l>c?c+1:l:l>u?u+1:l;return c};try{To="undefined"!=typeof Intl&&void 0!==Intl.Collator?Intl.Collator("generic",{sensitivity:"base"}):null}catch(e){void 0!==typeof console&&console.warn("Collator could not be initialized and wouldn't be used")}var Wo,Fo=function leven(e,t,r,n){var o=[],a=[],i=r&&To&&r.useCollator,s=1;if(r&&r.subcost&&"number"==typeof r.subcost&&(s=r.subcost),e===t)return 0;var c=e.length,u=t.length;if(0===c)return u;if(0===u)return c;if(r&&r.wildcards&&"string"==typeof r.wildcards&&r.wildcards.length>0){var l,f,p,h,v,d;if(!1===r.full_process&&!0!==r.processed){f=(l=r.wildcards[0]).charCodeAt(0);var _="["+function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(r.wildcards)+"]";if((e=e.replace(new RegExp(_,"g"),l))===(t=t.replace(new RegExp(_,"g"),l)))return 0}else f=(l=r.wildcards[0].toLowerCase()).charCodeAt(0);for(var y=0,g=0;y<c;)a[y]=e.charCodeAt(y),o[y]=++y;if(i)for(;g<u;)for(p=t.charCodeAt(g),v=g++,h=g,y=0;y<c;y++)d=0===To.compare(String.fromCharCode(p),String.fromCharCode(a[y]))||p===f||a[y]===f?v:v+s,v=o[y],h=o[y]=v>h?d>h?h+1:d:d>v?v+1:d;else for(;g<u;)for(p=t.charCodeAt(g),v=g++,h=g,y=0;y<c;y++)d=p===a[y]||p===f||a[y]===f?v:v+s,v=o[y],h=o[y]=v>h?d>h?h+1:d:d>v?v+1:d;return h}return n(e,t,r)};try{Wo="undefined"!=typeof Intl&&void 0!==Intl.Collator?Intl.Collator("generic",{sensitivity:"base"}):null}catch(e){void 0!==typeof console&&console.warn("Collator could not be initialized and wouldn't be used")}var Do=function leven(e,t,r){var n=[],o=[],a=r&&Wo&&r.useCollator,i=1;if(r&&r.subcost&&"number"==typeof r.subcost&&(i=r.subcost),e===t)return 0;var s,c,u,l,f=e.length,p=t.length;if(0===f)return p;if(0===p)return f;for(var h=0,v=0;h<f;)o[h]=e.charCodeAt(h),n[h]=++h;if(a)for(;v<p;)for(s=t.charCodeAt(v),u=v++,c=v,h=0;h<f;h++)l=0===Wo.compare(String.fromCharCode(s),String.fromCharCode(o[h]))?u:u+i,u=n[h],c=n[h]=u>c?l>c?c+1:l:l>u?u+1:l;else for(;v<p;)for(s=t.charCodeAt(v),u=v++,c=v,h=0;h<f;h++)l=s===o[h]?u:u+i,u=n[h],c=n[h]=u>c?l>c?c+1:l:l>u?u+1:l;return c};!function(e,t){if(!e.setImmediate){var r,n=1,o={},a=!1,i=e.document,s=Object.getPrototypeOf&&Object.getPrototypeOf(e);s=s&&s.setTimeout?s:e,"[object process]"==={}.toString.call(e.process)?function installNextTickImplementation(){r=function(e){process.nextTick((function(){runIfPresent(e)}))}}():!function canUsePostMessage(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?function installMessageChannelImplementation(){var e=new MessageChannel;e.port1.onmessage=function(e){runIfPresent(e.data)},r=function(t){e.port2.postMessage(t)}}():i&&"onreadystatechange"in i.createElement("script")?function installReadyStateChangeImplementation(){var e=i.documentElement;r=function(t){var r=i.createElement("script");r.onreadystatechange=function(){runIfPresent(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}():function installSetTimeoutImplementation(){r=function(e){setTimeout(runIfPresent,0,e)}}():function installPostMessageImplementation(){var t="setImmediate$"+Math.random()+"$",onGlobalMessage=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&runIfPresent(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",onGlobalMessage,!1):e.attachEvent("onmessage",onGlobalMessage),r=function(r){e.postMessage(t+r,"*")}}(),s.setImmediate=function setImmediate(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),a=0;a<t.length;a++)t[a]=arguments[a+1];var i={callback:e,args:t};return o[n]=i,r(n),n++},s.clearImmediate=clearImmediate}function clearImmediate(e){delete o[e]}function runIfPresent(e){if(a)setTimeout(runIfPresent,0,e);else{var t=o[e];if(t){a=!0;try{!function run(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{clearImmediate(e),a=!1}}}}}("undefined"==typeof self?e:self);var No={exports:{}};return function(e){e.exports=function(t,r,n,o){return(e={}).dedupe=function dedupe(e,a){var i,s=t(a);if(!r(e)&&"object"!=typeof e)throw new Error("contains_dupes must be an array or object");if(0===Object.keys(e).length)return void 0!==typeof console&&console.warn("contains_dupes is empty"),[];s.limit&&(void 0!==typeof console&&console.warn("options.limit will be ignored in dedupe"),s.limit=0),s.cutoff&&"number"==typeof s.cutoff||(void 0!==typeof console&&console.warn("Using default cutoff of 70"),s.cutoff=70),s.scorer||(s.scorer=n,void 0!==typeof console&&console.log("Using default scorer 'ratio' for dedupe")),i=s.processor&&"function"==typeof s.processor?s.processor:function(e){return e};var c={};for(var u in e){var l=i(e[u]);if("string"!=typeof l&&l instanceof String==!1)throw new Error("Each processed item in dedupe must be a string.");var f=o(l,e,s);s.returnObjects?(1===f.length||(f=f.sort((function(e,t){var r=i(e.choice),n=i(t.choice),o=r.length,a=n.length;return o===a?r<n?-1:1:a-o}))),s.keepmap?c[i(f[0].choice)]={item:f[0].choice,key:f[0].key,matches:f}:c[i(f[0].choice)]={item:f[0].choice,key:f[0].key}):(1===f.length||(f=f.sort((function(e,t){var r=i(e[0]),n=i(t[0]),o=r.length,a=n.length;return o===a?r<n?-1:1:a-o}))),s.keepmap?c[i(f[0][0])]=[f[0][0],f[0][2],f]:c[i(f[0][0])]=[f[0][0],f[0][2]])}var p=[];for(var h in c)p.push(c[h]);return p},e}}(No),function(){var e=a,r=s,n=Ho,o=Ro._intersect,i=Ro._intersectWith,c=Ro._difference,u=Ro._differenceWith,l=Ro._partialRight,f=Ro._forEach,p=Ro._isArray,h=Bo,v=Fo,d=Do,_=function(e,t,r){var n={},o=Fo,a=Do;function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function validate(e){return("string"==typeof e||e instanceof String)&&e.length>0}n.validate=validate,n.process_and_sort=function process_and_sort(e){return validate(e)?e.match(/\S+/g).sort().join(" ").trim():""},n.tokenize=function unique_tokens(n,i){if(i&&i.wildcards&&t&&r){var s=r(o,i,a);return t(n.match(/\S+/g),(function(e,t){return 0===s(e,t)}))}return e(n.match(/\S+/g))};const i=/[^\p{L}\p{N}]/gu;return n.full_process=function full_process(e,t){if(!(e instanceof String)&&"string"!=typeof e)return"";var r;if(t&&"object"==typeof t&&t.wildcards&&"string"==typeof t.wildcards&&t.wildcards.length>0){var n=t.wildcards.toLowerCase();if(e=e.toLowerCase(),t.force_ascii){var o="[^\0 -|"+escapeRegExp(n)+"]";e=e.replace(new RegExp(o,"g"),"");var a="["+escapeRegExp(n)+"]",s=n[0];e=e.replace(new RegExp(a,"g"),s);var c="[^A-Za-z0-9"+escapeRegExp(n)+"]";r=(e=(e=e.replace(new RegExp(c,"g")," ")).replace(/_/g," ")).trim()}else{var u="[^\\p{L}\\p{N}|"+escapeRegExp(n)+"]";e=e.replace(new RegExp(u,"gu")," "),a="["+escapeRegExp(n)+"]",s=n[0],r=(e=e.replace(new RegExp(a,"g"),s)).trim()}}else r=t&&(t.force_ascii||!0===t)?(e=e.replace(/[^\x00-\x7F]/g,"")).replace(/\W|_/g," ").toLowerCase().trim():e.replace(i," ").toLowerCase().trim();return t&&t.collapseWhitespace&&(r=r.replace(/\s+/g," ")),r},n.clone_and_set_option_defaults=function(e){if(e&&e.isAClone)return e;var t={isAClone:!0};if(e){var r,n=Object.keys(e);for(r=0;r<n.length;r++)t[n[r]]=e[n[r]]}return!1!==t.full_process&&(t.full_process=!0),!0!==t.force_ascii&&(t.force_ascii=!1),!1!==t.normalize&&!0===t.astral&&(t.normalize=!0),!1!==t.collapseWhitespace&&(t.collapseWhitespace=!0),t},n.isCustomFunc=function(e){return"function"!=typeof e||"token_set_ratio"!==e.name&&"partial_token_set_ratio"!==e.name&&"token_sort_ratio"!==e.name&&"partial_token_sort_ratio"!==e.name&&"QRatio"!==e.name&&"WRatio"!==e.name&&"distance"!==e.name&&"partial_ratio"!==e.name},n}(Ro._uniq,Ro._uniqWith,l),y=_.validate,g=_.process_and_sort,m=_.tokenize,b=_.full_process,$=_.clone_and_set_option_defaults,j=_.isCustomFunc,k=No.exports($,p,QRatio,extract).dedupe;function QRatio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?_ratio(e,t,n):0}function token_set_ratio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?_token_set(e,t,n):0}function partial_token_set_ratio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?(n.partial=!0,_token_set(e,t,n)):0}function token_sort_ratio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?(n.proc_sorted||(e=g(e),t=g(t)),_ratio(e,t,n)):0}function partial_token_sort_ratio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?(n.partial=!0,n.proc_sorted||(e=g(e),t=g(t)),_partial_ratio(e,t,n)):0}function extract(e,t,n){var o,a=$(n);if(p(t))o=t.length;else{if(!(t instanceof Object))throw new Error("Invalid choices");o=Object.keys(t).length}if(!t||0===o)return void 0!==typeof console&&console.warn("No choices"),[];if(a.processor&&"function"!=typeof a.processor)throw new Error("Invalid Processor");if(a.processor||(a.processor=function(e){return e}),a.scorer&&"function"!=typeof a.scorer)throw new Error("Invalid Scorer");a.scorer||(a.scorer=QRatio);var i=j(a.scorer);a.cutoff&&"number"==typeof a.cutoff||(a.cutoff=-1);var pre_processor=function(e,t){return e};a.full_process&&(pre_processor=b,i||(a.processed=!0));var s=!1;i||(a.astral&&a.normalize&&(a.normalize=!1,String.prototype.normalize?(s=!0,e=e.normalize()):void 0!==typeof console&&console.warn("Normalization not supported in your environment")),e=pre_processor(e,a),a.full_process=!1,0===e.length&&void 0!==typeof console&&console.warn("Processed query is empty string"));var c,u,l,h,v=[],d=!1,_=!1,y=!1;if("token_sort_ratio"===a.scorer.name||"partial_token_sort_ratio"===a.scorer.name){var k=g(e);_=!0}else if("token_set_ratio"===a.scorer.name||"partial_token_set_ratio"===a.scorer.name){var w=m(e,a);y=!0}return a.returnObjects?(l=function(e,t){return e.score-t.score},h=function(e,t){return t.score-e.score}):(l=function(e,t){return e[1]-t[1]},h=function(e,t){return t[1]-e[1]}),f(t,(function(t,r){a.tokens=void 0,a.proc_sorted=!1,_?(a.proc_sorted=!0,t&&t.proc_sorted?u=t.proc_sorted:(u=pre_processor(s?a.processor(t).normalize():a.processor(t),a),u=g(u)),c=a.scorer(k,u,a)):y?(u="x",t&&t.tokens?(a.tokens=[w,t.tokens],a.trySimple&&(u=pre_processor(a.processor(t),a))):(u=pre_processor(s?a.processor(t).normalize():a.processor(t),a),a.tokens=[w,m(u,a)]),c=a.scorer(e,u,a)):i?(u=a.processor(t),c=a.scorer(e,u,a)):("string"==typeof(u=pre_processor(s?a.processor(t).normalize():a.processor(t),a))&&0!==u.length||(d=!0),c=a.scorer(e,u,a)),c>a.cutoff&&(a.returnObjects?v.push({choice:t,score:c,key:r}):v.push([t,c,r]))})),d&&void 0!==typeof console&&console.log("One or more choices were empty. (post-processing if applied)"),a.limit&&"number"==typeof a.limit&&a.limit>0&&a.limit<o&&!a.unsorted?v=r.nlargest(v,a.limit,l):a.unsorted||(v=v.sort(h)),v}function extractAsync(e,t,n,o){var a,i,s=$(n);"object"==typeof n.abortController&&(a=n.abortController),"object"==typeof n.cancelToken&&(i=n.cancelToken);var c=256;"number"==typeof s.asyncLoopOffset&&(c=s.asyncLoopOffset<1?1:s.asyncLoopOffset);var u,l=!1;if(t&&t.length&&p(t))u=t.length,l=!0;else{if(!(t instanceof Object))return void o(new Error("Invalid choices"));u=Object.keys(t).length}if(!t||0===u)return void 0!==typeof console&&console.warn("No choices"),void o(null,[]);if(s.processor&&"function"!=typeof s.processor)o(new Error("Invalid Processor"));else if(s.processor||(s.processor=function(e){return e}),s.scorer&&"function"!=typeof s.scorer)o(new Error("Invalid Scorer"));else{s.scorer||(s.scorer=QRatio);var f=j(s.scorer);s.cutoff&&"number"==typeof s.cutoff||(s.cutoff=-1);var pre_processor=function(e,t){return e};s.full_process&&(pre_processor=b,f||(s.processed=!0));var h=!1;f||(s.astral&&s.normalize&&(s.normalize=!1,String.prototype.normalize?(h=!0,e=e.normalize()):void 0!==typeof console&&console.warn("Normalization not supported in your environment")),e=pre_processor(e,s),s.full_process=!1,0===e.length&&void 0!==typeof console&&console.warn("Processed query is empty string"));var v,d,_,y,k,w=[],O=!1,z=!1,C=!1;if("token_sort_ratio"===s.scorer.name||"partial_token_sort_ratio"===s.scorer.name){var S=g(e);z=!0}else if("token_set_ratio"===s.scorer.name||"partial_token_set_ratio"===s.scorer.name){var A=m(e,s);C=!0}s.returnObjects?(y=function(e,t){return e.score-t.score},k=function(e,t){return t.score-e.score}):(y=function(e,t){return e[1]-t[1]},k=function(e,t){return t[1]-e[1]});var x=Object.keys(t);l?searchLoop(0):searchLoop(x[0],0)}function searchLoop(n,p){(l||t.hasOwnProperty(n))&&(s.tokens=void 0,s.proc_sorted=!1,z?(s.proc_sorted=!0,t[n]&&t[n].proc_sorted?d=t[n].proc_sorted:(d=pre_processor(h?s.processor(t[n]).normalize():s.processor(t[n]),s),d=g(d)),_=s.scorer(S,d,s)):C?(d="x",t[n]&&t[n].tokens?(s.tokens=[A,t[n].tokens],s.trySimple&&(d=pre_processor(s.processor(t[n]),s))):(d=pre_processor(h?s.processor(t[n]).normalize():s.processor(t[n]),s),s.tokens=[A,m(d,s)]),_=s.scorer(e,d,s)):f?(d=s.processor(t[n]),_=s.scorer(e,d,s)):("string"==typeof(d=pre_processor(h?s.processor(t[n]).normalize():s.processor(t[n]),s))&&0!==d.length||(O=!0),_=s.scorer(e,d,s)),v=l?parseInt(n):n,_>s.cutoff&&(s.returnObjects?w.push({choice:t[n],score:_,key:v}):w.push([t[n],_,v]))),a&&!0===a.signal.aborted?o(new Error("aborted")):i&&!0===i.canceled?o(new Error("canceled")):l&&n<t.length-1?n%c==0?setImmediate((function(){searchLoop(n+1)})):searchLoop(n+1):p<x.length-1?p%c==0?setImmediate((function(){searchLoop(x[p+1],p+1)})):searchLoop(x[p+1],p+1):(O&&void 0!==typeof console&&console.log("One or more choices were empty. (post-processing if applied)"),s.limit&&"number"==typeof s.limit&&s.limit>0&&s.limit<u&&!s.unsorted?w=r.nlargest(w,s.limit,y):s.unsorted||(w=w.sort(k)),o(null,w))}}var w="%*SuperUniqueWildcardKey*%";function _getCharacterCounts(e,t){var r=e;if(t.astral)var n=Array.from(r);else n=r.split("");var o={};if(t.wildcards)for(var a=0;a<n.length;a++){var i=n[a];t.wildcards.indexOf(i)>-1?o[w]?o[w]+=1:o[w]=1:o[i]?o[i]+=1:o[i]=1}else for(a=0;a<n.length;a++){o[i=n[a]]?o[i]+=1:o[i]=1}return o}function _token_similarity_sort(e,t,r){for(var a=t,i=e.reduce((function(e,t){return e[t]=_getCharacterCounts(t,r),e}),{}),s=a.reduce((function(e,t){return e[t]=_getCharacterCounts(t,r),e}),{}),c=[],u=0;a.length&&u<e.length;){var l=n(a,(function(t){return r=i[e[u]],n=s[t],a=Object.keys(r),c=Object.keys(n),l=o(a,c).map((function(e){return r[e]*n[e]})).reduce((function(e,t){return e+t}),0),f=a.map((function(e){return Math.pow(r[e],2)})).reduce((function(e,t){return e+t}),0),p=c.map((function(e){return Math.pow(n[e],2)})).reduce((function(e,t){return e+t}),0),l/(Math.sqrt(f)*Math.sqrt(p));var r,n,a,c,l,f,p}),"desc")[0];c.push(l),u++,a=a.filter((function(e){return e!==l}))}return c.concat(a)}function _order_token_lists(e,t,r,n){var o=t,a=n;if(t.length>n.length)o=n,a=t;else if(t.length===n.length){if(e.length>r.length)o=n,a=t;else[e,r].sort()[0]===r&&(o=n,a=t)}return[o,a]}function _token_similarity_sort_ratio(e,t,r){if(r.tokens)n=r.tokens[0],o=r.tokens[1];else var n=m(e,r),o=m(t,r);var a=_order_token_lists(e,n.sort(),t,o.sort()),i=a[0];const s=_token_similarity_sort(i,a[1],r);return r.partial?_partial_ratio(i.join(" "),s.join(" "),r):_ratio(i.join(" "),s.join(" "),r)}function _token_set(e,t,r){if(r.tokens)n=r.tokens[0],a=r.tokens[1];else var n=m(e,r),a=m(t,r);if(r.wildcards)var s=l(v,r,d),wildCompare=function(e,t){return 0===s(e,t)},f=i(n,a,wildCompare),p=u(n,a,wildCompare),h=u(a,n,wildCompare);else f=o(n,a),p=c(n,a),h=c(a,n);var _=f.sort().join(" "),y=p.sort(),g=h.sort();if(r.sortBySimilarity)var b=_order_token_lists(e,y,t,g),$=b[0],j=b[1],k=$.join(" "),w=_token_similarity_sort($,j,r).join(" ");else k=y.join(" "),w=g.join(" ");var O=_+" "+k,z=_+" "+w;_=_.trim(),O=O.trim(),z=z.trim();var C=_ratio;if(r.partial&&(C=_partial_ratio,_.length>0))return 100;var S=[C(_,O,r),C(_,z,r),C(O,z,r)];return r.trySimple&&S.push(C(e,t,r)),Math.max.apply(null,S)}function _ratio(t,r,n){if(!y(t))return 0;if(!y(r))return 0;if(n.ratio_alg&&"difflib"===n.ratio_alg){var o=new e(null,t,r,n.autojunk).ratio();return Math.round(100*o)}var a,i;return void 0===n.subcost&&(n.subcost=2),n.astral?(a=h(t,r,n),i=Array.from(t).length+Array.from(r).length):n.wildcards?(a=v(t,r,n,d),i=t.length+r.length):(a=d(t,r,n),i=t.length+r.length),Math.round((i-a)/i*100)}function _partial_ratio(t,r,n){if(!y(t))return 0;if(!y(r))return 0;if(t.length<=r.length)var o=t,a=r;else o=r,a=t;for(var i=new e(null,o,a,n.autojunk).getMatchingBlocks(),s=[],c=0;c<i.length;c++){var u=i[c][1]-i[c][0]>0?i[c][1]-i[c][0]:0,l=u+o.length,f=_ratio(o,a.substring(u,l),n);if(f>99.5)return 100;s.push(f)}return Math.max.apply(null,s)}Object.keys||(Object.keys=function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],n=r.length;return function(o){if("object"!=typeof o&&("function"!=typeof o||null===o))throw new TypeError("Object.keys called on non-object");var a,i,s=[];for(a in o)e.call(o,a)&&s.push(a);if(t)for(i=0;i<n;i++)e.call(o,r[i])&&s.push(r[i]);return s}}());var O=void 0;"undefined"!=typeof Promise&&(O=function(e,t,r){return new Promise((function(n,o){extractAsync(e,t,r,(function(e,t){e?o(e):n(t)}))}))});var z={distance:function distance(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,void 0===n.subcost&&(n.subcost=1),n.astral?h(e,t,n):v(e,t,n,d)},ratio:QRatio,partial_ratio:function partial_ratio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?_partial_ratio(e,t,n):0},token_set_ratio:token_set_ratio,token_sort_ratio:token_sort_ratio,partial_token_set_ratio:partial_token_set_ratio,partial_token_sort_ratio:partial_token_sort_ratio,token_similarity_sort_ratio:function token_similarity_sort_ratio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?_token_similarity_sort_ratio(e,t,n):0},partial_token_similarity_sort_ratio:function partial_token_similarity_sort_ratio(e,t,r){var n=$(r);return e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,y(e)&&y(t)?(n.partial=!0,_token_similarity_sort_ratio(e,t,n)):0},WRatio:function WRatio(e,t,r){var n=$(r);if(e=n.normalize?e.normalize():e,t=n.normalize?t.normalize():t,e=n.full_process?b(e,n):e,t=n.full_process?b(t,n):t,n.full_process=!1,!y(e))return 0;if(!y(t))return 0;var o=!0,a=.95,i=.9,s=_ratio(e,t,n),c=Math.max(e.length,t.length)/Math.min(e.length,t.length);if(c<1.5&&(o=!1),c>8&&(i=.6),o){var u=_partial_ratio(e,t,n)*i,l=partial_token_sort_ratio(e,t,n)*a*i,f=partial_token_set_ratio(e,t,n)*a*i;return Math.round(Math.max(s,u,l,f))}var p=token_sort_ratio(e,t,n)*a,h=token_set_ratio(e,t,n)*a;return Math.round(Math.max(s,p,h))},full_process:b,extract:extract,extractAsync:extractAsync,extractAsPromised:O,process_and_sort:g,unique_tokens:m,dedupe:k};t.exports=z}(),t.exports}));