fuzzball
Version:
Fuzzy string matching algorithms and utilities, port of the TheFuzz Python library.
2 lines (1 loc) • 48 kB
JavaScript
var e,t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}},n=Math.floor,o=Math.max,a=Math.min,_calculateRatio=function(e,t){return t?2*e/t:1},_arrayCmp=function(e,t){var r,n,o,i,s,c;for(s=[e.length,t.length],r=i=0,c=a(n=s[0],o=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-o},_has=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i=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,r,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)r=e[o],(_has(t,r)?t[r]:t[r]=[]).push(o);if(i={},a=this.isjunk)for(f=0,h=(v=Object.keys(t)).length;f<h;f++)a(r=v[f])&&(i[r]=!0,delete t[r]);if(u={},s=e.length,this.autojunk&&s>=200)for(r in c=n(s/100)+1,t)t[r].length>c&&(u[r]=!0,delete t[r]);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,k,j,$,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=d=e;e<=t?d<t:d>t;l=e<=t?++d:--d){for(_={},y=0,g=(k=_has(i,o[l])?i[o[l]]:[]).length;y<g;y++)if(!((p=k[y])<r)){if(p>=n)break;(v=_[p]=(h[p-1]||0)+1)>u&&(s=(j=[l-v+1,p-v+1,v])[0],c=j[1],u=j[2])}h=_}for(;s>e&&c>r&&!f(a[c-1])&&o[s-1]===a[c-1];)s=($=[s-1,c-1,u+1])[0],c=$[1],u=$[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,k,j,$,w,O;if(this.matchingBlocks)return this.matchingBlocks;for(y=[[0,h=(k=[this.a.length,this.b.length])[0],0,v=k[1]]],_=[];y.length;)t=(j=y.pop())[0],e=j[1],n=j[2],r=j[3],o=($=g=this.findLongestMatch(t,e,n,r))[0],s=$[1],(l=$[2])&&(_.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(_.sort(_arrayCmp),a=c=f=0,d=[],m=0,b=_.length;m<b;m++)i=(w=_[m])[0],u=w[1],p=w[2],a+f===i&&c+f===u?f+=p:(f&&d.push([a,c,f]),a=(O=[i,u,p])[0],c=O[1],f=O[2]);return f&&d.push([a,c,f]),d.push([h,v,0]),this.matchingBlocks=d},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,n,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,o(i,s-e),s,o(c,u-e),u]),"equal"===t[t.length-1][0]&&(f=(_=t[t.length-1])[0],i=_[1],s=_[2],c=_[3],u=_[4],t[t.length-1]=[f,i,a(s,i+e),c,a(u,c+e)]),l=e+e,n=[],r=[],p=0,h=t.length;p<h;p++)f=(d=t[p])[0],i=d[1],s=d[2],c=d[3],u=d[4],"equal"===f&&s-i>l&&(r.push([f,i,a(s,i+e),c,a(u,c+e)]),n.push(r),r=[],i=(y=[o(i,s-e),o(c,u-e)])[0],c=y[1]),r.push([f,i,s,c,u]);return!r.length||1===r.length&&"equal"===r[0][0]||n.push(r),n},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(a(e=r[0],t=r[1]),e+t)},SequenceMatcher}(),s={exports:{}};e=s,function(){var t,r,n,o,a,i,s,c,u,l,f,p,h,v,_;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,_(e,0,t)):o=n,o},c=function(e,t,n){var o;return null==n&&(n=r),o=e[0],e[0]=t,_(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],_(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(_(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),_(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),d=[],p=0,_=l(t,e.length);0<=_?p<_:p>_;0<=_?++p:--p)d.push(a(e,n));return d},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},_=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)},t=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}(),e.exports=t}.call(t);var c=s.exports;var u=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},l=Array.isArray,f="object"==typeof t&&t&&t.Object===Object&&t,p=f,h="object"==typeof self&&self&&self.Object===Object&&self,v=p||h||Function("return this")(),_=v.Symbol,d=_,y=Object.prototype,g=y.hasOwnProperty,m=y.toString,b=d?d.toStringTag:void 0;var k=function getRawTag$1(e){var t=g.call(e,b),r=e[b];try{e[b]=void 0;var n=!0}catch(e){}var o=m.call(e);return n&&(t?e[b]=r:delete e[b]),o},j=Object.prototype.toString;var $=k,w=function objectToString$1(e){return j.call(e)},O=_?_.toStringTag:void 0;var S=function baseGetTag$5(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":O&&O in Object(e)?$(e):w(e)};var C=function isObjectLike$5(e){return null!=e&&"object"==typeof e},z=S,A=C;var x=function isSymbol$4(e){return"symbol"==typeof e||A(e)&&"[object Symbol]"==z(e)},M=l,I=x,E=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,P=/^\w*$/;var q=function isKey$3(e,t){if(M(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!I(e))||(P.test(e)||!E.test(e)||null!=t&&e in Object(t))};var H=function isObject$3(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},L=S,R=H;var T,B=function isFunction$2(e){if(!R(e))return!1;var t=L(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},W=v["__core-js_shared__"],F=(T=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"";var D=function isMasked$1(e){return!!F&&F in e},N=Function.prototype.toString;var U=function toSource$2(e){if(null!=e){try{return N.call(e)}catch(e){}try{return e+""}catch(e){}}return""},G=B,K=D,Q=H,V=U,Z=/^\[object .+?Constructor\]$/,J=Function.prototype,X=Object.prototype,Y=J.toString,ee=X.hasOwnProperty,te=RegExp("^"+Y.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var re=function baseIsNative$1(e){return!(!Q(e)||K(e))&&(G(e)?te:Z).test(V(e))},ne=function getValue$1(e,t){return null==e?void 0:e[t]};var oe=function getNative$6(e,t){var r=ne(e,t);return re(r)?r:void 0},ae=oe(Object,"create"),ie=ae;var se=function hashClear$1(){this.__data__=ie?ie(null):{},this.size=0};var ce=function hashDelete$1(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ue=ae,le=Object.prototype.hasOwnProperty;var fe=function hashGet$1(e){var t=this.__data__;if(ue){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return le.call(t,e)?t[e]:void 0},pe=ae,he=Object.prototype.hasOwnProperty;var ve=ae;var _e=se,de=ce,ye=fe,ge=function hashHas$1(e){var t=this.__data__;return pe?void 0!==t[e]:he.call(t,e)},me=function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ve&&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=_e,Hash$1.prototype.delete=de,Hash$1.prototype.get=ye,Hash$1.prototype.has=ge,Hash$1.prototype.set=me;var be=Hash$1;var ke=function listCacheClear$1(){this.__data__=[],this.size=0};var je=function eq$2(e,t){return e===t||e!=e&&t!=t},$e=je;var we=function assocIndexOf$4(e,t){for(var r=e.length;r--;)if($e(e[r][0],t))return r;return-1},Oe=we,Se=Array.prototype.splice;var Ce=we;var ze=we;var Ae=we;var xe=ke,Me=function listCacheDelete$1(e){var t=this.__data__,r=Oe(t,e);return!(r<0)&&(r==t.length-1?t.pop():Se.call(t,r,1),--this.size,!0)},Ie=function listCacheGet$1(e){var t=this.__data__,r=Ce(t,e);return r<0?void 0:t[r][1]},Ee=function listCacheHas$1(e){return ze(this.__data__,e)>-1},Pe=function listCacheSet$1(e,t){var r=this.__data__,n=Ae(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=xe,ListCache$4.prototype.delete=Me,ListCache$4.prototype.get=Ie,ListCache$4.prototype.has=Ee,ListCache$4.prototype.set=Pe;var qe=ListCache$4,He=oe(v,"Map"),Le=be,Re=qe,Te=He;var Be=function isKeyable$1(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var We=function getMapData$4(e,t){var r=e.__data__;return Be(t)?r["string"==typeof t?"string":"hash"]:r.map},Fe=We;var De=We;var Ne=We;var Ue=We;var Ge=function mapCacheClear$1(){this.size=0,this.__data__={hash:new Le,map:new(Te||Re),string:new Le}},Ke=function mapCacheDelete$1(e){var t=Fe(this,e).delete(e);return this.size-=t?1:0,t},Qe=function mapCacheGet$1(e){return De(this,e).get(e)},Ve=function mapCacheHas$1(e){return Ne(this,e).has(e)},Ze=function mapCacheSet$1(e,t){var r=Ue(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=Ge,MapCache$3.prototype.delete=Ke,MapCache$3.prototype.get=Qe,MapCache$3.prototype.has=Ve,MapCache$3.prototype.set=Ze;var Je=MapCache$3,Xe=Je;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||Xe),memoized}memoize$1.Cache=Xe;var Ye=memoize$1;var et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/\\(\\)?/g,rt=function memoizeCapped$1(e){var t=Ye(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(et,(function(e,r,n,o){t.push(n?o.replace(tt,"$1"):r||e)})),t})),nt=u,ot=l,at=x,it=_?_.prototype:void 0,st=it?it.toString:void 0;var ct=function baseToString$1(e){if("string"==typeof e)return e;if(ot(e))return nt(e,baseToString$1)+"";if(at(e))return st?st.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t},ut=ct;var lt=l,ft=q,pt=rt,ht=function toString$1(e){return null==e?"":ut(e)};var vt=function castPath$2(e,t){return lt(e)?e:ft(e,t)?[e]:pt(ht(e))},_t=x;var dt=function toKey$4(e){if("string"==typeof e||_t(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t},yt=vt,gt=dt;var mt=function baseGet$3(e,t){for(var r=0,n=(t=yt(t,e)).length;null!=e&&r<n;)e=e[gt(t[r++])];return r&&r==n?e:void 0},bt=qe;var kt=qe,jt=He,$t=Je;var wt=qe,Ot=function stackClear$1(){this.__data__=new bt,this.size=0},St=function stackDelete$1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Ct=function stackGet$1(e){return this.__data__.get(e)},zt=function stackHas$1(e){return this.__data__.has(e)},At=function stackSet$1(e,t){var r=this.__data__;if(r instanceof kt){var n=r.__data__;if(!jt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new $t(n)}return r.set(e,t),this.size=r.size,this};function Stack$2(e){var t=this.__data__=new wt(e);this.size=t.size}Stack$2.prototype.clear=Ot,Stack$2.prototype.delete=St,Stack$2.prototype.get=Ct,Stack$2.prototype.has=zt,Stack$2.prototype.set=At;var xt=Stack$2;var Mt=Je,It=function setCacheAdd$1(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Et=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 Mt;++t<r;)this.add(e[t])}SetCache$1.prototype.add=SetCache$1.prototype.push=It,SetCache$1.prototype.has=Et;var Pt=SetCache$1,qt=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},Ht=function cacheHas$1(e,t){return e.has(t)};var Lt=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 Pt:void 0;for(a.set(e,t),a.set(t,e);++f<s;){var v=e[f],_=t[f];if(n)var d=i?n(_,v,f,t,e,a):n(v,_,f,e,t,a);if(void 0!==d){if(d)continue;p=!1;break}if(h){if(!qt(t,(function(e,t){if(!Ht(h,t)&&(v===e||o(v,e,r,n,a)))return h.push(t)}))){p=!1;break}}else if(v!==_&&!o(v,_,r,n,a)){p=!1;break}}return a.delete(e),a.delete(t),p};var Rt=v.Uint8Array,Tt=je,Bt=Lt,Wt=function mapToArray$1(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r},Ft=function setToArray$1(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r},Dt=_?_.prototype:void 0,Nt=Dt?Dt.valueOf:void 0;var Ut=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 Rt(e),new Rt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Tt(+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=Wt;case"[object Set]":var c=1&n;if(s||(s=Ft),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=Bt(s(e),s(t),n,o,a,i);return i.delete(e),l;case"[object Symbol]":if(Nt)return Nt.call(e)==Nt.call(t)}return!1};var Gt=function arrayPush$1(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e},Kt=l;var Qt=function baseGetAllKeys$1(e,t,r){var n=t(e);return Kt(e)?n:Gt(n,r(e))};var Vt=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},Zt=function stubArray$1(){return[]},Jt=Object.prototype.propertyIsEnumerable,Xt=Object.getOwnPropertySymbols,Yt=Xt?function(e){return null==e?[]:(e=Object(e),Vt(Xt(e),(function(t){return Jt.call(e,t)})))}:Zt;var er=function baseTimes$1(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n},tr=S,rr=C;var nr=function baseIsArguments$1(e){return rr(e)&&"[object Arguments]"==tr(e)},or=C,ar=Object.prototype,ir=ar.hasOwnProperty,sr=ar.propertyIsEnumerable,cr=nr(function(){return arguments}())?nr:function(e){return or(e)&&ir.call(e,"callee")&&!sr.call(e,"callee")},ur={exports:{}};var lr=function stubFalse(){return!1};!function(e,t){var r=v,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=S,_r=hr,dr=C,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 dr(e)&&_r(e.length)&&!!yr[vr(e)]};var mr=function baseUnary$2(e){return function(t){return e(t)}},br={exports:{}};!function(e,t){var r=f,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 kr=gr,jr=mr,$r=br.exports,wr=$r&&$r.isTypedArray,Or=wr?jr(wr):kr,Sr=er,Cr=cr,zr=l,Ar=ur.exports,xr=pr,Mr=Or,Ir=Object.prototype.hasOwnProperty;var Er=function arrayLikeKeys$1(e,t){var r=zr(e),n=!r&&Cr(e),o=!r&&!n&&Ar(e),a=!r&&!n&&!o&&Mr(e),i=r||n||o||a,s=i?Sr(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=B,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=Qt,Qr=Yt,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 _=e[l=s[u]],d=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=oe(v,"DataView"),en=He,tn=oe(v,"Promise"),rn=oe(v,"Set"),nn=oe(v,"WeakMap"),on=S,an=U,sn=an(Yr),cn=an(en),un=an(tn),ln=an(rn),fn=an(nn),pn=on;(Yr&&"[object DataView]"!=pn(new Yr(new ArrayBuffer(1)))||en&&"[object Map]"!=pn(new en)||tn&&"[object Promise]"!=pn(tn.resolve())||rn&&"[object Set]"!=pn(new rn)||nn&&"[object WeakMap]"!=pn(new nn))&&(pn=function(e){var t=on(e),r="[object Object]"==t?e.constructor:void 0,n=r?an(r):"";if(n)switch(n){case sn:return"[object DataView]";case cn:return"[object Map]";case un:return"[object Promise]";case ln:return"[object Set]";case fn:return"[object WeakMap]"}return t});var hn=xt,vn=Lt,_n=Ut,dn=Xr,yn=pn,gn=l,mn=ur.exports,bn=Or,kn="[object Object]",jn=Object.prototype.hasOwnProperty;var $n=function baseIsEqualDeep$1(e,t,r,n,o,a){var i=gn(e),s=gn(t),c=i?"[object Array]":yn(e),u=s?"[object Array]":yn(t),l=(c="[object Arguments]"==c?kn:c)==kn,f=(u="[object Arguments]"==u?kn:u)==kn,p=c==u;if(p&&mn(e)){if(!mn(t))return!1;i=!0,l=!1}if(p&&!l)return a||(a=new hn),i||bn(e)?vn(e,t,r,n,o,a):_n(e,t,c,r,n,o,a);if(!(1&r)){var h=l&&jn.call(e,"__wrapped__"),v=f&&jn.call(t,"__wrapped__");if(h||v){var _=h?e.value():e,d=v?t.value():t;return a||(a=new hn),o(_,d,r,n,a)}}return!!p&&(a||(a=new hn),dn(e,t,r,n,o,a))},wn=C;var On=function baseIsEqual$2(e,t,r,n,o){return e===t||(null==e||null==t||!wn(e)&&!wn(t)?e!=e&&t!=t:$n(e,t,r,n,baseIsEqual$2,o))},Sn=xt,Cn=On;var zn=H;var An=function isStrictComparable$2(e){return e==e&&!zn(e)},xn=An,Mn=Gr;var In=function matchesStrictComparable$2(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}},En=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 Sn;if(n)var p=n(u,l,c,e,t,f);if(!(void 0===p?Cn(l,u,3,n,f):p))return!1}}return!0},Pn=function getMatchData$1(e){for(var t=Mn(e),r=t.length;r--;){var n=t[r],o=e[n];t[r]=[n,o,xn(o)]}return t},qn=In;var Hn=mt;var Ln=vt,Rn=cr,Tn=l,Bn=pr,Wn=hr,Fn=dt;var Dn=function baseHasIn$1(e,t){return null!=e&&t in Object(e)},Nn=function hasPath$1(e,t,r){for(var n=-1,o=(t=Ln(t,e)).length,a=!1;++n<o;){var i=Fn(t[n]);if(!(a=null!=e&&r(e,i)))break;e=e[i]}return a||++n!=o?a:!!(o=null==e?0:e.length)&&Wn(o)&&Bn(i,o)&&(Tn(e)||Rn(e))};var Un=On,Gn=function get$1(e,t,r){var n=null==e?void 0:Hn(e,t);return void 0===n?r:n},Kn=function hasIn$1(e,t){return null!=e&&Nn(e,t,Dn)},Qn=q,Vn=An,Zn=In,Jn=dt;var Xn=function identity$2(e){return e};var Yn=mt;var eo=function baseProperty$1(e){return function(t){return null==t?void 0:t[e]}},to=function basePropertyDeep$1(e){return function(t){return Yn(t,e)}},ro=q,no=dt;var oo=function baseMatches$1(e){var t=Pn(e);return 1==t.length&&t[0][2]?qn(t[0][0],t[0][1]):function(r){return r===e||En(r,e,t)}},ao=function baseMatchesProperty$1(e,t){return Qn(e)&&Vn(t)?Zn(Jn(e),t):function(r){var n=Gn(r,e);return void 0===n&&n===t?Kn(r,e):Un(t,n,3)}},io=Xn,so=l,co=function property$1(e){return ro(e)?eo(no(e)):to(e)};var uo=function baseIteratee$1(e){return"function"==typeof e?e:null==e?io:"object"==typeof e?so(e)?ao(e[0],e[1]):oo(e):co(e)};var lo=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}}(),fo=Gr;var po=Fr;var ho=function createBaseEach$1(e,t){return function(r,n){if(null==r)return r;if(!po(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&&lo(e,t,fo)})),vo=Fr;var _o=x;var yo=function compareAscending$1(e,t){if(e!==t){var r=void 0!==e,n=null===e,o=e==e,a=_o(e),i=void 0!==t,s=null===t,c=t==t,u=_o(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 go=u,mo=mt,bo=uo,ko=function baseMap$1(e,t){var r=-1,n=vo(e)?Array(e.length):[];return ho(e,(function(e,o,a){n[++r]=t(e,o,a)})),n},jo=function baseSortBy$1(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e},$o=mr,wo=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=yo(o[n],a[n]);if(c)return n>=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index},Oo=Xn,So=l;var Co=function baseOrderBy$1(e,t,r){t=t.length?go(t,(function(e){return So(e)?function(t){return mo(t,1===e.length?e[0]:e)}:e})):[Oo];var n=-1;t=go(t,$o(bo));var o=ko(e,(function(e,r,o){return{criteria:go(t,(function(t){return t(e)})),index:++n,value:e}}));return jo(o,(function(e,t){return wo(e,t,r)}))},zo=l;var Ao=function orderBy(e,t,r,n){return null==e?[]:(zo(t)||(t=null==t?[]:[t]),zo(r=n?void 0:r)||(r=null==r?[]:[r]),Co(e,t,r))};var xo,Mo={_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{xo="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 Io,Eo=function leven(e,t,r){var n=[],o=[],a=r&&xo&&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 _=0,d=0;_<h;)o[_]=f[_].codePointAt(0),n[_]=++_;if(a)for(;d<v;)for(s=p[d].codePointAt(0),u=d++,c=d,_=0;_<h;_++)l=0===xo.compare(String.fromCodePoint(s),String.fromCodePoint(o[_]))?u:u+i,u=n[_],c=n[_]=u>c?l>c?c+1:l:l>u?u+1:l;else for(;d<v;)for(s=p[d].codePointAt(0),u=d++,c=d,_=0;_<h;_++)l=s===o[_]?u:u+i,u=n[_],c=n[_]=u>c?l>c?c+1:l:l>u?u+1:l;return c};try{Io="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 Po,qo=function leven(e,t,r,n){var o=[],a=[],i=r&&Io&&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,_;if(!1===r.full_process&&!0!==r.processed){f=(l=r.wildcards[0]).charCodeAt(0);var d="["+function escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(r.wildcards)+"]";if((e=e.replace(new RegExp(d,"g"),l))===(t=t.replace(new RegExp(d,"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++)_=0===Io.compare(String.fromCharCode(p),String.fromCharCode(a[y]))||p===f||a[y]===f?v:v+s,v=o[y],h=o[y]=v>h?_>h?h+1:_:_>v?v+1:_;else for(;g<u;)for(p=t.charCodeAt(g),v=g++,h=g,y=0;y<c;y++)_=p===a[y]||p===f||a[y]===f?v:v+s,v=o[y],h=o[y]=v>h?_>h?h+1:_:_>v?v+1:_;return h}return n(e,t,r)};try{Po="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 Ho=function leven(e,t,r){var n=[],o=[],a=r&&Po&&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===Po.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?t:self);var Lo={exports:{}};!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}}(Lo),function(){var e=i,t=c,n=Ao,o=Mo._intersect,a=Mo._intersectWith,s=Mo._difference,u=Mo._differenceWith,l=Mo._partialRight,f=Mo._forEach,p=Mo._isArray,h=Eo,v=qo,_=Ho,d=function(e,t,r){var n={},o=qo,a=Ho;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}(Mo._uniq,Mo._uniqWith,l),y=d.validate,g=d.process_and_sort,m=d.tokenize,b=d.full_process,k=d.clone_and_set_option_defaults,j=d.isCustomFunc,$=Lo.exports(k,p,QRatio,extract).dedupe;function QRatio(e,t,r){var n=k(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=k(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=k(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=k(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=k(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,r,n){var o,a=k(n);if(p(r))o=r.length;else{if(!(r instanceof Object))throw new Error("Invalid choices");o=Object.keys(r).length}if(!r||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=[],_=!1,d=!1,y=!1;if("token_sort_ratio"===a.scorer.name||"partial_token_sort_ratio"===a.scorer.name){var $=g(e);d=!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(r,(function(t,r){a.tokens=void 0,a.proc_sorted=!1,d?(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($,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||(_=!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]))})),_&&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=t.nlargest(v,a.limit,l):a.unsorted||(v=v.sort(h)),v}function extractAsync(e,r,n,o){var a,i,s=k(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(r&&r.length&&p(r))u=r.length,l=!0;else{if(!(r instanceof Object))return void o(new Error("Invalid choices"));u=Object.keys(r).length}if(!r||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,$,w=[],O=!1,S=!1,C=!1;if("token_sort_ratio"===s.scorer.name||"partial_token_sort_ratio"===s.scorer.name){var z=g(e);S=!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},$=function(e,t){return t.score-e.score}):(y=function(e,t){return e[1]-t[1]},$=function(e,t){return t[1]-e[1]});var x=Object.keys(r);l?searchLoop(0):searchLoop(x[0],0)}function searchLoop(n,p){(l||r.hasOwnProperty(n))&&(s.tokens=void 0,s.proc_sorted=!1,S?(s.proc_sorted=!0,r[n]&&r[n].proc_sorted?_=r[n].proc_sorted:(_=pre_processor(h?s.processor(r[n]).normalize():s.processor(r[n]),s),_=g(_)),d=s.scorer(z,_,s)):C?(_="x",r[n]&&r[n].tokens?(s.tokens=[A,r[n].tokens],s.trySimple&&(_=pre_processor(s.processor(r[n]),s))):(_=pre_processor(h?s.processor(r[n]).normalize():s.processor(r[n]),s),s.tokens=[A,m(_,s)]),d=s.scorer(e,_,s)):f?(_=s.processor(r[n]),d=s.scorer(e,_,s)):("string"==typeof(_=pre_processor(h?s.processor(r[n]).normalize():s.processor(r[n]),s))&&0!==_.length||(O=!0),d=s.scorer(e,_,s)),v=l?parseInt(n):n,d>s.cutoff&&(s.returnObjects?w.push({choice:r[n],score:d,key:v}):w.push([r[n],d,v]))),a&&!0===a.signal.aborted?o(new Error("aborted")):i&&!0===i.canceled?o(new Error("canceled")):l&&n<r.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=t.nlargest(w,s.limit,y):s.unsorted||(w=w.sort($)),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],i=r.tokens[1];else var n=m(e,r),i=m(t,r);if(r.wildcards)var c=l(v,r,_),wildCompare=function(e,t){return 0===c(e,t)},f=a(n,i,wildCompare),p=u(n,i,wildCompare),h=u(i,n,wildCompare);else f=o(n,i),p=s(n,i),h=s(i,n);var d=f.sort().join(" "),y=p.sort(),g=h.sort();if(r.sortBySimilarity)var b=_order_token_lists(e,y,t,g),k=b[0],j=b[1],$=k.join(" "),w=_token_similarity_sort(k,j,r).join(" ");else $=y.join(" "),w=g.join(" ");var O=d+" "+$,S=d+" "+w;d=d.trim(),O=O.trim(),S=S.trim();var C=_ratio;if(r.partial&&(C=_partial_ratio,d.length>0))return 100;var z=[C(d,O,r),C(d,S,r),C(O,S,r)];return r.trySimple&&z.push(C(e,t,r)),Math.max.apply(null,z)}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).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,_),i=t.length+r.length):(a=_(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).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 S={distance:function distance(e,t,r){var n=k(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,_)},ratio:QRatio,partial_ratio:function partial_ratio(e,t,r){var n=k(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=k(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=k(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=k(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:$};r.exports=S}();var Ro=r.exports;const To=Ro.distance,Bo=Ro.ratio,Wo=Ro.partial_ratio,Fo=Ro.token_set_ratio,Do=Ro.token_sort_ratio,No=Ro.partial_token_set_ratio,Uo=Ro.partial_token_sort_ratio,Go=Ro.token_similarity_sort_ratio,Ko=Ro.partial_token_similarity_sort_ratio,Qo=Ro.WRatio,Vo=Ro.full_process,Zo=Ro.extract,Jo=Ro.extractAsync,Xo=Ro.extractAsPromised,Yo=Ro.process_and_sort,ea=Ro.unique_tokens,ta=Ro.dedupe;export{Qo as WRatio,ta as dedupe,To as distance,Zo as extract,Xo as extractAsPromised,Jo as extractAsync,Vo as full_process,Wo as partial_ratio,No as partial_token_set_ratio,Ko as partial_token_similarity_sort_ratio,Uo as partial_token_sort_ratio,Yo as process_and_sort,Bo as ratio,Fo as token_set_ratio,Go as token_similarity_sort_ratio,Do as token_sort_ratio,ea as unique_tokens};