constV=Object.entries,et=Object.fromEntries,st="ENTRIES",L="KEYS",T="VALUES",_="";classD{set;_type;_path;constructor(t,s){constn=t._tree,o=Array.from(n.keys());this.set=t,this._type=s,this._path=o.length>0?[{node:n,keys:o}]:[]}next(){constt=this.dive();returnthis.backtrack(),t}dive(){if(this._path.length===0)return{done:!0,value:void0};const{node:t,keys:s}=E(this._path);if(E(s)===_)return{done:!1,value:this.result()};constn=t.get(E(s));returnthis._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;constt=E(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}key(){returnthis.set._prefix+this._path.map(({keys:t})=>E(t)).filter(t=>t!==_).join("")}value(){returnE(this._path).node.get(_)}result(){switch(this._type){caseT:returnthis.value();caseL:returnthis.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){returnthis}}constE=e=>e[e.length-1],nt=(e,t,s)=>{constn=newMap;if(t===void0)returnn;consto=t.length+1,u=o+s,i=newUint8Array(u*o).fill(s+1);for(letr=0;r<o;++r)i[r]=r;for(letr=1;r<u;++r)i[r*o]=r;returnR(e,t,s,n,i,1,o,""),n},R=(e,t,s,n,o,u,i,r)=>{constd=u*i;t:for(constcofe.keys())if(c===_){consta=o[d-1];a<=s&&n.set(r,[e.get(c),a])}else{leta=u;for(leth=0;h<c.length;++h,++a){constg=c[h],m=i*a,p=m-i;letl=o[m];constf=Math.max(0,a-s-1),y=Math.min(i-1,a+s);for(letF=f;F<y;++F){constv=g!==t[F],z=o[p+F]++v,A=o[p+F+1]+1,w=o[m+F]+1,j=o[m+F+1]=Math.min(z,A,w);j<l&&(l=j)}if(l>s)continuet}R(e.get(c),t,s,n,o,a,i,r+c)}};classC{_tree;_prefix;_size=void0;constructor(t=newMap,s=""){this._tree=t,this._prefix=s}atPrefix(t){if(!t.startsWith(this._prefix))thrownewError("Mismatched prefix");const[s,n]=x(this._tree,t.slice(this._prefix.length));if(s===void0){const[o,u]=O(n);for(constiofo.keys())if(i!==_&&i.startsWith(u)){constr=newMap;returnr.set(i.slice(u.length),o.get(i)),newC(r,t)}}returnnewC(s,t)}clear(){this._size=void0,this._tree.clear()}delete(t){returnthis._size=void0,ot(this._tree,t)}entries(){returnnewD(this,st)}forEach(t){for(const[s,n]ofthis)t(s,n,this)}fuzzyGet(t,s){returnnt(this._tree,t,s)}get(t){consts=k(this._tree,t);returns!==void0?s.get(_):void0}has(t){consts=k(this._tree,t);returns!==void0&&s.has(_)}keys(){returnnewD(this,L)}set(t,s){if(typeoft!="string")thrownewError("key must be a string");returnthis._size=void0,I(this._tree,t).set(_,s),this}getsize(){if(this._size)returnthis._size;this._size=0;constt=this.entries();for(;!t.next().done;)this._size+=1;returnthis._size}update(t,s){if(typeoft!="string")thrownewError("key must be a string");this._size=void0;constn=I(this._tree,t);returnn.set(_,s(n.get(_))),this}fetch(t,s){if(typeoft!="string")thrownewError("key must be a string");this._size=void0;constn=I(this._tree,t);leto=n.get(_);returno===void0&&n.set(_,o=s()),o}values(){returnnewD(this,T)}[Symbol.iterator](){returnthis.entries()}staticfrom(t){consts=newC;for(const[n,o]oft)s.set(n,o);returns}staticfromObject(t){returnC.from(Object.entries(t))}}constx=(e,t,s=[])=>{if(t.length===0||e==null)return[e,s];for(constnofe.keys())if(n!==_&&t.startsWith(n))returns.push([e,n]),x(e.get(n),t.slice(n.length),s);returns.push([e,t]),x(void0,"",s)},k=(e,t)=>{if(t.length===0||e==null)returne;for(constsofe.keys())if(s!==_&&t.startsWith(s))returnk(e.get(s),t.slice(s.length))},I=(e,t)=>{consts=t.length;t:for(letn=0;e&&n<s;){for(constuofe.keys())if(u!==_&&t[n]===u[0]){consti=Math.min(s-n,u.length);letr=1;for(;r<i&&t[n+r]===u[r];)++r;constd=e.get(u);if(r===u.length)e=d;else{constc=newMap;c.set(u.slice(r),d),e.set(t.slice(n,n+r),c),e.delete(u),e=c}n+=r;continuet}consto=newMap;returne.set(t.slice(n),o),o}returne},ot=(e,t)=>{const[s,n]=x(e,t);if(s!==void0){if(s.delete(_),s.size===0)W(n);elseif(s.size===1){const[o,u]=s.entries().next().value;q(n,o,u)}}},W=e=>{if(e.length===0)return;const[t,s]=O(e);if(t.delete(s),t.size===0)W(e.slice(0,-1));elseif(t.size===1){const[n,o]=t.entries().next().value;n!==_&&q(e.slice(0,-1),n,o)}},q=(e,t,s)=>{i