Comparing version 0.3.1 to 0.3.2
@@ -1,1 +0,1 @@ | ||
var t=Object.defineProperty,e=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(e,o,n)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,i=(t,i)=>{for(var c in i||(i={}))o.call(i,c)&&r(t,c,i[c]);if(e)for(var c of e(i))n.call(i,c)&&r(t,c,i[c]);return t};const c={225:"a",259:"a",462:"a",226:"a",228:"a",551:"a",7841:"a",513:"a",224:"a",7843:"a",515:"a",257:"a",261:"a",7834:"a",229:"a",7681:"a",227:"a",867:"a",592:"a",7683:"b",7685:"b",595:"b",7687:"b",384:"b",387:"b",263:"c",269:"c",231:"c",265:"c",597:"c",267:"c",392:"c",572:"c",872:"c",663:"c",8580:"c",271:"d",7697:"d",7699:"d",545:"d",7691:"d",7693:"d",599:"d",7695:"d",273:"d",598:"d",396:"d",873:"d",233:"e",277:"e",283:"e",553:"e",7705:"e",234:"e",235:"e",279:"e",7865:"e",517:"e",232:"e",7867:"e",605:"e",519:"e",275:"e",281:"e",583:"e",7707:"e",7869:"e",868:"e",666:"e",606:"e",603:"e",600:"e",604:"e",477:"e",7432:"e",7711:"f",402:"f",501:"g",287:"g",487:"g",291:"g",285:"g",289:"g",608:"g",7713:"g",485:"g",609:"g",7723:"h",543:"h",7721:"h",293:"h",7719:"h",7715:"h",7717:"h",686:"h",614:"h",7830:"h",295:"h",874:"h",613:"h",8341:"h",237:"i",301:"i",464:"i",238:"i",239:"i",7883:"i",521:"i",236:"i",7881:"i",523:"i",299:"i",303:"i",616:"i",7725:"i",297:"i",869:"i",305:"i",7433:"i",7522:"i",8305:"i",496:"j",309:"j",669:"j",585:"j",607:"j",567:"j",7729:"k",489:"k",311:"k",7731:"k",409:"k",7733:"k",670:"k",8342:"k",314:"l",410:"l",620:"l",318:"l",316:"l",7741:"l",564:"l",7735:"l",7739:"l",320:"l",619:"l",621:"l",322:"l",8343:"l",7743:"m",7745:"m",7747:"m",625:"m",624:"m",875:"m",7455:"m",623:"m",8344:"m",324:"n",328:"n",326:"n",7755:"n",565:"n",7749:"n",7751:"n",505:"n",626:"n",7753:"n",414:"n",627:"n",241:"n",8345:"n",243:"o",335:"o",466:"o",244:"o",246:"o",559:"o",7885:"o",337:"o",525:"o",242:"o",7887:"o",417:"o",527:"o",333:"o",491:"o",248:"o",7443:"o",245:"o",870:"o",629:"o",7447:"o",596:"o",7441:"o",7442:"o",7446:"o",7765:"p",7767:"p",421:"p",8346:"p",587:"q",672:"q",341:"r",345:"r",343:"r",7769:"r",7771:"r",529:"r",638:"r",639:"r",635:"r",531:"r",7775:"r",636:"r",634:"r",589:"r",637:"r",876:"r",633:"r",7523:"r",347:"s",353:"s",351:"s",349:"s",537:"s",7777:"s",7835:"s",7779:"s",642:"s",575:"s",383:"s",223:"s",8347:"s",357:"t",355:"t",7793:"t",539:"t",566:"t",7831:"t",7787:"t",7789:"t",429:"t",7791:"t",427:"t",648:"t",359:"t",877:"t",647:"t",8348:"t",649:"u",250:"u",365:"u",468:"u",7799:"u",251:"u",7795:"u",252:"u",7909:"u",369:"u",533:"u",249:"u",7911:"u",432:"u",535:"u",363:"u",371:"u",367:"u",7797:"u",361:"u",871:"u",7453:"u",7454:"u",7524:"u",7807:"v",651:"v",7805:"v",878:"v",652:"v",7525:"v",7811:"w",373:"w",7813:"w",7815:"w",7817:"w",7809:"w",7832:"w",653:"w",7821:"x",7819:"x",879:"x",253:"y",375:"y",255:"y",7823:"y",7925:"y",7923:"y",7927:"y",436:"y",563:"y",7833:"y",591:"y",7929:"y",654:"y",378:"z",382:"z",7825:"z",657:"z",380:"z",7827:"z",549:"z",7829:"z",656:"z",438:"z",576:"z",593:"a",193:"A",194:"A",196:"A",192:"A",197:"A",570:"A",195:"A",7424:"A",385:"B",579:"B",665:"B",7427:"B",199:"C",571:"C",7428:"C",394:"D",393:"D",7429:"D",201:"E",202:"E",203:"E",200:"E",582:"E",400:"E",398:"E",7431:"E",403:"G",667:"G",610:"G",668:"H",205:"I",206:"I",207:"I",304:"I",204:"I",407:"I",618:"I",584:"J",7434:"J",7435:"K",573:"L",7436:"L",671:"L",412:"M",7437:"M",413:"N",544:"N",209:"N",628:"N",7438:"N",211:"O",212:"O",214:"O",210:"O",415:"O",216:"O",213:"O",390:"O",7439:"O",7440:"O",7448:"P",586:"Q",588:"R",640:"R",641:"R",7449:"R",7450:"R",574:"T",430:"T",7451:"T",580:"U",218:"U",219:"U",220:"U",217:"U",7452:"U",434:"V",581:"V",7456:"V",7457:"W",221:"Y",376:"Y",590:"Y",655:"Y",7458:"Z",["Ắ".codePointAt(0)]:"A",["Ấ".codePointAt(0)]:"A",["Ằ".codePointAt(0)]:"A",["Ầ".codePointAt(0)]:"A",["Ẳ".codePointAt(0)]:"A",["Ẩ".codePointAt(0)]:"A",["Ẵ".codePointAt(0)]:"A",["Ẫ".codePointAt(0)]:"A",["Ặ".codePointAt(0)]:"A",["Ậ".codePointAt(0)]:"A",["ắ".codePointAt(0)]:"a",["ấ".codePointAt(0)]:"a",["ằ".codePointAt(0)]:"a",["ầ".codePointAt(0)]:"a",["ẳ".codePointAt(0)]:"a",["ẩ".codePointAt(0)]:"a",["ẵ".codePointAt(0)]:"a",["ẫ".codePointAt(0)]:"a",["ặ".codePointAt(0)]:"a",["ậ".codePointAt(0)]:"a",["Ế".codePointAt(0)]:"E",["Ề".codePointAt(0)]:"E",["Ể".codePointAt(0)]:"E",["Ễ".codePointAt(0)]:"E",["Ệ".codePointAt(0)]:"E",["ế".codePointAt(0)]:"e",["ề".codePointAt(0)]:"e",["ể".codePointAt(0)]:"e",["ễ".codePointAt(0)]:"e",["ệ".codePointAt(0)]:"e",["Ố".codePointAt(0)]:"O",["Ớ".codePointAt(0)]:"O",["Ồ".codePointAt(0)]:"O",["Ờ".codePointAt(0)]:"O",["Ổ".codePointAt(0)]:"O",["Ở".codePointAt(0)]:"O",["Ỗ".codePointAt(0)]:"O",["Ỡ".codePointAt(0)]:"O",["Ộ".codePointAt(0)]:"O",["Ợ".codePointAt(0)]:"O",["ố".codePointAt(0)]:"o",["ớ".codePointAt(0)]:"o",["ồ".codePointAt(0)]:"o",["ờ".codePointAt(0)]:"o",["ổ".codePointAt(0)]:"o",["ở".codePointAt(0)]:"o",["ỗ".codePointAt(0)]:"o",["ỡ".codePointAt(0)]:"o",["ộ".codePointAt(0)]:"o",["ợ".codePointAt(0)]:"o",["Ứ".codePointAt(0)]:"U",["Ừ".codePointAt(0)]:"U",["Ử".codePointAt(0)]:"U",["Ữ".codePointAt(0)]:"U",["Ự".codePointAt(0)]:"U",["ứ".codePointAt(0)]:"u",["ừ".codePointAt(0)]:"u",["ử".codePointAt(0)]:"u",["ữ".codePointAt(0)]:"u",["ự".codePointAt(0)]:"u"};function s(t,e){return t>e?t:e}const a=t=>t.split("").map((t=>t.codePointAt(0))),u=" \f\n\r\t\v \u2028\u2029 \ufeff".split("").map((t=>t.codePointAt(0)));for(let B=" ".codePointAt(0);B<=" ".codePointAt(0);B++)u.push(B);Object.freeze(u);const l="".codePointAt(0),d="A".codePointAt(0),A="Z".codePointAt(0),f="a".codePointAt(0),P="z".codePointAt(0),h="0".codePointAt(0),b="9".codePointAt(0);function y(t,e,o){return o?t:e-t-1}var g,m;function p(t,e){if(t){return new Array}return null}function O(t,e,o){if(null!==e&&e.i16.length>t+o){return[t+o,e.i16.subarray(t,t+o)]}return[t,new Int16Array(o)]}function w(t,e,o){if(null!==e&&e.i32.length>t+o){return[t+o,e.i32.subarray(t,t+o)]}return[t,new Int32Array(o)]}function v(t){return t>=f&&t<=P?1:t>=d&&t<=A?2:t>=h&&t<=b?4:0}function L(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function C(t){return t<=l?v(t):L(t)}function z(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function I(t){if(t<192||t>8580)return t;const e=c[t];return void 0!==e?e.codePointAt(0):t}function k(t,e,o,n){let r=t.slice(n),i=r.indexOf(o);if(0===i)return n;if(!e&&o>=f&&o<=P){i>0&&(r=r.slice(0,i));const t=r.indexOf(o-32);t>=0&&(i=t)}return i<0?-1:n+i}function E(t){for(const e of t)if(e>=128)return!1;return!0}function U(t,e,o){if(!E(t))return 0;if(!E(e))return-1;let n=0,r=0;for(let i=0;i<e.length;i++){if(r=k(t,o,e[i],r),r<0)return-1;0===i&&r>0&&(n=r-1),r++}return n}(m=g||(g={}))[m.NonWord=0]="NonWord",m[m.Lower=1]="Lower",m[m.Upper=2]="Upper",m[m.Letter=3]="Letter",m[m.Number=4]="Number";const j=(t,e,o,n,r,i,c)=>{if(0===r.length)return[{start:0,end:0,score:0},null];if(U(n,r,t)<0)return[{start:-1,end:-1,score:0},null];let a=0,u=-1,f=-1;const P=n.length,h=r.length;for(let s=0;s<P;s++){let i=n[y(s,P,o)];t||(i>=d&&i<=A?i+=32:i>l&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=I(i));if(i===r[y(a,h,o)]&&(u<0&&(u=s),a++,a===h)){f=s+1;break}}if(u>=0&&f>=0){a--;for(let e=f-1;e>=u;e--){let i=n[y(e,P,o)];t||(i>=d&&i<=A?i+=32:i>l&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0)));if(i===r[y(a,h,o)]&&(a--,a<0)){u=e;break}}if(!o){const t=u;u=P-f,f=P-t}const[c,b]=function(t,e,o,n,r,i,c){let a=0,u=0,f=!1,P=0,h=0;const b=p(c,n.length);let y=0;r>0&&(y=C(o[r-1]));for(let g=r;g<i;g++){let r=o[g];const i=C(r);if(t||(r>=d&&r<=A?r+=32:r>l&&(r=String.fromCodePoint(r).toLowerCase().codePointAt(0))),e&&(r=I(r)),r===n[a]){c&&(null==b||b.push(g)),u+=16;let t=z(y,i);0===P?h=t:(8===t&&(h=t),t=s(s(t,h),4)),u+=0===a?2*t:t,f=!1,P++,a++}else u+=f?-1:-3,f=!0,P=0,h=0;y=i}return[u,b]}(t,e,n,r,u,f,i);return[{start:u,end:f,score:c},b]}return[{start:-1,end:-1,score:0},null]};const N=(x=2048,{i16:new Int16Array(102400),i32:new Int32Array(x)});var x;const R={cache:!1,maxResultItems:1/0,selector:t=>t,casing:"smart-case",normalize:!1};class S{constructor(t,...e){this.cache={},this.find=t=>{let e=!1;switch(this.opts.casing){case"smart-case":t.toLowerCase()!==t&&(e=!0);break;case"case-sensitive":e=!0;break;case"case-insensitive":t=t.toLowerCase(),e=!1}if(this.opts.cache){const e=this.cache[t];if(void 0!==e)return e}const o=a(t);let n=this.runesList.map(((t,n)=>{const r=((t,e,o,n,r,i,c)=>{const a=r.length;if(0===a)return[{start:0,end:0,score:0},p(i)];const u=n.length;if(null!==c&&u*a>c.i16.length)return j(t,e,o,n,r,i);const d=U(n,r,t);if(d<0)return[{start:-1,end:-1,score:0},null];let A=0,f=0,P=null,h=null,b=null,y=null;[A,P]=O(A,c,u),[A,h]=O(A,c,u),[A,b]=O(A,c,u),[f,y]=w(f,c,a);const[,g]=w(f,c,u);for(let s=0;s<g.length;s++)g[s]=n[s];let m=0,C=0,k=0,E=0;const N=r[0];let x=r[0],R=0,S=0,B=!1,Y=g.subarray(d),D=P.subarray(d).subarray(0,Y.length),G=h.subarray(d).subarray(0,Y.length),M=b.subarray(d).subarray(0,Y.length);for(let[p,O]of Y.entries()){let n=null;O<=l?(n=v(O),t||2!==n||(O+=32)):(n=L(O),t||2!==n||(O=String.fromCodePoint(O).toLowerCase().codePointAt(0)),e&&(O=I(O))),Y[p]=O;const i=z(S,n);if(M[p]=i,S=n,O===x&&(k<a&&(y[k]=d+p,k++,x=r[Math.min(k,a-1)]),E=d+p),O===N){const t=16+2*i;if(D[p]=t,G[p]=1,1===a&&(o&&t>m||!o&&t>=m)&&(m=t,C=d+p,o&&8===i))break;B=!1}else D[p]=s(B?R+-1:R+-3,0),G[p]=0,B=!0;R=D[p]}if(k!==a)return[{start:-1,end:-1,score:0},null];if(1===a){const t={start:C,end:C+1,score:m};return i?[t,[C]]:[t,null]}const T=y[0],V=E-T+1;let W=null;[A,W]=O(A,c,V*a);{const t=P.subarray(T,E+1);for(const[e,o]of t.entries())W[e]=o}let[,q]=O(A,c,V*a);{const t=h.subarray(T,E+1);for(const[e,o]of t.entries())q[e]=o}const J=y.subarray(1),Z=r.slice(1).slice(0,J.length);for(const[l,p]of J.entries()){let t=!1;const e=Z[l],n=l+1,r=n*V,i=g.subarray(p,E+1),c=b.subarray(p).subarray(0,i.length),u=q.subarray(r+p-T).subarray(0,i.length),d=q.subarray(r+p-T-1-V).subarray(0,i.length),A=W.subarray(r+p-T).subarray(0,i.length),f=W.subarray(r+p-T-1-V).subarray(0,i.length),P=W.subarray(r+p-T-1).subarray(0,i.length);P[0]=0;for(const[l,h]of i.entries()){const r=l+p;let i=0,y=0,g=0;if(y=t?P[l]+-1:P[l]+-3,e===h){i=f[l]+16;let t=c[l];g=d[l]+1,8===t?g=1:g>1&&(t=s(t,s(4,b[r-g+1]))),i+t<y?(i+=c[l],g=0):i+=t}u[l]=g,t=i<y;const O=s(s(i,y),0);n===a-1&&(o&&O>m||!o&&O>=m)&&(m=O,C=r),A[l]=O}}const F=p(i);let H=T;if(i){let t=a-1;H=C;let e=!0;for(;;){const o=t*V,n=H-T,r=W[o+n];let i=0,c=0;if(t>0&&H>=y[t]&&(i=W[o-V+n-1]),H>y[t]&&(c=W[o+n-1]),r>i&&(r>c||r===c&&e)){if(F.push(H),0===t)break;t--}e=q[o+n]>1||o+V+n+1<q.length&&q[o+V+n+1]>0,H--}}return[{start:H,end:C+1,score:m},F]})(e,this.opts.normalize,!1,t,o,!0,N);return{item:this.items[n],result:r[0],positions:r[1]}})).filter((t=>0!==t.result.score));return n.sort(((t,e)=>e.result.score-t.result.score)),Number.isFinite(this.opts.maxResultItems)&&(n=n.slice(0,this.opts.maxResultItems)),this.opts.cache&&(this.cache[t]=n),n},this.opts=i(i({},R),e[0]),this.items=t,this.runesList=t.map((t=>a(this.opts.selector(t))))}}export{S as Fzf}; | ||
var t=Object.defineProperty,e=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(e,o,n)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,i=(t,i)=>{for(var s in i||(i={}))o.call(i,s)&&r(t,s,i[s]);if(e)for(var s of e(i))n.call(i,s)&&r(t,s,i[s]);return t};const s={225:"a",259:"a",462:"a",226:"a",228:"a",551:"a",7841:"a",513:"a",224:"a",7843:"a",515:"a",257:"a",261:"a",7834:"a",229:"a",7681:"a",227:"a",867:"a",592:"a",7683:"b",7685:"b",595:"b",7687:"b",384:"b",387:"b",263:"c",269:"c",231:"c",265:"c",597:"c",267:"c",392:"c",572:"c",872:"c",663:"c",8580:"c",271:"d",7697:"d",7699:"d",545:"d",7691:"d",7693:"d",599:"d",7695:"d",273:"d",598:"d",396:"d",873:"d",233:"e",277:"e",283:"e",553:"e",7705:"e",234:"e",235:"e",279:"e",7865:"e",517:"e",232:"e",7867:"e",605:"e",519:"e",275:"e",281:"e",583:"e",7707:"e",7869:"e",868:"e",666:"e",606:"e",603:"e",600:"e",604:"e",477:"e",7432:"e",7711:"f",402:"f",501:"g",287:"g",487:"g",291:"g",285:"g",289:"g",608:"g",7713:"g",485:"g",609:"g",7723:"h",543:"h",7721:"h",293:"h",7719:"h",7715:"h",7717:"h",686:"h",614:"h",7830:"h",295:"h",874:"h",613:"h",8341:"h",237:"i",301:"i",464:"i",238:"i",239:"i",7883:"i",521:"i",236:"i",7881:"i",523:"i",299:"i",303:"i",616:"i",7725:"i",297:"i",869:"i",305:"i",7433:"i",7522:"i",8305:"i",496:"j",309:"j",669:"j",585:"j",607:"j",567:"j",7729:"k",489:"k",311:"k",7731:"k",409:"k",7733:"k",670:"k",8342:"k",314:"l",410:"l",620:"l",318:"l",316:"l",7741:"l",564:"l",7735:"l",7739:"l",320:"l",619:"l",621:"l",322:"l",8343:"l",7743:"m",7745:"m",7747:"m",625:"m",624:"m",875:"m",7455:"m",623:"m",8344:"m",324:"n",328:"n",326:"n",7755:"n",565:"n",7749:"n",7751:"n",505:"n",626:"n",7753:"n",414:"n",627:"n",241:"n",8345:"n",243:"o",335:"o",466:"o",244:"o",246:"o",559:"o",7885:"o",337:"o",525:"o",242:"o",7887:"o",417:"o",527:"o",333:"o",491:"o",248:"o",7443:"o",245:"o",870:"o",629:"o",7447:"o",596:"o",7441:"o",7442:"o",7446:"o",7765:"p",7767:"p",421:"p",8346:"p",587:"q",672:"q",341:"r",345:"r",343:"r",7769:"r",7771:"r",529:"r",638:"r",639:"r",635:"r",531:"r",7775:"r",636:"r",634:"r",589:"r",637:"r",876:"r",633:"r",7523:"r",347:"s",353:"s",351:"s",349:"s",537:"s",7777:"s",7835:"s",7779:"s",642:"s",575:"s",383:"s",223:"s",8347:"s",357:"t",355:"t",7793:"t",539:"t",566:"t",7831:"t",7787:"t",7789:"t",429:"t",7791:"t",427:"t",648:"t",359:"t",877:"t",647:"t",8348:"t",649:"u",250:"u",365:"u",468:"u",7799:"u",251:"u",7795:"u",252:"u",7909:"u",369:"u",533:"u",249:"u",7911:"u",432:"u",535:"u",363:"u",371:"u",367:"u",7797:"u",361:"u",871:"u",7453:"u",7454:"u",7524:"u",7807:"v",651:"v",7805:"v",878:"v",652:"v",7525:"v",7811:"w",373:"w",7813:"w",7815:"w",7817:"w",7809:"w",7832:"w",653:"w",7821:"x",7819:"x",879:"x",253:"y",375:"y",255:"y",7823:"y",7925:"y",7923:"y",7927:"y",436:"y",563:"y",7833:"y",591:"y",7929:"y",654:"y",378:"z",382:"z",7825:"z",657:"z",380:"z",7827:"z",549:"z",7829:"z",656:"z",438:"z",576:"z",593:"a",193:"A",194:"A",196:"A",192:"A",197:"A",570:"A",195:"A",7424:"A",385:"B",579:"B",665:"B",7427:"B",199:"C",571:"C",7428:"C",394:"D",393:"D",7429:"D",201:"E",202:"E",203:"E",200:"E",582:"E",400:"E",398:"E",7431:"E",403:"G",667:"G",610:"G",668:"H",205:"I",206:"I",207:"I",304:"I",204:"I",407:"I",618:"I",584:"J",7434:"J",7435:"K",573:"L",7436:"L",671:"L",412:"M",7437:"M",413:"N",544:"N",209:"N",628:"N",7438:"N",211:"O",212:"O",214:"O",210:"O",415:"O",216:"O",213:"O",390:"O",7439:"O",7440:"O",7448:"P",586:"Q",588:"R",640:"R",641:"R",7449:"R",7450:"R",574:"T",430:"T",7451:"T",580:"U",218:"U",219:"U",220:"U",217:"U",7452:"U",434:"V",581:"V",7456:"V",7457:"W",221:"Y",376:"Y",590:"Y",655:"Y",7458:"Z",["Ắ".codePointAt(0)]:"A",["Ấ".codePointAt(0)]:"A",["Ằ".codePointAt(0)]:"A",["Ầ".codePointAt(0)]:"A",["Ẳ".codePointAt(0)]:"A",["Ẩ".codePointAt(0)]:"A",["Ẵ".codePointAt(0)]:"A",["Ẫ".codePointAt(0)]:"A",["Ặ".codePointAt(0)]:"A",["Ậ".codePointAt(0)]:"A",["ắ".codePointAt(0)]:"a",["ấ".codePointAt(0)]:"a",["ằ".codePointAt(0)]:"a",["ầ".codePointAt(0)]:"a",["ẳ".codePointAt(0)]:"a",["ẩ".codePointAt(0)]:"a",["ẵ".codePointAt(0)]:"a",["ẫ".codePointAt(0)]:"a",["ặ".codePointAt(0)]:"a",["ậ".codePointAt(0)]:"a",["Ế".codePointAt(0)]:"E",["Ề".codePointAt(0)]:"E",["Ể".codePointAt(0)]:"E",["Ễ".codePointAt(0)]:"E",["Ệ".codePointAt(0)]:"E",["ế".codePointAt(0)]:"e",["ề".codePointAt(0)]:"e",["ể".codePointAt(0)]:"e",["ễ".codePointAt(0)]:"e",["ệ".codePointAt(0)]:"e",["Ố".codePointAt(0)]:"O",["Ớ".codePointAt(0)]:"O",["Ồ".codePointAt(0)]:"O",["Ờ".codePointAt(0)]:"O",["Ổ".codePointAt(0)]:"O",["Ở".codePointAt(0)]:"O",["Ỗ".codePointAt(0)]:"O",["Ỡ".codePointAt(0)]:"O",["Ộ".codePointAt(0)]:"O",["Ợ".codePointAt(0)]:"O",["ố".codePointAt(0)]:"o",["ớ".codePointAt(0)]:"o",["ồ".codePointAt(0)]:"o",["ờ".codePointAt(0)]:"o",["ổ".codePointAt(0)]:"o",["ở".codePointAt(0)]:"o",["ỗ".codePointAt(0)]:"o",["ỡ".codePointAt(0)]:"o",["ộ".codePointAt(0)]:"o",["ợ".codePointAt(0)]:"o",["Ứ".codePointAt(0)]:"U",["Ừ".codePointAt(0)]:"U",["Ử".codePointAt(0)]:"U",["Ữ".codePointAt(0)]:"U",["Ự".codePointAt(0)]:"U",["ứ".codePointAt(0)]:"u",["ừ".codePointAt(0)]:"u",["ử".codePointAt(0)]:"u",["ữ".codePointAt(0)]:"u",["ự".codePointAt(0)]:"u"};function c(t,e){return t>e?t:e}const a=t=>t.split("").map((t=>t.codePointAt(0))),u=" \f\n\r\t\v \u2028\u2029 \ufeff".split("").map((t=>t.codePointAt(0)));for(let B=" ".codePointAt(0);B<=" ".codePointAt(0);B++)u.push(B);Object.freeze(u);const l="".codePointAt(0),d="A".codePointAt(0),A="Z".codePointAt(0),f="a".codePointAt(0),P="z".codePointAt(0),h="0".codePointAt(0),b="9".codePointAt(0);function y(t,e,o){return o?t:e-t-1}var g,m;function p(t,e){if(t){return new Array}return null}function O(t,e,o){if(null!==e&&e.i16.length>t+o){return[t+o,e.i16.subarray(t,t+o)]}return[t,new Int16Array(o)]}function w(t,e,o){if(null!==e&&e.i32.length>t+o){return[t+o,e.i32.subarray(t,t+o)]}return[t,new Int32Array(o)]}function v(t){return t>=f&&t<=P?1:t>=d&&t<=A?2:t>=h&&t<=b?4:0}function L(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function C(t){return t<=l?v(t):L(t)}function z(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function I(t){if(t<192||t>8580)return t;const e=s[t];return void 0!==e?e.codePointAt(0):t}function k(t,e,o,n){let r=t.slice(n),i=r.indexOf(o);if(0===i)return n;if(!e&&o>=f&&o<=P){i>0&&(r=r.slice(0,i));const t=r.indexOf(o-32);t>=0&&(i=t)}return i<0?-1:n+i}function E(t){for(const e of t)if(e>=128)return!1;return!0}function U(t,e,o){if(!E(t))return 0;if(!E(e))return-1;let n=0,r=0;for(let i=0;i<e.length;i++){if(r=k(t,o,e[i],r),r<0)return-1;0===i&&r>0&&(n=r-1),r++}return n}(m=g||(g={}))[m.NonWord=0]="NonWord",m[m.Lower=1]="Lower",m[m.Upper=2]="Upper",m[m.Letter=3]="Letter",m[m.Number=4]="Number";const j=(t,e,o,n,r,i,s)=>{if(0===r.length)return[{start:0,end:0,score:0},null];if(U(n,r,t)<0)return[{start:-1,end:-1,score:0},null];let a=0,u=-1,f=-1;const P=n.length,h=r.length;for(let c=0;c<P;c++){let i=n[y(c,P,o)];t||(i>=d&&i<=A?i+=32:i>l&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0))),e&&(i=I(i));if(i===r[y(a,h,o)]&&(u<0&&(u=c),a++,a===h)){f=c+1;break}}if(u>=0&&f>=0){a--;for(let e=f-1;e>=u;e--){let i=n[y(e,P,o)];t||(i>=d&&i<=A?i+=32:i>l&&(i=String.fromCodePoint(i).toLowerCase().codePointAt(0)));if(i===r[y(a,h,o)]&&(a--,a<0)){u=e;break}}if(!o){const t=u;u=P-f,f=P-t}const[s,b]=function(t,e,o,n,r,i,s){let a=0,u=0,f=!1,P=0,h=0;const b=p(s,n.length);let y=0;r>0&&(y=C(o[r-1]));for(let g=r;g<i;g++){let r=o[g];const i=C(r);if(t||(r>=d&&r<=A?r+=32:r>l&&(r=String.fromCodePoint(r).toLowerCase().codePointAt(0))),e&&(r=I(r)),r===n[a]){s&&(null==b||b.push(g)),u+=16;let t=z(y,i);0===P?h=t:(8===t&&(h=t),t=c(c(t,h),4)),u+=0===a?2*t:t,f=!1,P++,a++}else u+=f?-1:-3,f=!0,P=0,h=0;y=i}return[u,b]}(t,e,n,r,u,f,i);return[{start:u,end:f,score:s},b]}return[{start:-1,end:-1,score:0},null]};const N=(x=2048,{i16:new Int16Array(102400),i32:new Int32Array(x)});var x;const R={cache:!1,maxResultItems:1/0,selector:t=>t,casing:"smart-case",normalize:!1,sort:!0};class S{constructor(t,...e){this.cache={},this.find=t=>{let e=!1;switch(this.opts.casing){case"smart-case":t.toLowerCase()!==t&&(e=!0);break;case"case-sensitive":e=!0;break;case"case-insensitive":t=t.toLowerCase(),e=!1}if(this.opts.cache){const e=this.cache[t];if(void 0!==e)return e}const o=a(t);let n=this.runesList.map(((t,n)=>{const r=((t,e,o,n,r,i,s)=>{const a=r.length;if(0===a)return[{start:0,end:0,score:0},p(i)];const u=n.length;if(null!==s&&u*a>s.i16.length)return j(t,e,o,n,r,i);const d=U(n,r,t);if(d<0)return[{start:-1,end:-1,score:0},null];let A=0,f=0,P=null,h=null,b=null,y=null;[A,P]=O(A,s,u),[A,h]=O(A,s,u),[A,b]=O(A,s,u),[f,y]=w(f,s,a);const[,g]=w(f,s,u);for(let c=0;c<g.length;c++)g[c]=n[c];let m=0,C=0,k=0,E=0;const N=r[0];let x=r[0],R=0,S=0,B=!1,Y=g.subarray(d),D=P.subarray(d).subarray(0,Y.length),G=h.subarray(d).subarray(0,Y.length),M=b.subarray(d).subarray(0,Y.length);for(let[p,O]of Y.entries()){let n=null;O<=l?(n=v(O),t||2!==n||(O+=32)):(n=L(O),t||2!==n||(O=String.fromCodePoint(O).toLowerCase().codePointAt(0)),e&&(O=I(O))),Y[p]=O;const i=z(S,n);if(M[p]=i,S=n,O===x&&(k<a&&(y[k]=d+p,k++,x=r[Math.min(k,a-1)]),E=d+p),O===N){const t=16+2*i;if(D[p]=t,G[p]=1,1===a&&(o&&t>m||!o&&t>=m)&&(m=t,C=d+p,o&&8===i))break;B=!1}else D[p]=c(B?R+-1:R+-3,0),G[p]=0,B=!0;R=D[p]}if(k!==a)return[{start:-1,end:-1,score:0},null];if(1===a){const t={start:C,end:C+1,score:m};return i?[t,[C]]:[t,null]}const T=y[0],V=E-T+1;let W=null;[A,W]=O(A,s,V*a);{const t=P.subarray(T,E+1);for(const[e,o]of t.entries())W[e]=o}let[,q]=O(A,s,V*a);{const t=h.subarray(T,E+1);for(const[e,o]of t.entries())q[e]=o}const J=y.subarray(1),Z=r.slice(1).slice(0,J.length);for(const[l,p]of J.entries()){let t=!1;const e=Z[l],n=l+1,r=n*V,i=g.subarray(p,E+1),s=b.subarray(p).subarray(0,i.length),u=q.subarray(r+p-T).subarray(0,i.length),d=q.subarray(r+p-T-1-V).subarray(0,i.length),A=W.subarray(r+p-T).subarray(0,i.length),f=W.subarray(r+p-T-1-V).subarray(0,i.length),P=W.subarray(r+p-T-1).subarray(0,i.length);P[0]=0;for(const[l,h]of i.entries()){const r=l+p;let i=0,y=0,g=0;if(y=t?P[l]+-1:P[l]+-3,e===h){i=f[l]+16;let t=s[l];g=d[l]+1,8===t?g=1:g>1&&(t=c(t,c(4,b[r-g+1]))),i+t<y?(i+=s[l],g=0):i+=t}u[l]=g,t=i<y;const O=c(c(i,y),0);n===a-1&&(o&&O>m||!o&&O>=m)&&(m=O,C=r),A[l]=O}}const F=p(i);let H=T;if(i){let t=a-1;H=C;let e=!0;for(;;){const o=t*V,n=H-T,r=W[o+n];let i=0,s=0;if(t>0&&H>=y[t]&&(i=W[o-V+n-1]),H>y[t]&&(s=W[o+n-1]),r>i&&(r>s||r===s&&e)){if(F.push(H),0===t)break;t--}e=q[o+n]>1||o+V+n+1<q.length&&q[o+V+n+1]>0,H--}}return[{start:H,end:C+1,score:m},F]})(e,this.opts.normalize,!1,t,o,!0,N);return{item:this.items[n],result:r[0],positions:r[1]}})).filter((t=>0!==t.result.score));if(this.opts.sort){const t=(t,e)=>e.result.score-t.result.score;n.sort(t)}return Number.isFinite(this.opts.maxResultItems)&&(n=n.slice(0,this.opts.maxResultItems)),this.opts.cache&&(this.cache[t]=n),n},this.opts=i(i({},R),e[0]),this.items=t,this.runesList=t.map((t=>a(this.opts.selector(t))))}}export{S as Fzf}; |
@@ -1,1 +0,1 @@ | ||
var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t};!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).fzf={})}(this,(function(t){"use strict";const e={225:"a",259:"a",462:"a",226:"a",228:"a",551:"a",7841:"a",513:"a",224:"a",7843:"a",515:"a",257:"a",261:"a",7834:"a",229:"a",7681:"a",227:"a",867:"a",592:"a",7683:"b",7685:"b",595:"b",7687:"b",384:"b",387:"b",263:"c",269:"c",231:"c",265:"c",597:"c",267:"c",392:"c",572:"c",872:"c",663:"c",8580:"c",271:"d",7697:"d",7699:"d",545:"d",7691:"d",7693:"d",599:"d",7695:"d",273:"d",598:"d",396:"d",873:"d",233:"e",277:"e",283:"e",553:"e",7705:"e",234:"e",235:"e",279:"e",7865:"e",517:"e",232:"e",7867:"e",605:"e",519:"e",275:"e",281:"e",583:"e",7707:"e",7869:"e",868:"e",666:"e",606:"e",603:"e",600:"e",604:"e",477:"e",7432:"e",7711:"f",402:"f",501:"g",287:"g",487:"g",291:"g",285:"g",289:"g",608:"g",7713:"g",485:"g",609:"g",7723:"h",543:"h",7721:"h",293:"h",7719:"h",7715:"h",7717:"h",686:"h",614:"h",7830:"h",295:"h",874:"h",613:"h",8341:"h",237:"i",301:"i",464:"i",238:"i",239:"i",7883:"i",521:"i",236:"i",7881:"i",523:"i",299:"i",303:"i",616:"i",7725:"i",297:"i",869:"i",305:"i",7433:"i",7522:"i",8305:"i",496:"j",309:"j",669:"j",585:"j",607:"j",567:"j",7729:"k",489:"k",311:"k",7731:"k",409:"k",7733:"k",670:"k",8342:"k",314:"l",410:"l",620:"l",318:"l",316:"l",7741:"l",564:"l",7735:"l",7739:"l",320:"l",619:"l",621:"l",322:"l",8343:"l",7743:"m",7745:"m",7747:"m",625:"m",624:"m",875:"m",7455:"m",623:"m",8344:"m",324:"n",328:"n",326:"n",7755:"n",565:"n",7749:"n",7751:"n",505:"n",626:"n",7753:"n",414:"n",627:"n",241:"n",8345:"n",243:"o",335:"o",466:"o",244:"o",246:"o",559:"o",7885:"o",337:"o",525:"o",242:"o",7887:"o",417:"o",527:"o",333:"o",491:"o",248:"o",7443:"o",245:"o",870:"o",629:"o",7447:"o",596:"o",7441:"o",7442:"o",7446:"o",7765:"p",7767:"p",421:"p",8346:"p",587:"q",672:"q",341:"r",345:"r",343:"r",7769:"r",7771:"r",529:"r",638:"r",639:"r",635:"r",531:"r",7775:"r",636:"r",634:"r",589:"r",637:"r",876:"r",633:"r",7523:"r",347:"s",353:"s",351:"s",349:"s",537:"s",7777:"s",7835:"s",7779:"s",642:"s",575:"s",383:"s",223:"s",8347:"s",357:"t",355:"t",7793:"t",539:"t",566:"t",7831:"t",7787:"t",7789:"t",429:"t",7791:"t",427:"t",648:"t",359:"t",877:"t",647:"t",8348:"t",649:"u",250:"u",365:"u",468:"u",7799:"u",251:"u",7795:"u",252:"u",7909:"u",369:"u",533:"u",249:"u",7911:"u",432:"u",535:"u",363:"u",371:"u",367:"u",7797:"u",361:"u",871:"u",7453:"u",7454:"u",7524:"u",7807:"v",651:"v",7805:"v",878:"v",652:"v",7525:"v",7811:"w",373:"w",7813:"w",7815:"w",7817:"w",7809:"w",7832:"w",653:"w",7821:"x",7819:"x",879:"x",253:"y",375:"y",255:"y",7823:"y",7925:"y",7923:"y",7927:"y",436:"y",563:"y",7833:"y",591:"y",7929:"y",654:"y",378:"z",382:"z",7825:"z",657:"z",380:"z",7827:"z",549:"z",7829:"z",656:"z",438:"z",576:"z",593:"a",193:"A",194:"A",196:"A",192:"A",197:"A",570:"A",195:"A",7424:"A",385:"B",579:"B",665:"B",7427:"B",199:"C",571:"C",7428:"C",394:"D",393:"D",7429:"D",201:"E",202:"E",203:"E",200:"E",582:"E",400:"E",398:"E",7431:"E",403:"G",667:"G",610:"G",668:"H",205:"I",206:"I",207:"I",304:"I",204:"I",407:"I",618:"I",584:"J",7434:"J",7435:"K",573:"L",7436:"L",671:"L",412:"M",7437:"M",413:"N",544:"N",209:"N",628:"N",7438:"N",211:"O",212:"O",214:"O",210:"O",415:"O",216:"O",213:"O",390:"O",7439:"O",7440:"O",7448:"P",586:"Q",588:"R",640:"R",641:"R",7449:"R",7450:"R",574:"T",430:"T",7451:"T",580:"U",218:"U",219:"U",220:"U",217:"U",7452:"U",434:"V",581:"V",7456:"V",7457:"W",221:"Y",376:"Y",590:"Y",655:"Y",7458:"Z",["Ắ".codePointAt(0)]:"A",["Ấ".codePointAt(0)]:"A",["Ằ".codePointAt(0)]:"A",["Ầ".codePointAt(0)]:"A",["Ẳ".codePointAt(0)]:"A",["Ẩ".codePointAt(0)]:"A",["Ẵ".codePointAt(0)]:"A",["Ẫ".codePointAt(0)]:"A",["Ặ".codePointAt(0)]:"A",["Ậ".codePointAt(0)]:"A",["ắ".codePointAt(0)]:"a",["ấ".codePointAt(0)]:"a",["ằ".codePointAt(0)]:"a",["ầ".codePointAt(0)]:"a",["ẳ".codePointAt(0)]:"a",["ẩ".codePointAt(0)]:"a",["ẵ".codePointAt(0)]:"a",["ẫ".codePointAt(0)]:"a",["ặ".codePointAt(0)]:"a",["ậ".codePointAt(0)]:"a",["Ế".codePointAt(0)]:"E",["Ề".codePointAt(0)]:"E",["Ể".codePointAt(0)]:"E",["Ễ".codePointAt(0)]:"E",["Ệ".codePointAt(0)]:"E",["ế".codePointAt(0)]:"e",["ề".codePointAt(0)]:"e",["ể".codePointAt(0)]:"e",["ễ".codePointAt(0)]:"e",["ệ".codePointAt(0)]:"e",["Ố".codePointAt(0)]:"O",["Ớ".codePointAt(0)]:"O",["Ồ".codePointAt(0)]:"O",["Ờ".codePointAt(0)]:"O",["Ổ".codePointAt(0)]:"O",["Ở".codePointAt(0)]:"O",["Ỗ".codePointAt(0)]:"O",["Ỡ".codePointAt(0)]:"O",["Ộ".codePointAt(0)]:"O",["Ợ".codePointAt(0)]:"O",["ố".codePointAt(0)]:"o",["ớ".codePointAt(0)]:"o",["ồ".codePointAt(0)]:"o",["ờ".codePointAt(0)]:"o",["ổ".codePointAt(0)]:"o",["ở".codePointAt(0)]:"o",["ỗ".codePointAt(0)]:"o",["ỡ".codePointAt(0)]:"o",["ộ".codePointAt(0)]:"o",["ợ".codePointAt(0)]:"o",["Ứ".codePointAt(0)]:"U",["Ừ".codePointAt(0)]:"U",["Ử".codePointAt(0)]:"U",["Ữ".codePointAt(0)]:"U",["Ự".codePointAt(0)]:"U",["ứ".codePointAt(0)]:"u",["ừ".codePointAt(0)]:"u",["ử".codePointAt(0)]:"u",["ữ".codePointAt(0)]:"u",["ự".codePointAt(0)]:"u"};function o(t,e){return t>e?t:e}const n=t=>t.split("").map((t=>t.codePointAt(0))),r=" \f\n\r\t\v \u2028\u2029 \ufeff".split("").map((t=>t.codePointAt(0)));for(let k=" ".codePointAt(0);k<=" ".codePointAt(0);k++)r.push(k);Object.freeze(r);const i="".codePointAt(0),s="A".codePointAt(0),c="Z".codePointAt(0),a="a".codePointAt(0),u="z".codePointAt(0),l="0".codePointAt(0),d="9".codePointAt(0);function f(t,e,o){return o?t:e-t-1}var A,P;function h(t,e){if(t){return new Array}return null}function p(t,e,o){if(null!==e&&e.i16.length>t+o){return[t+o,e.i16.subarray(t,t+o)]}return[t,new Int16Array(o)]}function b(t,e,o){if(null!==e&&e.i32.length>t+o){return[t+o,e.i32.subarray(t,t+o)]}return[t,new Int32Array(o)]}function y(t){return t>=a&&t<=u?1:t>=s&&t<=c?2:t>=l&&t<=d?4:0}function m(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function g(t){return t<=i?y(t):m(t)}function O(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function _(t){if(t<192||t>8580)return t;const o=e[t];return void 0!==o?o.codePointAt(0):t}function w(t,e,o,n){let r=t.slice(n),i=r.indexOf(o);if(0===i)return n;if(!e&&o>=a&&o<=u){i>0&&(r=r.slice(0,i));const t=r.indexOf(o-32);t>=0&&(i=t)}return i<0?-1:n+i}function v(t){for(const e of t)if(e>=128)return!1;return!0}function z(t,e,o){if(!v(t))return 0;if(!v(e))return-1;let n=0,r=0;for(let i=0;i<e.length;i++){if(r=w(t,o,e[i],r),r<0)return-1;0===i&&r>0&&(n=r-1),r++}return n}(P=A||(A={}))[P.NonWord=0]="NonWord",P[P.Lower=1]="Lower",P[P.Upper=2]="Upper",P[P.Letter=3]="Letter",P[P.Number=4]="Number";const I=(t,e,n,r,a,u,l)=>{if(0===a.length)return[{start:0,end:0,score:0},null];if(z(r,a,t)<0)return[{start:-1,end:-1,score:0},null];let d=0,A=-1,P=-1;const p=r.length,b=a.length;for(let o=0;o<p;o++){let u=r[f(o,p,n)];t||(u>=s&&u<=c?u+=32:u>i&&(u=String.fromCodePoint(u).toLowerCase().codePointAt(0))),e&&(u=_(u));if(u===a[f(d,b,n)]&&(A<0&&(A=o),d++,d===b)){P=o+1;break}}if(A>=0&&P>=0){d--;for(let e=P-1;e>=A;e--){let o=r[f(e,p,n)];t||(o>=s&&o<=c?o+=32:o>i&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0)));if(o===a[f(d,b,n)]&&(d--,d<0)){A=e;break}}if(!n){const t=A;A=p-P,P=p-t}const[l,y]=function(t,e,n,r,a,u,l){let d=0,f=0,A=!1,P=0,p=0;const b=h(l,r.length);let y=0;a>0&&(y=g(n[a-1]));for(let h=a;h<u;h++){let a=n[h];const u=g(a);if(t||(a>=s&&a<=c?a+=32:a>i&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0))),e&&(a=_(a)),a===r[d]){l&&(null==b||b.push(h)),f+=16;let t=O(y,u);0===P?p=t:(8===t&&(p=t),t=o(o(t,p),4)),f+=0===d?2*t:t,A=!1,P++,d++}else f+=A?-1:-3,A=!0,P=0,p=0;y=u}return[f,b]}(t,e,r,a,A,P,u);return[{start:A,end:P,score:l},y]}return[{start:-1,end:-1,score:0},null]};const L=(C=2048,{i16:new Int16Array(102400),i32:new Int32Array(C)});var C;const E={cache:!1,maxResultItems:1/0,selector:t=>t,casing:"smart-case",normalize:!1};t.Fzf=class{constructor(t,...e){this.cache={},this.find=t=>{let e=!1;switch(this.opts.casing){case"smart-case":t.toLowerCase()!==t&&(e=!0);break;case"case-sensitive":e=!0;break;case"case-insensitive":t=t.toLowerCase(),e=!1}if(this.opts.cache){const e=this.cache[t];if(void 0!==e)return e}const r=n(t);let s=this.runesList.map(((t,n)=>{const s=((t,e,n,r,s,c,a)=>{const u=s.length;if(0===u)return[{start:0,end:0,score:0},h(c)];const l=r.length;if(null!==a&&l*u>a.i16.length)return I(t,e,n,r,s,c);const d=z(r,s,t);if(d<0)return[{start:-1,end:-1,score:0},null];let f=0,A=0,P=null,g=null,w=null,v=null;[f,P]=p(f,a,l),[f,g]=p(f,a,l),[f,w]=p(f,a,l),[A,v]=b(A,a,u);const[,L]=b(A,a,l);for(let o=0;o<L.length;o++)L[o]=r[o];let C=0,E=0,k=0,N=0;const U=s[0];let j=s[0],x=0,S=0,R=!1,T=L.subarray(d),V=P.subarray(d).subarray(0,T.length),M=g.subarray(d).subarray(0,T.length),B=w.subarray(d).subarray(0,T.length);for(let[h,p]of T.entries()){let r=null;p<=i?(r=y(p),t||2!==r||(p+=32)):(r=m(p),t||2!==r||(p=String.fromCodePoint(p).toLowerCase().codePointAt(0)),e&&(p=_(p))),T[h]=p;const c=O(S,r);if(B[h]=c,S=r,p===j&&(k<u&&(v[k]=d+h,k++,j=s[Math.min(k,u-1)]),N=d+h),p===U){const t=16+2*c;if(V[h]=t,M[h]=1,1===u&&(n&&t>C||!n&&t>=C)&&(C=t,E=d+h,n&&8===c))break;R=!1}else V[h]=o(R?x+-1:x+-3,0),M[h]=0,R=!0;x=V[h]}if(k!==u)return[{start:-1,end:-1,score:0},null];if(1===u){const t={start:E,end:E+1,score:C};return c?[t,[E]]:[t,null]}const Y=v[0],D=N-Y+1;let G=null;[f,G]=p(f,a,D*u);{const t=P.subarray(Y,N+1);for(const[e,o]of t.entries())G[e]=o}let[,W]=p(f,a,D*u);{const t=g.subarray(Y,N+1);for(const[e,o]of t.entries())W[e]=o}const q=v.subarray(1),F=s.slice(1).slice(0,q.length);for(const[i,h]of q.entries()){let t=!1;const e=F[i],r=i+1,s=r*D,c=L.subarray(h,N+1),a=w.subarray(h).subarray(0,c.length),l=W.subarray(s+h-Y).subarray(0,c.length),d=W.subarray(s+h-Y-1-D).subarray(0,c.length),f=G.subarray(s+h-Y).subarray(0,c.length),A=G.subarray(s+h-Y-1-D).subarray(0,c.length),P=G.subarray(s+h-Y-1).subarray(0,c.length);P[0]=0;for(const[i,p]of c.entries()){const s=i+h;let c=0,b=0,y=0;if(b=t?P[i]+-1:P[i]+-3,e===p){c=A[i]+16;let t=a[i];y=d[i]+1,8===t?y=1:y>1&&(t=o(t,o(4,w[s-y+1]))),c+t<b?(c+=a[i],y=0):c+=t}l[i]=y,t=c<b;const m=o(o(c,b),0);r===u-1&&(n&&m>C||!n&&m>=C)&&(C=m,E=s),f[i]=m}}const J=h(c);let Z=Y;if(c){let t=u-1;Z=E;let e=!0;for(;;){const o=t*D,n=Z-Y,r=G[o+n];let i=0,s=0;if(t>0&&Z>=v[t]&&(i=G[o-D+n-1]),Z>v[t]&&(s=G[o+n-1]),r>i&&(r>s||r===s&&e)){if(J.push(Z),0===t)break;t--}e=W[o+n]>1||o+D+n+1<W.length&&W[o+D+n+1]>0,Z--}}return[{start:Z,end:E+1,score:C},J]})(e,this.opts.normalize,!1,t,r,!0,L);return{item:this.items[n],result:s[0],positions:s[1]}})).filter((t=>0!==t.result.score));return s.sort(((t,e)=>e.result.score-t.result.score)),Number.isFinite(this.opts.maxResultItems)&&(s=s.slice(0,this.opts.maxResultItems)),this.opts.cache&&(this.cache[t]=s),s},this.opts=__spreadValues(__spreadValues({},E),e[0]),this.items=t,this.runesList=t.map((t=>n(this.opts.selector(t))))}},Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"})); | ||
var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,o)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,__spreadValues=(t,e)=>{for(var o in e||(e={}))__hasOwnProp.call(e,o)&&__defNormalProp(t,o,e[o]);if(__getOwnPropSymbols)for(var o of __getOwnPropSymbols(e))__propIsEnum.call(e,o)&&__defNormalProp(t,o,e[o]);return t};!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).fzf={})}(this,(function(t){"use strict";const e={225:"a",259:"a",462:"a",226:"a",228:"a",551:"a",7841:"a",513:"a",224:"a",7843:"a",515:"a",257:"a",261:"a",7834:"a",229:"a",7681:"a",227:"a",867:"a",592:"a",7683:"b",7685:"b",595:"b",7687:"b",384:"b",387:"b",263:"c",269:"c",231:"c",265:"c",597:"c",267:"c",392:"c",572:"c",872:"c",663:"c",8580:"c",271:"d",7697:"d",7699:"d",545:"d",7691:"d",7693:"d",599:"d",7695:"d",273:"d",598:"d",396:"d",873:"d",233:"e",277:"e",283:"e",553:"e",7705:"e",234:"e",235:"e",279:"e",7865:"e",517:"e",232:"e",7867:"e",605:"e",519:"e",275:"e",281:"e",583:"e",7707:"e",7869:"e",868:"e",666:"e",606:"e",603:"e",600:"e",604:"e",477:"e",7432:"e",7711:"f",402:"f",501:"g",287:"g",487:"g",291:"g",285:"g",289:"g",608:"g",7713:"g",485:"g",609:"g",7723:"h",543:"h",7721:"h",293:"h",7719:"h",7715:"h",7717:"h",686:"h",614:"h",7830:"h",295:"h",874:"h",613:"h",8341:"h",237:"i",301:"i",464:"i",238:"i",239:"i",7883:"i",521:"i",236:"i",7881:"i",523:"i",299:"i",303:"i",616:"i",7725:"i",297:"i",869:"i",305:"i",7433:"i",7522:"i",8305:"i",496:"j",309:"j",669:"j",585:"j",607:"j",567:"j",7729:"k",489:"k",311:"k",7731:"k",409:"k",7733:"k",670:"k",8342:"k",314:"l",410:"l",620:"l",318:"l",316:"l",7741:"l",564:"l",7735:"l",7739:"l",320:"l",619:"l",621:"l",322:"l",8343:"l",7743:"m",7745:"m",7747:"m",625:"m",624:"m",875:"m",7455:"m",623:"m",8344:"m",324:"n",328:"n",326:"n",7755:"n",565:"n",7749:"n",7751:"n",505:"n",626:"n",7753:"n",414:"n",627:"n",241:"n",8345:"n",243:"o",335:"o",466:"o",244:"o",246:"o",559:"o",7885:"o",337:"o",525:"o",242:"o",7887:"o",417:"o",527:"o",333:"o",491:"o",248:"o",7443:"o",245:"o",870:"o",629:"o",7447:"o",596:"o",7441:"o",7442:"o",7446:"o",7765:"p",7767:"p",421:"p",8346:"p",587:"q",672:"q",341:"r",345:"r",343:"r",7769:"r",7771:"r",529:"r",638:"r",639:"r",635:"r",531:"r",7775:"r",636:"r",634:"r",589:"r",637:"r",876:"r",633:"r",7523:"r",347:"s",353:"s",351:"s",349:"s",537:"s",7777:"s",7835:"s",7779:"s",642:"s",575:"s",383:"s",223:"s",8347:"s",357:"t",355:"t",7793:"t",539:"t",566:"t",7831:"t",7787:"t",7789:"t",429:"t",7791:"t",427:"t",648:"t",359:"t",877:"t",647:"t",8348:"t",649:"u",250:"u",365:"u",468:"u",7799:"u",251:"u",7795:"u",252:"u",7909:"u",369:"u",533:"u",249:"u",7911:"u",432:"u",535:"u",363:"u",371:"u",367:"u",7797:"u",361:"u",871:"u",7453:"u",7454:"u",7524:"u",7807:"v",651:"v",7805:"v",878:"v",652:"v",7525:"v",7811:"w",373:"w",7813:"w",7815:"w",7817:"w",7809:"w",7832:"w",653:"w",7821:"x",7819:"x",879:"x",253:"y",375:"y",255:"y",7823:"y",7925:"y",7923:"y",7927:"y",436:"y",563:"y",7833:"y",591:"y",7929:"y",654:"y",378:"z",382:"z",7825:"z",657:"z",380:"z",7827:"z",549:"z",7829:"z",656:"z",438:"z",576:"z",593:"a",193:"A",194:"A",196:"A",192:"A",197:"A",570:"A",195:"A",7424:"A",385:"B",579:"B",665:"B",7427:"B",199:"C",571:"C",7428:"C",394:"D",393:"D",7429:"D",201:"E",202:"E",203:"E",200:"E",582:"E",400:"E",398:"E",7431:"E",403:"G",667:"G",610:"G",668:"H",205:"I",206:"I",207:"I",304:"I",204:"I",407:"I",618:"I",584:"J",7434:"J",7435:"K",573:"L",7436:"L",671:"L",412:"M",7437:"M",413:"N",544:"N",209:"N",628:"N",7438:"N",211:"O",212:"O",214:"O",210:"O",415:"O",216:"O",213:"O",390:"O",7439:"O",7440:"O",7448:"P",586:"Q",588:"R",640:"R",641:"R",7449:"R",7450:"R",574:"T",430:"T",7451:"T",580:"U",218:"U",219:"U",220:"U",217:"U",7452:"U",434:"V",581:"V",7456:"V",7457:"W",221:"Y",376:"Y",590:"Y",655:"Y",7458:"Z",["Ắ".codePointAt(0)]:"A",["Ấ".codePointAt(0)]:"A",["Ằ".codePointAt(0)]:"A",["Ầ".codePointAt(0)]:"A",["Ẳ".codePointAt(0)]:"A",["Ẩ".codePointAt(0)]:"A",["Ẵ".codePointAt(0)]:"A",["Ẫ".codePointAt(0)]:"A",["Ặ".codePointAt(0)]:"A",["Ậ".codePointAt(0)]:"A",["ắ".codePointAt(0)]:"a",["ấ".codePointAt(0)]:"a",["ằ".codePointAt(0)]:"a",["ầ".codePointAt(0)]:"a",["ẳ".codePointAt(0)]:"a",["ẩ".codePointAt(0)]:"a",["ẵ".codePointAt(0)]:"a",["ẫ".codePointAt(0)]:"a",["ặ".codePointAt(0)]:"a",["ậ".codePointAt(0)]:"a",["Ế".codePointAt(0)]:"E",["Ề".codePointAt(0)]:"E",["Ể".codePointAt(0)]:"E",["Ễ".codePointAt(0)]:"E",["Ệ".codePointAt(0)]:"E",["ế".codePointAt(0)]:"e",["ề".codePointAt(0)]:"e",["ể".codePointAt(0)]:"e",["ễ".codePointAt(0)]:"e",["ệ".codePointAt(0)]:"e",["Ố".codePointAt(0)]:"O",["Ớ".codePointAt(0)]:"O",["Ồ".codePointAt(0)]:"O",["Ờ".codePointAt(0)]:"O",["Ổ".codePointAt(0)]:"O",["Ở".codePointAt(0)]:"O",["Ỗ".codePointAt(0)]:"O",["Ỡ".codePointAt(0)]:"O",["Ộ".codePointAt(0)]:"O",["Ợ".codePointAt(0)]:"O",["ố".codePointAt(0)]:"o",["ớ".codePointAt(0)]:"o",["ồ".codePointAt(0)]:"o",["ờ".codePointAt(0)]:"o",["ổ".codePointAt(0)]:"o",["ở".codePointAt(0)]:"o",["ỗ".codePointAt(0)]:"o",["ỡ".codePointAt(0)]:"o",["ộ".codePointAt(0)]:"o",["ợ".codePointAt(0)]:"o",["Ứ".codePointAt(0)]:"U",["Ừ".codePointAt(0)]:"U",["Ử".codePointAt(0)]:"U",["Ữ".codePointAt(0)]:"U",["Ự".codePointAt(0)]:"U",["ứ".codePointAt(0)]:"u",["ừ".codePointAt(0)]:"u",["ử".codePointAt(0)]:"u",["ữ".codePointAt(0)]:"u",["ự".codePointAt(0)]:"u"};function o(t,e){return t>e?t:e}const n=t=>t.split("").map((t=>t.codePointAt(0))),r=" \f\n\r\t\v \u2028\u2029 \ufeff".split("").map((t=>t.codePointAt(0)));for(let k=" ".codePointAt(0);k<=" ".codePointAt(0);k++)r.push(k);Object.freeze(r);const i="".codePointAt(0),s="A".codePointAt(0),c="Z".codePointAt(0),a="a".codePointAt(0),u="z".codePointAt(0),l="0".codePointAt(0),d="9".codePointAt(0);function f(t,e,o){return o?t:e-t-1}var A,P;function h(t,e){if(t){return new Array}return null}function p(t,e,o){if(null!==e&&e.i16.length>t+o){return[t+o,e.i16.subarray(t,t+o)]}return[t,new Int16Array(o)]}function b(t,e,o){if(null!==e&&e.i32.length>t+o){return[t+o,e.i32.subarray(t,t+o)]}return[t,new Int32Array(o)]}function y(t){return t>=a&&t<=u?1:t>=s&&t<=c?2:t>=l&&t<=d?4:0}function m(t){const e=String.fromCodePoint(t);return e!==e.toUpperCase()?1:e!==e.toLowerCase()?2:null!==e.match(/\p{Number}/gu)?4:null!==e.match(/\p{Letter}/gu)?3:0}function g(t){return t<=i?y(t):m(t)}function O(t,e){return 0===t&&0!==e?8:1===t&&2===e||4!==t&&4===e?7:0===e?8:0}function _(t){if(t<192||t>8580)return t;const o=e[t];return void 0!==o?o.codePointAt(0):t}function w(t,e,o,n){let r=t.slice(n),i=r.indexOf(o);if(0===i)return n;if(!e&&o>=a&&o<=u){i>0&&(r=r.slice(0,i));const t=r.indexOf(o-32);t>=0&&(i=t)}return i<0?-1:n+i}function v(t){for(const e of t)if(e>=128)return!1;return!0}function z(t,e,o){if(!v(t))return 0;if(!v(e))return-1;let n=0,r=0;for(let i=0;i<e.length;i++){if(r=w(t,o,e[i],r),r<0)return-1;0===i&&r>0&&(n=r-1),r++}return n}(P=A||(A={}))[P.NonWord=0]="NonWord",P[P.Lower=1]="Lower",P[P.Upper=2]="Upper",P[P.Letter=3]="Letter",P[P.Number=4]="Number";const I=(t,e,n,r,a,u,l)=>{if(0===a.length)return[{start:0,end:0,score:0},null];if(z(r,a,t)<0)return[{start:-1,end:-1,score:0},null];let d=0,A=-1,P=-1;const p=r.length,b=a.length;for(let o=0;o<p;o++){let u=r[f(o,p,n)];t||(u>=s&&u<=c?u+=32:u>i&&(u=String.fromCodePoint(u).toLowerCase().codePointAt(0))),e&&(u=_(u));if(u===a[f(d,b,n)]&&(A<0&&(A=o),d++,d===b)){P=o+1;break}}if(A>=0&&P>=0){d--;for(let e=P-1;e>=A;e--){let o=r[f(e,p,n)];t||(o>=s&&o<=c?o+=32:o>i&&(o=String.fromCodePoint(o).toLowerCase().codePointAt(0)));if(o===a[f(d,b,n)]&&(d--,d<0)){A=e;break}}if(!n){const t=A;A=p-P,P=p-t}const[l,y]=function(t,e,n,r,a,u,l){let d=0,f=0,A=!1,P=0,p=0;const b=h(l,r.length);let y=0;a>0&&(y=g(n[a-1]));for(let h=a;h<u;h++){let a=n[h];const u=g(a);if(t||(a>=s&&a<=c?a+=32:a>i&&(a=String.fromCodePoint(a).toLowerCase().codePointAt(0))),e&&(a=_(a)),a===r[d]){l&&(null==b||b.push(h)),f+=16;let t=O(y,u);0===P?p=t:(8===t&&(p=t),t=o(o(t,p),4)),f+=0===d?2*t:t,A=!1,P++,d++}else f+=A?-1:-3,A=!0,P=0,p=0;y=u}return[f,b]}(t,e,r,a,A,P,u);return[{start:A,end:P,score:l},y]}return[{start:-1,end:-1,score:0},null]};const L=(C=2048,{i16:new Int16Array(102400),i32:new Int32Array(C)});var C;const E={cache:!1,maxResultItems:1/0,selector:t=>t,casing:"smart-case",normalize:!1,sort:!0};t.Fzf=class{constructor(t,...e){this.cache={},this.find=t=>{let e=!1;switch(this.opts.casing){case"smart-case":t.toLowerCase()!==t&&(e=!0);break;case"case-sensitive":e=!0;break;case"case-insensitive":t=t.toLowerCase(),e=!1}if(this.opts.cache){const e=this.cache[t];if(void 0!==e)return e}const r=n(t);let s=this.runesList.map(((t,n)=>{const s=((t,e,n,r,s,c,a)=>{const u=s.length;if(0===u)return[{start:0,end:0,score:0},h(c)];const l=r.length;if(null!==a&&l*u>a.i16.length)return I(t,e,n,r,s,c);const d=z(r,s,t);if(d<0)return[{start:-1,end:-1,score:0},null];let f=0,A=0,P=null,g=null,w=null,v=null;[f,P]=p(f,a,l),[f,g]=p(f,a,l),[f,w]=p(f,a,l),[A,v]=b(A,a,u);const[,L]=b(A,a,l);for(let o=0;o<L.length;o++)L[o]=r[o];let C=0,E=0,k=0,N=0;const U=s[0];let j=s[0],x=0,S=0,R=!1,T=L.subarray(d),V=P.subarray(d).subarray(0,T.length),M=g.subarray(d).subarray(0,T.length),B=w.subarray(d).subarray(0,T.length);for(let[h,p]of T.entries()){let r=null;p<=i?(r=y(p),t||2!==r||(p+=32)):(r=m(p),t||2!==r||(p=String.fromCodePoint(p).toLowerCase().codePointAt(0)),e&&(p=_(p))),T[h]=p;const c=O(S,r);if(B[h]=c,S=r,p===j&&(k<u&&(v[k]=d+h,k++,j=s[Math.min(k,u-1)]),N=d+h),p===U){const t=16+2*c;if(V[h]=t,M[h]=1,1===u&&(n&&t>C||!n&&t>=C)&&(C=t,E=d+h,n&&8===c))break;R=!1}else V[h]=o(R?x+-1:x+-3,0),M[h]=0,R=!0;x=V[h]}if(k!==u)return[{start:-1,end:-1,score:0},null];if(1===u){const t={start:E,end:E+1,score:C};return c?[t,[E]]:[t,null]}const Y=v[0],D=N-Y+1;let G=null;[f,G]=p(f,a,D*u);{const t=P.subarray(Y,N+1);for(const[e,o]of t.entries())G[e]=o}let[,W]=p(f,a,D*u);{const t=g.subarray(Y,N+1);for(const[e,o]of t.entries())W[e]=o}const q=v.subarray(1),F=s.slice(1).slice(0,q.length);for(const[i,h]of q.entries()){let t=!1;const e=F[i],r=i+1,s=r*D,c=L.subarray(h,N+1),a=w.subarray(h).subarray(0,c.length),l=W.subarray(s+h-Y).subarray(0,c.length),d=W.subarray(s+h-Y-1-D).subarray(0,c.length),f=G.subarray(s+h-Y).subarray(0,c.length),A=G.subarray(s+h-Y-1-D).subarray(0,c.length),P=G.subarray(s+h-Y-1).subarray(0,c.length);P[0]=0;for(const[i,p]of c.entries()){const s=i+h;let c=0,b=0,y=0;if(b=t?P[i]+-1:P[i]+-3,e===p){c=A[i]+16;let t=a[i];y=d[i]+1,8===t?y=1:y>1&&(t=o(t,o(4,w[s-y+1]))),c+t<b?(c+=a[i],y=0):c+=t}l[i]=y,t=c<b;const m=o(o(c,b),0);r===u-1&&(n&&m>C||!n&&m>=C)&&(C=m,E=s),f[i]=m}}const J=h(c);let Z=Y;if(c){let t=u-1;Z=E;let e=!0;for(;;){const o=t*D,n=Z-Y,r=G[o+n];let i=0,s=0;if(t>0&&Z>=v[t]&&(i=G[o-D+n-1]),Z>v[t]&&(s=G[o+n-1]),r>i&&(r>s||r===s&&e)){if(J.push(Z),0===t)break;t--}e=W[o+n]>1||o+D+n+1<W.length&&W[o+D+n+1]>0,Z--}}return[{start:Z,end:E+1,score:C},J]})(e,this.opts.normalize,!1,t,r,!0,L);return{item:this.items[n],result:s[0],positions:s[1]}})).filter((t=>0!==t.result.score));if(this.opts.sort){const t=(t,e)=>e.result.score-t.result.score;s.sort(t)}return Number.isFinite(this.opts.maxResultItems)&&(s=s.slice(0,this.opts.maxResultItems)),this.opts.cache&&(this.cache[t]=s),s},this.opts=__spreadValues(__spreadValues({},E),e[0]),this.items=t,this.runesList=t.map((t=>n(this.opts.selector(t))))}},Object.defineProperty(t,"__esModule",{value:!0}),t[Symbol.toStringTag]="Module"})); |
@@ -38,2 +38,3 @@ import type { Result } from "./algo"; | ||
normalize: boolean; | ||
sort: boolean; | ||
} | ||
@@ -40,0 +41,0 @@ export interface FzfResultItem<U = string> { |
{ | ||
"===== INFO =====": "", | ||
"name": "fzf", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Do fuzzy matching using FZF algorithm in JavaScript", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
32553
183
0