function kt(...f){const n=f.reduce((l,c)=>l+(c.byteLength||c.length),0),o=new Uint8Array(n);let s=0;return f.forEach(l=>{o.set(l instanceof ArrayBuffer?new Uint8Array(l):l,s),s+=l.byteLength||l.length}),o}Uint8Array.prototype.concat=function(...f){return kt(this,...f)};Uint8Array.prototype.toJSON=function(){return[...this]};Promise.prototype.finally=Promise.prototype.finally||function(f){const n=o=>Promise.resolve(f()).then(o);return this.then(o=>n(()=>o),o=>n(()=>Promise.reject(o)))};var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fe(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var Ke={exports:{}};(function(f){var n=function(o){var s=1e7,l=7,c=9007199254740992,y=nt(c),T="0123456789abcdefghijklmnopqrstuvwxyz",R=typeof BigInt=="function";function A(e,r,a,u){return typeof e>"u"?A[0]:typeof r<"u"?+r==10&&!a?C(e):Se(e,r,a,u):C(e)}function p(e,r){this.value=e,this.sign=r,this.isSmall=!1}p.prototype=Object.create(A.prototype);function b(e){this.value=e,this.sign=e<0,this.isSmall=!0}b.prototype=Object.create(A.prototype);function S(e){this.value=e}S.prototype=Object.create(A.prototype);function O(e){return-c0?Math.floor(e):Math.ceil(e)}function Ht(e,r){var a=e.length,u=r.length,v=new Array(a),d=0,k=s,_,P;for(P=0;P=k?1:0,v[P]=_-d*k;for(;P0&&v.push(d),v}function Tt(e,r){return e.length>=r.length?Ht(e,r):Ht(r,e)}function ot(e,r){var a=e.length,u=new Array(a),v=s,d,k;for(k=0;k0;)u[k++]=r%v,r=Math.floor(r/v);return u}p.prototype.add=function(e){var r=C(e);if(this.sign!==r.sign)return this.subtract(r.negate());var a=this.value,u=r.value;return r.isSmall?new p(ot(a,Math.abs(u)),this.sign):new p(Tt(a,u),this.sign)},p.prototype.plus=p.prototype.add,b.prototype.add=function(e){var r=C(e),a=this.value;if(a<0!==r.sign)return this.subtract(r.negate());var u=r.value;if(r.isSmall){if(O(a+u))return new b(a+u);u=nt(Math.abs(u))}return new p(ot(u,Math.abs(a)),a<0)},b.prototype.plus=b.prototype.add,S.prototype.add=function(e){return new S(this.value+C(e).value)},S.prototype.plus=S.prototype.add;function At(e,r){var a=e.length,u=r.length,v=new Array(a),d=0,k=s,_,P;for(_=0;_=0?u=At(e,r):(u=At(r,e),a=!a),u=ut(u),typeof u=="number"?(a&&(u=-u),new b(u)):new p(u,a)}function Mt(e,r,a){var u=e.length,v=new Array(u),d=-r,k=s,_,P;for(_=0;_=0)},b.prototype.minus=b.prototype.subtract,S.prototype.subtract=function(e){return new S(this.value-C(e).value)},S.prototype.minus=S.prototype.subtract,p.prototype.negate=function(){return new p(this.value,!this.sign)},b.prototype.negate=function(){var e=this.sign,r=new b(-this.value);return r.sign=!e,r},S.prototype.negate=function(){return new S(-this.value)},p.prototype.abs=function(){return new p(this.value,!1)},b.prototype.abs=function(){return new b(Math.abs(this.value))},S.prototype.abs=function(){return new S(this.value>=0?this.value:-this.value)};function Ut(e,r){var a=e.length,u=r.length,v=a+u,d=yt(v),k=s,_,P,q,W,F;for(q=0;q0;)u[_++]=d%v,d=Math.floor(d/v);return u}function Bt(e,r){for(var a=[];r-- >0;)a.push(0);return a.concat(e)}function st(e,r){var a=Math.max(e.length,r.length);if(a<=30)return Ut(e,r);a=Math.ceil(a/2);var u=e.slice(a),v=e.slice(0,a),d=r.slice(a),k=r.slice(0,a),_=st(v,k),P=st(u,d),q=st(Tt(v,u),Tt(k,d)),W=Tt(Tt(_,Bt(At(At(q,_),P),a)),Bt(P,2*a));return _t(W),W}function Nt(e,r){return-.012*e-.012*r+15e-6*e*r>0}p.prototype.multiply=function(e){var r=C(e),a=this.value,u=r.value,v=this.sign!==r.sign,d;if(r.isSmall){if(u===0)return A[0];if(u===1)return this;if(u===-1)return this.negate();if(d=Math.abs(u),d=0;F--){for(W=v-1,P[F+u]!==k&&(W=Math.floor((P[F+u]*v+P[F+u-1])/k)),j=0,ht=0,h=q.length,i=0;iu&&(q=(q+1)*k),_=Math.ceil(q/W);do{if(F=wt(r,_),dt(F,d)<=0)break;_--}while(_);v.push(_),d=At(d,F)}return v.reverse(),[ut(v),ut(d)]}function K(e,r){var a=e.length,u=yt(a),v=s,d,k,_,P;for(_=0,d=a-1;d>=0;--d)P=_*v+e[d],k=at(P/r),_=P-k*r,u[d]=k|0;return[u,_|0]}function tt(e,r){var a,u=C(r);if(R)return[new S(e.value/u.value),new S(e.value%u.value)];var v=e.value,d=u.value,k;if(d===0)throw new Error("Cannot divide by zero");if(e.isSmall)return u.isSmall?[new b(at(v/d)),new b(v%d)]:[A[0],e];if(u.isSmall){if(d===1)return[e,A[0]];if(d==-1)return[e.negate(),A[0]];var _=Math.abs(d);if(_r.length?1:-1;for(var a=e.length-1;a>=0;a--)if(e[a]!==r[a])return e[a]>r[a]?1:-1;return 0}p.prototype.compareAbs=function(e){var r=C(e),a=this.value,u=r.value;return r.isSmall?1:dt(a,u)},b.prototype.compareAbs=function(e){var r=C(e),a=Math.abs(this.value),u=r.value;return r.isSmall?(u=Math.abs(u),a===u?0:a>u?1:-1):-1},S.prototype.compareAbs=function(e){var r=this.value,a=C(e).value;return r=r>=0?r:-r,a=a>=0?a:-a,r===a?0:r>a?1:-1},p.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var r=C(e),a=this.value,u=r.value;return this.sign!==r.sign?r.sign?1:-1:r.isSmall?this.sign?-1:1:dt(a,u)*(this.sign?-1:1)},p.prototype.compareTo=p.prototype.compare,b.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var r=C(e),a=this.value,u=r.value;return r.isSmall?a==u?0:a>u?1:-1:a<0!==r.sign?a<0?-1:1:a<0?1:-1},b.prototype.compareTo=b.prototype.compare,S.prototype.compare=function(e){if(e===1/0)return-1;if(e===-1/0)return 1;var r=this.value,a=C(e).value;return r===a?0:r>a?1:-1},S.prototype.compareTo=S.prototype.compare,p.prototype.equals=function(e){return this.compare(e)===0},S.prototype.eq=S.prototype.equals=b.prototype.eq=b.prototype.equals=p.prototype.eq=p.prototype.equals,p.prototype.notEquals=function(e){return this.compare(e)!==0},S.prototype.neq=S.prototype.notEquals=b.prototype.neq=b.prototype.notEquals=p.prototype.neq=p.prototype.notEquals,p.prototype.greater=function(e){return this.compare(e)>0},S.prototype.gt=S.prototype.greater=b.prototype.gt=b.prototype.greater=p.prototype.gt=p.prototype.greater,p.prototype.lesser=function(e){return this.compare(e)<0},S.prototype.lt=S.prototype.lesser=b.prototype.lt=b.prototype.lesser=p.prototype.lt=p.prototype.lesser,p.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},S.prototype.geq=S.prototype.greaterOrEquals=b.prototype.geq=b.prototype.greaterOrEquals=p.prototype.geq=p.prototype.greaterOrEquals,p.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},S.prototype.leq=S.prototype.lesserOrEquals=b.prototype.leq=b.prototype.lesserOrEquals=p.prototype.leq=p.prototype.lesserOrEquals,p.prototype.isEven=function(){return(this.value[0]&1)===0},b.prototype.isEven=function(){return(this.value&1)===0},S.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)},p.prototype.isOdd=function(){return(this.value[0]&1)===1},b.prototype.isOdd=function(){return(this.value&1)===1},S.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)},p.prototype.isPositive=function(){return!this.sign},b.prototype.isPositive=function(){return this.value>0},S.prototype.isPositive=b.prototype.isPositive,p.prototype.isNegative=function(){return this.sign},b.prototype.isNegative=function(){return this.value<0},S.prototype.isNegative=b.prototype.isNegative,p.prototype.isUnit=function(){return!1},b.prototype.isUnit=function(){return Math.abs(this.value)===1},S.prototype.isUnit=function(){return this.abs().value===BigInt(1)},p.prototype.isZero=function(){return!1},b.prototype.isZero=function(){return this.value===0},S.prototype.isZero=function(){return this.value===BigInt(0)},p.prototype.isDivisibleBy=function(e){var r=C(e);return r.isZero()?!1:r.isUnit()?!0:r.compareAbs(2)===0?this.isEven():this.mod(r).isZero()},S.prototype.isDivisibleBy=b.prototype.isDivisibleBy=p.prototype.isDivisibleBy;function ct(e){var r=e.abs();if(r.isUnit())return!1;if(r.equals(2)||r.equals(3)||r.equals(5))return!0;if(r.isEven()||r.isDivisibleBy(3)||r.isDivisibleBy(5))return!1;if(r.lesser(49))return!0}function Wt(e,r){for(var a=e.prev(),u=a,v=0,d,k,_;u.isEven();)u=u.divide(2),v++;t:for(k=0;k-c?new b(e-1):new p(y,!0)},S.prototype.prev=function(){return new S(this.value-BigInt(1))};for(var mt=[1];2*mt[mt.length-1]<=s;)mt.push(2*mt[mt.length-1]);var Lt=mt.length,Et=mt[Lt-1];function Gt(e){return Math.abs(e)<=s}p.prototype.shiftLeft=function(e){var r=C(e).toJSNumber();if(!Gt(r))throw new Error(String(r)+" is too large for shifting.");if(r<0)return this.shiftRight(-r);var a=this;if(a.isZero())return a;for(;r>=Lt;)a=a.multiply(Et),r-=Lt-1;return a.multiply(mt[r])},S.prototype.shiftLeft=b.prototype.shiftLeft=p.prototype.shiftLeft,p.prototype.shiftRight=function(e){var r,a=C(e).toJSNumber();if(!Gt(a))throw new Error(String(a)+" is too large for shifting.");if(a<0)return this.shiftLeft(-a);for(var u=this;a>=Lt;){if(u.isZero()||u.isNegative()&&u.isUnit())return u;r=tt(u,Et),u=r[1].isNegative()?r[0].prev():r[0],a-=Lt-1}return r=tt(u,mt[a]),r[1].isNegative()?r[0].prev():r[0]},S.prototype.shiftRight=b.prototype.shiftRight=p.prototype.shiftRight;function qt(e,r,a){r=C(r);for(var u=e.isNegative(),v=r.isNegative(),d=u?e.not():e,k=v?r.not():r,_=0,P=0,q=null,W=null,F=[];!d.isZero()||!k.isZero();)q=tt(d,Et),_=q[1].toJSNumber(),u&&(_=Et-1-_),W=tt(k,Et),P=W[1].toJSNumber(),v&&(P=Et-1-P),d=q[0],k=W[0],F.push(a(_,P));for(var j=a(u?1:0,v?1:0)!==0?n(-1):n(0),ht=F.length-1;ht>=0;ht-=1)j=j.multiply(Et).add(n(F[ht]));return j}p.prototype.not=function(){return this.negate().prev()},S.prototype.not=b.prototype.not=p.prototype.not,p.prototype.and=function(e){return qt(this,e,function(r,a){return r&a})},S.prototype.and=b.prototype.and=p.prototype.and,p.prototype.or=function(e){return qt(this,e,function(r,a){return r|a})},S.prototype.or=b.prototype.or=p.prototype.or,p.prototype.xor=function(e){return qt(this,e,function(r,a){return r^a})},S.prototype.xor=b.prototype.xor=p.prototype.xor;var Jt=1<<30,Ae=(s&-s)*(s&-s)|Jt;function Zt(e){var r=e.value,a=typeof r=="number"?r|Jt:typeof r=="bigint"?r|BigInt(Jt):r[0]+r[1]*s|Ae;return a&-a}function bt(e,r){if(r.compareTo(e)<=0){var a=bt(e,r.square(r)),u=a.p,v=a.e,d=u.multiply(r);return d.compareTo(e)<=0?{p:d,e:v*2+1}:{p:u,e:v*2}}return{p:n(1),e:0}}p.prototype.bitLength=function(){var e=this;return e.compareTo(n(0))<0&&(e=e.negate().subtract(n(1))),e.compareTo(n(0))===0?n(0):n(bt(e,n(2)).e).add(n(1))},S.prototype.bitLength=b.prototype.bitLength=p.prototype.bitLength;function ae(e,r){return e=C(e),r=C(r),e.greater(r)?e:r}function $t(e,r){return e=C(e),r=C(r),e.lesser(r)?e:r}function fe(e,r){if(e=C(e).abs(),r=C(r).abs(),e.equals(r))return e;if(e.isZero())return r;if(r.isZero())return e;for(var a=A[1],u,v;e.isEven()&&r.isEven();)u=$t(Zt(e),Zt(r)),e=e.divide(u),r=r.divide(u),a=a.multiply(u);for(;e.isEven();)e=e.divide(Zt(e));do{for(;r.isEven();)r=r.divide(Zt(r));e.greater(r)&&(v=r,r=e,e=v),r=r.subtract(e)}while(!r.isZero());return a.isUnit()?e:e.multiply(a)}function le(e,r){return e=C(e).abs(),r=C(r).abs(),e.divide(fe(e,r)).multiply(r)}function Dt(e,r,a){e=C(e),r=C(r);var u=a||Math.random,v=$t(e,r),d=ae(e,r),k=d.subtract(v).add(1);if(k.isSmall)return v.add(Math.floor(u()*k));for(var _=xt(k,s).value,P=[],q=!0,W=0;W<_.length;W++){var F=q?_[W]+(W+1<_.length?_[W+1]/s:0):s,j=at(u()*F);P.push(j),j<_[W]&&(q=!1)}return v.add(A.fromArray(P,s,!1))}var Se=function(e,r,a,u){a=a||T,e=String(e),u||(e=e.toLowerCase(),a=a.toLowerCase());var v=e.length,d,k=Math.abs(r),_={};for(d=0;d=k){if(P==="1"&&k===1)continue;throw new Error(P+" is not a valid digit in base "+r+".")}}r=C(r);var q=[],W=e[0]==="-";for(d=W?1:0;d"&&d=0;d--)u=u.add(e[d].times(v)),v=v.times(r);return a?u.negate():u}function Ee(e,r){return r=r||T,e"}function xt(e,r){if(r=n(r),r.isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(r.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var a=Array.apply(null,Array(e.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);return a.unshift([1]),{value:[].concat.apply([],a),isNegative:!1}}var u=!1;if(e.isNegative()&&r.isPositive()&&(u=!0,e=e.abs()),r.isUnit())return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(e.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:u};for(var v=[],d=e,k;d.isNegative()||d.compareAbs(r)>=0;){k=d.divmod(r),d=k.quotient;var _=k.remainder;_.isNegative()&&(_=r.minus(_).abs(),d=d.next()),v.push(_.toJSNumber())}return v.push(d.toJSNumber()),{value:v.reverse(),isNegative:u}}function ce(e,r,a){var u=xt(e,r);return(u.isNegative?"-":"")+u.value.map(function(v){return Ee(v,a)}).join("")}p.prototype.toArray=function(e){return xt(this,e)},b.prototype.toArray=function(e){return xt(this,e)},S.prototype.toArray=function(e){return xt(this,e)},p.prototype.toString=function(e,r){if(e===o&&(e=10),e!==10||r)return ce(this,e,r);for(var a=this.value,u=a.length,v=String(a[--u]),d="0000000",k;--u>=0;)k=String(a[u]),v+=d.slice(k.length)+k;var _=this.sign?"-":"";return _+v},b.prototype.toString=function(e,r){return e===o&&(e=10),e!=10||r?ce(this,e,r):String(this.value)},S.prototype.toString=b.prototype.toString,S.prototype.toJSON=p.prototype.toJSON=b.prototype.toJSON=function(){return this.toString()},p.prototype.valueOf=function(){return parseInt(this.toString(),10)},p.prototype.toJSNumber=p.prototype.valueOf,b.prototype.valueOf=function(){return this.value},b.prototype.toJSNumber=b.prototype.valueOf,S.prototype.valueOf=S.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function he(e){if(O(+e)){var r=+e;if(r===at(r))return R?new S(BigInt(r)):new b(r);throw new Error("Invalid integer: "+e)}var a=e[0]==="-";a&&(e=e.slice(1));var u=e.split(/e/i);if(u.length>2)throw new Error("Invalid integer: "+u.join("e"));if(u.length===2){var v=u[1];if(v[0]==="+"&&(v=v.slice(1)),v=+v,v!==at(v)||!O(v))throw new Error("Invalid integer: "+v+" is not a valid exponent.");var d=u[0],k=d.indexOf(".");if(k>=0&&(v-=d.length-k-1,d=d.slice(0,k)+d.slice(k+1)),v<0)throw new Error("Cannot include negative exponent part for integers");d+=new Array(v+1).join("0"),e=d}var _=/^([0-9][0-9]*)$/.test(e);if(!_)throw new Error("Invalid integer: "+e);if(R)return new S(BigInt(a?"-"+e:e));for(var P=[],q=e.length,W=l,F=q-W;q>0;)P.push(+e.slice(F,q)),F-=W,F<0&&(F=0),q-=W;return _t(P),new p(P,a)}function pe(e){if(R)return new S(BigInt(e));if(O(e)){if(e!==at(e))throw new Error(e+" is not an integer.");return new b(e)}return he(e.toString())}function C(e){return typeof e=="number"?pe(e):typeof e=="string"?he(e):typeof e=="bigint"?new S(e):e}for(var It=0;It<1e3;It++)A[It]=C(It),It>0&&(A[-It]=C(-It));return A.one=A[1],A.zero=A[0],A.minusOne=A[-1],A.max=ae,A.min=$t,A.gcd=fe,A.lcm=le,A.isInstance=function(e){return e instanceof p||e instanceof b||e instanceof S},A.randBetween=Dt,A.fromArray=function(e,r,a){return ue(e.map(C),C(r||10),a)},A}();f.hasOwnProperty("exports")&&(f.exports=n)})(Ke);var tr=Ke.exports,Y=Fe(tr);Y(Number.MAX_SAFE_INTEGER);const ze=Y(Y[2]).pow(64),er=ze.divide(Y[2]);function gt(f,n=256){return Y.fromArray(f instanceof Uint8Array?[...f]:f,n)}function Rt(f){return new Uint8Array(f.toArray(256).value)}function rr(f){return f.greater(er)?f.minus(ze):f}function He(f,n,o){const s=gt(f),l=gt(n),c=gt(o),y=s.modPow(l,c);return Rt(y)}var Ie={exports:{}};/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */(function(f,n){(function(o,s){s(n)})($e,function(o){var s=(i,h,t,E)=>{let B=65535&i|0,m=i>>>16&65535|0,U=0;for(;t!==0;){U=t>2e3?2e3:t,t-=U;do B=B+h[E++]|0,m=m+B|0;while(--U);B%=65521,m%=65521}return B|m<<16|0};const l=new Uint32Array((()=>{let i,h=[];for(var t=0;t<256;t++){i=t;for(var E=0;E<8;E++)i=1&i?3988292384^i>>>1:i>>>1;h[t]=i}return h})());var c=(i,h,t,E)=>{const B=l,m=E+t;i^=-1;for(let U=E;U>>8^B[255&(i^h[U])];return-1^i};const y=16209;var T=function(i,h){let t,E,B,m,U,x,V,g,w,ft,Z,I,lt,X,N,$,H,M,J,rt,L,Q,z,D;const G=i.state;t=i.next_in,z=i.input,E=t+(i.avail_in-5),B=i.next_out,D=i.output,m=B-(h-i.avail_out),U=B+(i.avail_out-257),x=G.dmax,V=G.wsize,g=G.whave,w=G.wnext,ft=G.window,Z=G.hold,I=G.bits,lt=G.lencode,X=G.distcode,N=(1<>>24,Z>>>=M,I-=M,M=H>>>16&255,M===0)D[B++]=65535&H;else{if(!(16&M)){if(!(64&M)){H=lt[(65535&H)+(Z&(1<>>=M,I-=M),I<15&&(Z+=z[t++]<>>24,Z>>>=M,I-=M,M=H>>>16&255,!(16&M)){if(!(64&M)){H=X[(65535&H)+(Z&(1<x){i.msg="invalid distance too far back",G.mode=y;break t}if(Z>>>=M,I-=M,M=B-m,rt>M){if(M=rt-M,M>g&&G.sane){i.msg="invalid distance too far back",G.mode=y;break t}if(L=0,Q=ft,w===0){if(L+=V-M,M2;)D[B++]=Q[L++],D[B++]=Q[L++],D[B++]=Q[L++],J-=3;J&&(D[B++]=Q[L++],J>1&&(D[B++]=Q[L++]))}else{L=B-rt;do D[B++]=D[L++],D[B++]=D[L++],D[B++]=D[L++],J-=3;while(J>2);J&&(D[B++]=D[L++],J>1&&(D[B++]=D[L++]))}break}}break}}while(t>3,t-=J,I-=J<<3,Z&=(1<{const V=x.bits;let g,w,ft,Z,I,lt,X=0,N=0,$=0,H=0,M=0,J=0,rt=0,L=0,Q=0,z=0,D=null;const G=new Uint16Array(16),pt=new Uint16Array(16);let te,de,ve,ge=null;for(X=0;X<=R;X++)G[X]=0;for(N=0;N=1&&G[H]===0;H--);if(M>H&&(M=H),H===0)return B[m++]=20971520,B[m++]=20971520,x.bits=1,0;for($=1;$0&&(i===0||H!==1))return-1;for(pt[1]=0,X=1;X852||i===2&&Q>592)return 1;for(;;){te=X-rt,U[N]+1=lt?(de=ge[U[N]-lt],ve=D[U[N]-lt]):(de=96,ve=0),g=1<>rt)+w]=te<<24|de<<16|ve|0;while(w!==0);for(g=1<>=1;if(g!==0?(z&=g-1,z+=g):z=0,N++,--G[X]==0){if(X===H)break;X=h[t+U[N]]}if(X>M&&(z&Z)!==ft){for(rt===0&&(rt=M),I+=$,J=X-rt,L=1<852||i===2&&Q>592)return 1;ft=z&Z,B[ft]=M<<24|J<<16|I-m|0}}return z!==0&&(B[I+z]=X-rt<<24|64<<16|0),x.bits=M,0},nt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{Z_FINISH:ut,Z_BLOCK:_t,Z_TREES:yt,Z_OK:at,Z_STREAM_END:Ht,Z_NEED_DICT:Tt,Z_STREAM_ERROR:ot,Z_DATA_ERROR:At,Z_MEM_ERROR:St,Z_BUF_ERROR:Mt,Z_DEFLATED:Ut}=nt,wt=16180,Bt=16190,st=16191,Nt=16192,Ot=16194,Pt=16199,Ct=16200,et=16206,K=16209,tt=i=>(i>>>24&255)+(i>>>8&65280)+((65280&i)<<8)+((255&i)<<24);function dt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ct=i=>{if(!i)return 1;const h=i.state;return!h||h.strm!==i||h.mode16211?1:0},Wt=i=>{if(ct(i))return ot;const h=i.state;return i.total_in=i.total_out=h.total=0,i.msg="",h.wrap&&(i.adler=1&h.wrap),h.mode=wt,h.last=0,h.havedict=0,h.flags=-1,h.dmax=32768,h.head=null,h.hold=0,h.bits=0,h.lencode=h.lendyn=new Int32Array(852),h.distcode=h.distdyn=new Int32Array(592),h.sane=1,h.back=-1,at},mt=i=>{if(ct(i))return ot;const h=i.state;return h.wsize=0,h.whave=0,h.wnext=0,Wt(i)},Lt=(i,h)=>{let t;if(ct(i))return ot;const E=i.state;return h<0?(t=0,h=-h):(t=5+(h>>4),h<48&&(h&=15)),h&&(h<8||h>15)?ot:(E.window!==null&&E.wbits!==h&&(E.window=null),E.wrap=t,E.wbits=h,mt(i))},Et=(i,h)=>{if(!i)return ot;const t=new dt;i.state=t,t.strm=i,t.window=null,t.mode=wt;const E=Lt(i,h);return E!==at&&(i.state=null),E};let Gt,qt,Jt=!0;const Ae=i=>{if(Jt){Gt=new Int32Array(512),qt=new Int32Array(32);let h=0;for(;h<144;)i.lens[h++]=8;for(;h<256;)i.lens[h++]=9;for(;h<280;)i.lens[h++]=7;for(;h<288;)i.lens[h++]=8;for(O(1,i.lens,0,288,Gt,0,i.work,{bits:9}),h=0;h<32;)i.lens[h++]=5;O(2,i.lens,0,32,qt,0,i.work,{bits:5}),Jt=!1}i.lencode=Gt,i.lenbits=9,i.distcode=qt,i.distbits=5},Zt=(i,h,t,E)=>{let B;const m=i.state;return m.window===null&&(m.wsize=1<=m.wsize?(m.window.set(h.subarray(t-m.wsize,t),0),m.wnext=0,m.whave=m.wsize):(B=m.wsize-m.wnext,B>E&&(B=E),m.window.set(h.subarray(t-E,t-E+B),m.wnext),(E-=B)?(m.window.set(h.subarray(t-E,t),0),m.wnext=E,m.whave=m.wsize):(m.wnext+=B,m.wnext===m.wsize&&(m.wnext=0),m.whaveEt(i,15),inflateInit2:Et,inflate:(i,h)=>{let t,E,B,m,U,x,V,g,w,ft,Z,I,lt,X,N,$,H,M,J,rt,L,Q,z=0;const D=new Uint8Array(4);let G,pt;const te=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ct(i)||!i.output||!i.input&&i.avail_in!==0)return ot;t=i.state,t.mode===st&&(t.mode=Nt),U=i.next_out,B=i.output,V=i.avail_out,m=i.next_in,E=i.input,x=i.avail_in,g=t.hold,w=t.bits,ft=x,Z=V,Q=at;t:for(;;)switch(t.mode){case wt:if(t.wrap===0){t.mode=Nt;break}for(;w<16;){if(x===0)break t;x--,g+=E[m++]<>>8&255,t.check=c(t.check,D,2,0),g=0,w=0,t.mode=16181;break}if(t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&g)<<8)+(g>>8))%31){i.msg="incorrect header check",t.mode=K;break}if((15&g)!==Ut){i.msg="unknown compression method",t.mode=K;break}if(g>>>=4,w-=4,L=8+(15&g),t.wbits===0&&(t.wbits=L),L>15||L>t.wbits){i.msg="invalid window size",t.mode=K;break}t.dmax=1<>8&1),512&t.flags&&4&t.wrap&&(D[0]=255&g,D[1]=g>>>8&255,t.check=c(t.check,D,2,0)),g=0,w=0,t.mode=16182;case 16182:for(;w<32;){if(x===0)break t;x--,g+=E[m++]<>>8&255,D[2]=g>>>16&255,D[3]=g>>>24&255,t.check=c(t.check,D,4,0)),g=0,w=0,t.mode=16183;case 16183:for(;w<16;){if(x===0)break t;x--,g+=E[m++]<>8),512&t.flags&&4&t.wrap&&(D[0]=255&g,D[1]=g>>>8&255,t.check=c(t.check,D,2,0)),g=0,w=0,t.mode=16184;case 16184:if(1024&t.flags){for(;w<16;){if(x===0)break t;x--,g+=E[m++]<>>8&255,t.check=c(t.check,D,2,0)),g=0,w=0}else t.head&&(t.head.extra=null);t.mode=16185;case 16185:if(1024&t.flags&&(I=t.length,I>x&&(I=x),I&&(t.head&&(L=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(E.subarray(m,m+I),L)),512&t.flags&&4&t.wrap&&(t.check=c(t.check,E,I,m)),x-=I,m+=I,t.length-=I),t.length))break t;t.length=0,t.mode=16186;case 16186:if(2048&t.flags){if(x===0)break t;I=0;do L=E[m+I++],t.head&&L&&t.length<65536&&(t.head.name+=String.fromCharCode(L));while(L&&I>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=st;break;case 16189:for(;w<32;){if(x===0)break t;x--,g+=E[m++]<>>=7&w,w-=7&w,t.mode=et;break}for(;w<3;){if(x===0)break t;x--,g+=E[m++]<>>=1,w-=1,3&g){case 0:t.mode=16193;break;case 1:if(Ae(t),t.mode=Pt,h===yt){g>>>=2,w-=2;break t}break;case 2:t.mode=16196;break;case 3:i.msg="invalid block type",t.mode=K}g>>>=2,w-=2;break;case 16193:for(g>>>=7&w,w-=7&w;w<32;){if(x===0)break t;x--,g+=E[m++]<>>16^65535)){i.msg="invalid stored block lengths",t.mode=K;break}if(t.length=65535&g,g=0,w=0,t.mode=Ot,h===yt)break t;case Ot:t.mode=16195;case 16195:if(I=t.length,I){if(I>x&&(I=x),I>V&&(I=V),I===0)break t;B.set(E.subarray(m,m+I),U),x-=I,m+=I,V-=I,U+=I,t.length-=I;break}t.mode=st;break;case 16196:for(;w<14;){if(x===0)break t;x--,g+=E[m++]<>>=5,w-=5,t.ndist=1+(31&g),g>>>=5,w-=5,t.ncode=4+(15&g),g>>>=4,w-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=K;break}t.have=0,t.mode=16197;case 16197:for(;t.have>>=3,w-=3}for(;t.have<19;)t.lens[te[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,G={bits:t.lenbits},Q=O(0,t.lens,0,19,t.lencode,0,t.work,G),t.lenbits=G.bits,Q){i.msg="invalid code lengths set",t.mode=K;break}t.have=0,t.mode=16198;case 16198:for(;t.have>>24,$=z>>>16&255,H=65535&z,!(N<=w);){if(x===0)break t;x--,g+=E[m++]<>>=N,w-=N,t.lens[t.have++]=H;else{if(H===16){for(pt=N+2;w>>=N,w-=N,t.have===0){i.msg="invalid bit length repeat",t.mode=K;break}L=t.lens[t.have-1],I=3+(3&g),g>>>=2,w-=2}else if(H===17){for(pt=N+3;w>>=N,w-=N,L=0,I=3+(7&g),g>>>=3,w-=3}else{for(pt=N+7;w>>=N,w-=N,L=0,I=11+(127&g),g>>>=7,w-=7}if(t.have+I>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=K;break}for(;I--;)t.lens[t.have++]=L}}if(t.mode===K)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=K;break}if(t.lenbits=9,G={bits:t.lenbits},Q=O(1,t.lens,0,t.nlen,t.lencode,0,t.work,G),t.lenbits=G.bits,Q){i.msg="invalid literal/lengths set",t.mode=K;break}if(t.distbits=6,t.distcode=t.distdyn,G={bits:t.distbits},Q=O(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,G),t.distbits=G.bits,Q){i.msg="invalid distances set",t.mode=K;break}if(t.mode=Pt,h===yt)break t;case Pt:t.mode=Ct;case Ct:if(x>=6&&V>=258){i.next_out=U,i.avail_out=V,i.next_in=m,i.avail_in=x,t.hold=g,t.bits=w,T(i,Z),U=i.next_out,B=i.output,V=i.avail_out,m=i.next_in,E=i.input,x=i.avail_in,g=t.hold,w=t.bits,t.mode===st&&(t.back=-1);break}for(t.back=0;z=t.lencode[g&(1<>>24,$=z>>>16&255,H=65535&z,!(N<=w);){if(x===0)break t;x--,g+=E[m++]<>M)],N=z>>>24,$=z>>>16&255,H=65535&z,!(M+N<=w);){if(x===0)break t;x--,g+=E[m++]<>>=M,w-=M,t.back+=M}if(g>>>=N,w-=N,t.back+=N,t.length=H,$===0){t.mode=16205;break}if(32&$){t.back=-1,t.mode=st;break}if(64&$){i.msg="invalid literal/length code",t.mode=K;break}t.extra=15&$,t.mode=16201;case 16201:if(t.extra){for(pt=t.extra;w>>=t.extra,w-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=16202;case 16202:for(;z=t.distcode[g&(1<>>24,$=z>>>16&255,H=65535&z,!(N<=w);){if(x===0)break t;x--,g+=E[m++]<>M)],N=z>>>24,$=z>>>16&255,H=65535&z,!(M+N<=w);){if(x===0)break t;x--,g+=E[m++]<>>=M,w-=M,t.back+=M}if(g>>>=N,w-=N,t.back+=N,64&$){i.msg="invalid distance code",t.mode=K;break}t.offset=H,t.extra=15&$,t.mode=16203;case 16203:if(t.extra){for(pt=t.extra;w>>=t.extra,w-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=K;break}t.mode=16204;case 16204:if(V===0)break t;if(I=Z-V,t.offset>I){if(I=t.offset-I,I>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=K;break}I>t.wnext?(I-=t.wnext,lt=t.wsize-I):lt=t.wnext-I,I>t.length&&(I=t.length),X=t.window}else X=B,lt=U-t.offset,I=t.length;I>V&&(I=V),V-=I,t.length-=I;do B[U++]=X[lt++];while(--I);t.length===0&&(t.mode=Ct);break;case 16205:if(V===0)break t;B[U++]=t.length,V--,t.mode=Ct;break;case et:if(t.wrap){for(;w<32;){if(x===0)break t;x--,g|=E[m++]<{if(ct(i))return ot;let h=i.state;return h.window&&(h.window=null),i.state=null,at},inflateGetHeader:(i,h)=>{if(ct(i))return ot;const t=i.state;return 2&t.wrap?(t.head=h,h.done=!1,at):ot},inflateSetDictionary:(i,h)=>{const t=h.length;let E,B,m;return ct(i)?ot:(E=i.state,E.wrap!==0&&E.mode!==Bt?ot:E.mode===Bt&&(B=1,B=s(B,h,t,0),B!==E.check)?At:(m=Zt(i,h,t,t),m?(E.mode=16210,St):(E.havedict=1,at)))},inflateInfo:"pako inflate (from Nodeca project)"};const ae=(i,h)=>Object.prototype.hasOwnProperty.call(i,h);var $t=function(i){const h=Array.prototype.slice.call(arguments,1);for(;h.length;){const t=h.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const E in t)ae(t,E)&&(i[E]=t[E])}}return i},fe=i=>{let h=0;for(let E=0,B=i.length;E=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;Dt[254]=Dt[254]=1;var Se=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let h,t,E,B,m,U=i.length,x=0;for(B=0;B>>6,h[m++]=128|63&t):t<65536?(h[m++]=224|t>>>12,h[m++]=128|t>>>6&63,h[m++]=128|63&t):(h[m++]=240|t>>>18,h[m++]=128|t>>>12&63,h[m++]=128|t>>>6&63,h[m++]=128|63&t);return h},ue=(i,h)=>{const t=h||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,h));let E,B;const m=new Array(2*t);for(B=0,E=0;E4)m[B++]=65533,E+=x-1;else{for(U&=x===2?31:x===3?15:7;x>1&&E1?m[B++]=65533:U<65536?m[B++]=U:(U-=65536,m[B++]=55296|U>>10&1023,m[B++]=56320|1023&U)}}return((U,x)=>{if(x<65534&&U.subarray&&le)return String.fromCharCode.apply(null,U.length===x?U:U.subarray(0,x));let V="";for(let g=0;g{(h=h||i.length)>i.length&&(h=i.length);let t=h-1;for(;t>=0&&(192&i[t])==128;)t--;return t<0||t===0?h:t+Dt[i[t]]>h?t:h},xt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ce=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},he=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const pe=Object.prototype.toString,{Z_NO_FLUSH:C,Z_FINISH:It,Z_OK:e,Z_STREAM_END:r,Z_NEED_DICT:a,Z_STREAM_ERROR:u,Z_DATA_ERROR:v,Z_MEM_ERROR:d}=nt;function k(i){this.options=$t({chunkSize:65536,windowBits:15,to:""},i||{});const h=this.options;h.raw&&h.windowBits>=0&&h.windowBits<16&&(h.windowBits=-h.windowBits,h.windowBits===0&&(h.windowBits=-15)),!(h.windowBits>=0&&h.windowBits<16)||i&&i.windowBits||(h.windowBits+=32),h.windowBits>15&&h.windowBits<48&&!(15&h.windowBits)&&(h.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ce,this.strm.avail_out=0;let t=bt.inflateInit2(this.strm,h.windowBits);if(t!==e)throw new Error(xt[t]);if(this.header=new he,bt.inflateGetHeader(this.strm,this.header),h.dictionary&&(typeof h.dictionary=="string"?h.dictionary=Se(h.dictionary):pe.call(h.dictionary)==="[object ArrayBuffer]"&&(h.dictionary=new Uint8Array(h.dictionary)),h.raw&&(t=bt.inflateSetDictionary(this.strm,h.dictionary),t!==e)))throw new Error(xt[t])}function _(i,h){const t=new k(h);if(t.push(i),t.err)throw t.msg||xt[t.err];return t.result}k.prototype.push=function(i,h){const t=this.strm,E=this.options.chunkSize,B=this.options.dictionary;let m,U,x;if(this.ended)return!1;for(U=h===~~h?h:h===!0?It:C,pe.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(E),t.next_out=0,t.avail_out=E),m=bt.inflate(t,U),m===a&&B&&(m=bt.inflateSetDictionary(t,B),m===e?m=bt.inflate(t,U):m===v&&(m=a));t.avail_in>0&&m===r&&t.state.wrap>0&&i[t.next_in]!==0;)bt.inflateReset(t),m=bt.inflate(t,U);switch(m){case u:case v:case a:case d:return this.onEnd(m),this.ended=!0,!1}if(x=t.avail_out,t.next_out&&(t.avail_out===0||m===r))if(this.options.to==="string"){let V=Ee(t.output,t.next_out),g=t.next_out-V,w=ue(t.output,V);t.next_out=g,t.avail_out=E-g,g&&t.output.set(t.output.subarray(V,V+g),0),this.onData(w)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(m!==e||x!==0){if(m===r)return m=bt.inflateEnd(this.strm),this.onEnd(m),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},k.prototype.onData=function(i){this.chunks.push(i)},k.prototype.onEnd=function(i){i===e&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=fe(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};var P=k,q=_,W=function(i,h){return(h=h||{}).raw=!0,_(i,h)},F=_,j=nt,ht={Inflate:P,inflate:q,inflateRaw:W,ungzip:F,constants:j};o.Inflate=P,o.constants=j,o.default=ht,o.inflate=q,o.inflateRaw=W,o.ungzip=F,Object.defineProperty(o,"__esModule",{value:!0})})})(Ie,Ie.exports);var nr=Ie.exports,ir=Fe(nr);function or(f,n){return ir.inflate(f,n?{to:"string"}:void 0)}const Ft=typeof window<"u"?window:self;function sr(f,n,o){const s=(l,c)=>{f.attachListenPort(l),c&&f.attachSendPort(c),n?.(l)};f.setOnPortDisconnect(o),typeof SharedWorkerGlobalScope<"u"?Ft.addEventListener("connect",l=>s(l.source,l.source)):typeof ServiceWorkerGlobalScope<"u"?s(Ft,null):s(Ft,Ft)}const zt={test:location.search.indexOf("test=1")>0,debug:location.search.indexOf("debug=1")>0,http:!1,ssl:!0,asServiceWorker:!1,transport:"websocket",noSharedWorker:location.search.indexOf("noSharedWorker=1")>0,multipleTransports:!0};(zt.http=location.search.indexOf("http=1")>0)&&(zt.multipleTransports=!1);zt.multipleTransports&&(zt.http=!0);zt.http&&(zt.transport="https");const Me=zt.debug,ar=typeof window<"u"?window:self,Oe=ar,fr=Date.now()%Math.random()*1e8|0;function Te(f,n){const o=f.indexOf(n);return(o===-1?void 0:f.splice(o,1))?.[0]}const se=typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope,be=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&!se,We=be||se,lr=()=>self.clients.matchAll({includeUncontrolled:!1,type:"window"}),Ge=(f,...n)=>{try{f.postMessage(...n)}catch(o){console.error("[worker] postMessage error:",o,n)}},Je=(f,...n)=>{lr().then(o=>{o.length&&o.slice(f?0:-1).forEach(s=>{Ge(s,...n)})})},je=(...f)=>{Ge(self,...f)},Ve=()=>{};se&&Je.bind(null,!1);se&&Je.bind(null,!0);class ur{constructor(n){this._constructor(n)}_constructor(n){this.reuseResults=n,this.listeners={},this.listenerResults={}}addEventListener(n,o,s){var c;const l={callback:o,options:s};if(((c=this.listeners)[n]??(c[n]=new Set)).add(l),this.listenerResults.hasOwnProperty(n)&&(o(...this.listenerResults[n]),s?.once)){this.listeners[n].delete(l);return}}addMultipleEventsListeners(n){for(const o in n)this.addEventListener(o,n[o])}removeEventListener(n,o,s){if(this.listeners[n]){for(const l of this.listeners[n])if(l.callback===o){this.listeners[n].delete(l);break}}}invokeListenerCallback(n,o,...s){let l,c;try{l=o.callback(...s)}catch(y){c=y}if(o.options?.once&&this.removeEventListener(n,o.callback),c)throw c;return l}_dispatchEvent(n,o,...s){this.reuseResults&&(this.listenerResults[n]=s);const l=o&&[],c=this.listeners[n];if(c)for(const y of c){const T=this.invokeListenerCallback(n,y,...s);l&&l.push(T)}return l}dispatchResultableEvent(n,...o){return this._dispatchEvent(n,!0,...o)}dispatchEvent(n,...o){this._dispatchEvent(n,!1,...o)}cleanup(){this.listeners={},this.listenerResults={}}}const Be={};function cr(f){return Be[f]??(Be[f]={type:f})}const ye=navigator?navigator.userAgent:null;navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i);navigator.userAgent.toLowerCase().indexOf("android");(()=>{try{return+navigator.userAgent.match(/Chrom(?:e|ium)\/(.+?)(?:\s|\.)/)[1]}catch{}})();const hr="safari"in Ft||!!(ye&&(/\b(iPad|iPhone|iPod)\b/.test(ye)||ye.match("Safari")&&!ye.match("Chrome"))),pr=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(navigator.maxTouchPoints===void 0||navigator.maxTouchPoints>0)&&navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i)!=-1;const dr=Date.now();function Le(){return"["+((Date.now()-dr)/1e3).toFixed(3)+"]"}const vr=[0,1,2,4,8],gr=hr||pr,Ne=!gr,Pe={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",fg:{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"},bg:{black:"\x1B[40m",red:"\x1B[41m",green:"\x1B[42m",yellow:"\x1B[43m",blue:"\x1B[44m",magenta:"\x1B[45m",cyan:"\x1B[46m",white:"\x1B[47m"}},yr=[["debug",8],["info",4],["warn",2],["error",1],["assert",1],["trace",4],["group",4],["groupCollapsed",4],["groupEnd",4]];function Xe(f,n=7,o=!1,s=""){let l;!Me&&!o&&(n=1),Ne?s||(se?s=Pe.fg.yellow:be&&(s=Pe.fg.cyan)):s="";const c=s;s?s=`%s ${s}%s`:s="%s";const y=function(...R){return n&4&&console.log(s,Le(),f,...R)};yr.forEach(([R,A])=>{y[R]=function(...p){return n&A&&console[R](s,Le(),f,...p)}}),y.setPrefix=function(R){l=R,f="["+R+"]"},y.setPrefix(f),y.setLevel=function(R){n=vr.slice(0,R+1).reduce((A,p)=>A|p,0)};const T={};return y.bindPrefix=function(R,A=n){return T[R]??(T[R]=Xe(`${l}] ${Ne&&c?Pe.reset:""}[${R}`,A,o,c))},y}const wr=!0;class mr extends ur{constructor(n){super(!1),this.logSuffix=n,this.onMessage=o=>{const s=o.data,l=o.source||o.currentTarget;this.processTaskMap[s.type](s,l,o)},this.processResultTask=o=>{const{taskId:s,result:l,error:c}=o.payload,y=this.awaiting[s];y&&(this.debug&&this.log.debug("done",y.taskType,l,c),"error"in o.payload?y.reject(c):y.resolve(l),delete this.awaiting[s])},this.processAckTask=o=>{const s=o.payload,l=this.awaiting[s.taskId];if(!l)return;const c=l.resolve,y={cached:s.cached,result:s.cached?"result"in s?Promise.resolve(s.result):Promise.reject(s.error):new Promise((T,R)=>{l.resolve=T,l.reject=R})};c(y),s.cached&&delete this.awaiting[s.taskId]},this.processPingTask=(o,s,l)=>{this.pushTask(this.createTask("pong",void 0),l.source)},this.processPongTask=(o,s,l)=>{const c=this.pingResolves.get(s);c&&(this.pingResolves.delete(s),c())},this.processCloseTask=(o,s,l)=>{this.detachPort(s)},this.processBatchTask=(o,s,l)=>{const c={data:l.data,source:l.source,currentTarget:l.currentTarget};o.payload.forEach(y=>{c.data=y,this.onMessage(c)})},this.processLockTask=(o,s,l)=>{const c=o.payload;this.requestedLocks.has(c)||(this.requestedLocks.set(c,s),navigator.locks.request(c,()=>{this.processCloseTask(void 0,s,void 0),this.requestedLocks.delete(c)}))},this.processInvokeTask=async(o,s,l)=>{const c=o.id,y=o.payload;let T,R,A;y.void||(T={taskId:c},R=this.createTask("result",T)),y.withAck&&(A=this.createTask("ack",{taskId:c,cached:!0}));let p;try{const b=this.listeners[y.type];if(!b?.size)throw new Error("no listener");const S=b.values().next().value;let O=this.invokeListenerCallback(y.type,S,y.payload,s,l);if(y.void)return;if(p=O instanceof Promise,A){const nt=!p;if(A.payload.cached=nt,nt&&(A.payload.result=O),this.pushTask(A,s),nt)return}p&&(O=await O),T.result=O}catch(b){if(this.log.error("worker task error:",b,o),y.void)return;if(A&&A.payload.cached){A.payload.error=b,this.pushTask(A,s);return}T.error=b}this.pushTask(R,s)},this.listenPorts=[],this.sendPorts=[],this.pingResolves=new Map,this.taskId=0,this.awaiting={},this.pending=new Map,this.log=Xe("MP"+(n?"-"+n:"")),this.debug=Me,this.heldLocks=new Map,this.requestedLocks=new Map,this.processTaskMap={result:this.processResultTask,ack:this.processAckTask,invoke:this.processInvokeTask,ping:this.processPingTask,pong:this.processPongTask,close:this.processCloseTask,lock:this.processLockTask,batch:this.processBatchTask}}setOnPortDisconnect(n){this.onPortDisconnect=n}attachPort(n){this.attachListenPort(n),this.attachSendPort(n)}attachListenPort(n){this.listenPorts.push(n),n.addEventListener("message",this.onMessage)}attachSendPort(n){if(this.log.warn("attaching send port"),n.start?.(),this.sendPorts.push(n),typeof window<"u"&&wr)if("locks"in navigator){const o=["lock",fr,this.logSuffix||"",Math.random()*2147483647|0].join("-");this.log.warn("created lock",o);const s=new Promise(l=>this.heldLocks.set(n,{resolve:l,id:o})).then(()=>this.heldLocks.delete(n));navigator.locks.request(o,()=>(this.resendLockTask(n),s))}else window.addEventListener("beforeunload",()=>{const o=this.createTask("close",void 0);this.postMessage(void 0,o)});this.releasePending()}resendLockTask(n){const o=this.heldLocks.get(n);o&&this.pushTask(this.createTask("lock",o.id),n)}detachPort(n){this.log.warn("disconnecting port"),Te(this.listenPorts,n),Te(this.sendPorts,n),n.removeEventListener?.("message",this.onMessage),n.close?.(),this.onPortDisconnect?.(n),this.heldLocks.get(n)?.resolve();const s=cr("PORT_DISCONNECTED");for(const l in this.awaiting){const c=this.awaiting[l];c.port===n&&(c.reject(s),delete this.awaiting[l])}}postMessage(n,o){(Array.isArray(n)?n:n?[n]:this.sendPorts).forEach(l=>{l.postMessage(o,o.transfer)})}async releasePending(){this.releasingPending||(this.releasingPending=!0,await Promise.resolve(),this.debug&&this.log.debug("releasing tasks, length:",this.pending.size),this.pending.forEach((n,o)=>{let s=n;{let c;s=[],n.forEach(y=>{y.transfer?(c=void 0,s.push(y)):(c||(c=this.createTask("batch",[]),s.push(c)),c.payload.push(y))})}const l=o?[o]:this.sendPorts;l.length&&(s.forEach(c=>{try{this.postMessage(l,c)}catch(y){this.log.error("postMessage error:",y,c,l)}}),this.pending.delete(o))}),this.debug&&this.log.debug("released tasks"),this.releasingPending=!1)}createTask(n,o,s){return{type:n,payload:o,id:this.taskId++,transfer:s}}createInvokeTask(n,o,s,l,c){return this.createTask("invoke",{type:n,payload:o,withAck:s,void:l},c)}pushTask(n,o){let s=this.pending.get(o);s||this.pending.set(o,s=[]),s.push(n),this.releasePending()}invokeVoid(n,o,s,l){const c=this.createInvokeTask(n,o,void 0,!0,l);this.pushTask(c,s)}invoke(n,o,s,l,c){this.debug&&this.log.debug("start",n,o);let y;const T=new Promise((R,A)=>{y=this.createInvokeTask(n,o,s,void 0,c),this.awaiting[y.id]={resolve:R,reject:A,taskType:n,port:l},this.pushTask(y,l)});if(We){T.finally(()=>{clearInterval(R)});const R=Ft.setInterval(()=>{this.log.error("task still has no result",y,l)},6e4)}return T}invokeExceptSource(n,o,s){const l=this.sendPorts.slice();Te(l,s),l.forEach(c=>{this.invokeVoid(n,o,c)})}}class br extends mr{constructor(){super("CRYPTO"),this.lastIndex=-1}invokeCryptoNew({method:n,args:o,transfer:s}){const l={method:n,args:o},c=this.listeners.invoke;if(c?.size){let T=c.values().next().value.callback(l);return!We&&!(T instanceof Promise)&&(T=Promise.resolve(T)),T}const y=n==="aes-encrypt"||n==="aes-decrypt"?this.lastIndex=(this.lastIndex+1)%this.sendPorts.length:0;return this.invoke("invoke",l,void 0,this.sendPorts[y],s)}invokeCrypto(n,...o){return this.invokeCryptoNew({method:n,args:o})}}const it=new br;Oe&&(Oe.cryptoMessagePort=it);function kr(f){const n=f.length,o=n*8;let s=Y(f[0]).and(127).shiftLeft(o-8);for(let l=1;l0&&y{for(;;){const p=Ye(new Uint8Array(A.length)),b=gt(p);if(!b.greater(Y.one))continue;const S=gt(A);if(b.lesser(S.subtract(Y.one)))return p}})(n),c=Re(o.toString(16)),y=ke(await it.invokeCrypto("mod-pow",c,l,n),256,!0,!0,!0),T=await it.invokeCrypto("sha256",y);return{a:l,g_a:y,g_a_hash:T,p:n}}function Er(f,n){const o=f.length,s=new Uint8Array(o);for(let l=0;l{const K=new Uint8Array(et.length);for(let tt=0;tt{const tt=K.subtract(et),dt=1984;return!(tt.isNegative()||tt.bitLength().toJSNumber()256)},Ht=async()=>{for(;;){const et=gt(p(n.secure_random)),K=c.modPow(et,l);if(at(K,l)){const tt=Rt(K),dt=await it.invokeCrypto("sha256",kt(tt,nt)),ct=gt(dt);if(!ct.isZero()&&!ct.isNegative())return{a:et,a_for_hash:tt,u:ct}}}},{a:Tt,a_for_hash:ot,u:At}=await Ht();let St;b.greater(yt)?St=b:St=b.add(l),St=St.subtract(yt).mod(l);const Mt=At.multiply(T),Ut=Tt.add(Mt),wt=St.modPow(Ut,l),Bt=await it.invokeCrypto("sha256",R(Rt(wt),256));let st=await it.invokeCrypto("sha256",S);const Nt=await it.invokeCrypto("sha256",O);st=Er(st,Nt);const Ot=kt(st,await it.invokeCrypto("sha256",s.salt1),await it.invokeCrypto("sha256",s.salt2),ot,nt,Bt),Pt=await it.invokeCrypto("sha256",Ot);return{_:"inputCheckPasswordSRP",srp_id:n.srp_id,A:new Uint8Array(ot),M1:Pt}}var vt=new Uint8Array(256),ee=new Uint8Array(256),re=new Uint32Array(256),ne=new Uint32Array(256),ie=new Uint32Array(256),oe=new Uint32Array(256),jt=new Uint32Array(256),Vt=new Uint32Array(256),Xt=new Uint32Array(256),Yt=new Uint32Array(256);function xr(){for(var f=new Uint8Array(256),n=new Uint8Array(256),o,s,l,c,y,T,R=0,A=0,p=0;p<256;p++)f[p]=p<<1^(p>>7)*283,n[f[p]^p]=p;for(;!vt[R];R^=o||1)c=A^A<<1^A<<2^A<<3^A<<4,c=c>>8^c&255^99,vt[R]=c,ee[c]=R,l=f[s=f[o=f[R]]],T=l*16843009^s*65537^o*257^R*16843008,y=f[c]*257^c*16843008,re[R]=y=y<<24^y>>>8,ne[R]=y=y<<24^y>>>8,ie[R]=y=y<<24^y>>>8,oe[R]=y=y<<24^y>>>8,jt[c]=T=T<<24^T>>>8,Vt[c]=T=T<<24^T>>>8,Xt[c]=T=T<<24^T>>>8,Yt[c]=T=T<<24^T>>>8,A=n[A]||1}function Ir(f,n){return f.charCodeAt(n)<<24^f.charCodeAt(n+1)<<16^f.charCodeAt(n+2)<<8^f.charCodeAt(n+3)}function Kt(f){if(f instanceof Uint32Array)return f;if(typeof f=="string"){if(f.length%4!==0)for(var n=f.length%4;n<=4;n++)f+="\0x00";for(var o=new Uint32Array(f.length/4),n=0;n>>24]<<24^vt[c>>16&255]<<16^vt[c>>8&255]<<8^vt[c&255],l%o.length===0&&(c=c<<8^c>>>24^s<<24,s=s<<1^(s>>7)*283)),this.encKey[l]=this.encKey[l-o.length]^c;for(var y=0;l;y++,l--)c=this.encKey[y&3?l:l-4],l<=4||y<4?this.decKey[y]=c:this.decKey[y]=jt[vt[c>>>24]]^Vt[vt[c>>16&255]]^Xt[vt[c>>8&255]]^Yt[vt[c&255]]}return f.prototype.encrypt=function(n){for(var o=Kt(n),s=new Uint32Array(4),l=o[0]^this.encKey[0],c=o[1]^this.encKey[1],y=o[2]^this.encKey[2],T=o[3]^this.encKey[3],R=this.encKey.length/4-2,A=4,p,b,S,O=0;O>>24]^ne[c>>16&255]^ie[y>>8&255]^oe[T&255]^this.encKey[A],b=re[c>>>24]^ne[y>>16&255]^ie[T>>8&255]^oe[l&255]^this.encKey[A+1],S=re[y>>>24]^ne[T>>16&255]^ie[l>>8&255]^oe[c&255]^this.encKey[A+2],T=re[T>>>24]^ne[l>>16&255]^ie[c>>8&255]^oe[y&255]^this.encKey[A+3],l=p,c=b,y=S,A+=4;for(var O=0;O<4;O++)s[O]=vt[l>>>24]<<24^vt[c>>16&255]<<16^vt[y>>8&255]<<8^vt[T&255]^this.encKey[A++],p=l,l=c,c=y,y=T,T=p;return s},f.prototype.decrypt=function(n){for(var o=Kt(n),s=new Uint32Array(4),l=o[0]^this.decKey[0],c=o[3]^this.decKey[1],y=o[2]^this.decKey[2],T=o[1]^this.decKey[3],R=this.decKey.length/4-2,A,p,b,S=4,O=0;O>>24]^Vt[c>>16&255]^Xt[y>>8&255]^Yt[T&255]^this.decKey[S],p=jt[c>>>24]^Vt[y>>16&255]^Xt[T>>8&255]^Yt[l&255]^this.decKey[S+1],b=jt[y>>>24]^Vt[T>>16&255]^Xt[l>>8&255]^Yt[c&255]^this.decKey[S+2],T=jt[T>>>24]^Vt[l>>16&255]^Xt[c>>8&255]^Yt[y&255]^this.decKey[S+3],l=A,c=p,y=b,S+=4;for(var O=0;O<4;O++)s[3&-O]=ee[l>>>24]<<24^ee[c>>16&255]<<16^ee[y>>8&255]<<8^ee[T&255]^this.decKey[S++],A=l,l=c,c=y,y=T,T=A;return s},f}(),Mr=function(){function f(n,o,s){s===void 0&&(s=16),this.key=Kt(n),this.iv=Kt(o),this.cipher=new Rr(n),this.blockSize=s/4}return f.prototype.encrypt=function(n,o){for(var s=Kt(n),l=o||new Uint32Array(s.length),c=this.iv.subarray(this.blockSize,this.iv.length),y=this.iv.subarray(0,this.blockSize),T=new Uint32Array(this.blockSize),R=0;R>>2]>>>24-o%4*8&255;return n}function xe(f){const n=_e(f),o=[];for(let s=0,l=n.length;s>>2]|=n[s]<<24-s%4*8;return new Uint32Array(o)}function Qe(f,n,o,s=!0){const c=new Mr(xe(n),xe(o))[s?"encrypt":"decrypt"](xe(f));return Ur(c)}function Or(f,n,o){return Qe(ke(f),n,o,!0)}function Lr(f,n,o){return Qe(f,n,o,!1)}const Nr={8:new Uint8Array(1),16:new Uint16Array(1),32:new Uint32Array(1)};function Cr(f){const n=Nr[f];return crypto.getRandomValues(n),n[0]}function qe(f,n){return Y.randBetween(f,n,()=>Cr(32)/4294967295)}function Ze(f){const n=Y[2];if(f.remainder(n).isZero())return n;const o=Y(1e3);let s,l,c,y,T,R,A;do s=qe(Y.one,f.minus(1));while(s.isZero()||s.eq(f.minus(n)));c=qe(Y.one,f.minus(1)),T=Y.one,R=Y.one;const b=Y("FFFFFFFFFFFFFFFF",16).minus(f).plus(1),S=O=>(O=O.pow(n).mod(f),O=O.add(s),O.lesser(s)&&(O=O.add(b)),O=O.mod(f),O);do{l=c;for(let nt=0;Y(nt).lesser(T);++nt)c=S(c);let O=Y.zero;do{y=c;const nt=Y.min(o,T.minus(O));for(let ut=0;Y(ut).lesser(nt);++ut)c=S(c),R=R.multiply(l.greater(c)?l.minus(c):c.minus(l)).mod(f);A=Y.gcd(R,f),O=O.add(o)}while(O.lesser(T)&&A.eq(Y.one));T=T.shiftLeft(Y.one)}while(A.eq(Y.one));if(A.eq(f))do y=S(y),A=Y.gcd(l.minus(y).abs(),f);while(A.eq(Y.one));return A}function qr(f){const n=gt(f),o=[],s=[];let l=Ze(n);o.push(n.divide(l)),o.push(l);do{const c=o.pop();if(!c.eq(Y.one))if(c.isPrime(!0)){s.push(c);for(let y=0;yl.compare(c)),n.length>2&&(n=[n.splice(n.length-2,1)[0],n.reduce((l,c)=>l.multiply(c),Y.one)]);const o=n[0],s=n[n.length-1];return(o.lesser(s)?[o,s]:[s,o]).map(l=>Rt(l))}const Qt=typeof window<"u"&&"crypto"in window?window.crypto.subtle:self.crypto.subtle;async function Dr(f,n,o){const s=await Qt.importKey("raw",f,{name:"PBKDF2"},!1,["deriveBits"]);return Qt.deriveBits({name:"PBKDF2",salt:n,iterations:o,hash:{name:"SHA-512"}},s,512).then(c=>new Uint8Array(c))}function Fr(f,n){return He(f,Re(n.exponent),Re(n.modulus))}function Kr(f){return Qt.digest("SHA-1",_e(f)).then(n=>new Uint8Array(n))}function zr(f){return Qt.digest("SHA-256",_e(f)).then(n=>new Uint8Array(n))}const me=16;class De{constructor(n,o,s){this.mode=n,this.cryptoKey=o,this.queue=[],this.counter=gt(s)}async update(n){return new Promise(o=>{this.queue.push({data:n,resolve:o}),this.release()})}async release(){if(!this.releasing){for(this.releasing=!0;this.queue.length;){const{data:n,resolve:o}=this.queue.shift();o(await this._update(n))}this.releasing=!1}}async perform(n){return await Qt[this.mode]({name:"AES-CTR",counter:ke(Rt(this.counter),me,!0,!0,!0),length:128},this.cryptoKey,n)}async _update(n){let o=n,s;if(this.leftLength){const A=this.leftLength,p=me-A,b=new Uint8Array(A).concat(o.slice(0,p)),S=await this.perform(b);s=new Uint8Array(S.slice(A)),o=o.slice(p),this.counter=this.counter.add(1)}const l=new Uint8Array(await this.perform(o)),c=s?s.concat(l):l;let y=o.length;const T=y%me;y-=T;const R=y/me;return this.counter=this.counter.add(R),this.leftLength=T||void 0,c}}const Ue=new Map;let Hr=-1;async function Wr({encKey:f,encIv:n,decKey:o,decIv:s}){const l=++Hr,y=[["encrypt",f],["decrypt",o]].map(([S,O])=>Qt.importKey("raw",O,{name:"AES-CTR"},!1,[S])),[T,R]=await Promise.all(y),A=new De("encrypt",T,n.slice()),p=new De("decrypt",R,s.slice()),b={enc:A,dec:p};return Ue.set(l,b),l}async function Gr({id:f,data:n,operation:o}){const s=Ue.get(f);return await(o==="encrypt"?s.enc:s.dec).update(n)}function Jr(f){Ue.delete(f)}console.log("CryptoWorker start");const jr={sha1:Kr,sha256:zr,pbkdf2:Dr,"aes-encrypt":Or,"aes-decrypt":Lr,"rsa-encrypt":Fr,factorize:Zr,"mod-pow":He,gzipUncompress:or,computeSRP:Pr,"generate-dh":Sr,"compute-dh-key":Ar,"get-emojis-fingerprint":_r,"aes-ctr-prepare":Wr,"aes-ctr-process":Gr,"aes-ctr-destroy":Jr};it.addMultipleEventsListeners({invoke:({method:f,args:n})=>jr[f](...n),terminate:()=>{Ft.close()}});typeof MessageChannel<"u"&&sr(it,f=>{const n=new MessageChannel;it.attachPort(n.port1),it.invokeVoid("port",void 0,f,[n.port2])}); //# sourceMappingURL=crypto.worker-CfCshcpI.js.map