(()=>{var EB=Object.create;var lA=Object.defineProperty;var bB=Object.getOwnPropertyDescriptor;var yB=Object.getOwnPropertyNames;var CB=Object.getPrototypeOf,_B=Object.prototype.hasOwnProperty;var ho=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var he=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var DB=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of yB(t))!_B.call(e,i)&&i!==r&&lA(e,i,{get:()=>t[i],enumerable:!(n=bB(t,i))||n.enumerable});return e};var yn=(e,t,r)=>(r=e!=null?EB(CB(e)):{},DB(t||!e||!e.__esModule?lA(r,"default",{value:e,enumerable:!0}):r,e));var dA=he(hA=>{"use strict";(function(e){function t(){}function r(){}var n=String.fromCharCode,i={}.toString,a=i.call(e.SharedArrayBuffer),s=i(),u=e.Uint8Array,l=u||Array,f=u?ArrayBuffer:l,d=f.isView||function(w){return w&&"length"in w},m=i.call(f.prototype);f=r.prototype;var p=e.TextEncoder,h=new(u?Uint16Array:l)(32);t.prototype.decode=function(w){if(!d(w)){var v=i.call(w);if(v!==m&&v!==a&&v!==s)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");w=u?new l(w):w||[]}for(var y=v="",g=0,b=w.length|0,D=b-32|0,_,F,L=0,N=0,S,B=0,O=-1;g>4){case 15:if(S=w[g=g+1|0]&255,S>>6!==2||247>6===2?N+4|0:24,F=F+256&768;case 13:case 12:S=w[g=g+1|0]&255,L<<=6,L|=(F&31)<<6|S&63,N=N+7|0,g>6===2&&L>>N&&1114112>L?(F=L,L=L-65536|0,0<=L&&(O=(L>>10)+55296|0,F=(L&1023)+56320|0,31>B?(h[B]=O,B=B+1|0,O=-1):(S=O,O=F,F=S))):(F>>=8,g=g-F-1|0,F=65533),L=N=0,_=g<=D?32:b-g|0;default:h[B]=F;continue;case 11:case 10:case 9:case 8:}h[B]=65533}if(y+=n(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15],h[16],h[17],h[18],h[19],h[20],h[21],h[22],h[23],h[24],h[25],h[26],h[27],h[28],h[29],h[30],h[31]),32>B&&(y=y.slice(0,B-32|0)),g>>31,O=-1,y.length=_)y[b]=_;else{if(2047>=_)y[b]=192|_>>6;else{e:{if(55296<=_)if(56319>=_){var F=w.charCodeAt(g=g+1|0)|0;if(56320<=F&&57343>=F){if(_=(_<<10)+F-56613888|0,65535<_){y[b]=240|_>>18,y[b=b+1|0]=128|_>>12&63,y[b=b+1|0]=128|_>>6&63,y[b=b+1|0]=128|_&63;continue}break e}_=65533}else 57343>=_&&(_=65533);!D&&g<<1>12,y[b=b+1|0]=128|_>>6&63}y[b=b+1|0]=128|_&63}}return u?y.subarray(0,b):y.slice(0,b)},p||(e.TextDecoder=t,e.TextEncoder=r)})(typeof global>"u"?typeof self>"u"?hA:self:global)});var O1=he(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.isCorrect=bl.isInSubnet=void 0;function YB(e){return this.subnetMask{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});Ns.RE_SUBNET_STRING=Ns.RE_ADDRESS=Ns.GROUPS=Ns.BITS=void 0;Ns.BITS=32;Ns.GROUPS=4;Ns.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;Ns.RE_SUBNET_STRING=/\/\d{1,2}$/});var A0=he(w0=>{"use strict";Object.defineProperty(w0,"__esModule",{value:!0});w0.AddressError=void 0;var N1=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};w0.AddressError=N1});var L1=he((E0,TA)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(R,k,V){R!=null&&(typeof R=="number"?this.fromNumber(R,k,V):k==null&&typeof R!="string"?this.fromString(R,256):this.fromString(R,k))}function i(){return new n(null)}function a(R,k,V,Q,ve,Ee){for(;--Ee>=0;){var Ie=k*this[R++]+V[Q]+ve;ve=Math.floor(Ie/67108864),V[Q++]=Ie&67108863}return ve}function s(R,k,V,Q,ve,Ee){for(var Ie=k&32767,Re=k>>15;--Ee>=0;){var Vt=this[R]&32767,Ar=this[R++]>>15,un=Re*Vt+Ar*Ie;Vt=Ie*Vt+((un&32767)<<15)+V[Q]+(ve&1073741823),ve=(Vt>>>30)+(un>>>15)+Re*Ar+(ve>>>30),V[Q++]=Vt&1073741823}return ve}function u(R,k,V,Q,ve,Ee){for(var Ie=k&16383,Re=k>>14;--Ee>=0;){var Vt=this[R]&16383,Ar=this[R++]>>14,un=Re*Vt+Ar*Ie;Vt=Ie*Vt+((un&16383)<<14)+V[Q]+ve,ve=(Vt>>28)+(un>>14)+Re*Ar,V[Q++]=Vt&268435455}return ve}var l=typeof navigator<"u";l&&r&&navigator.appName=="Microsoft Internet Explorer"?(n.prototype.am=s,e=30):l&&r&&navigator.appName!="Netscape"?(n.prototype.am=a,e=26):(n.prototype.am=u,e=28),n.prototype.DB=e,n.prototype.DM=(1<=0;--k)R[k]=this[k];R.t=this.t,R.s=this.s}function g(R){this.t=1,this.s=R<0?-1:0,R>0?this[0]=R:R<-1?this[0]=R+this.DV:this.t=0}function b(R){var k=i();return k.fromInt(R),k}function D(R,k){var V;if(k==16)V=4;else if(k==8)V=3;else if(k==256)V=8;else if(k==2)V=1;else if(k==32)V=5;else if(k==4)V=2;else{this.fromRadix(R,k);return}this.t=0,this.s=0;for(var Q=R.length,ve=!1,Ee=0;--Q>=0;){var Ie=V==8?R[Q]&255:v(R,Q);if(Ie<0){R.charAt(Q)=="-"&&(ve=!0);continue}ve=!1,Ee==0?this[this.t++]=Ie:Ee+V>this.DB?(this[this.t-1]|=(Ie&(1<>this.DB-Ee):this[this.t-1]|=Ie<=this.DB&&(Ee-=this.DB)}V==8&&R[0]&128&&(this.s=-1,Ee>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==R;)--this.t}function F(R){if(this.s<0)return"-"+this.negate().toString(R);var k;if(R==16)k=4;else if(R==8)k=3;else if(R==2)k=1;else if(R==32)k=5;else if(R==4)k=2;else return this.toRadix(R);var V=(1<0)for(Re>Re)>0&&(ve=!0,Ee=w(Q));Ie>=0;)Re>(Re+=this.DB-k)):(Q=this[Ie]>>(Re-=k)&V,Re<=0&&(Re+=this.DB,--Ie)),Q>0&&(ve=!0),ve&&(Ee+=w(Q));return ve?Ee:"0"}function L(){var R=i();return n.ZERO.subTo(this,R),R}function N(){return this.s<0?this.negate():this}function S(R){var k=this.s-R.s;if(k!=0)return k;var V=this.t;if(k=V-R.t,k!=0)return this.s<0?-k:k;for(;--V>=0;)if((k=this[V]-R[V])!=0)return k;return 0}function B(R){var k=1,V;return(V=R>>>16)!=0&&(R=V,k+=16),(V=R>>8)!=0&&(R=V,k+=8),(V=R>>4)!=0&&(R=V,k+=4),(V=R>>2)!=0&&(R=V,k+=2),(V=R>>1)!=0&&(R=V,k+=1),k}function O(){return this.t<=0?0:this.DB*(this.t-1)+B(this[this.t-1]^this.s&this.DM)}function P(R,k){var V;for(V=this.t-1;V>=0;--V)k[V+R]=this[V];for(V=R-1;V>=0;--V)k[V]=0;k.t=this.t+R,k.s=this.s}function U(R,k){for(var V=R;V=0;--Re)k[Re+Ee+1]=this[Re]>>Q|Ie,Ie=(this[Re]&ve)<=0;--Re)k[Re]=0;k[Ee]=Ie,k.t=this.t+Ee+1,k.s=this.s,k.clamp()}function H(R,k){k.s=this.s;var V=Math.floor(R/this.DB);if(V>=this.t){k.t=0;return}var Q=R%this.DB,ve=this.DB-Q,Ee=(1<>Q;for(var Ie=V+1;Ie>Q;Q>0&&(k[this.t-V-1]|=(this.s&Ee)<>=this.DB;if(R.t>=this.DB;Q+=this.s}else{for(Q+=this.s;V>=this.DB;Q-=R.s}k.s=Q<0?-1:0,Q<-1?k[V++]=this.DV+Q:Q>0&&(k[V++]=Q),k.t=V,k.clamp()}function Y(R,k){var V=this.abs(),Q=R.abs(),ve=V.t;for(k.t=ve+Q.t;--ve>=0;)k[ve]=0;for(ve=0;ve=0;)R[V]=0;for(V=0;V=k.DV&&(R[V+k.t]-=k.DV,R[V+k.t+1]=1)}R.t>0&&(R[R.t-1]+=k.am(V,k[V],R,2*V,0,1)),R.s=0,R.clamp()}function _e(R,k,V){var Q=R.abs();if(!(Q.t<=0)){var ve=this.abs();if(ve.t0?(Q.lShiftTo(Vt,Ee),ve.lShiftTo(Vt,V)):(Q.copyTo(Ee),ve.copyTo(V));var Ar=Ee.t,un=Ee[Ar-1];if(un!=0){var on=un*(1<1?Ee[Ar-2]>>this.F2:0),Ei=this.FV/on,du=(1<=0&&(V[V.t++]=1,V.subTo(Mi,V)),n.ONE.dlShiftTo(Ar,Mi),Mi.subTo(Ee,Ee);Ee.t=0;){var to=V[--ln]==un?this.DM:Math.floor(V[ln]*Ei+(V[ln-1]+kn)*du);if((V[ln]+=Ee.am(0,to,V,pu,0,Ar))0&&V.rShiftTo(Vt,V),Ie<0&&n.ZERO.subTo(V,V)}}}function Fe(R){var k=i();return this.abs().divRemTo(R,null,k),this.s<0&&k.compareTo(n.ZERO)>0&&R.subTo(k,k),k}function $e(R){this.m=R}function et(R){return R.s<0||R.compareTo(this.m)>=0?R.mod(this.m):R}function Qe(R){return R}function at(R){R.divRemTo(this.m,null,R)}function ut(R,k,V){R.multiplyTo(k,V),this.reduce(V)}function Qr(R,k){R.squareTo(k),this.reduce(k)}$e.prototype.convert=et,$e.prototype.revert=Qe,$e.prototype.reduce=at,$e.prototype.mulTo=ut,$e.prototype.sqrTo=Qr;function Qt(){if(this.t<1)return 0;var R=this[0];if(!(R&1))return 0;var k=R&3;return k=k*(2-(R&15)*k)&15,k=k*(2-(R&255)*k)&255,k=k*(2-((R&65535)*k&65535))&65535,k=k*(2-R*k%this.DV)%this.DV,k>0?this.DV-k:-k}function Et(R){this.m=R,this.mp=R.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(k,k),k}function tr(R){var k=i();return R.copyTo(k),this.reduce(k),k}function ct(R){for(;R.t<=this.mt2;)R[R.t++]=0;for(var k=0;k>15)*this.mpl&this.um)<<15)&R.DM;for(V=k+this.m.t,R[V]+=this.m.am(0,Q,R,k,0,this.m.t);R[V]>=R.DV;)R[V]-=R.DV,R[++V]++}R.clamp(),R.drShiftTo(this.m.t,R),R.compareTo(this.m)>=0&&R.subTo(this.m,R)}function Mt(R,k){R.squareTo(k),this.reduce(k)}function tt(R,k,V){R.multiplyTo(k,V),this.reduce(V)}Et.prototype.convert=gr,Et.prototype.revert=tr,Et.prototype.reduce=ct,Et.prototype.mulTo=tt,Et.prototype.sqrTo=Mt;function qe(){return(this.t>0?this[0]&1:this.s)==0}function rr(R,k){if(R>4294967295||R<1)return n.ONE;var V=i(),Q=i(),ve=k.convert(this),Ee=B(R)-1;for(ve.copyTo(V);--Ee>=0;)if(k.sqrTo(V,Q),(R&1<0)k.mulTo(Q,ve,V);else{var Ie=V;V=Q,Q=Ie}return k.revert(V)}function Ue(R,k){var V;return R<256||k.isEven()?V=new $e(k):V=new Et(k),this.exp(R,V)}n.prototype.copyTo=y,n.prototype.fromInt=g,n.prototype.fromString=D,n.prototype.clamp=_,n.prototype.dlShiftTo=P,n.prototype.drShiftTo=U,n.prototype.lShiftTo=G,n.prototype.rShiftTo=H,n.prototype.subTo=K,n.prototype.multiplyTo=Y,n.prototype.squareTo=ie,n.prototype.divRemTo=_e,n.prototype.invDigit=Qt,n.prototype.isEven=qe,n.prototype.exp=rr,n.prototype.toString=F,n.prototype.negate=L,n.prototype.abs=N,n.prototype.compareTo=S,n.prototype.bitLength=O,n.prototype.mod=Fe,n.prototype.modPowInt=Ue,n.ZERO=b(0),n.ONE=b(1);function Pt(){var R=i();return this.copyTo(R),R}function en(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function qt(){return this.t==0?this.s:this[0]<<16>>16}function pt(R){return Math.floor(Math.LN2*this.DB/Math.log(R))}function Br(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ai(R){if(R==null&&(R=10),this.signum()==0||R<2||R>36)return"0";var k=this.chunkSize(R),V=Math.pow(R,k),Q=b(V),ve=i(),Ee=i(),Ie="";for(this.divRemTo(Q,ve,Ee);ve.signum()>0;)Ie=(V+Ee.intValue()).toString(R).substr(1)+Ie,ve.divRemTo(Q,ve,Ee);return Ee.intValue().toString(R)+Ie}function tn(R,k){this.fromInt(0),k==null&&(k=10);for(var V=this.chunkSize(k),Q=Math.pow(k,V),ve=!1,Ee=0,Ie=0,Re=0;Re=V&&(this.dMultiply(Q),this.dAddOffset(Ie,0),Ee=0,Ie=0)}Ee>0&&(this.dMultiply(Math.pow(k,Ee)),this.dAddOffset(Ie,0)),ve&&n.ZERO.subTo(this,this)}function Ct(R,k,V){if(typeof k=="number")if(R<2)this.fromInt(1);else for(this.fromNumber(R,V),this.testBit(R-1)||this.bitwiseTo(n.ONE.shiftLeft(R-1),ge,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(k);)this.dAddOffset(2,0),this.bitLength()>R&&this.subTo(n.ONE.shiftLeft(R-1),this);else{var Q=new Array,ve=R&7;Q.length=(R>>3)+1,k.nextBytes(Q),ve>0?Q[0]&=(1<0)for(V>V)!=(this.s&this.DM)>>V&&(k[ve++]=Q|this.s<=0;)V<8?(Q=(this[R]&(1<>(V+=this.DB-8)):(Q=this[R]>>(V-=8)&255,V<=0&&(V+=this.DB,--R)),Q&128&&(Q|=-256),ve==0&&(this.s&128)!=(Q&128)&&++ve,(ve>0||Q!=this.s)&&(k[ve++]=Q);return k}function De(R){return this.compareTo(R)==0}function mr(R){return this.compareTo(R)<0?this:R}function rn(R){return this.compareTo(R)>0?this:R}function rt(R,k,V){var Q,ve,Ee=Math.min(R.t,this.t);for(Q=0;Q>=16,k+=16),R&255||(R>>=8,k+=8),R&15||(R>>=4,k+=4),R&3||(R>>=2,k+=2),R&1||++k,k}function $t(){for(var R=0;R=this.t?this.s!=0:(this[k]&1<>=this.DB;if(R.t>=this.DB;Q+=this.s}else{for(Q+=this.s;V>=this.DB;Q+=R.s}k.s=Q<0?-1:0,Q>0?k[V++]=Q:Q<-1&&(k[V++]=this.DV+Q),k.t=V,k.clamp()}function ma(R){var k=i();return this.addTo(R,k),k}function re(R){var k=i();return this.subTo(R,k),k}function ce(R){var k=i();return this.multiplyTo(R,k),k}function ke(){var R=i();return this.squareTo(R),R}function Te(R){var k=i();return this.divRemTo(R,k,null),k}function Me(R){var k=i();return this.divRemTo(R,null,k),k}function nt(R){var k=i(),V=i();return this.divRemTo(R,k,V),new Array(k,V)}function ot(R){this[this.t]=this.am(0,R-1,this,0,0,this.t),++this.t,this.clamp()}function Dr(R,k){if(R!=0){for(;this.t<=k;)this[this.t++]=0;for(this[k]+=R;this[k]>=this.DV;)this[k]-=this.DV,++k>=this.t&&(this[this.t++]=0),++this[k]}}function Nt(){}function Xn(R){return R}function Hi(R,k,V){R.multiplyTo(k,V)}function sn(R,k){R.squareTo(k)}Nt.prototype.convert=Xn,Nt.prototype.revert=Xn,Nt.prototype.mulTo=Hi,Nt.prototype.sqrTo=sn;function wn(R){return this.exp(R,new Nt)}function vr(R,k,V){var Q=Math.min(this.t+R.t,k);for(V.s=0,V.t=Q;Q>0;)V[--Q]=0;var ve;for(ve=V.t-this.t;Q=0;)V[Q]=0;for(Q=Math.max(k-this.t,0);Q2*this.m.t)return R.mod(this.m);if(R.compareTo(this.m)<0)return R;var k=i();return R.copyTo(k),this.reduce(k),k}function Bs(R){return R}function $n(R){for(R.drShiftTo(this.m.t-1,this.r2),R.t>this.m.t+1&&(R.t=this.m.t+1,R.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);R.compareTo(this.r2)<0;)R.dAddOffset(1,this.m.t+1);for(R.subTo(this.r2,R);R.compareTo(this.m)>=0;)R.subTo(this.m,R)}function xt(R,k){R.squareTo(k),this.reduce(k)}function wr(R,k,V){R.multiplyTo(k,V),this.reduce(V)}Nr.prototype.convert=Yu,Nr.prototype.revert=Bs,Nr.prototype.reduce=$n,Nr.prototype.mulTo=wr,Nr.prototype.sqrTo=xt;function Xe(R,k){var V=R.bitLength(),Q,ve=b(1),Ee;if(V<=0)return ve;V<18?Q=1:V<48?Q=3:V<144?Q=4:V<768?Q=5:Q=6,V<8?Ee=new $e(k):k.isEven()?Ee=new Nr(k):Ee=new Et(k);var Ie=new Array,Re=3,Vt=Q-1,Ar=(1<1){var un=i();for(Ee.sqrTo(Ie[1],un);Re<=Ar;)Ie[Re]=i(),Ee.mulTo(un,Ie[Re-2],Ie[Re]),Re+=2}var on=R.t-1,Ei,du=!0,kn=i(),ln;for(V=B(R[on])-1;on>=0;){for(V>=Vt?Ei=R[on]>>V-Vt&Ar:(Ei=(R[on]&(1<0&&(Ei|=R[on-1]>>this.DB+V-Vt)),Re=Q;!(Ei&1);)Ei>>=1,--Re;if((V-=Re)<0&&(V+=this.DB,--on),du)Ie[Ei].copyTo(ve),du=!1;else{for(;Re>1;)Ee.sqrTo(ve,kn),Ee.sqrTo(kn,ve),Re-=2;Re>0?Ee.sqrTo(ve,kn):(ln=ve,ve=kn,kn=ln),Ee.mulTo(kn,Ie[Ei],ve)}for(;on>=0&&!(R[on]&1<0&&(k.rShiftTo(Ee,k),V.rShiftTo(Ee,V));k.signum()>0;)(ve=k.getLowestSetBit())>0&&k.rShiftTo(ve,k),(ve=V.getLowestSetBit())>0&&V.rShiftTo(ve,V),k.compareTo(V)>=0?(k.subTo(V,k),k.rShiftTo(1,k)):(V.subTo(k,V),V.rShiftTo(1,V));return Ee>0&&V.lShiftTo(Ee,V),V}function Kr(R){if(R<=0)return 0;var k=this.DV%R,V=this.s<0?R-1:0;if(this.t>0)if(k==0)V=this[0]%R;else for(var Q=this.t-1;Q>=0;--Q)V=(k*V+this[Q])%R;return V}function ir(R){var k=R.isEven();if(this.isEven()&&k||R.signum()==0)return n.ZERO;for(var V=R.clone(),Q=this.clone(),ve=b(1),Ee=b(0),Ie=b(0),Re=b(1);V.signum()!=0;){for(;V.isEven();)V.rShiftTo(1,V),k?((!ve.isEven()||!Ee.isEven())&&(ve.addTo(this,ve),Ee.subTo(R,Ee)),ve.rShiftTo(1,ve)):Ee.isEven()||Ee.subTo(R,Ee),Ee.rShiftTo(1,Ee);for(;Q.isEven();)Q.rShiftTo(1,Q),k?((!Ie.isEven()||!Re.isEven())&&(Ie.addTo(this,Ie),Re.subTo(R,Re)),Ie.rShiftTo(1,Ie)):Re.isEven()||Re.subTo(R,Re),Re.rShiftTo(1,Re);V.compareTo(Q)>=0?(V.subTo(Q,V),k&&ve.subTo(Ie,ve),Ee.subTo(Re,Ee)):(Q.subTo(V,Q),k&&Ie.subTo(ve,Ie),Re.subTo(Ee,Re))}if(Q.compareTo(n.ONE)!=0)return n.ZERO;if(Re.compareTo(R)>=0)return Re.subtract(R);if(Re.signum()<0)Re.addTo(R,Re);else return Re;return Re.signum()<0?Re.add(R):Re}var Lt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Rn=(1<<26)/Lt[Lt.length-1];function Zn(R){var k,V=this.abs();if(V.t==1&&V[0]<=Lt[Lt.length-1]){for(k=0;k>1,R>Lt.length&&(R=Lt.length);for(var ve=i(),Ee=0;Ee>8&255,xr[ur++]^=R>>16&255,xr[ur++]^=R>>24&255,ur>=On&&(ur-=On)}function Wu(){_c(new Date().getTime())}if(xr==null){xr=new Array,ur=0;var zr;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var Xu=new Uint8Array(32);for(window.crypto.getRandomValues(Xu),zr=0;zr<32;++zr)xr[ur++]=Xu[zr]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Go=window.crypto.random(32);for(zr=0;zr>>8,xr[ur++]=zr&255;ur=0,Wu()}function Yo(){if(Tn==null){for(Wu(),Tn=eo(),Tn.init(xr),ur=0;ur{(function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(s){return n(a(s),arguments)}function r(s,u){return t.apply(null,[s].concat(u||[]))}function n(s,u){var l=1,f=s.length,d,m="",p,h,w,v,y,g,b,D;for(p=0;p=0),w.type){case"b":d=parseInt(d,10).toString(2);break;case"c":d=String.fromCharCode(parseInt(d,10));break;case"d":case"i":d=parseInt(d,10);break;case"j":d=JSON.stringify(d,null,w.width?parseInt(w.width):0);break;case"e":d=w.precision?parseFloat(d).toExponential(w.precision):parseFloat(d).toExponential();break;case"f":d=w.precision?parseFloat(d).toFixed(w.precision):parseFloat(d);break;case"g":d=w.precision?String(Number(d.toPrecision(w.precision))):parseFloat(d);break;case"o":d=(parseInt(d,10)>>>0).toString(8);break;case"s":d=String(d),d=w.precision?d.substring(0,w.precision):d;break;case"t":d=String(!!d),d=w.precision?d.substring(0,w.precision):d;break;case"T":d=Object.prototype.toString.call(d).slice(8,-1).toLowerCase(),d=w.precision?d.substring(0,w.precision):d;break;case"u":d=parseInt(d,10)>>>0;break;case"v":d=d.valueOf(),d=w.precision?d.substring(0,w.precision):d;break;case"x":d=(parseInt(d,10)>>>0).toString(16);break;case"X":d=(parseInt(d,10)>>>0).toString(16).toUpperCase();break}e.json.test(w.type)?m+=d:(e.number.test(w.type)&&(!b||w.sign)?(D=b?"+":"-",d=d.toString().replace(e.sign,"")):D="",y=w.pad_char?w.pad_char==="0"?"0":w.pad_char.charAt(1):" ",g=w.width-(D+d).length,v=w.width&&g>0?y.repeat(g):"",m+=w.align?D+d+v:y==="0"?D+v+d:v+D+d)}return m}var i=Object.create(null);function a(s){if(i[s])return i[s];for(var u=s,l,f=[],d=0;u;){if((l=e.text.exec(u))!==null)f.push(l[0]);else if((l=e.modulo.exec(u))!==null)f.push("%");else if((l=e.placeholder.exec(u))!==null){if(l[2]){d|=1;var m=[],p=l[2],h=[];if((h=e.key.exec(p))!==null)for(m.push(h[1]);(p=p.substring(h[0].length))!=="";)if((h=e.key_access.exec(p))!==null)m.push(h[1]);else if((h=e.index_access.exec(p))!==null)m.push(h[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");l[2]=m}else d|=2;if(d===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");f.push({placeholder:l[0],param_no:l[1],keys:l[2],sign:l[3],pad_char:l[4],align:l[5],width:l[6],precision:l[7],type:l[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");u=u.substring(l[0].length)}return i[s]=f}typeof b0<"u"&&(b0.sprintf=t,b0.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var j1=he(Ls=>{"use strict";var XB=Ls&&Ls.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),ZB=Ls&&Ls.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),NA=Ls&&Ls.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&XB(t,e,r);return ZB(t,e),t};Object.defineProperty(Ls,"__esModule",{value:!0});Ls.Address4=void 0;var OA=NA(O1()),ds=NA(k1()),kA=A0(),Xc=L1(),yl=Wc(),U1=class e{constructor(t){this.groups=ds.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=OA.isCorrect(ds.BITS),this.isInSubnet=OA.isInSubnet,this.address=t;let r=ds.RE_SUBNET_STRING.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>ds.BITS)throw new kA.AddressError("Invalid subnet mask.");t=t.replace(ds.RE_SUBNET_STRING,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(!t.match(ds.RE_ADDRESS))throw new kA.AddressError("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromHex(t){let r=t.replace(/:/g,"").padStart(8,"0"),n=[],i;for(i=0;i<8;i+=2){let a=r.slice(i,i+2);n.push(parseInt(a,16))}return new e(n.join("."))}static fromInteger(t){return e.fromHex(t.toString(16))}static fromArpa(t){let n=t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join(".");return new e(n)}toHex(){return this.parsedAddress.map(t=>(0,yl.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r(0,yl.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new Xc.BigInteger(this.mask()+"0".repeat(ds.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new Xc.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new Xc.BigInteger(this.mask()+"1".repeat(ds.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new Xc.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}static fromBigInteger(t){return e.fromInteger(parseInt(t.toString(),10))}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:(0,yl.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(ds.BITS,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(ds.RE_ADDRESS,(0,yl.sprintf)('%s.%s',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};Ls.Address4=U1});var H1=he(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.RE_URL_WITH_PORT=yr.RE_URL=yr.RE_ZONE_STRING=yr.RE_SUBNET_STRING=yr.RE_BAD_ADDRESS=yr.RE_BAD_CHARACTERS=yr.TYPES=yr.SCOPES=yr.GROUPS=yr.BITS=void 0;yr.BITS=128;yr.GROUPS=8;yr.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};yr.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"};yr.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;yr.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;yr.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;yr.RE_ZONE_STRING=/%.*$/;yr.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);yr.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var M1=he(Us=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});Us.simpleGroup=Us.spanLeadingZeroes=Us.spanAll=Us.spanAllZeroes=void 0;var LA=Wc();function UA(e){return e.replace(/(0+)/g,'$1')}Us.spanAllZeroes=UA;function JB(e,t=0){return e.split("").map((n,i)=>(0,LA.sprintf)('%s',n,i+t,UA(n))).join("")}Us.spanAll=JB;function jA(e){return e.replace(/^(0+)/,'$1')}function QB(e){return e.split(":").map(r=>jA(r)).join(":")}Us.spanLeadingZeroes=QB;function e9(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,LA.sprintf)('%s',i+t,jA(n)))}Us.simpleGroup=e9});var HA=he(Yr=>{"use strict";var t9=Yr&&Yr.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),r9=Yr&&Yr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n9=Yr&&Yr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&t9(t,e,r);return r9(t,e),t};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.possibleElisions=Yr.simpleRegularExpression=Yr.ADDRESS_BOUNDARY=Yr.padGroup=Yr.groupPossibilities=void 0;var i9=n9(H1()),Cl=Wc();function C0(e){return(0,Cl.sprintf)("(%s)",e.join("|"))}Yr.groupPossibilities=C0;function y0(e){return e.length<4?(0,Cl.sprintf)("0{0,%d}%s",4-e.length,e):e}Yr.padGroup=y0;Yr.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function s9(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,a)=>{if(a===n){let s=a===0||a===i9.GROUPS-1?":":"";return C0([y0(i),s])}return y0(i)}).join(":"));return r.push(e.map(y0).join(":")),C0(r)}Yr.simpleRegularExpression=s9;function a9(e,t,r){let n=t?"":":",i=r?"":":",a=[];!t&&!r&&a.push("::"),t&&r&&a.push(""),(r&&!t||!r&&t)&&a.push(":"),a.push((0,Cl.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),a.push((0,Cl.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),a.push((0,Cl.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let s=1;s{"use strict";var u9=js&&js.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),o9=js&&js.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),D0=js&&js.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&u9(t,e,r);return o9(t,e),t};Object.defineProperty(js,"__esModule",{value:!0});js.Address6=void 0;var MA=D0(O1()),q1=D0(k1()),er=D0(H1()),V1=D0(M1()),vo=j1(),wo=HA(),Oa=A0(),qn=L1(),Vn=Wc();function _0(e){if(!e)throw new Error("Assertion failed.")}function l9(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function c9(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'$1$2'),e=e.replace(/^(0{1,})(0)$/,'$1$2'),e}function f9(e,t){let r=[],n=[],i;for(i=0;it[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function qA(e){return(0,Vn.sprintf)("%04x",parseInt(e,16))}function VA(e){return e&255}var K1=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=MA.isInSubnet,this.isCorrect=MA.isCorrect(er.BITS),r===void 0?this.groups=er.GROUPS:this.groups=r,this.address=t;let n=er.RE_SUBNET_STRING.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>er.BITS)throw new Oa.AddressError("Invalid subnet mask.");t=t.replace(er.RE_SUBNET_STRING,"")}else if(/\//.test(t))throw new Oa.AddressError("Invalid subnet mask.");let i=er.RE_ZONE_STRING.exec(t);i&&(this.zone=i[0],t=t.replace(er.RE_ZONE_STRING,"")),this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInteger(t){let r=t.toString(16).padStart(32,"0"),n=[],i;for(i=0;i65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new vo.Address4(t),n=er.BITS-(q1.BITS-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.$/,""),n=7;if(r.length!==63)throw new Oa.AddressError("Invalid 'ip6.arpa' form.");let i=r.split(".").reverse();for(let a=n;a>0;a--){let s=a*4;i.splice(s,0,":")}return r=i.join(""),new e(r)}microsoftTranscription(){return(0,Vn.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=er.BITS-this.subnetMask,n=Math.abs(t-er.BITS),i=r-n;return i<0?"0":l9(new qn.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new qn.BigInteger(this.mask()+"0".repeat(er.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new qn.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new qn.BigInteger(this.mask()+"1".repeat(er.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new qn.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=er.SCOPES[this.getBits(12,16).intValue()];return this.getType()==="Global unicast"&&t!=="Link local"&&(t="Global"),t||"Unknown"}getType(){for(let t of Object.keys(er.TYPES))if(this.isInSubnet(new e(t)))return er.TYPES[t];return"Global unicast"}getBits(t,r){return new qn.BigInteger(this.getBitsBase2(t,r),2)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}getBitsBase16(t,r){let n=r-t;if(n%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(t,r).toString(16).padStart(n/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,er.BITS)}reverseForm(t){t||(t={});let r=Math.floor(this.subnetMask/4),n=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?t.omitSuffix?n:(0,Vn.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t0&&(n>1&&i.push([t-n,t-1]),n=0)}n>1&&i.push([this.parsedAddress.length-n,this.parsedAddress.length-1]);let a=i.map(u=>u[1]-u[0]+1);if(i.length>0){let u=a.indexOf(Math.max(...a));r=f9(this.parsedAddress,i[u])}else r=this.parsedAddress;for(t=0;t1?"s":"",r.join("")),t.replace(er.RE_BAD_CHARACTERS,'$1'));let n=t.match(er.RE_BAD_ADDRESS);if(n)throw new Oa.AddressError((0,Vn.sprintf)("Address failed regex: %s",n.join("")),t.replace(er.RE_BAD_ADDRESS,'$1'));let i=[],a=t.split("::");if(a.length===2){let s=a[0].split(":"),u=a[1].split(":");s.length===1&&s[0]===""&&(s=[]),u.length===1&&u[0]===""&&(u=[]);let l=this.groups-(s.length+u.length);if(!l)throw new Oa.AddressError("Error parsing groups");this.elidedGroups=l,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,i=i.concat(s);for(let f=0;f(0,Vn.sprintf)("%x",parseInt(s,16))),i.length!==this.groups)throw new Oa.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(qA).join(":")}decimal(){return this.parsedAddress.map(t=>(0,Vn.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new qn.BigInteger(this.parsedAddress.map(qA).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return vo.Address4.fromHex(new qn.BigInteger(t.slice(96,128).join(""),2).toString(16))}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.address}inspectTeredo(){let t=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new qn.BigInteger("ffff",16)).toString(),n=vo.Address4.fromHex(this.getBitsBase16(32,64)),i=vo.Address4.fromHex(this.getBits(96,128).xor(new qn.BigInteger("ffffffff",16)).toString(16)),a=this.getBits(64,80),s=this.getBitsBase2(64,80),u=a.testBit(15),l=a.testBit(14),f=a.testBit(8),d=a.testBit(9),m=new qn.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:(0,Vn.sprintf)("%s:%s",t.slice(0,4),t.slice(4,8)),server4:n.address,client4:i.address,flags:s,coneNat:u,microsoft:{reserved:l,universalLocal:d,groupIndividual:f,nonce:m},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=vo.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:(0,Vn.sprintf)("%s",t.slice(0,4)),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}toByteArray(){let t=this.bigInteger().toByteArray();return t.length===17&&t[0]===0?t.slice(1):t}toUnsignedByteArray(){return this.toByteArray().map(VA)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(VA))}static fromUnsignedByteArray(t){let r=new qn.BigInteger("256",10),n=new qn.BigInteger("0",10),i=new qn.BigInteger("1",10);for(let a=t.length-1;a>=0;a--)n=n.add(i.multiply(new qn.BigInteger(t[a].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return this.getBitsBase2(0,64)==="1111111010000000000000000000000000000000000000000000000000000000"}isMulticast(){return this.getType()==="Multicast"}is4(){return this.v4}isTeredo(){return this.isInSubnet(new e("2001::/32"))}is6to4(){return this.isInSubnet(new e("2002::/16"))}isLoopback(){return this.getType()==="Loopback"}href(t){return t===void 0?t="":t=(0,Vn.sprintf)(":%s",t),(0,Vn.sprintf)("http://[%s]%s/",this.correctForm(),t)}link(t){t||(t={}),t.className===void 0&&(t.className=""),t.prefix===void 0&&(t.prefix="/#address="),t.v4===void 0&&(t.v4=!1);let r=this.correctForm;return t.v4&&(r=this.to4in6),t.className?(0,Vn.sprintf)('%2$s',t.prefix,r.call(this),t.className):(0,Vn.sprintf)('%2$s',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return V1.simpleGroup(this.address).join(":");_0(typeof this.elidedGroups=="number"),_0(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...V1.simpleGroup(r)):t.push("");let i=["hover-group"];for(let a=this.elisionBegin;a',i.join(" "))),n.length?t.push(...V1.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(_0(this.address4 instanceof vo.Address4),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push((0,wo.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===er.GROUPS)r.push((0,wo.possibleElisions)(er.GROUPS));else{let i=n.address.split("::");i[0].length&&r.push((0,wo.simpleRegularExpression)(i[0].split(":"))),_0(typeof n.elidedGroups=="number"),r.push((0,wo.possibleElisions)(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push((0,wo.simpleRegularExpression)(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",wo.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",wo.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};js.Address6=K1});var zA=he(Sn=>{"use strict";var h9=Sn&&Sn.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),d9=Sn&&Sn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),p9=Sn&&Sn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&h9(t,e,r);return d9(t,e),t};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.v6=Sn.AddressError=Sn.Address6=Sn.Address4=void 0;var g9=j1();Object.defineProperty(Sn,"Address4",{enumerable:!0,get:function(){return g9.Address4}});var m9=KA();Object.defineProperty(Sn,"Address6",{enumerable:!0,get:function(){return m9.Address6}});var v9=A0();Object.defineProperty(Sn,"AddressError",{enumerable:!0,get:function(){return v9.AddressError}});var w9=p9(M1());Sn.v6={helpers:w9}});var Eo=he((RV,Ao)=>{"use strict";function ZA(e){return typeof e>"u"||e===null}function _9(e){return typeof e=="object"&&e!==null}function D9(e){return Array.isArray(e)?e:ZA(e)?[]:[e]}function F9(e,t){var r,n,i,a;if(t)for(a=Object.keys(t),r=0,n=a.length;r{"use strict";function ef(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ef.prototype=Object.create(Error.prototype);ef.prototype.constructor=ef;ef.prototype.toString=function(t){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!t&&this.mark&&(r+=" "+this.mark.toString()),r};JA.exports=ef});var tE=he((OV,eE)=>{"use strict";var QA=Eo();function Y1(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}Y1.prototype.getSnippet=function(t,r){var n,i,a,s,u;if(!this.buffer)return null;for(t=t||4,r=r||75,n="",i=this.position;i>0&&`\0\r \x85\u2028\u2029`.indexOf(this.buffer.charAt(i-1))===-1;)if(i-=1,this.position-i>r/2-1){n=" ... ",i+=5;break}for(a="",s=this.position;sr/2-1){a=" ... ",s-=5;break}return u=this.buffer.slice(i,s),QA.repeat(" ",t)+n+u+a+` `+QA.repeat(" ",t+this.position-i+n.length)+"^"};Y1.prototype.toString=function(t){var r,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),t||(r=this.getSnippet(),r&&(n+=`: `+r)),n};eE.exports=Y1});var jr=he((kV,nE)=>{"use strict";var rE=Sl(),B9=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],x9=["scalar","sequence","mapping"];function P9(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function $9(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(B9.indexOf(r)===-1)throw new rE('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=P9(t.styleAliases||null),x9.indexOf(this.kind)===-1)throw new rE('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}nE.exports=$9});var bo=he((NV,sE)=>{"use strict";var iE=Eo(),P0=Sl(),R9=jr();function W1(e,t,r){var n=[];return e.include.forEach(function(i){r=W1(i,t,r)}),e[t].forEach(function(i){r.forEach(function(a,s){a.tag===i.tag&&a.kind===i.kind&&n.push(s)}),r.push(i)}),r.filter(function(i,a){return n.indexOf(a)===-1})}function T9(){var e={scalar:{},sequence:{},mapping:{},fallback:{}},t,r;function n(i){e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,r=arguments.length;t{"use strict";var O9=jr();aE.exports=new O9("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}})});var lE=he((UV,oE)=>{"use strict";var k9=jr();oE.exports=new k9("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}})});var fE=he((jV,cE)=>{"use strict";var N9=jr();cE.exports=new N9("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}})});var $0=he((HV,hE)=>{"use strict";var L9=bo();hE.exports=new L9({explicit:[uE(),lE(),fE()]})});var pE=he((MV,dE)=>{"use strict";var U9=jr();function j9(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function H9(){return null}function M9(e){return e===null}dE.exports=new U9("tag:yaml.org,2002:null",{kind:"scalar",resolve:j9,construct:H9,predicate:M9,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var mE=he((qV,gE)=>{"use strict";var q9=jr();function V9(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function K9(e){return e==="true"||e==="True"||e==="TRUE"}function z9(e){return Object.prototype.toString.call(e)==="[object Boolean]"}gE.exports=new q9("tag:yaml.org,2002:bool",{kind:"scalar",resolve:V9,construct:K9,predicate:z9,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})});var wE=he((VV,vE)=>{"use strict";var G9=Eo(),Y9=jr();function W9(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function X9(e){return 48<=e&&e<=55}function Z9(e){return 48<=e&&e<=57}function J9(e){if(e===null)return!1;var t=e.length,r=0,n=!1,i;if(!t)return!1;if(i=e[r],(i==="-"||i==="+")&&(i=e[++r]),i==="0"){if(r+1===t)return!0;if(i=e[++r],i==="b"){for(r++;r=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var bE=he((KV,EE)=>{"use strict";var AE=Eo(),t7=jr(),r7=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function n7(e){return!(e===null||!r7.test(e)||e[e.length-1]==="_")}function i7(e){var t,r,n,i;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:t.indexOf(":")>=0?(t.split(":").forEach(function(a){i.unshift(parseFloat(a,10))}),t=0,n=1,i.forEach(function(a){t+=a*n,n*=60}),r*t):r*parseFloat(t,10)}var s7=/^[-+]?[0-9]+e/;function a7(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(AE.isNegativeZero(e))return"-0.0";return r=e.toString(10),s7.test(r)?r.replace("e",".e"):r}function u7(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||AE.isNegativeZero(e))}EE.exports=new t7("tag:yaml.org,2002:float",{kind:"scalar",resolve:n7,construct:i7,predicate:u7,represent:a7,defaultStyle:"lowercase"})});var X1=he((zV,yE)=>{"use strict";var o7=bo();yE.exports=new o7({include:[$0()],implicit:[pE(),mE(),wE(),bE()]})});var Z1=he((GV,CE)=>{"use strict";var l7=bo();CE.exports=new l7({include:[X1()]})});var SE=he((YV,FE)=>{"use strict";var c7=jr(),_E=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),DE=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function f7(e){return e===null?!1:_E.exec(e)!==null||DE.exec(e)!==null}function h7(e){var t,r,n,i,a,s,u,l=0,f=null,d,m,p;if(t=_E.exec(e),t===null&&(t=DE.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(a=+t[4],s=+t[5],u=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(d=+t[10],m=+(t[11]||0),f=(d*60+m)*6e4,t[9]==="-"&&(f=-f)),p=new Date(Date.UTC(r,n,i,a,s,u,l)),f&&p.setTime(p.getTime()-f),p}function d7(e){return e.toISOString()}FE.exports=new c7("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:f7,construct:h7,instanceOf:Date,represent:d7})});var BE=he((WV,IE)=>{"use strict";var p7=jr();function g7(e){return e==="<<"||e===null}IE.exports=new p7("tag:yaml.org,2002:merge",{kind:"scalar",resolve:g7})});var $E=he((XV,PE)=>{"use strict";var yo;try{xE=ho,yo=xE("buffer").Buffer}catch{}var xE,m7=jr(),J1=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= \r`;function v7(e){if(e===null)return!1;var t,r,n=0,i=e.length,a=J1;for(r=0;r64)){if(t<0)return!1;n+=6}return n%8===0}function w7(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,a=J1,s=0,u=[];for(t=0;t>16&255),u.push(s>>8&255),u.push(s&255)),s=s<<6|a.indexOf(n.charAt(t));return r=i%4*6,r===0?(u.push(s>>16&255),u.push(s>>8&255),u.push(s&255)):r===18?(u.push(s>>10&255),u.push(s>>2&255)):r===12&&u.push(s>>4&255),yo?yo.from?yo.from(u):new yo(u):u}function A7(e){var t="",r=0,n,i,a=e.length,s=J1;for(n=0;n>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[n];return i=a%3,i===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):i===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):i===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}function E7(e){return yo&&yo.isBuffer(e)}PE.exports=new m7("tag:yaml.org,2002:binary",{kind:"scalar",resolve:v7,construct:w7,predicate:E7,represent:A7})});var TE=he((JV,RE)=>{"use strict";var b7=jr(),y7=Object.prototype.hasOwnProperty,C7=Object.prototype.toString;function _7(e){if(e===null)return!0;var t=[],r,n,i,a,s,u=e;for(r=0,n=u.length;r{"use strict";var F7=jr(),S7=Object.prototype.toString;function I7(e){if(e===null)return!0;var t,r,n,i,a,s=e;for(a=new Array(s.length),t=0,r=s.length;t{"use strict";var x7=jr(),P7=Object.prototype.hasOwnProperty;function $7(e){if(e===null)return!0;var t,r=e;for(t in r)if(P7.call(r,t)&&r[t]!==null)return!1;return!0}function R7(e){return e!==null?e:{}}NE.exports=new x7("tag:yaml.org,2002:set",{kind:"mapping",resolve:$7,construct:R7})});var Bl=he((tK,UE)=>{"use strict";var T7=bo();UE.exports=new T7({include:[Z1()],implicit:[SE(),BE()],explicit:[$E(),TE(),kE(),LE()]})});var HE=he((rK,jE)=>{"use strict";var O7=jr();function k7(){return!0}function N7(){}function L7(){return""}function U7(e){return typeof e>"u"}jE.exports=new O7("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:k7,construct:N7,predicate:U7,represent:L7})});var qE=he((nK,ME)=>{"use strict";var j7=jr();function H7(e){if(e===null||e.length===0)return!1;var t=e,r=/\/([gim]*)$/.exec(e),n="";return!(t[0]==="/"&&(r&&(n=r[1]),n.length>3||t[t.length-n.length-1]!=="/"))}function M7(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return t[0]==="/"&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)}function q7(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function V7(e){return Object.prototype.toString.call(e)==="[object RegExp]"}ME.exports=new j7("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:H7,construct:M7,predicate:V7,represent:q7})});var zE=he((iK,KE)=>{"use strict";var R0;try{VE=ho,R0=VE("esprima")}catch{typeof window<"u"&&(R0=window.esprima)}var VE,K7=jr();function z7(e){if(e===null)return!1;try{var t="("+e+")",r=R0.parse(t,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function G7(e){var t="("+e+")",r=R0.parse(t,{range:!0}),n=[],i;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(a){n.push(a.name)}),i=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(n,t.slice(i[0]+1,i[1]-1)):new Function(n,"return "+t.slice(i[0],i[1]))}function Y7(e){return e.toString()}function W7(e){return Object.prototype.toString.call(e)==="[object Function]"}KE.exports=new K7("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:z7,construct:G7,predicate:W7,represent:Y7})});var tf=he((aK,YE)=>{"use strict";var GE=bo();YE.exports=GE.DEFAULT=new GE({include:[Bl()],explicit:[HE(),qE(),zE()]})});var db=he((uK,rf)=>{"use strict";var Na=Eo(),tb=Sl(),X7=tE(),rb=Bl(),Z7=tf(),Fu=Object.prototype.hasOwnProperty,T0=1,nb=2,ib=3,O0=4,Q1=1,J7=2,WE=3,Q7=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,ex=/[\x85\u2028\u2029]/,tx=/[,\[\]\{\}]/,sb=/^(?:!|!!|![a-z\-]+!)$/i,ab=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function XE(e){return Object.prototype.toString.call(e)}function Ms(e){return e===10||e===13}function _o(e){return e===9||e===32}function oi(e){return e===9||e===32||e===10||e===13}function xl(e){return e===44||e===91||e===93||e===123||e===125}function rx(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function nx(e){return e===120?2:e===117?4:e===85?8:0}function ix(e){return 48<=e&&e<=57?e-48:-1}function ZE(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?` `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function sx(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var ub=new Array(256),ob=new Array(256);for(Co=0;Co<256;Co++)ub[Co]=ZE(Co)?1:0,ob[Co]=ZE(Co);var Co;function ax(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Z7,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function lb(e,t){return new tb(t,new X7(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function Ge(e,t){throw lb(e,t)}function k0(e,t){e.onWarning&&e.onWarning.call(null,lb(e,t))}var JE={YAML:function(t,r,n){var i,a,s;t.version!==null&&Ge(t,"duplication of %YAML directive"),n.length!==1&&Ge(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Ge(t,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&Ge(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&k0(t,"unsupported YAML version of the document")},TAG:function(t,r,n){var i,a;n.length!==2&&Ge(t,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],sb.test(i)||Ge(t,"ill-formed tag handle (first argument) of the TAG directive"),Fu.call(t.tagMap,i)&&Ge(t,'there is a previously declared suffix for "'+i+'" tag handle'),ab.test(a)||Ge(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[i]=a}};function Du(e,t,r,n){var i,a,s,u;if(t1&&(e.result+=Na.repeat(` `,t-1))}function ux(e,t,r){var n,i,a,s,u,l,f,d,m=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),oi(h)||xl(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),oi(i)||r&&xl(i)))return!1;for(e.kind="scalar",e.result="",a=s=e.position,u=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),oi(i)||r&&xl(i))break}else if(h===35){if(n=e.input.charCodeAt(e.position-1),oi(n))break}else{if(e.position===e.lineStart&&N0(e)||r&&xl(h))break;if(Ms(h))if(l=e.line,f=e.lineStart,d=e.lineIndent,Tr(e,!1,-1),e.lineIndent>=t){u=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=f,e.lineIndent=d;break}}u&&(Du(e,a,s,!1),tg(e,e.line-l),a=s=e.position,u=!1),_o(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return Du(e,a,s,!1),e.result?!0:(e.kind=m,e.result=p,!1)}function ox(e,t){var r,n,i;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(Du(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,i=e.position;else return!0;else Ms(r)?(Du(e,n,i,!0),tg(e,Tr(e,!1,t)),n=i=e.position):e.position===e.lineStart&&N0(e)?Ge(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Ge(e,"unexpected end of the stream within a single quoted scalar")}function lx(e,t){var r,n,i,a,s,u;if(u=e.input.charCodeAt(e.position),u!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(u=e.input.charCodeAt(e.position))!==0;){if(u===34)return Du(e,r,e.position,!0),e.position++,!0;if(u===92){if(Du(e,r,e.position,!0),u=e.input.charCodeAt(++e.position),Ms(u))Tr(e,!1,t);else if(u<256&&ub[u])e.result+=ob[u],e.position++;else if((s=nx(u))>0){for(i=s,a=0;i>0;i--)u=e.input.charCodeAt(++e.position),(s=rx(u))>=0?a=(a<<4)+s:Ge(e,"expected hexadecimal character");e.result+=sx(a),e.position++}else Ge(e,"unknown escape sequence");r=n=e.position}else Ms(u)?(Du(e,r,n,!0),tg(e,Tr(e,!1,t)),r=n=e.position):e.position===e.lineStart&&N0(e)?Ge(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Ge(e,"unexpected end of the stream within a double quoted scalar")}function cx(e,t){var r=!0,n,i=e.tag,a,s=e.anchor,u,l,f,d,m,p={},h,w,v,y;if(y=e.input.charCodeAt(e.position),y===91)l=93,m=!1,a=[];else if(y===123)l=125,m=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),y=e.input.charCodeAt(++e.position);y!==0;){if(Tr(e,!0,t),y=e.input.charCodeAt(e.position),y===l)return e.position++,e.tag=i,e.anchor=s,e.kind=m?"mapping":"sequence",e.result=a,!0;r||Ge(e,"missed comma between flow collection entries"),w=h=v=null,f=d=!1,y===63&&(u=e.input.charCodeAt(e.position+1),oi(u)&&(f=d=!0,e.position++,Tr(e,!0,t))),n=e.line,$l(e,t,T0,!1,!0),w=e.tag,h=e.result,Tr(e,!0,t),y=e.input.charCodeAt(e.position),(d||e.line===n)&&y===58&&(f=!0,y=e.input.charCodeAt(++e.position),Tr(e,!0,t),$l(e,t,T0,!1,!0),v=e.result),m?Pl(e,a,p,w,h,v):f?a.push(Pl(e,null,p,w,h,v)):a.push(h),Tr(e,!0,t),y=e.input.charCodeAt(e.position),y===44?(r=!0,y=e.input.charCodeAt(++e.position)):r=!1}Ge(e,"unexpected end of the stream within a flow collection")}function fx(e,t){var r,n,i=Q1,a=!1,s=!1,u=t,l=0,f=!1,d,m;if(m=e.input.charCodeAt(e.position),m===124)n=!1;else if(m===62)n=!0;else return!1;for(e.kind="scalar",e.result="";m!==0;)if(m=e.input.charCodeAt(++e.position),m===43||m===45)Q1===i?i=m===43?WE:J7:Ge(e,"repeat of a chomping mode identifier");else if((d=ix(m))>=0)d===0?Ge(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Ge(e,"repeat of an indentation width identifier"):(u=t+d-1,s=!0);else break;if(_o(m)){do m=e.input.charCodeAt(++e.position);while(_o(m));if(m===35)do m=e.input.charCodeAt(++e.position);while(!Ms(m)&&m!==0)}for(;m!==0;){for(eg(e),e.lineIndent=0,m=e.input.charCodeAt(e.position);(!s||e.lineIndentu&&(u=e.lineIndent),Ms(m)){l++;continue}if(e.lineIndentt)&&l!==0)Ge(e,"bad indentation of a sequence entry");else if(e.lineIndentt)&&($l(e,t,O0,!0,i)&&(w?p=e.result:h=e.result),w||(Pl(e,f,d,m,p,h,a,s),m=p=h=null),Tr(e,!0,-1),y=e.input.charCodeAt(e.position)),e.lineIndent>t&&y!==0)Ge(e,"bad indentation of a mapping entry");else if(e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndentt?l=1:e.lineIndent===t?l=0:e.lineIndent tag; it should be "scalar", not "'+e.kind+'"'),m=0,p=e.implicitTypes.length;m tag; it should be "'+h.kind+'", not "'+e.kind+'"'),h.resolve(e.result)?(e.result=h.construct(e.result),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Ge(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):Ge(e,"unknown tag !<"+e.tag+">");return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function mx(e){var t=e.position,r,n,i,a=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};(s=e.input.charCodeAt(e.position))!==0&&(Tr(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(a=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!oi(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&Ge(e,"directive name must not be less than one character in length");s!==0;){for(;_o(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Ms(s));break}if(Ms(s))break;for(r=e.position;s!==0&&!oi(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}s!==0&&eg(e),Fu.call(JE,n)?JE[n](e,n,i):k0(e,'unknown document directive "'+n+'"')}if(Tr(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Tr(e,!0,-1)):a&&Ge(e,"directives end mark is expected"),$l(e,e.lineIndent-1,O0,!1,!0),Tr(e,!0,-1),e.checkLineBreaks&&ex.test(e.input.slice(t,e.position))&&k0(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&N0(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Tr(e,!0,-1));return}if(e.position"u"&&(r=t,t=null);var n=cb(e,r);if(typeof t!="function")return n;for(var i=0,a=n.length;i"u"&&(r=t,t=null),fb(e,t,Na.extend({schema:rb},r))}function wx(e,t){return hb(e,Na.extend({schema:rb},t))}rf.exports.loadAll=fb;rf.exports.load=hb;rf.exports.safeLoadAll=vx;rf.exports.safeLoad=wx});var kb=he((oK,sg)=>{"use strict";var sf=Eo(),af=Sl(),Ax=tf(),Ex=Bl(),bb=Object.prototype.toString,yb=Object.prototype.hasOwnProperty,bx=9,nf=10,yx=13,Cx=32,_x=33,Dx=34,Cb=35,Fx=37,Sx=38,Ix=39,Bx=42,_b=44,xx=45,Db=58,Px=61,$x=62,Rx=63,Tx=64,Fb=91,Sb=93,Ox=96,Ib=123,kx=124,Bb=125,In={};In[0]="\\0";In[7]="\\a";In[8]="\\b";In[9]="\\t";In[10]="\\n";In[11]="\\v";In[12]="\\f";In[13]="\\r";In[27]="\\e";In[34]='\\"';In[92]="\\\\";In[133]="\\N";In[160]="\\_";In[8232]="\\L";In[8233]="\\P";var Nx=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function Lx(e,t){var r,n,i,a,s,u,l;if(t===null)return{};for(r={},n=Object.keys(t),i=0,a=n.length;i0?e.charCodeAt(a-1):null,p=p&&mb(s,u)}else{for(a=0;an&&e[m+1]!==" ",m=a);else if(!Rl(s))return L0;u=a>0?e.charCodeAt(a-1):null,p=p&&mb(s,u)}f=f||d&&a-m-1>n&&e[m+1]!==" "}return!l&&!f?p&&!i(e)?Pb:$b:r>9&&xb(e)?L0:f?Tb:Rb}function Vx(e,t,r,n){e.dump=function(){if(t.length===0)return"''";if(!e.noCompatMode&&Nx.indexOf(t)!==-1)return"'"+t+"'";var i=e.indent*Math.max(1,r),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),s=n||e.flowLevel>-1&&r>=e.flowLevel;function u(l){return jx(e,l)}switch(qx(t,s,e.indent,a,u)){case Pb:return t;case $b:return"'"+t.replace(/'/g,"''")+"'";case Rb:return"|"+vb(t,e.indent)+wb(gb(t,i));case Tb:return">"+vb(t,e.indent)+wb(gb(Kx(t,a),i));case L0:return'"'+zx(t,a)+'"';default:throw new af("impossible error: invalid scalar style")}}()}function vb(e,t){var r=xb(e)?String(t):"",n=e[e.length-1]===` `,i=n&&(e[e.length-2]===` `||e===` `),a=i?"+":n?"":"-";return r+a+` `}function wb(e){return e[e.length-1]===` `?e.slice(0,-1):e}function Kx(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var f=e.indexOf(` `);return f=f!==-1?f:e.length,r.lastIndex=f,Ab(e.slice(0,f),t)}(),i=e[0]===` `||e[0]===" ",a,s;s=r.exec(e);){var u=s[1],l=s[2];a=l[0]===" ",n+=u+(!i&&!a&&l!==""?` `:"")+Ab(l,t),i=a}return n}function Ab(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,i=0,a,s=0,u=0,l="";n=r.exec(e);)u=n.index,u-i>t&&(a=s>i?s:u,l+=` `+e.slice(i,a),i=a+1),s=u;return l+=` `,e.length-i>t&&s>i?l+=e.slice(i,s)+` `+e.slice(s+1):l+=e.slice(i),l.slice(1)}function zx(e){for(var t="",r,n,i,a=0;a=55296&&r<=56319&&(n=e.charCodeAt(a+1),n>=56320&&n<=57343)){t+=pb((r-55296)*1024+n-56320+65536),a++;continue}i=In[r],t+=!i&&Rl(r)?e[a]:i||pb(r)}return t}function Gx(e,t,r){var n="",i=e.tag,a,s;for(a=0,s=r.length;a1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Do(e,t,f,!1,!1)&&(d+=e.dump,n+=d));e.tag=i,e.dump="{"+n+"}"}function Xx(e,t,r,n){var i="",a=e.tag,s=Object.keys(r),u,l,f,d,m,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new af("sortKeys must be a boolean or a function");for(u=0,l=s.length;u1024,m&&(e.dump&&nf===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,m&&(p+=rg(e,t)),Do(e,t+1,d,!0,m)&&(e.dump&&nf===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=a,e.dump=i||"{}"}function Eb(e,t,r){var n,i,a,s,u,l;for(i=r?e.explicitTypes:e.implicitTypes,a=0,s=i.length;a tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function Do(e,t,r,n,i,a){e.tag=null,e.dump=r,Eb(e,r,!1)||Eb(e,r,!0);var s=bb.call(e.dump);n&&(n=e.flowLevel<0||e.flowLevel>t);var u=s==="[object Object]"||s==="[object Array]",l,f;if(u&&(l=e.duplicates.indexOf(r),f=l!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[l])e.dump="*ref_"+l;else{if(u&&f&&!e.usedDuplicates[l]&&(e.usedDuplicates[l]=!0),s==="[object Object]")n&&Object.keys(e.dump).length!==0?(Xx(e,t,e.dump,i),f&&(e.dump="&ref_"+l+e.dump)):(Wx(e,t,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump));else if(s==="[object Array]"){var d=e.noArrayIndent&&t>0?t-1:t;n&&e.dump.length!==0?(Yx(e,d,e.dump,i),f&&(e.dump="&ref_"+l+e.dump)):(Gx(e,d,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump))}else if(s==="[object String]")e.tag!=="?"&&Vx(e,e.dump,t,a);else{if(e.skipInvalid)return!1;throw new af("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function Zx(e,t){var r=[],n=[],i,a;for(ng(e,r,n),i=0,a=n.length;i{"use strict";var U0=db(),Nb=kb();function j0(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}Cr.exports.Type=jr();Cr.exports.Schema=bo();Cr.exports.FAILSAFE_SCHEMA=$0();Cr.exports.JSON_SCHEMA=X1();Cr.exports.CORE_SCHEMA=Z1();Cr.exports.DEFAULT_SAFE_SCHEMA=Bl();Cr.exports.DEFAULT_FULL_SCHEMA=tf();Cr.exports.load=U0.load;Cr.exports.loadAll=U0.loadAll;Cr.exports.safeLoad=U0.safeLoad;Cr.exports.safeLoadAll=U0.safeLoadAll;Cr.exports.dump=Nb.dump;Cr.exports.safeDump=Nb.safeDump;Cr.exports.YAMLException=Sl();Cr.exports.MINIMAL_SCHEMA=$0();Cr.exports.SAFE_SCHEMA=Bl();Cr.exports.DEFAULT_SCHEMA=tf();Cr.exports.scan=j0("scan");Cr.exports.parse=j0("parse");Cr.exports.compose=j0("compose");Cr.exports.addConstructor=j0("addConstructor")});var jb=he((cK,Ub)=>{"use strict";var Qx=Lb();Ub.exports=Qx});var Mb=he((fK,Hb)=>{"use strict";var H0=jb();Hb.exports={safeLoad:H0.safeLoad,load:H0.load,safeDump:H0.safeDump,dump:H0.dump}});var Yb=he(q0=>{"use strict";q0.byteLength=oP;q0.toByteArray=cP;q0.fromByteArray=dP;var Vs=[],Xi=[],uP=typeof Uint8Array<"u"?Uint8Array:Array,ag="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Fo=0,zb=ag.length;Fo0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function oP(e){var t=Gb(e),r=t[0],n=t[1];return(r+n)*3/4-n}function lP(e,t,r){return(t+r)*3/4-r}function cP(e){var t,r=Gb(e),n=r[0],i=r[1],a=new uP(lP(e,n,i)),s=0,u=i>0?n-4:n,l;for(l=0;l>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Xi[e.charCodeAt(l)]<<2|Xi[e.charCodeAt(l+1)]>>4,a[s++]=t&255),i===1&&(t=Xi[e.charCodeAt(l)]<<10|Xi[e.charCodeAt(l+1)]<<4|Xi[e.charCodeAt(l+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function fP(e){return Vs[e>>18&63]+Vs[e>>12&63]+Vs[e>>6&63]+Vs[e&63]}function hP(e,t,r){for(var n,i=[],a=t;au?u:s+a));return n===1?(t=e[r-1],i.push(Vs[t>>2]+Vs[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Vs[t>>10]+Vs[t>>4&63]+Vs[t<<2&63]+"=")),i.join("")}});var Wb=he(ug=>{ug.read=function(e,t,r,n,i){var a,s,u=i*8-n-1,l=(1<>1,d=-7,m=r?i-1:0,p=r?-1:1,h=e[t+m];for(m+=p,a=h&(1<<-d)-1,h>>=-d,d+=u;d>0;a=a*256+e[t+m],m+=p,d-=8);for(s=a&(1<<-d)-1,a>>=-d,d+=n;d>0;s=s*256+e[t+m],m+=p,d-=8);if(a===0)a=1-f;else{if(a===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),a=a-f}return(h?-1:1)*s*Math.pow(2,a-n)};ug.write=function(e,t,r,n,i,a){var s,u,l,f=a*8-i-1,d=(1<>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,w=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+m>=1?t+=p/l:t+=p*Math.pow(2,1-m),t*l>=2&&(s++,l/=2),s+m>=d?(u=0,s=d):s+m>=1?(u=(t*l-1)*Math.pow(2,i),s=s+m):(u=t*Math.pow(2,m-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=u&255,h+=w,u/=256,i-=8);for(s=s<0;e[r+h]=s&255,h+=w,s/=256,f-=8);e[r+h-w]|=v*128}});var z0=he(Nl=>{"use strict";var og=Yb(),Ol=Wb(),Xb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Nl.Buffer=de;Nl.SlowBuffer=AP;Nl.INSPECT_MAX_BYTES=50;var V0=2147483647;Nl.kMaxLength=V0;de.TYPED_ARRAY_SUPPORT=pP();!de.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function pP(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(de.prototype,"parent",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.buffer}});Object.defineProperty(de.prototype,"offset",{enumerable:!0,get:function(){if(de.isBuffer(this))return this.byteOffset}});function La(e){if(e>V0)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,de.prototype),t}function de(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return hg(e)}return ey(e,t,r)}de.poolSize=8192;function ey(e,t,r){if(typeof e=="string")return mP(e,t);if(ArrayBuffer.isView(e))return vP(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Ks(e,ArrayBuffer)||e&&Ks(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ks(e,SharedArrayBuffer)||e&&Ks(e.buffer,SharedArrayBuffer)))return cg(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return de.from(n,t,r);let i=wP(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return de.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}de.from=function(e,t,r){return ey(e,t,r)};Object.setPrototypeOf(de.prototype,Uint8Array.prototype);Object.setPrototypeOf(de,Uint8Array);function ty(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function gP(e,t,r){return ty(e),e<=0?La(e):t!==void 0?typeof r=="string"?La(e).fill(t,r):La(e).fill(t):La(e)}de.alloc=function(e,t,r){return gP(e,t,r)};function hg(e){return ty(e),La(e<0?0:dg(e)|0)}de.allocUnsafe=function(e){return hg(e)};de.allocUnsafeSlow=function(e){return hg(e)};function mP(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!de.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=ry(e,t)|0,n=La(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function lg(e){let t=e.length<0?0:dg(e.length)|0,r=La(t);for(let n=0;n=V0)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+V0.toString(16)+" bytes");return e|0}function AP(e){return+e!=e&&(e=0),de.alloc(+e)}de.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==de.prototype};de.compare=function(t,r){if(Ks(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),Ks(r,Uint8Array)&&(r=de.from(r,r.offset,r.byteLength)),!de.isBuffer(t)||!de.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let a=0,s=Math.min(n,i);ai.length?(de.isBuffer(s)||(s=de.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(de.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function ry(e,t){if(de.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Ks(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return fg(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fy(e).length;default:if(i)return n?-1:fg(e).length;t=(""+t).toLowerCase(),i=!0}}de.byteLength=ry;function EP(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return xP(this,t,r);case"utf8":case"utf-8":return iy(this,t,r);case"ascii":return IP(this,t,r);case"latin1":case"binary":return BP(this,t,r);case"base64":return FP(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return PP(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}de.prototype._isBuffer=!0;function So(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}de.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(t+=" ... "),""};Xb&&(de.prototype[Xb]=de.prototype.inspect);de.prototype.compare=function(t,r,n,i,a){if(Ks(t,Uint8Array)&&(t=de.from(t,t.offset,t.byteLength)),!de.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),r<0||n>t.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&r>=n)return 0;if(i>=a)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,a>>>=0,this===t)return 0;let s=a-i,u=n-r,l=Math.min(s,u),f=this.slice(i,a),d=t.slice(r,n);for(let m=0;m2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,gg(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=de.from(t,n)),de.isBuffer(t))return t.length===0?-1:Zb(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Zb(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Zb(e,t,r,n,i){let a=1,s=e.length,u=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function l(d,m){return a===1?d[m]:d.readUInt16BE(m*a)}let f;if(i){let d=-1;for(f=r;fs&&(r=s-u),f=r;f>=0;f--){let d=!0;for(let m=0;mi&&(n=i)):n=i;let a=t.length;n>a/2&&(n=a/2);let s;for(s=0;s>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-r;if((n===void 0||n>a)&&(n=a),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return bP(this,t,r,n);case"utf8":case"utf-8":return yP(this,t,r,n);case"ascii":case"latin1":case"binary":return CP(this,t,r,n);case"base64":return _P(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return DP(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};de.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function FP(e,t,r){return t===0&&r===e.length?og.fromByteArray(e):og.fromByteArray(e.slice(t,r))}function iy(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i239?4:a>223?3:a>191?2:1;if(i+u<=r){let l,f,d,m;switch(u){case 1:a<128&&(s=a);break;case 2:l=e[i+1],(l&192)===128&&(m=(a&31)<<6|l&63,m>127&&(s=m));break;case 3:l=e[i+1],f=e[i+2],(l&192)===128&&(f&192)===128&&(m=(a&15)<<12|(l&63)<<6|f&63,m>2047&&(m<55296||m>57343)&&(s=m));break;case 4:l=e[i+1],f=e[i+2],d=e[i+3],(l&192)===128&&(f&192)===128&&(d&192)===128&&(m=(a&15)<<18|(l&63)<<12|(f&63)<<6|d&63,m>65535&&m<1114112&&(s=m))}}s===null?(s=65533,u=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=u}return SP(n)}var Jb=4096;function SP(e){let t=e.length;if(t<=Jb)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn)&&(r=n);let i="";for(let a=t;an&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}de.prototype.readUintLE=de.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Xr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s>>0,r=r>>>0,n||Xr(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i};de.prototype.readUint8=de.prototype.readUInt8=function(t,r){return t=t>>>0,r||Xr(t,1,this.length),this[t]};de.prototype.readUint16LE=de.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Xr(t,2,this.length),this[t]|this[t+1]<<8};de.prototype.readUint16BE=de.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Xr(t,2,this.length),this[t]<<8|this[t+1]};de.prototype.readUint32LE=de.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Xr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};de.prototype.readUint32BE=de.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Xr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};de.prototype.readBigUInt64LE=Su(function(t){t=t>>>0,kl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&lf(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,a=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(a)<>>0,kl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&lf(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],a=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Xr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*r)),i};de.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Xr(t,r,this.length);let i=r,a=1,s=this[t+--i];for(;i>0&&(a*=256);)s+=this[t+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*r)),s};de.prototype.readInt8=function(t,r){return t=t>>>0,r||Xr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};de.prototype.readInt16LE=function(t,r){t=t>>>0,r||Xr(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};de.prototype.readInt16BE=function(t,r){t=t>>>0,r||Xr(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};de.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Xr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};de.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Xr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};de.prototype.readBigInt64LE=Su(function(t){t=t>>>0,kl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&lf(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<>>0,kl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&lf(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<>>0,r||Xr(t,4,this.length),Ol.read(this,t,!0,23,4)};de.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Xr(t,4,this.length),Ol.read(this,t,!1,23,4)};de.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Xr(t,8,this.length),Ol.read(this,t,!0,52,8)};de.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Xr(t,8,this.length),Ol.read(this,t,!1,52,8)};function li(e,t,r,n,i,a){if(!de.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}de.prototype.writeUintLE=de.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;li(this,t,r,n,u,0)}let a=1,s=0;for(this[r]=t&255;++s>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;li(this,t,r,n,u,0)}let a=n-1,s=1;for(this[r+a]=t&255;--a>=0&&(s*=256);)this[r+a]=t/s&255;return r+n};de.prototype.writeUint8=de.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,1,255,0),this[r]=t&255,r+1};de.prototype.writeUint16LE=de.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};de.prototype.writeUint16BE=de.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};de.prototype.writeUint32LE=de.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};de.prototype.writeUint32BE=de.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function sy(e,t,r,n,i){cy(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a,a=a>>8,e[r++]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function ay(e,t,r,n,i){cy(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a=a>>8,e[r+6]=a,a=a>>8,e[r+5]=a,a=a>>8,e[r+4]=a;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}de.prototype.writeBigUInt64LE=Su(function(t,r=0){return sy(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});de.prototype.writeBigUInt64BE=Su(function(t,r=0){return ay(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});de.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);li(this,t,r,n,l-1,-l)}let a=0,s=1,u=0;for(this[r]=t&255;++a>0)-u&255;return r+n};de.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);li(this,t,r,n,l-1,-l)}let a=n-1,s=1,u=0;for(this[r+a]=t&255;--a>=0&&(s*=256);)t<0&&u===0&&this[r+a+1]!==0&&(u=1),this[r+a]=(t/s>>0)-u&255;return r+n};de.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};de.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};de.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};de.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};de.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||li(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};de.prototype.writeBigInt64LE=Su(function(t,r=0){return sy(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});de.prototype.writeBigInt64BE=Su(function(t,r=0){return ay(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function uy(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function oy(e,t,r,n,i){return t=+t,r=r>>>0,i||uy(e,t,r,4,34028234663852886e22,-34028234663852886e22),Ol.write(e,t,r,n,23,4),r+4}de.prototype.writeFloatLE=function(t,r,n){return oy(this,t,r,!0,n)};de.prototype.writeFloatBE=function(t,r,n){return oy(this,t,r,!1,n)};function ly(e,t,r,n,i){return t=+t,r=r>>>0,i||uy(e,t,r,8,17976931348623157e292,-17976931348623157e292),Ol.write(e,t,r,n,52,8),r+8}de.prototype.writeDoubleLE=function(t,r,n){return ly(this,t,r,!0,n)};de.prototype.writeDoubleBE=function(t,r,n){return ly(this,t,r,!1,n)};de.prototype.copy=function(t,r,n,i){if(!de.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let a;if(typeof t=="number")for(a=r;a2**32?i=Qb(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Qb(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function Qb(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function $P(e,t,r){kl(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&lf(t,e.length-(r+1))}function cy(e,t,r,n,i,a){if(e>r||e3?t===0||t===BigInt(0)?u=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:u=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:u=`>= ${t}${s} and <= ${r}${s}`,new Tl.ERR_OUT_OF_RANGE("value",u,e)}$P(n,i,a)}function kl(e,t){if(typeof e!="number")throw new Tl.ERR_INVALID_ARG_TYPE(t,"number",e)}function lf(e,t,r){throw Math.floor(e)!==e?(kl(e,r),new Tl.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new Tl.ERR_BUFFER_OUT_OF_BOUNDS:new Tl.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var RP=/[^+/0-9A-Za-z-_]/g;function TP(e){if(e=e.split("=")[0],e=e.trim().replace(RP,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function fg(e,t){t=t||1/0;let r,n=e.length,i=null,a=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return a}function OP(e){let t=[];for(let r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function fy(e){return og.toByteArray(TP(e))}function K0(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Ks(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function gg(e){return e!==e}var NP=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Su(e){return typeof BigInt>"u"?LP:e}function LP(){throw new Error("BigInt not supported")}});var Oy=he(Ce=>{var cf={};cf.userAgent=!1;var Ll={},UP="11.1.0",jP="jsrsasign(all) 11.1.0 (2024-02-01) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var Se=Se||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function h(){}return{extend:function(w){h.prototype=this;var v=new h;return w&&v.mixIn(w),v.hasOwnProperty("init")||(v.init=function(){v.$super.init.apply(this,arguments)}),v.init.prototype=v,v.$super=this,v},create:function(){var w=this.extend();return w.init.apply(w,arguments),w},init:function(){},mixIn:function(w){for(var v in w)w.hasOwnProperty(v)&&(this[v]=w[v]);w.hasOwnProperty("toString")&&(this.toString=w.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),a=n.WordArray=i.extend({init:function(h,w){h=this.words=h||[],w!=t?this.sigBytes=w:this.sigBytes=h.length*4},toString:function(h){return(h||u).stringify(this)},concat:function(h){var w=this.words,v=h.words,y=this.sigBytes,g=h.sigBytes;if(this.clamp(),y%4)for(var b=0;b>>2]>>>24-b%4*8&255;w[y+b>>>2]|=D<<24-(y+b)%4*8}else for(var b=0;b>>2]=v[b>>>2];return this.sigBytes+=g,this},clamp:function(){var h=this.words,w=this.sigBytes;h[w>>>2]&=4294967295<<32-w%4*8,h.length=e.ceil(w/4)},clone:function(){var h=i.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var w=[],v=0;v>>2]>>>24-g%4*8&255;y.push((b>>>4).toString(16)),y.push((b&15).toString(16))}return y.join("")},parse:function(h){for(var w=h.length,v=[],y=0;y>>3]|=parseInt(h.substr(y,2),16)<<24-y%8*4;return new a.init(v,w/2)}},l=s.Latin1={stringify:function(h){for(var w=h.words,v=h.sigBytes,y=[],g=0;g>>2]>>>24-g%4*8&255;y.push(String.fromCharCode(b))}return y.join("")},parse:function(h){for(var w=h.length,v=[],y=0;y>>2]|=(h.charCodeAt(y)&255)<<24-y%4*8;return new a.init(v,w)}},f=s.Utf8={stringify:function(h){try{return decodeURIComponent(escape(l.stringify(h)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(h){return l.parse(unescape(encodeURIComponent(h)))}},d=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(h){typeof h=="string"&&(h=f.parse(h)),this._data.concat(h),this._nDataBytes+=h.sigBytes},_process:function(h){var w=this._data,v=w.words,y=w.sigBytes,g=this.blockSize,b=g*4,D=y/b;h?D=e.ceil(D):D=e.max((D|0)-this._minBufferSize,0);var _=D*g,F=e.min(_*4,y);if(_){for(var L=0;L<_;L+=g)this._doProcessBlock(v,L);var N=v.splice(0,_);w.sigBytes-=F}return new a.init(N,F)},clone:function(){var h=i.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0}),m=n.Hasher=d.extend({cfg:i.extend(),init:function(h){this.cfg=this.cfg.extend(h),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(h){return this._append(h),this._process(),this},finalize:function(h){h&&this._append(h);var w=this._doFinalize();return w},blockSize:512/32,_createHelper:function(h){return function(w,v){return new h.init(v).finalize(w)}},_createHmacHelper:function(h){return function(w,v){return new p.HMAC.init(h,v).finalize(w)}}}),p=r.algo={};return r}(Math);(function(e){var i=Se,t=i.lib,r=t.Base,n=t.WordArray,i=i.x64={};i.Word=r.extend({init:function(a,s){this.high=a,this.low=s}}),i.WordArray=r.extend({init:function(a,s){a=this.words=a||[],this.sigBytes=s!=e?s:8*a.length},toX32:function(){for(var a=this.words,s=a.length,u=[],l=0;l>>2]&255}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:m,padding:f}),reset:function(){u.reset.call(this);var y=this.cfg,v=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var g=y.createEncryptor;else g=y.createDecryptor,this._minBufferSize=1;this._mode=g.call(y,this,v&&v.words)},_doProcessBlock:function(v,y){this._mode.processBlock(v,y)},_doFinalize:function(){var v=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){v.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),v.unpad(y);return y},blockSize:4});var d=t.CipherParams=r.extend({init:function(v){this.mixIn(v)},toString:function(v){return(v||this.formatter).stringify(this)}}),m=(h.format={}).OpenSSL={stringify:function(v){var y=v.ciphertext;return v=v.salt,(v?n.create([1398893684,1701076831]).concat(v).concat(y):y).toString(a)},parse:function(v){v=a.parse(v);var y=v.words;if(y[0]==1398893684&&y[1]==1701076831){var g=n.create(y.slice(2,4));y.splice(0,4),v.sigBytes-=16}return d.create({ciphertext:v,salt:g})}},p=t.SerializableCipher=r.extend({cfg:r.extend({format:m}),encrypt:function(v,y,g,b){b=this.cfg.extend(b);var D=v.createEncryptor(g,b);return y=D.finalize(y),D=D.cfg,d.create({ciphertext:y,key:g,iv:D.iv,algorithm:v,mode:D.mode,padding:D.padding,blockSize:v.blockSize,formatter:b.format})},decrypt:function(v,y,g,b){return b=this.cfg.extend(b),y=this._parse(y,b.format),v.createDecryptor(g,b).finalize(y.ciphertext)},_parse:function(v,y){return typeof v=="string"?y.parse(v,this):v}}),h=(h.kdf={}).OpenSSL={execute:function(v,y,g,b){return b||(b=n.random(8)),v=s.create({keySize:y+g}).compute(v,b),g=n.create(v.words.slice(y),4*g),v.sigBytes=4*y,d.create({key:v,iv:g,salt:b})}},w=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),encrypt:function(v,y,g,b){return b=this.cfg.extend(b),g=b.kdf.execute(g,v.keySize,v.ivSize),b.iv=g.iv,v=p.encrypt.call(this,v,y,g.key,b),v.mixIn(g),v},decrypt:function(v,y,g,b){return b=this.cfg.extend(b),y=this._parse(y,b.format),g=b.kdf.execute(g,v.keySize,v.ivSize,y.salt),b.iv=g.iv,p.decrypt.call(this,v,y,g.key,b)}})}();(function(){for(var e=Se,t=e.lib.BlockCipher,L=e.algo,r=[],n=[],i=[],a=[],s=[],u=[],l=[],f=[],d=[],m=[],p=[],h=0;256>h;h++)p[h]=128>h?h<<1:h<<1^283;for(var w=0,v=0,h=0;256>h;h++){var y=v^v<<1^v<<2^v<<3^v<<4,y=y>>>8^y&255^99;r[w]=y,n[y]=w;var g=p[w],b=p[g],D=p[b],_=257*p[y]^16843008*y;i[w]=_<<24|_>>>8,a[w]=_<<16|_>>>16,s[w]=_<<8|_>>>24,u[w]=_,_=16843009*D^65537*b^257*g^16843008*w,l[y]=_<<24|_>>>8,f[y]=_<<16|_>>>16,d[y]=_<<8|_>>>24,m[y]=_,w?(w=g^p[p[p[D^g]]],v^=p[p[v]]):w=v=1}var F=[0,1,2,4,8,16,32,64,128,27,54],L=L.AES=t.extend({_doReset:function(){for(var B=this._key,N=B.words,S=B.sigBytes/4,B=4*((this._nRounds=S+6)+1),O=this._keySchedule=[],P=0;P>>24]<<24|r[U>>>16&255]<<16|r[U>>>8&255]<<8|r[U&255]):(U=U<<8|U>>>24,U=r[U>>>24]<<24|r[U>>>16&255]<<16|r[U>>>8&255]<<8|r[U&255],U^=F[P/S|0]<<24),O[P]=O[P-S]^U}for(N=this._invKeySchedule=[],S=0;SS||4>=P?U:l[r[U>>>24]]^f[r[U>>>16&255]]^d[r[U>>>8&255]]^m[r[U&255]]},encryptBlock:function(N,S){this._doCryptBlock(N,S,this._keySchedule,i,a,s,u,r)},decryptBlock:function(N,S){var B=N[S+1];N[S+1]=N[S+3],N[S+3]=B,this._doCryptBlock(N,S,this._invKeySchedule,l,f,d,m,n),B=N[S+1],N[S+1]=N[S+3],N[S+3]=B},_doCryptBlock:function(N,S,B,O,P,U,G,H){for(var K=this._nRounds,Qe=N[S]^B[0],at=N[S+1]^B[1],ut=N[S+2]^B[2],et=N[S+3]^B[3],Y=4,ie=1;ie>>24]^P[at>>>16&255]^U[ut>>>8&255]^G[et&255]^B[Y++],Fe=O[at>>>24]^P[ut>>>16&255]^U[et>>>8&255]^G[Qe&255]^B[Y++],$e=O[ut>>>24]^P[et>>>16&255]^U[Qe>>>8&255]^G[at&255]^B[Y++],et=O[et>>>24]^P[Qe>>>16&255]^U[at>>>8&255]^G[ut&255]^B[Y++],Qe=_e,at=Fe,ut=$e;_e=(H[Qe>>>24]<<24|H[at>>>16&255]<<16|H[ut>>>8&255]<<8|H[et&255])^B[Y++],Fe=(H[at>>>24]<<24|H[ut>>>16&255]<<16|H[et>>>8&255]<<8|H[Qe&255])^B[Y++],$e=(H[ut>>>24]<<24|H[et>>>16&255]<<16|H[Qe>>>8&255]<<8|H[at&255])^B[Y++],et=(H[et>>>24]<<24|H[Qe>>>16&255]<<16|H[at>>>8&255]<<8|H[ut&255])^B[Y++],N[S]=_e,N[S+1]=Fe,N[S+2]=$e,N[S+3]=et},keySize:8});e.AES=t._createHelper(L)})();(function(){function e(p,h){var w=(this._lBlock>>>p^this._rBlock)&h;this._rBlock^=w,this._lBlock^=w<>>p^this._lBlock)&h;this._lBlock^=w,this._rBlock^=w<w;w++){var v=s[w]-1;h[w]=p[v>>>5]>>>31-v%32&1}for(p=this._subKeys=[],v=0;16>v;v++){for(var y=p[v]=[],g=l[v],w=0;24>w;w++)y[w/6|0]|=h[(u[w]-1+g)%28]<<31-w%6,y[4+(w/6|0)]|=h[28+(u[w+24]-1+g)%28]<<31-w%6;for(y[0]=y[0]<<1|y[0]>>>31,w=1;7>w;w++)y[w]>>>=4*(w-1)+3;y[7]=y[7]<<5|y[7]>>>27}for(h=this._invSubKeys=[],w=0;16>w;w++)h[w]=p[15-w]},encryptBlock:function(p,h){this._doCryptBlock(p,h,this._subKeys)},decryptBlock:function(p,h){this._doCryptBlock(p,h,this._invSubKeys)},_doCryptBlock:function(p,h,w){this._lBlock=p[h],this._rBlock=p[h+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var v=0;16>v;v++){for(var y=w[v],g=this._lBlock,b=this._rBlock,D=0,_=0;8>_;_++)D|=f[_][((b^y[_])&d[_])>>>0];this._lBlock=b,this._rBlock=g^D}w=this._lBlock,this._lBlock=this._rBlock,this._rBlock=w,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),p[h]=this._lBlock,p[h+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(m),a=a.TripleDES=i.extend({_doReset:function(){var p=this._key.words;this._des1=m.createEncryptor(n.create(p.slice(0,2))),this._des2=m.createEncryptor(n.create(p.slice(2,4))),this._des3=m.createEncryptor(n.create(p.slice(4,6)))},encryptBlock:function(p,h){this._des1.encryptBlock(p,h),this._des2.decryptBlock(p,h),this._des3.encryptBlock(p,h)},decryptBlock:function(p,h){this._des3.decryptBlock(p,h),this._des2.encryptBlock(p,h),this._des1.decryptBlock(p,h)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(a)})();(function(){var e=Se,t=e.lib.WordArray;e.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,a=this._map;r.clamp(),r=[];for(var s=0;s>>2]>>>24-8*(s%4)&255)<<16|(n[s+1>>>2]>>>24-8*((s+1)%4)&255)<<8|n[s+2>>>2]>>>24-8*((s+2)%4)&255,l=0;4>l&&s+.75*l>>6*(3-l)&63));if(n=a.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,a=i.charAt(64);a&&(a=r.indexOf(a),a!=-1&&(n=a));for(var a=[],s=0,u=0;u>>6-2*(u%4);a[s>>>2]|=(l|f)<<24-8*(s%4),s++}return t.create(a,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(e){function t(m,p,h,w,v,y,g){return m=m+(p&h|~p&w)+v+g,(m<>>32-y)+p}function r(m,p,h,w,v,y,g){return m=m+(p&w|h&~w)+v+g,(m<>>32-y)+p}function n(m,p,h,w,v,y,g){return m=m+(p^h^w)+v+g,(m<>>32-y)+p}function i(m,p,h,w,v,y,g){return m=m+(h^(p|~w))+v+g,(m<>>32-y)+p}for(var a=Se,l=a.lib,s=l.WordArray,u=l.Hasher,l=a.algo,f=[],d=0;64>d;d++)f[d]=4294967296*e.abs(e.sin(d+1))|0;l=l.MD5=u.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,p){for(var h=0;16>h;h++){var w=p+h,v=m[w];m[w]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var h=this._hash.words,w=m[p+0],v=m[p+1],y=m[p+2],g=m[p+3],b=m[p+4],D=m[p+5],_=m[p+6],F=m[p+7],L=m[p+8],N=m[p+9],S=m[p+10],B=m[p+11],O=m[p+12],P=m[p+13],U=m[p+14],G=m[p+15],H=h[0],ie=h[1],Y=h[2],K=h[3],H=t(H,ie,Y,K,w,7,f[0]),K=t(K,H,ie,Y,v,12,f[1]),Y=t(Y,K,H,ie,y,17,f[2]),ie=t(ie,Y,K,H,g,22,f[3]),H=t(H,ie,Y,K,b,7,f[4]),K=t(K,H,ie,Y,D,12,f[5]),Y=t(Y,K,H,ie,_,17,f[6]),ie=t(ie,Y,K,H,F,22,f[7]),H=t(H,ie,Y,K,L,7,f[8]),K=t(K,H,ie,Y,N,12,f[9]),Y=t(Y,K,H,ie,S,17,f[10]),ie=t(ie,Y,K,H,B,22,f[11]),H=t(H,ie,Y,K,O,7,f[12]),K=t(K,H,ie,Y,P,12,f[13]),Y=t(Y,K,H,ie,U,17,f[14]),ie=t(ie,Y,K,H,G,22,f[15]),H=r(H,ie,Y,K,v,5,f[16]),K=r(K,H,ie,Y,_,9,f[17]),Y=r(Y,K,H,ie,B,14,f[18]),ie=r(ie,Y,K,H,w,20,f[19]),H=r(H,ie,Y,K,D,5,f[20]),K=r(K,H,ie,Y,S,9,f[21]),Y=r(Y,K,H,ie,G,14,f[22]),ie=r(ie,Y,K,H,b,20,f[23]),H=r(H,ie,Y,K,N,5,f[24]),K=r(K,H,ie,Y,U,9,f[25]),Y=r(Y,K,H,ie,g,14,f[26]),ie=r(ie,Y,K,H,L,20,f[27]),H=r(H,ie,Y,K,P,5,f[28]),K=r(K,H,ie,Y,y,9,f[29]),Y=r(Y,K,H,ie,F,14,f[30]),ie=r(ie,Y,K,H,O,20,f[31]),H=n(H,ie,Y,K,D,4,f[32]),K=n(K,H,ie,Y,L,11,f[33]),Y=n(Y,K,H,ie,B,16,f[34]),ie=n(ie,Y,K,H,U,23,f[35]),H=n(H,ie,Y,K,v,4,f[36]),K=n(K,H,ie,Y,b,11,f[37]),Y=n(Y,K,H,ie,F,16,f[38]),ie=n(ie,Y,K,H,S,23,f[39]),H=n(H,ie,Y,K,P,4,f[40]),K=n(K,H,ie,Y,w,11,f[41]),Y=n(Y,K,H,ie,g,16,f[42]),ie=n(ie,Y,K,H,_,23,f[43]),H=n(H,ie,Y,K,N,4,f[44]),K=n(K,H,ie,Y,O,11,f[45]),Y=n(Y,K,H,ie,G,16,f[46]),ie=n(ie,Y,K,H,y,23,f[47]),H=i(H,ie,Y,K,w,6,f[48]),K=i(K,H,ie,Y,F,10,f[49]),Y=i(Y,K,H,ie,U,15,f[50]),ie=i(ie,Y,K,H,D,21,f[51]),H=i(H,ie,Y,K,O,6,f[52]),K=i(K,H,ie,Y,g,10,f[53]),Y=i(Y,K,H,ie,S,15,f[54]),ie=i(ie,Y,K,H,v,21,f[55]),H=i(H,ie,Y,K,L,6,f[56]),K=i(K,H,ie,Y,G,10,f[57]),Y=i(Y,K,H,ie,_,15,f[58]),ie=i(ie,Y,K,H,P,21,f[59]),H=i(H,ie,Y,K,b,6,f[60]),K=i(K,H,ie,Y,B,10,f[61]),Y=i(Y,K,H,ie,y,15,f[62]),ie=i(ie,Y,K,H,N,21,f[63]);h[0]=h[0]+H|0,h[1]=h[1]+ie|0,h[2]=h[2]+Y|0,h[3]=h[3]+K|0},_doFinalize:function(){var m=this._data,p=m.words,h=8*this._nDataBytes,w=8*m.sigBytes;p[w>>>5]|=128<<24-w%32;var v=e.floor(h/4294967296);for(p[(w+64>>>9<<4)+15]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360,p[(w+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,m.sigBytes=4*(p.length+1),this._process(),m=this._hash,p=m.words,h=0;4>h;h++)w=p[h],p[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360;return m},clone:function(){var m=u.clone.call(this);return m._hash=this._hash.clone(),m}}),a.MD5=u._createHelper(l),a.HmacMD5=u._createHmacHelper(l)})(Math);(function(){var e=Se,i=e.lib,t=i.WordArray,r=i.Hasher,n=[],i=e.algo.SHA1=r.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,s){for(var u=this._hash.words,l=u[0],f=u[1],d=u[2],m=u[3],p=u[4],h=0;80>h;h++){if(16>h)n[h]=a[s+h]|0;else{var w=n[h-3]^n[h-8]^n[h-14]^n[h-16];n[h]=w<<1|w>>>31}w=(l<<5|l>>>27)+p+n[h],w=20>h?w+((f&d|~f&m)+1518500249):40>h?w+((f^d^m)+1859775393):60>h?w+((f&d|f&m|d&m)-1894007588):w+((f^d^m)-899497514),p=m,m=d,d=f<<30|f>>>2,f=l,l=w}u[0]=u[0]+l|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+m|0,u[4]=u[4]+p|0},_doFinalize:function(){var a=this._data,s=a.words,u=8*this._nDataBytes,l=8*a.sigBytes;return s[l>>>5]|=128<<24-l%32,s[(l+64>>>9<<4)+14]=Math.floor(u/4294967296),s[(l+64>>>9<<4)+15]=u,a.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var a=r.clone.call(this);return a._hash=this._hash.clone(),a}});e.SHA1=r._createHelper(i),e.HmacSHA1=r._createHmacHelper(i)})();(function(e){for(var t=Se,h=t.lib,r=h.WordArray,n=h.Hasher,h=t.algo,i=[],a=[],s=function(v){return 4294967296*(v-(v|0))|0},u=2,l=0;64>l;){var f;e:{f=u;for(var d=e.sqrt(f),m=2;m<=d;m++)if(!(f%m)){f=!1;break e}f=!0}f&&(8>l&&(i[l]=s(e.pow(u,.5))),a[l]=s(e.pow(u,1/3)),l++),u++}var p=[],h=h.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(w,v){for(var y=this._hash.words,g=y[0],b=y[1],D=y[2],_=y[3],F=y[4],L=y[5],N=y[6],S=y[7],B=0;64>B;B++){if(16>B)p[B]=w[v+B]|0;else{var O=p[B-15],P=p[B-2];p[B]=((O<<25|O>>>7)^(O<<14|O>>>18)^O>>>3)+p[B-7]+((P<<15|P>>>17)^(P<<13|P>>>19)^P>>>10)+p[B-16]}O=S+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&L^~F&N)+a[B]+p[B],P=((g<<30|g>>>2)^(g<<19|g>>>13)^(g<<10|g>>>22))+(g&b^g&D^b&D),S=N,N=L,L=F,F=_+O|0,_=D,D=b,b=g,g=O+P|0}y[0]=y[0]+g|0,y[1]=y[1]+b|0,y[2]=y[2]+D|0,y[3]=y[3]+_|0,y[4]=y[4]+F|0,y[5]=y[5]+L|0,y[6]=y[6]+N|0,y[7]=y[7]+S|0},_doFinalize:function(){var w=this._data,v=w.words,y=8*this._nDataBytes,g=8*w.sigBytes;return v[g>>>5]|=128<<24-g%32,v[(g+64>>>9<<4)+14]=e.floor(y/4294967296),v[(g+64>>>9<<4)+15]=y,w.sigBytes=4*v.length,this._process(),this._hash},clone:function(){var w=n.clone.call(this);return w._hash=this._hash.clone(),w}});t.SHA256=n._createHelper(h),t.HmacSHA256=n._createHmacHelper(h)})(Math);(function(){var e=Se,t=e.lib.WordArray,n=e.algo,r=n.SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=r._doFinalize.call(this);return i.sigBytes-=4,i}});e.SHA224=r._createHelper(n),e.HmacSHA224=r._createHmacHelper(n)})();(function(){function e(){return n.create.apply(n,arguments)}for(var t=Se,r=t.lib.Hasher,a=t.x64,n=a.Word,i=a.WordArray,a=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],u=[],l=0;80>l;l++)u[l]=e();a=a.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(f,d){for(var b=this._hash.words,m=b[0],p=b[1],h=b[2],w=b[3],v=b[4],y=b[5],g=b[6],b=b[7],D=m.high,_=m.low,F=p.high,L=p.low,N=h.high,S=h.low,B=w.high,O=w.low,P=v.high,U=v.low,G=y.high,H=y.low,K=g.high,Y=g.low,ie=b.high,_e=b.low,Fe=D,$e=_,et=F,Qe=L,at=N,ut=S,Qr=B,Qt=O,Et=P,gr=U,tr=G,ct=H,Mt=K,tt=Y,qe=ie,rr=_e,Ue=0;80>Ue;Ue++){var mr=u[Ue];if(16>Ue)var Pt=mr.high=f[d+2*Ue]|0,De=mr.low=f[d+2*Ue+1]|0;else{var Pt=u[Ue-15],De=Pt.high,pt=Pt.low,Pt=(De>>>1|pt<<31)^(De>>>8|pt<<24)^De>>>7,pt=(pt>>>1|De<<31)^(pt>>>8|De<<24)^(pt>>>7|De<<25),Br=u[Ue-2],De=Br.high,Ct=Br.low,Br=(De>>>19|Ct<<13)^(De<<3|Ct>>>29)^De>>>6,Ct=(Ct>>>19|De<<13)^(Ct<<3|De>>>29)^(Ct>>>6|De<<26),De=u[Ue-7],en=De.high,Xt=u[Ue-16],Ne=Xt.high,Xt=Xt.low,De=pt+De.low,Pt=Pt+en+(De>>>0>>0?1:0),De=De+Ct,Pt=Pt+Br+(De>>>0>>0?1:0),De=De+Xt,Pt=Pt+Ne+(De>>>0>>0?1:0);mr.high=Pt,mr.low=De}var en=Et&tr^~Et&Mt,Xt=gr&ct^~gr&tt,mr=Fe&et^Fe&at^et&at,qt=$e&Qe^$e&ut^Qe&ut,pt=(Fe>>>28|$e<<4)^(Fe<<30|$e>>>2)^(Fe<<25|$e>>>7),Br=($e>>>28|Fe<<4)^($e<<30|Fe>>>2)^($e<<25|Fe>>>7),Ct=s[Ue],Ai=Ct.high,tn=Ct.low,Ct=rr+((gr>>>14|Et<<18)^(gr>>>18|Et<<14)^(gr<<23|Et>>>9)),Ne=qe+((Et>>>14|gr<<18)^(Et>>>18|gr<<14)^(Et<<23|gr>>>9))+(Ct>>>0>>0?1:0),Ct=Ct+Xt,Ne=Ne+en+(Ct>>>0>>0?1:0),Ct=Ct+tn,Ne=Ne+Ai+(Ct>>>0>>0?1:0),Ct=Ct+De,Ne=Ne+Pt+(Ct>>>0>>0?1:0),De=Br+qt,mr=pt+mr+(De>>>0
>>0?1:0),qe=Mt,rr=tt,Mt=tr,tt=ct,tr=Et,ct=gr,gr=Qt+Ct|0,Et=Qr+Ne+(gr>>>0>>0?1:0)|0,Qr=at,Qt=ut,at=et,ut=Qe,et=Fe,Qe=$e,$e=Ct+De|0,Fe=Ne+mr+($e>>>0>>0?1:0)|0}_=m.low=_+$e,m.high=D+Fe+(_>>>0<$e>>>0?1:0),L=p.low=L+Qe,p.high=F+et+(L>>>0>>0?1:0),S=h.low=S+ut,h.high=N+at+(S>>>0>>0?1:0),O=w.low=O+Qt,w.high=B+Qr+(O>>>0>>0?1:0),U=v.low=U+gr,v.high=P+Et+(U>>>0>>0?1:0),H=y.low=H+ct,y.high=G+tr+(H>>>0>>0?1:0),Y=g.low=Y+tt,g.high=K+Mt+(Y>>>0>>0?1:0),_e=b.low=_e+rr,b.high=ie+qe+(_e>>>0>>0?1:0)},_doFinalize:function(){var f=this._data,d=f.words,m=8*this._nDataBytes,p=8*f.sigBytes;return d[p>>>5]|=128<<24-p%32,d[(p+128>>>10<<5)+30]=Math.floor(m/4294967296),d[(p+128>>>10<<5)+31]=m,f.sigBytes=4*d.length,this._process(),this._hash.toX32()},clone:function(){var f=r.clone.call(this);return f._hash=this._hash.clone(),f},blockSize:32}),t.SHA512=r._createHelper(a),t.HmacSHA512=r._createHmacHelper(a)})();(function(){var e=Se,i=e.x64,t=i.Word,r=i.WordArray,i=e.algo,n=i.SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var a=n._doFinalize.call(this);return a.sigBytes-=16,a}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)})();(function(){var e=Se,f=e.lib,t=f.WordArray,r=f.Hasher,f=e.algo,n=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),i=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),s=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=t.create([0,1518500249,1859775393,2400959708,2840853838]),l=t.create([1352829926,1548603684,1836072691,2053994217,0]),f=f.RIPEMD160=r.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,m){for(var p=0;16>p;p++){var h=m+p,w=d[h];d[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var h=this._hash.words,w=u.words,v=l.words,y=n.words,g=i.words,b=a.words,D=s.words,_,F,L,N,S,B,O,P,U,G;B=_=h[0],O=F=h[1],P=L=h[2],U=N=h[3],G=S=h[4];for(var H,p=0;80>p;p+=1)H=_+d[m+y[p]]|0,H=16>p?H+((F^L^N)+w[0]):32>p?H+((F&L|~F&N)+w[1]):48>p?H+(((F|~L)^N)+w[2]):64>p?H+((F&N|L&~N)+w[3]):H+((F^(L|~N))+w[4]),H|=0,H=H<>>32-b[p],H=H+S|0,_=S,S=N,N=L<<10|L>>>22,L=F,F=H,H=B+d[m+g[p]]|0,H=16>p?H+((O^(P|~U))+v[0]):32>p?H+((O&U|P&~U)+v[1]):48>p?H+(((O|~P)^U)+v[2]):64>p?H+((O&P|~O&U)+v[3]):H+((O^P^U)+v[4]),H|=0,H=H<>>32-D[p],H=H+G|0,B=G,G=U,U=P<<10|P>>>22,P=O,O=H;H=h[1]+L+U|0,h[1]=h[2]+N+G|0,h[2]=h[3]+S+B|0,h[3]=h[4]+_+O|0,h[4]=h[0]+F+P|0,h[0]=H},_doFinalize:function(){var d=this._data,m=d.words,p=8*this._nDataBytes,h=8*d.sigBytes;for(m[h>>>5]|=128<<24-h%32,m[(h+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,d.sigBytes=4*(m.length+1),this._process(),d=this._hash,m=d.words,p=0;5>p;p++)h=m[p],m[p]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return d},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});e.RIPEMD160=r._createHelper(f),e.HmacRIPEMD160=r._createHmacHelper(f)})(Math);(function(){var e=Se,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(r,n){r=this._hasher=new r.init,typeof n=="string"&&(n=t.parse(n));var i=r.blockSize,a=4*i;n.sigBytes>a&&(n=r.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),u=this._iKey=n.clone(),l=s.words,f=u.words,d=0;d>6)+Ul.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Ul.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Ul.charAt(r>>2)+Ul.charAt((r&3)<<4)),Ag)for(;(n.length&3)>0;)n+=Ag;return n}function Hl(e){var t="",r,n=0,i,a;for(r=0;r>2),i=a&3,n=1):n==1?(t+=Ua(i<<2|a>>4),i=a&15,n=2):n==2?(t+=Ua(i),t+=Ua(a>>2),i=a&3,n=3):(t+=Ua(i<<2|a>>4),t+=Ua(a&15),n=0));return n==1&&(t+=Ua(i<<2)),t}function gy(e){var t=Hl(e),r,n=new Array;for(r=0;2*r=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=s&67108863}return i}function qP(e,t,r,n,i,a){for(var s=t&32767,u=t>>15;--a>=0;){var l=this[e]&32767,f=this[e++]>>15,d=u*l+f*s;l=s*l+((d&32767)<<15)+r[n]+(i&1073741823),i=(l>>>30)+(d>>>15)+u*f+(i>>>30),r[n++]=l&1073741823}return i}function VP(e,t,r,n,i,a){for(var s=t&16383,u=t>>14;--a>=0;){var l=this[e]&16383,f=this[e++]>>14,d=u*l+f*s;l=s*l+((d&16383)<<14)+r[n]+i,i=(l>>28)+(d>>14)+u*f,r[n++]=l&268435455}return i}hy&&cf.appName=="Microsoft Internet Explorer"?(ee.prototype.am=qP,Bu=30):hy&&cf.appName!="Netscape"?(ee.prototype.am=MP,Bu=26):(ee.prototype.am=VP,Bu=28);ee.prototype.DB=Bu;ee.prototype.DM=(1<=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function GP(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}function Iu(e){var t=Ft();return t.fromInt(e),t}function YP(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var n=e.length,i=!1,a=0;--n>=0;){var s=r==8?e[n]&255:my(e,n);if(s<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,a==0?this[this.t++]=s:a+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-a):this[this.t-1]|=s<=this.DB&&(a-=this.DB)}r==8&&e[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t}function XP(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<0)for(u>u)>0&&(i=!0,a=Ua(n));s>=0;)u>(u+=this.DB-t)):(n=this[s]>>(u-=t)&r,u<=0&&(u+=this.DB,--s)),n>0&&(i=!0),i&&(a+=Ua(n));return i?a:"0"}function ZP(){var e=Ft();return ee.ZERO.subTo(this,e),e}function JP(){return this.s<0?this.negate():this}function QP(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this[r]-e[r])!=0)return t;return 0}function J0(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function e$(){return this.t<=0?0:this.DB*(this.t-1)+J0(this[this.t-1]^this.s&this.DM)}function t$(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}function r$(e,t){for(var r=e;r=0;--u)t[u+a+1]=this[u]>>n|s,s=(this[u]&i)<=0;--u)t[u]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function i$(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var n=e%this.DB,i=this.DB-n,a=(1<>n;for(var s=r+1;s>n;n>0&&(t[this.t-r-1]|=(this.s&a)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}function a$(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}function o$(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(l,a),i.lShiftTo(l,r)):(n.copyTo(a),i.copyTo(r));var f=a.t,d=a[f-1];if(d!=0){var m=d*(1<1?a[f-2]>>this.F2:0),p=this.FV/m,h=(1<=0&&(r[r.t++]=1,r.subTo(g,r)),ee.ONE.dlShiftTo(f,g),g.subTo(a,a);a.t=0;){var b=r[--v]==d?this.DM:Math.floor(r[v]*p+(r[v-1]+w)*h);if((r[v]+=a.am(0,b,r,y,0,f))0&&r.rShiftTo(l,r),s<0&&ee.ZERO.subTo(r,r)}}}function l$(e){var t=Ft();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(ee.ZERO)>0&&e.subTo(t,t),t}function Io(e){this.m=e}function c$(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function f$(e){return e}function h$(e){e.divRemTo(this.m,null,e)}function d$(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function p$(e,t){e.squareTo(t),this.reduce(t)}Io.prototype.convert=c$;Io.prototype.revert=f$;Io.prototype.reduce=h$;Io.prototype.mulTo=d$;Io.prototype.sqrTo=p$;function g$(){if(this.t<1)return 0;var e=this[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Bo(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(t,t),t}function v$(e){var t=Ft();return e.copyTo(t),this.reduce(t),t}function w$(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function A$(e,t){e.squareTo(t),this.reduce(t)}function E$(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Bo.prototype.convert=m$;Bo.prototype.revert=v$;Bo.prototype.reduce=w$;Bo.prototype.mulTo=E$;Bo.prototype.sqrTo=A$;function b$(){return(this.t>0?this[0]&1:this.s)==0}function y$(e,t){if(e>4294967295||e<1)return ee.ONE;var r=Ft(),n=Ft(),i=t.convert(this),a=J0(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function C$(e,t){var r;return e<256||t.isEven()?r=new Io(t):r=new Bo(t),this.exp(e,r)}ee.prototype.copyTo=zP;ee.prototype.fromInt=GP;ee.prototype.fromString=YP;ee.prototype.clamp=WP;ee.prototype.dlShiftTo=t$;ee.prototype.drShiftTo=r$;ee.prototype.lShiftTo=n$;ee.prototype.rShiftTo=i$;ee.prototype.subTo=s$;ee.prototype.multiplyTo=a$;ee.prototype.squareTo=u$;ee.prototype.divRemTo=o$;ee.prototype.invDigit=g$;ee.prototype.isEven=b$;ee.prototype.exp=y$;ee.prototype.toString=XP;ee.prototype.negate=ZP;ee.prototype.abs=JP;ee.prototype.compareTo=QP;ee.prototype.bitLength=e$;ee.prototype.mod=l$;ee.prototype.modPowInt=C$;ee.ZERO=Iu(0);ee.ONE=Iu(1);function _$(){var e=Ft();return this.copyTo(e),e}function D$(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function S$(){return this.t==0?this.s:this[0]<<16>>16}function I$(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function B$(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function x$(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=Iu(r),i=Ft(),a=Ft(),s="";for(this.divRemTo(n,i,a);i.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,a);return a.intValue().toString(e)+s}function P$(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,a=0,s=0,u=0;u=r&&(this.dMultiply(n),this.dAddOffset(s,0),a=0,s=0)}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),i&&ee.ZERO.subTo(this,this)}function $$(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(ee.ONE.shiftLeft(e-1),Dg,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(ee.ONE.shiftLeft(e-1),this);else{var n=new Array,i=e&7;n.length=(e>>3)+1,t.nextBytes(n),i>0?n[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<=0;)r<8?(n=(this[e]&(1<>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function T$(e){return this.compareTo(e)==0}function O$(e){return this.compareTo(e)<0?this:e}function k$(e){return this.compareTo(e)>0?this:e}function N$(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function G$(){for(var e=0;e=this.t?this.s!=0:(this[t]&1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}function rR(e){var t=Ft();return this.addTo(e,t),t}function nR(e){var t=Ft();return this.subTo(e,t),t}function iR(e){var t=Ft();return this.multiplyTo(e,t),t}function sR(){var e=Ft();return this.squareTo(e),e}function aR(e){var t=Ft();return this.divRemTo(e,t,null),t}function uR(e){var t=Ft();return this.divRemTo(e,null,t),t}function oR(e){var t=Ft(),r=Ft();return this.divRemTo(e,t,r),new Array(t,r)}function lR(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function cR(e,t){if(e!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}function hf(){}function Ay(e){return e}function fR(e,t,r){e.multiplyTo(t,r)}function hR(e,t){e.squareTo(t)}hf.prototype.convert=Ay;hf.prototype.revert=Ay;hf.prototype.mulTo=fR;hf.prototype.sqrTo=hR;function dR(e){return this.exp(e,new hf)}function pR(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n=0;)r[n]=0;for(n=Math.max(t-this.t,0);n2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Ft();return e.copyTo(t),this.reduce(t),t}function vR(e){return e}function wR(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function AR(e,t){e.squareTo(t),this.reduce(t)}function ER(e,t,r){e.multiplyTo(t,r),this.reduce(r)}ql.prototype.convert=mR;ql.prototype.revert=vR;ql.prototype.reduce=wR;ql.prototype.mulTo=ER;ql.prototype.sqrTo=AR;function bR(e,t){var r=e.bitLength(),n,i=Iu(1),a;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?a=new Io(t):t.isEven()?a=new ql(t):a=new Bo(t);var s=new Array,u=3,l=n-1,f=(1<1){var d=Ft();for(a.sqrTo(s[1],d);u<=f;)s[u]=Ft(),a.mulTo(d,s[u-2],s[u]),u+=2}var m=e.t-1,p,h=!0,w=Ft(),v;for(r=J0(e[m])-1;m>=0;){for(r>=l?p=e[m]>>r-l&f:(p=(e[m]&(1<0&&(p|=e[m-1]>>this.DB+r-l)),u=n;!(p&1);)p>>=1,--u;if((r-=u)<0&&(r+=this.DB,--m),h)s[p].copyTo(i),h=!1;else{for(;u>1;)a.sqrTo(i,w),a.sqrTo(w,i),u-=2;u>0?a.sqrTo(i,w):(v=i,i=w,w=v),a.mulTo(w,s[p],i)}for(;m>=0&&!(e[m]&1<0&&(t.rShiftTo(a,t),r.rShiftTo(a,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return a>0&&r.lShiftTo(a,r),r}function CR(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}function _R(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return ee.ZERO;for(var r=e.clone(),n=this.clone(),i=Iu(1),a=Iu(0),s=Iu(0),u=Iu(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!a.isEven())&&(i.addTo(this,i),a.subTo(e,a)),i.rShiftTo(1,i)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),t?((!s.isEven()||!u.isEven())&&(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(s,i),a.subTo(u,a)):(n.subTo(r,n),t&&s.subTo(i,s),u.subTo(a,u))}if(n.compareTo(ee.ONE)!=0)return ee.ZERO;if(u.compareTo(e)>=0)return u.subtract(e);if(u.signum()<0)u.addTo(e,u);else return u;return u.signum()<0?u.add(e):u}var Kn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],DR=(1<<26)/Kn[Kn.length-1];function FR(e){var t,r=this.abs();if(r.t==1&&r[0]<=Kn[Kn.length-1]){for(t=0;t>1,e>Kn.length&&(e=Kn.length);for(var i=Ft(),a=0;a>8&255,Bi[Zr++]^=e>>16&255,Bi[Zr++]^=e>>24&255,Zr>=Eg&&(Zr-=Eg)}function Sg(){PR(new Date().getTime())}if(Bi==null){if(Bi=new Array,Zr=0,Ll!==void 0&&(Ll.crypto!==void 0||Ll.msCrypto!==void 0)){if(mg=Ll.crypto||Ll.msCrypto,mg.getRandomValues)for(vg=new Uint8Array(32),mg.getRandomValues(vg),Zi=0;Zi<32;++Zi)Bi[Zr++]=vg[Zi];else if(cf.appName=="Netscape"&&cf.appVersion<"5")for(wg=Ll.crypto.random(32),Zi=0;Zi>>8,Bi[Zr++]=Zi&255;Zr=0,Sg()}var Zi,mg,vg,wg;function $R(){if(G0==null){for(Sg(),G0=xR(),G0.init(Bi),Zr=0;Zr0&&t.length>0)this.n=ci(e,16),this.e=parseInt(t,16);else throw"Invalid RSA public key"}function OR(e){return e.modPowInt(this.e,this.n)}Je.prototype.doPublic=OR;Je.prototype.setPublic=TR;Je.prototype.type="RSA";function kR(e,t,r){if(this.isPrivate=!0,typeof e!="string")this.n=e,this.e=t,this.d=r;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=ci(e,16),this.e=parseInt(t,16),this.d=ci(r,16);else throw"Invalid RSA private key"}function NR(e,t,r,n,i,a,s,u){if(this.isPrivate=!0,this.isPublic=!1,e==null)throw"RSASetPrivateEx N == null";if(t==null)throw"RSASetPrivateEx E == null";if(e.length==0)throw"RSASetPrivateEx N.length == 0";if(t.length==0)throw"RSASetPrivateEx E.length == 0";if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=ci(e,16),this.e=parseInt(t,16),this.d=ci(r,16),this.p=ci(n,16),this.q=ci(i,16),this.dmp1=ci(a,16),this.dmq1=ci(s,16),this.coeff=ci(u,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function LR(e,t){var r=new Vl,n=e>>1;this.e=parseInt(t,16);for(var i=new ee(t,16),a=e/2-100,s=ee.ONE.shiftLeft(a);;){for(;this.p=new ee(e-n,1,r),!(this.p.subtract(ee.ONE).gcd(i).compareTo(ee.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new ee(n,1,r),!(this.q.subtract(ee.ONE).gcd(i).compareTo(ee.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var u=this.p;this.p=this.q,this.q=u}var l=this.q.subtract(this.p).abs();if(!(l.bitLength()0;--f){i=i.twice();var d=r.testBit(f),m=t.testBit(f);d!=m&&(i=i.add(d?this:n))}for(f=s.bitLength()-2;f>0;--f){u=u.twice();var p=s.testBit(f),h=a.testBit(f);p!=h&&(u=u.add(p?u:l))}return i}function rT(e,t,r){var n;e.bitLength()>r.bitLength()?n=e.bitLength()-1:n=r.bitLength()-1;for(var i=this.curve.getInfinity(),a=this.add(t);n>=0;)i=i.twice(),e.testBit(n)?r.testBit(n)?i=i.add(a):i=i.add(this):r.testBit(n)&&(i=i.add(t)),--n;return i}Rt.prototype.getX=YR;Rt.prototype.getY=WR;Rt.prototype.equals=XR;Rt.prototype.isInfinity=ZR;Rt.prototype.negate=JR;Rt.prototype.add=QR;Rt.prototype.twice=eT;Rt.prototype.multiply=tT;Rt.prototype.multiplyTwo=rT;function Ha(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new Rt(this,null,null)}function nT(){return this.q}function iT(){return this.a}function sT(){return this.b}function aT(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function uT(){return this.infinity}function oT(e){return new Mr(this.q,e)}function lT(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var t=e.substr(0,2),r=e.substr(2),n=this.fromBigInteger(new ee(f,16)),i=this.getA(),a=this.getB(),s=n.square().add(i).multiply(n).add(a),u=s.sqrt();return t=="03"&&(u=u.negate()),new Rt(this,n,u);case 4:case 6:case 7:var l=(e.length-2)/2,f=e.substr(2,l),d=e.substr(l+2,l);return new Rt(this,this.fromBigInteger(new ee(f,16)),this.fromBigInteger(new ee(d,16)));default:return null}}Ha.prototype.getQ=nT;Ha.prototype.getA=iT;Ha.prototype.getB=sT;Ha.prototype.equals=aT;Ha.prototype.getInfinity=uT;Ha.prototype.fromBigInteger=oT;Ha.prototype.decodePointHex=lT;Mr.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Rt.prototype.getEncoded=function(e){var t=function(a,s){var u=a.toByteArrayUnsigned();if(su.length;)u.unshift(0);return u},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=t(r,32);return e?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(n,32))),i};Rt.decodeFrom=function(e,t){var r=t[0],n=t.length-1,i=t.slice(1,1+n/2),a=t.slice(1+n/2,1+n);i.unshift(0),a.unshift(0);var s=new ee(i),u=new ee(a);return new Rt(e,e.fromBigInteger(s),e.fromBigInteger(u))};Rt.decodeFromHex=function(e,t){var r=t.substr(0,2),n=t.length-2,i=t.substr(2,n/2),a=t.substr(2+n/2,n/2),s=new ee(i,16),u=new ee(a,16);return new Rt(e,e.fromBigInteger(s),e.fromBigInteger(u))};Rt.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),r=e.y.subtract(this.y),n=r.divide(t),i=n.square().subtract(this.x).subtract(e.x),a=n.multiply(this.x.subtract(i)).subtract(this.y);return new Rt(this.curve,i,a)};Rt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(ee.valueOf(2)),t=this.curve.fromBigInteger(ee.valueOf(3)),r=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Rt(this.curve,n,i)};Rt.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new ee("3")),n=this.negate(),i=this,a;for(a=r.bitLength()-2;a>0;--a){i=i.twice();var s=r.testBit(a),u=t.testBit(a);s!=u&&(i=i.add2D(s?this:n))}return i};Rt.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),a=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return a.equals(s)};Rt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Rt.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(t.compareTo(ee.ONE)<0||t.compareTo(e.subtract(ee.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(ee.ONE)<0||r.compareTo(e.subtract(ee.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var Ey=function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",t='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',r='(?:"'+t+'*")',n=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+r+")","g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),a={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:` `,r:"\r",t:" "};function s(m,p,h){return p?a[p]:String.fromCharCode(parseInt(h,16))}var u=new String(""),l="\\",f={"{":Object,"[":Array},d=Object.hasOwnProperty;return function(m,p){var h=m.match(n),w,v=h[0],y=!1;v==="{"?w={}:v==="["?w=[]:(w=[],y=!0);for(var g,b=[w],D=1-y,_=h.length;D<_;++D){v=h[D];var F;switch(v.charCodeAt(0)){default:F=b[0],F[g||F.length]=+v,g=void 0;break;case 34:if(v=v.substring(1,v.length-1),v.indexOf(l)!==-1&&(v=v.replace(i,s)),F=b[0],!g)if(F instanceof Array)g=F.length;else{g=v||u;break}F[g]=v,g=void 0;break;case 91:F=b[0],b.unshift(F[g||F.length]=[]),g=void 0;break;case 93:b.shift();break;case 102:F=b[0],F[g||F.length]=!1,g=void 0;break;case 110:F=b[0],F[g||F.length]=null,g=void 0;break;case 116:F=b[0],F[g||F.length]=!0,g=void 0;break;case 123:F=b[0],b.unshift(F[g||F.length]={}),g=void 0;break;case 125:b.shift();break}}if(y){if(b.length!==1)throw new Error;w=w[0]}else if(b.length)throw new Error;if(p){var L=function(N,S){var B=N[S];if(B&&typeof B=="object"){var O=null;for(var P in B)if(d.call(B,P)&&B!==N){var U=L(B,P);U!==void 0?B[P]=U:(O||(O=[]),O.push(P))}if(O)for(var G=O.length;--G>=0;)delete B[O[G]]}return p.call(N,S,B)};w=L({"":w},"")}return w}}();(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});A.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){return pf(e)},this.getPEMStringFromHex=function(e,t){return Bn(e,t)},this.newObject=function(e){var t=A,r=t.asn1,n=r.ASN1Object,i=r.DERBoolean,a=r.DERInteger,s=r.DERBitString,u=r.DEROctetString,l=r.DERNull,f=r.DERObjectIdentifier,d=r.DEREnumerated,m=r.DERUTF8String,p=r.DERNumericString,h=r.DERPrintableString,w=r.DERTeletexString,v=r.DERIA5String,y=r.DERUTCTime,g=r.DERGeneralizedTime,b=r.DERVisibleString,D=r.DERBMPString,_=r.DERSequence,F=r.DERSet,L=r.DERTaggedObject,N=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var S=Object.keys(e);if(S.length!=1)throw new Error("key of param shall be only one.");var B=S[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+B+":")==-1)throw new Error("undefined key: "+B);if(B=="bool")return new i(e[B]);if(B=="int")return new a(e[B]);if(B=="bitstr")return new s(e[B]);if(B=="octstr")return new u(e[B]);if(B=="null")return new l(e[B]);if(B=="oid")return new f(e[B]);if(B=="enum")return new d(e[B]);if(B=="utf8str")return new m(e[B]);if(B=="numstr")return new p(e[B]);if(B=="prnstr")return new h(e[B]);if(B=="telstr")return new w(e[B]);if(B=="ia5str")return new v(e[B]);if(B=="utctime")return new y(e[B]);if(B=="gentime")return new g(e[B]);if(B=="visstr")return new b(e[B]);if(B=="bmpstr")return new D(e[B]);if(B=="asn1")return new n(e[B]);if(B=="seq"){for(var O=e[B],P=[],U=0;U"u"||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+a.length+",v="+this.hV);var s=this.hV.length/2,u=s.toString(16);if(u.length%2==1&&(u="0"+u),s<128)return u;var l=u.length/2;if(l>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+s.toString(16));var f=128+l;return f.toString(16)+u},this.tohex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(s){this.params=s},e!=null&&e.tlv!=null&&(this.hTLV=e.tlv,this.isModified=!1)};A.asn1.DERAbstractString=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null,r=null;this.getString=function(){return this.s},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.s=n,this.hV=ed(this.s).toLowerCase()},this.setStringHex=function(n){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e=="string"?this.setString(e):typeof e.str<"u"?this.setString(e.str):typeof e.hex<"u"&&this.setStringHex(e.hex))};pe(A.asn1.DERAbstractString,A.asn1.ASN1Object);A.asn1.DERAbstractTime=function(e){A.asn1.DERAbstractTime.superclass.constructor.call(this);var t=null,r=null;this.localDateToUTC=function(n){var i=n.getTime()+n.getTimezoneOffset()*6e4,a=new Date(i);return a},this.formatDate=function(n,i,a){var s=this.zeroPadding,u=this.localDateToUTC(n),l=String(u.getFullYear());i=="utc"&&(l=l.substr(2,2));var f=s(String(u.getMonth()+1),2),d=s(String(u.getDate()),2),m=s(String(u.getHours()),2),p=s(String(u.getMinutes()),2),h=s(String(u.getSeconds()),2),w=l+f+d+m+p+h;if(a===!0){var v=u.getMilliseconds();if(v!=0){var y=s(String(v),3);y=y.replace(/[0]+$/,""),w=w+"."+y}}return w+"Z"},this.zeroPadding=function(n,i){return n.length>=i?n:new Array(i-n.length+1).join("0")+n},this.setByParam=function(n){this.hV=null,this.hTLV=null,this.params=n},this.getString=function(){},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.str=n},this.setByDate=function(n){this.hTLV=null,this.isModified=!0,this.params==null&&(this.params={}),this.params.date=n},this.setByDateValue=function(n,i,a,s,u,l){var f=new Date(Date.UTC(n,i-1,a,s,u,l,0));this.setByDate(f)},this.getFreshValueHex=function(){return this.hV}};pe(A.asn1.DERAbstractTime,A.asn1.ASN1Object);A.asn1.DERAbstractStructured=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null;this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof e<"u"&&typeof e.array<"u"&&(this.asn1Array=e.array)};pe(A.asn1.DERAbstractStructured,A.asn1.ASN1Object);A.asn1.DERBoolean=function(e){A.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",e==!1?this.hTLV="010100":this.hTLV="0101ff"};pe(A.asn1.DERBoolean,A.asn1.ASN1Object);A.asn1.DERInteger=function(e){A.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=pf;this.setByBigInteger=function(r){this.isModified=!0,this.params={bigint:r}},this.setByInteger=function(r){this.isModified=!0,this.params=r},this.setValueHex=function(r){this.isModified=!0,this.params={hex:r}},this.getFreshValueHex=function(){var r=this.params,n=null;if(r==null)throw new Error("value not set");if(typeof r=="object"&&r.hex!=null)return this.hV=r.hex,this.hV;if(typeof r=="number")n=new ee(String(r),10);else if(r.int!=null)n=new ee(String(r.int),10);else if(r.bigint!=null)n=r.bigint;else throw new Error("wrong parameter");return this.hV=t(n),this.hV},e!=null&&(this.params=e)};pe(A.asn1.DERInteger,A.asn1.ASN1Object);A.asn1.DERBitString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=A.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}A.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7=a)break}return n};ye.getNthChildIdx=function(e,t,r){var n=ye.getChildIdx(e,t);return n[r]};ye.getIdxbyList=function(e,t,r,n){var i=ye,a,s;return r.length==0?n!==void 0&&e.substr(t,2)!==n?-1:t:(a=r.shift(),s=i.getChildIdx(e,t),a>=s.length?-1:i.getIdxbyList(e,s[a],r,n))};ye.getIdxbyListEx=function(e,t,r,n){var i=ye,a,s;if(r.length==0)return n!==void 0&&e.substr(t,2)!==n?-1:t;a=r.shift(),s=i.getChildIdx(e,t);for(var u=0,l=0;l=e.length?null:i.getTLV(e,a)};ye.getTLVbyListEx=function(e,t,r,n){var i=ye,a=i.getIdxbyListEx(e,t,r,n);return a==-1?null:i.getTLV(e,a)};ye.getVbyList=function(e,t,r,n,i){var a=ye,s,u;return s=a.getIdxbyList(e,t,r,n),s==-1||s>=e.length?null:(u=a.getV(e,s),i===!0&&(u=u.substr(2)),u)};ye.getVbyListEx=function(e,t,r,n,i){var a=ye,s,u,l;return s=a.getIdxbyListEx(e,t,r,n),s==-1?null:(l=a.getV(e,s),e.substr(s,2)=="03"&&i!==!1&&(l=l.substr(2)),l)};ye.getInt=function(e,t,r){r==null&&(r=-1);try{var n=e.substr(t,2);if(n!="02"&&n!="03")return r;var i=ye.getV(e,t);return n=="02"?parseInt(i,16):By(i)}catch{return r}};ye.getOID=function(e,t,r){r==null&&(r=null);try{if(e.substr(t,2)!="06")return r;var n=ye.getV(e,t);return ad(n)}catch{return r}};ye.getOIDName=function(e,t,r){r==null&&(r=null);try{var n=ye.getOID(e,t,r);if(n==r)return r;var i=A.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};ye.getString=function(e,t,r){r==null&&(r=null);try{var n=ye.getV(e,t);return hi(n)}catch{return r}};ye.hextooidstr=function(e){var t=function(m,p){return m.length>=p?m:new Array(p-m.length+1).join("0")+m},r=[],n=e.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var a=e.substr(2),s=[],u=0;u0&&(d=d+"."+l.join(".")),d};ye.dump=function(e,t,r,n){var i=ye,a=i.getV,s=i.dump,u=i.getChildIdx,l=e;e instanceof A.asn1.ASN1Object&&(l=e.tohex());var f=function(N,S){if(N.length<=S*2)return N;var B=N.substr(0,S)+"..(total "+N.length/2+"bytes).."+N.substr(N.length-S,S);return B};t===void 0&&(t={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var d=t.ommit_long_octet,F=l.substr(r,2);if(F=="01"){var m=a(l,r);return m=="00"?n+`BOOLEAN FALSE `:n+`BOOLEAN TRUE `}if(F=="02"){var m=a(l,r);return n+"INTEGER "+f(m,d)+` `}if(F=="03"){var m=a(l,r);if(i.isASN1HEX(m.substr(2))){var p=n+`BITSTRING, encapsulates `;return p=p+s(m.substr(2),t,0,n+" "),p}else return n+"BITSTRING "+f(m,d)+` `}if(F=="04"){var m=a(l,r);if(i.isASN1HEX(m)){var p=n+`OCTETSTRING, encapsulates `;return p=p+s(m,t,0,n+" "),p}else return n+"OCTETSTRING "+f(m,d)+` `}if(F=="05")return n+`NULL `;if(F=="06"){var h=a(l,r),w=A.asn1.ASN1Util.oidHexToInt(h),v=A.asn1.x509.OID.oid2name(w),y=w.replace(/\./g," ");return v!=""?n+"ObjectIdentifier "+v+" ("+y+`) `:n+"ObjectIdentifier ("+y+`) `}if(F=="0a")return n+"ENUMERATED "+parseInt(a(l,r))+` `;if(F=="0c")return n+"UTF8String '"+jt(a(l,r))+`' `;if(F=="13")return n+"PrintableString '"+jt(a(l,r))+`' `;if(F=="14")return n+"TeletexString '"+jt(a(l,r))+`' `;if(F=="16")return n+"IA5String '"+jt(a(l,r))+`' `;if(F=="17")return n+"UTCTime "+jt(a(l,r))+` `;if(F=="18")return n+"GeneralizedTime "+jt(a(l,r))+` `;if(F=="1a")return n+"VisualString '"+jt(a(l,r))+`' `;if(F=="1e")return n+"BMPString '"+Pg(a(l,r))+`' `;if(F=="30"){if(l.substr(r,4)=="3000")return n+`SEQUENCE {} `;var p=n+`SEQUENCE `,g=u(l,r),b=t;if((g.length==2||g.length==3)&&l.substr(g[0],2)=="06"&&l.substr(g[g.length-1],2)=="04"){var v=i.oidname(a(l,g[0])),D=JSON.parse(JSON.stringify(t));D.x509ExtName=v,b=D}for(var _=0;_4?{enum:{hex:g}}:{enum:parseInt(g,16)};if(v=="30"||v=="31")return y[h[v]]=w(e),y;if(v=="14"){var L=p(g);return y[h[v]]={str:L},y}else if(v=="1e"){var L=m(g);return y[h[v]]={str:L},y}else if(":0c:12:13:16:17:18:1a:".indexOf(v)!=-1){var L=d(g);return y[h[v]]={str:L},y}else if(v.match(/^8[0-9]$/)){var L=d(g);return L==null|L==""?{tag:{tag:v,explicit:!1,hex:g}}:L.match(/[\x00-\x1F\x7F-\x9F]/)!=null||L.match(/[\u0000-\u001F\u0080–\u009F]/)!=null?{tag:{tag:v,explicit:!1,hex:g}}:{tag:{tag:v,explicit:!1,str:L}}}else if(v.match(/^a[0-9]$/))try{if(!n(g))throw new Error("not encap");return{tag:{tag:v,explicit:!0,obj:r(g)}}}catch{return{tag:{tag:v,explicit:!0,hex:g}}}else{var N=new A.asn1.ASN1Object;N.hV=g;var S=N.getLengthHexFromValue();return{asn1:{tlv:v+S+g}}}}}};ye.isContextTag=function(e,t){e=e.toLowerCase();var r,n;try{r=parseInt(e,16)}catch{return-1}if(t===void 0)return(r&192)==128;try{var i=t.match(/^\[[0-9]+\]$/);return i==null||(n=parseInt(t.substr(1,t.length-1),10),n>31)?!1:(r&192)==128&&(r&31)==n}catch{return!1}};ye.isASN1HEX=function(e){var t=ye;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),i=t.getL(e,0),a=e.length-n.length-i.length;return a==r*2};ye.checkStrictDER=function(e,t,r,n,i){var a=ye;if(r===void 0){if(typeof e!="string")throw new Error("not hex string");if(e=e.toLowerCase(),!A.lang.String.isHex(e))throw new Error("not hex string");r=e.length,n=e.length/2,n<128?i=1:i=Math.ceil(n.toString(16))+1}var s=a.getL(e,t);if(s.length>i*2)throw new Error("L of TLV too long: idx="+t);var u=a.getVblen(e,t);if(u>n)throw new Error("value of L too long than hex: idx="+t);var l=a.getTLV(e,t),f=l.length-2-a.getL(e,t).length;if(f!==u*2)throw new Error("V string length and L's value not the same:"+f+"/"+u*2);if(t===0&&e.length!=l.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+l.length);var d=e.substr(t,2);if(d==="02"){var m=a.getVidx(e,t);if(e.substr(m,2)=="00"&&e.charCodeAt(m+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(d,16)&32){for(var p=a.getVblen(e,t),h=0,w=a.getChildIdx(e,t),v=0;v"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.x509>"u"||!A.asn1.x509)&&(A.asn1.x509={});A.asn1.x509.Certificate=function(e){A.asn1.x509.Certificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.x509,s=a.TBSCertificate,u=a.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(l){this.params=l},this.sign=function(){var l=this.params,f=l.sigalg;l.sigalg.name!=null&&(f=l.sigalg.name);var d=l.tbsobj.tohex(),m=new A.crypto.Signature({alg:f});m.init(l.cakey),m.updateHex(d),l.sighex=m.sign()},this.getPEM=function(){return Bn(this.tohex(),"CERTIFICATE")},this.tohex=function(){var l=this.params;if((l.tbsobj==null||l.tbsobj==null)&&(l.tbsobj=new s(l)),l.sighex==null&&l.cakey!=null&&this.sign(),l.sighex==null)throw new Error("sighex or cakey parameter not defined");var f=[];f.push(l.tbsobj),f.push(new u({name:l.sigalg})),f.push(new n({hex:"00"+l.sighex}));var d=new i({array:f});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};pe(A.asn1.x509.Certificate,A.asn1.ASN1Object);A.asn1.x509.TBSCertificate=function(e){A.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.x509,i=r.DERTaggedObject,a=r.DERInteger,s=r.DERSequence,u=n.AlgorithmIdentifier,l=n.Time,f=n.X500Name,d=n.Extensions,m=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(p){this.params=p},this.tohex=function(){var p=[],h=this.params;if(h.version!=null||h.version!=1){var w=2;h.version!=null&&(w=h.version-1);var v=new i({obj:new a({int:w})});p.push(v)}p.push(new a(h.serial)),p.push(new u({name:h.sigalg})),p.push(new f(h.issuer)),p.push(new s({array:[new l(h.notbefore),new l(h.notafter)]})),p.push(new f(h.subject)),p.push(new m(vt.getKey(h.sbjpubkey))),h.ext!==void 0&&h.ext.length>0&&p.push(new i({tag:"a3",obj:new d(h.ext)}));var y=new A.asn1.DERSequence({array:p});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.x509.TBSCertificate,A.asn1.ASN1Object);A.asn1.x509.Extensions=function(e){A.asn1.x509.Extensions.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERSequence,i=r.x509;this.aParam=[],this.setByParam=function(a){this.aParam=a},this.tohex=function(){for(var a=[],s=0;s-1&&u.push(new n({int:this.pathLen}));var l=new i({array:u});return this.asn1ExtnValue=l,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,e!==void 0&&(e.cA!==void 0&&(this.cA=e.cA),e.pathLen!==void 0&&(this.pathLen=e.pathLen))};pe(A.asn1.x509.BasicConstraints,A.asn1.x509.Extension);A.asn1.x509.CRLDistributionPoints=function(e){A.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var a=[],s=0;s0&&a.push(new r({array:s}))}var l=new r({array:a});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(A.asn1.x509.PolicyInformation,A.asn1.ASN1Object);A.asn1.x509.PolicyQualifierInfo=function(e){A.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERSequence,n=t.DERIA5String,i=t.DERObjectIdentifier,a=t.x509.UserNotice;this.params=null,this.tohex=function(){if(this.params.cps!==void 0){var s=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]});return s.tohex()}if(this.params.unotice!=null){var s=new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new a(this.params.unotice)]});return s.tohex()}},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(A.asn1.x509.PolicyQualifierInfo,A.asn1.ASN1Object);A.asn1.x509.UserNotice=function(e){A.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText,i=A.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var a=[];this.params.noticeref!==void 0&&a.push(new i(this.params.noticeref)),this.params.exptext!==void 0&&a.push(new n(this.params.exptext));var s=new t({array:a});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};pe(A.asn1.x509.UserNotice,A.asn1.ASN1Object);A.asn1.x509.NoticeReference=function(e){A.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var i=[];if(this.params.org!==void 0&&i.push(new n(this.params.org)),this.params.noticenum!==void 0){for(var a=[],s=this.params.noticenum,u=0;u0)for(var s=0;s0;i++){var a=t.shift();if(r===!0){var s=n.pop(),u=(s+","+a).replace(/\\,/g,",");n.push(u),r=!1}else n.push(a);a.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(l){return l.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};A.asn1.x509.X500Name.ldapToOneline=function(e){return A.asn1.x509.X500Name.ldapToCompat(e)};A.asn1.x509.RDN=function(e){A.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=A.asn1.x509.AttributeTypeAndValue;this.setByParam=function(r){r.rule!==void 0&&(this.sRule=r.rule),r.str!==void 0&&this.addByMultiValuedString(r.str),r.array!==void 0&&(this.paramArray=r.array)},this.addByString=function(r){this.asn1Array.push(new A.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=A.asn1.x509.RDN.parseString(r),i=0;i0)for(var r=0;r0;i++){var a=t.shift();if(r===!0){var s=n.pop(),u=(s+"+"+a).replace(/\\\+/g,"+");n.push(u),r=!1}else n.push(a);a.substr(-1,1)==="\\"&&(r=!0)}for(var l=!1,f=[],i=0;n.length>0;i++){var a=n.shift();if(l===!0){var d=f.pop();if(a.match(/"$/)){var u=(d+"+"+a).replace(/^([^=]+)="(.*)"$/,"$1=$2");f.push(u),l=!1}else f.push(d+"+"+a)}else f.push(a);a.match(/^[^=]+="/)&&(l=!0)}return f};A.asn1.x509.AttributeTypeAndValue=function(e){A.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=A,r=t.asn1,n=r.DERSequence,i=r.DERUTF8String,a=r.DERPrintableString,s=r.DERTeletexString,u=r.DERIA5String,l=r.DERVisibleString,f=r.DERBMPString,d=t.lang.String.isMail,m=t.lang.String.isPrintable;this.setByParam=function(p){if(p.rule!==void 0&&(this.sRule=p.rule),p.ds!==void 0&&(this.dsType=p.ds),p.value===void 0&&p.str!==void 0){var h=p.str,w=h.match(/^([^=]+)=(.+)$/);if(w)this.sType=w[1],this.sValue=w[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=p.type,this.sValue=p.value},this.setByString=function(p,h){h!==void 0&&(this.sRule=h);var w=p.match(/^([^=]+)=(.+)$/);if(w)this.setByAttrTypeAndValueStr(w[1],w[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var p=this.sType,h=this.sValue,w=this.sRule;return w==="prn"?p=="CN"&&d(h)?"ia5":m(h)?"prn":"utf8":w==="utf8"?p=="CN"&&d(h)?"ia5":p=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(p,h,w){w!==void 0&&(this.sRule=w),this.sType=p,this.sValue=h},this.getValueObj=function(p,h){if(p=="utf8")return new i({str:h});if(p=="prn")return new a({str:h});if(p=="tel")return new s({str:h});if(p=="ia5")return new u({str:h});if(p=="vis")return new l({str:h});if(p=="bmp")return new f({str:h});throw new Error("unsupported directory string type: type="+p+" value="+h)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var p=A.asn1.x509.OID.atype2obj(this.sType),h=this.getValueObj(this.dsType,this.sValue),w=new n({array:[p,h]});return this.TLV=w.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.x509.AttributeTypeAndValue,A.asn1.ASN1Object);A.asn1.x509.SubjectPublicKeyInfo=function(e){A.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,a=i.DERInteger,s=i.DERBitString,u=i.DERObjectIdentifier,l=i.DERSequence,f=i.ASN1Util.newObject,d=i.x509,m=d.AlgorithmIdentifier,p=n.crypto,h=p.ECDSA,w=p.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var v=new l({array:[this.asn1AlgId,this.asn1SubjPKey]});return v},this.tohex=function(){var v=this.getASN1Object();return this.hTLV=v.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(v){try{if(v instanceof Je){var y=f({seq:[{int:{bigint:v.n}},{int:{int:v.e}}]}),g=y.tohex();this.asn1AlgId=new m({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+g})}}catch{}try{if(v instanceof A.crypto.ECDSA){var b=new u({name:v.curveName});this.asn1AlgId=new m({name:"ecPublicKey",asn1params:b}),this.asn1SubjPKey=new s({hex:"00"+v.pubKeyHex})}}catch{}try{if(v instanceof A.crypto.DSA){var b=new f({seq:[{int:{bigint:v.p}},{int:{bigint:v.q}},{int:{bigint:v.g}}]});this.asn1AlgId=new m({name:"dsa",asn1params:b});var D=new a({bigint:v.y});this.asn1SubjPKey=new s({hex:"00"+D.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};pe(A.asn1.x509.SubjectPublicKeyInfo,A.asn1.ASN1Object);A.asn1.x509.Time=function(e){A.asn1.x509.Time.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,a=i.DERUTCTime,s=i.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(u){this.timeParams=u},this.setByParam=function(u){this.params=u},this.getType=function(u){return u.match(/^[0-9]{12}Z$/)?"utc":u.match(/^[0-9]{14}Z$/)?"gen":u.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":u.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var u=this.params,l=null;if(typeof u=="string"&&(u={str:u}),u!=null&&u.str&&(u.type==null||u.type==null)&&(u.type=this.getType(u.str)),u!=null&&u.str?(u.type=="utc"&&(l=new a(u.str)),u.type=="gen"&&(l=new s(u.str))):this.type=="gen"?l=new s:l=new a,l==null)throw new Error("wrong setting for Time");return this.TLV=l.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};A.asn1.x509.Time_bak=function(e){A.asn1.x509.Time_bak.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,a=i.DERUTCTime,s=i.DERGeneralizedTime;this.setTimeParams=function(u){this.timeParams=u},this.tohex=function(){var u=null;return this.timeParams!=null?this.type=="utc"?u=new a(this.timeParams):u=new s(this.timeParams):this.type=="utc"?u=new a:u=new s,this.TLV=u.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",e!==void 0&&(e.type!==void 0?this.type=e.type:e.str!==void 0&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)};pe(A.asn1.x509.Time,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier=function(e){A.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=A,r=t.asn1,n=r.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(this.nameAlg===null&&this.asn1Alg===null)throw new Error("algorithm not specified");if(this.nameAlg!==null){var a=null;for(var s in n)s===this.nameAlg&&(a=n[s]);if(a!==null)return this.hTLV=a,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var u=[this.asn1Alg];this.asn1Params!==null&&u.push(this.asn1Params);var l=new r.DERSequence({array:u});return this.hTLV=l.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(e.name!==void 0&&(this.nameAlg=e.name),e.asn1params!==void 0&&(this.asn1Params=e.asn1params),e.paramempty!==void 0&&(this.paramEmpty=e.paramempty)),this.asn1Params===null&&this.paramEmpty===!1&&this.nameAlg!==null){this.nameAlg.name!==void 0&&(this.nameAlg=this.nameAlg.name);var i=this.nameAlg.toLowerCase();i.substr(-7,7)!=="withdsa"&&i.substr(-9,9)!=="withecdsa"&&(this.asn1Params=new r.DERNull)}};pe(A.asn1.x509.AlgorithmIdentifier,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};A.asn1.x509.GeneralName=function(e){A.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87",otherName:"a0"},r=A,n=r.asn1,i=n.x509,a=i.X500Name,s=i.OtherName,u=n.DERIA5String,l=n.DERPrintableString,f=n.DEROctetString,d=n.DERTaggedObject,m=n.ASN1Object,p=Error;this.params=null,this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,w,y,v,y=!1;if(h.other!==void 0)w="a0",v=new s(h.other);else if(h.rfc822!==void 0)w="81",v=new u({str:h.rfc822});else if(h.dns!==void 0)w="82",v=new u({str:h.dns});else if(h.dn!==void 0)w="a4",y=!0,typeof h.dn=="string"?v=new a({str:h.dn}):h.dn instanceof A.asn1.x509.X500Name?v=h.dn:v=new a(h.dn);else if(h.ldapdn!==void 0)w="a4",y=!0,v=new a({ldapstr:h.ldapdn});else if(h.certissuer!==void 0||h.certsubj!==void 0){w="a4",y=!0;var g,b,D=null;if(h.certsubj!==void 0?(g=!1,b=h.certsubj):(g=!0,b=h.certissuer),b.match(/^[0-9A-Fa-f]+$/)&&D==b,b.indexOf("-----BEGIN ")!=-1&&(D=hr(b)),D==null)throw new Error("certsubj/certissuer not cert");var _=new Ke;_.hex=D;var F;g?F=_.getIssuerHex():F=_.getSubjectHex(),v=new m,v.hTLV=F}else if(h.uri!==void 0)w="86",v=new u({str:h.uri});else if(h.ip!==void 0){w="87";var L,N=h.ip;try{if(N.match(/^[0-9a-f]+$/)){var S=N.length;if(S==8||S==16||S==32||S==64)L=N;else throw"err"}else L=xg(N)}catch(O){throw new p("malformed IP address: "+h.ip+":"+O.message)}v=new f({hex:L})}else throw new p("improper params");var B=new d({tag:w,explicit:y,obj:v});return B.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.x509.GeneralName,A.asn1.ASN1Object);A.asn1.x509.GeneralNames=function(e){A.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=A,n=r.asn1;this.setByParamArray=function(i){for(var a=0;a"u")throw"Name of ObjectIdentifier not defined: "+t;var r=this.name2oidList[t],n=new e({oid:r});return this.objCache[t]=n,n},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var r;if(t.match(/^\d+\.\d+\.[0-9.]+$/))r=t;else if(this.atype2oidList[t]!==void 0)r=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)r=this.name2oidList[t];else throw new Error("AttributeType name undefined: "+t);var n=new e({oid:r});return this.objCache[t]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var r in t)this.name2oidList[r]=t[r]},this.checkOIDs=function(t){try{var r=Object.keys(t);return r.length==0?!1:(r.map(function(n,i,a){var s=this[n];if(!s.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch{return!1}}};A.asn1.x509.OID.oid2name=function(e){var t=A.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};A.asn1.x509.OID.oid2atype=function(e){var t=A.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};A.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=A.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};A.asn1.x509.X509Util={};A.asn1.x509.X509Util.newCertPEM=function(e){var t=A.asn1.x509,r=t.TBSCertificate,n=t.Certificate,i=new n(e);return i.getPEM()};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cms>"u"||!A.asn1.cms)&&(A.asn1.cms={});A.asn1.cms.Attribute=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DERSet,s=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(u){this.params=u},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var u=new s({oid:this.typeOid}),l=new a({array:this.getValueArray()}),f=new i({array:[u,l]});return f.tohex()},this.getEncodedHex=function(){return this.tohex()}};pe(A.asn1.cms.Attribute,A.asn1.ASN1Object);A.asn1.cms.ContentType=function(e){var t=A,r=t.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},e!=null&&this.setByParam(e)};pe(A.asn1.cms.ContentType,A.asn1.cms.Attribute);A.asn1.cms.MessageDigest=function(e){var t=A,r=t.asn1,n=r.DEROctetString,i=r.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var a=new n(this.params);return[a]},e!=null&&this.setByParam(e)};pe(A.asn1.cms.MessageDigest,A.asn1.cms.Attribute);A.asn1.cms.SigningTime=function(e){var t=A,r=t.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},e!=null&&this.setByParam(e)};pe(A.asn1.cms.SigningTime,A.asn1.cms.Attribute);A.asn1.cms.SigningCertificate=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.cms,s=a.ESSCertID,u=r.crypto;a.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new t("parameter 'array' not specified");for(var l=this.params.array,f=[],d=0;d0){for(var w=a(p.valhex,h[0]),v=m(w,0),y=[],g=0;g1){var _=a(p.valhex,h[1]);p.polhex=_}delete p.valhex},this.setSignaturePolicyIdentifier=function(p){var h=m(p.valhex,0);if(h.length>0){var w=n.getOID(p.valhex,h[0]);p.oid=w}if(h.length>1){var v=new t,y=m(p.valhex,h[1]),g=a(p.valhex,y[0]),b=v.getAlgorithmIdentifierName(g);p.alg=b;var D=i(p.valhex,y[1]);p.hash=D}delete p.valhex},this.setSigningCertificateV2=function(p){var h=m(p.valhex,0);if(h.length>0){for(var w=a(p.valhex,h[0]),v=m(w,0),y=[],g=0;g1){var _=a(p.valhex,h[1]);p.polhex=_}delete p.valhex},this.getESSCertID=function(p){var h={},w=m(p,0);if(w.length>0){var v=i(p,w[0]);h.hash=v}if(w.length>1){var y=a(p,w[1]),g=this.getIssuerSerial(y);g.serial!=null&&(h.serial=g.serial),g.issuer!=null&&(h.issuer=g.issuer)}return h},this.getESSCertIDv2=function(p){var h={},w=m(p,0);if(w.length<1||3v+1){var b=a(p,w[v+1]),D=this.getIssuerSerial(b);h.issuer=D.issuer,h.serial=D.serial}return h},this.getIssuerSerial=function(p){var h={},w=m(p,0),v=a(p,w[0]),y=r.getGeneralNames(v),g=y[0].dn;h.issuer=g;var b=i(p,w[1]);return h.serial={hex:b},h},this.getCertificateSet=function(p){for(var h=m(p,0),w=[],v=0;v"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.tsp>"u"||!A.asn1.tsp)&&(A.asn1.tsp={});A.asn1.tsp.TimeStampToken=function(e){var t=A,r=t.asn1,n=r.tsp;n.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var i=new n.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=i.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.TimeStampToken,A.asn1.cms.SignedData);A.asn1.tsp.TSTInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DERInteger,s=n.DERBoolean,u=n.DERGeneralizedTime,l=n.DERObjectIdentifier,f=n.DERTaggedObject,d=n.tsp,m=d.MessageImprint,p=d.Accuracy,h=n.x509.X500Name,w=n.x509.GeneralName;if(d.TSTInfo.superclass.constructor.call(this),this.dVersion=new a({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var v=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(v.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(v.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(v.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");v.push(this.dGenTime),this.dAccuracy!=null&&v.push(this.dAccuracy),this.dOrdering!=null&&v.push(this.dOrdering),this.dNonce!=null&&v.push(this.dNonce),this.dTsa!=null&&v.push(this.dTsa);var y=new i({array:v});return this.hTLV=y.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0){if(typeof e.policy=="string"){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new l({oid:e.policy})}e.messageImprint!==void 0&&(this.dMessageImprint=new m(e.messageImprint)),e.serial!==void 0&&(this.dSerial=new a(e.serial)),e.genTime!==void 0&&(this.dGenTime=new u(e.genTime)),e.accuracy!==void 0&&(this.dAccuracy=new p(e.accuracy)),e.ordering!==void 0&&e.ordering==!0&&(this.dOrdering=new s),e.nonce!==void 0&&(this.dNonce=new a(e.nonce)),e.tsa!==void 0&&(this.dTsa=new f({tag:"a0",explicit:!0,obj:new w({dn:e.tsa})}))}};pe(A.asn1.tsp.TSTInfo,A.asn1.ASN1Object);A.asn1.tsp.Accuracy=function(e){var t=A,r=t.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,a=[];return i.seconds!=null&&typeof i.seconds=="number"&&a.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&a.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&a.push({tag:{tagi:"81",obj:{int:i.micros}}}),n({seq:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.Accuracy,A.asn1.ASN1Object);A.asn1.tsp.MessageImprint=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DEROctetString,a=r.x509,s=a.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=new s({name:u.alg}),f=new i({hex:u.hash}),d=new n({array:[l,f]});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.tsp.MessageImprint,A.asn1.ASN1Object);A.asn1.tsp.TimeStampReq=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DERInteger,a=r.DERBoolean,s=r.ASN1Object,u=r.DERObjectIdentifier,l=r.tsp,f=l.MessageImprint;l.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,m=[];m.push(new i({int:1})),d.messageImprint instanceof A.asn1.ASN1Object?m.push(d.messageImprint):m.push(new f(d.messageImprint)),d.policy!=null&&m.push(new u(d.policy)),d.nonce!=null&&m.push(new i(d.nonce)),d.certreq==!0&&m.push(new a);var p=new n({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.TimeStampReq,A.asn1.ASN1Object);A.asn1.tsp.TimeStampResp=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.ASN1Object,a=r.tsp,s=a.PKIStatusInfo;a.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];if(u.econtent!=null||u.tst!=null)if(u.statusinfo!=null?l.push(new s(u.statusinfo)):l.push(new s("granted")),u.econtent!=null)l.push(new a.TimeStampToken(u).getContentInfo());else if(u.tst instanceof r.ASN1Object)l.push(u.tst);else throw new Error("improper member tst value");else if(u.statusinfo!=null)l.push(new s(u.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var f=new n({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.TimeStampResp,A.asn1.ASN1Object);A.asn1.tsp.PKIStatusInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.tsp,s=a.PKIStatus,u=a.PKIFreeText,l=a.PKIFailureInfo;a.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var f=this.params,d=[];if(typeof f=="string")d.push(new s(f));else{if(f.status==null)throw new t("property 'status' unspecified");d.push(new s(f.status)),f.statusstr!=null&&d.push(new u(f.statusstr)),f.failinfo!=null&&d.push(new l(f.failinfo))}var m=new i({array:d});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.PKIStatusInfo,A.asn1.ASN1Object);A.asn1.tsp.PKIStatus=function(e){var t=Error,r=A,n=r.asn1,i=n.DERInteger,a=n.tsp;a.PKIStatus.superclass.constructor.call(this);var s={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var u=this.params,l,f;if(typeof u=="string")try{f=s[u]}catch{throw new t("undefined name: "+u)}else if(typeof u=="number")f=u;else throw new t("unsupported params");return new i({int:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.PKIStatus,A.asn1.ASN1Object);A.asn1.tsp.PKIFreeText=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DERUTF8String,s=n.tsp;s.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params;if(!u instanceof Array)throw new t("wrong params: not array");for(var l=[],f=0;f=0;p--)m+=d[p];return m}else{if(typeof l=="string"&&u[l]!=null)return X0([l],u);if(typeof l=="object"&&l.length!=null)return X0(l,u);throw new t("wrong params")}},this.tohex=function(){var l=this.params,f=this.getBinValue();return new i({bin:f}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.tsp.PKIFailureInfo,A.asn1.ASN1Object);A.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,r){throw"not implemented yet"}};A.asn1.tsp.SimpleTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(a,s){var u=i(a,s);this.params.econtent.content.messageImprint={alg:s,hash:u},this.params.econtent.content.serial={int:this.serial++};var l=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:l};var f=new n.TimeStampToken(this.params);return f.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};pe(A.asn1.tsp.SimpleTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.FixedTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(a,s){var u=i(a,s);this.params.econtent.content.messageImprint={alg:s,hash:u};var l=new n.TimeStampToken(this.params);return l.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};pe(A.asn1.tsp.FixedTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.TSPUtil=new function(){};A.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new A.asn1.tsp.TimeStampToken(e)};A.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=new A.asn1.tsp.TSPParser;return t.getTimeStampReq(e)};A.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=new A.asn1.tsp.TSPParser;return t.getMessageImprint(e)};A.asn1.tsp.TSPParser=function(){var e=Error,t=Ke,r=new t,n=ye,i=n.getV,a=n.getTLV,s=n.getIdxbyList,u=n.getTLVbyListEx,l=n.getChildIdx,f=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],d={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(m){var p=l(m,0);if(p.length==1)return this.getPKIStatusInfo(a(m,p[0]));if(p.length>1){var h=this.getPKIStatusInfo(a(m,p[0])),w=a(m,p[1]),v=this.getToken(w);return v.statusinfo=h,v}},this.getToken=function(m){var p=new A.asn1.cms.CMSParser,h=p.getCMSSignedData(m);return this.setTSTInfo(h),h},this.setTSTInfo=function(m){var p=m.econtent;if(p.type=="tstinfo"){var h=p.content.hex,w=this.getTSTInfo(h);p.content=w}},this.getTSTInfo=function(m){var p={},h=l(m,0),w=i(m,h[1]);p.policy=ad(w);var v=a(m,h[2]);p.messageImprint=this.getMessageImprint(v);var y=i(m,h[3]);p.serial={hex:y};var g=i(m,h[4]);p.genTime={str:jt(g)};var b=0;if(h.length>5&&m.substr(h[5],2)=="30"){var D=a(m,h[5]);p.accuracy=this.getAccuracy(D),b++}if(h.length>5+b&&m.substr(h[5+b],2)=="01"){var _=i(m,h[5+b]);_=="ff"&&(p.ordering=!0),b++}if(h.length>5+b&&m.substr(h[5+b],2)=="02"){var F=i(m,h[5+b]);p.nonce={hex:F},b++}if(h.length>5+b&&m.substr(h[5+b],2)=="a0"){var L=a(m,h[5+b]);L="30"+L.substr(2),pGeneralNames=r.getGeneralNames(L);var N=pGeneralNames[0].dn;p.tsa=N,b++}if(h.length>5+b&&m.substr(h[5+b],2)=="a1"){var S=a(m,h[5+b]);S="30"+S.substr(2);var B=r.getExtParamArray(S);p.ext=B,b++}return p},this.getAccuracy=function(m){for(var p={},h=l(m,0),w=0;w1&&m.substr(h[1],2)=="30"){var g=a(m,h[1]);p.statusstr=this.getPKIFreeText(g),w++}if(h.length>w&&m.substr(h[1+w],2)=="03"){var b=a(m,h[1+w]);p.failinfo=this.getPKIFailureInfo(b)}return p},this.getPKIFreeText=function(m){for(var p=[],h=l(m,0),w=0;w"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cades>"u"||!A.asn1.cades)&&(A.asn1.cades={});A.asn1.cades.SignaturePolicyIdentifier=function(e){var t=A,r=t.asn1,n=r.cades,i=n.SignaturePolicyId;n.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(a){this.params=a},e!=null&&this.setByParam(e)};pe(A.asn1.cades.SignaturePolicyIdentifier,A.asn1.cms.Attribute);A.asn1.cades.SignaturePolicyId=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,a=r.x509,s=a.AlgorithmIdentifier,u=r.cades,l=u.SignaturePolicyId,f=u.OtherHashAlgAndValue;l.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,m=[];m.push(new i(d.oid)),m.push(new f(d));var p=new n({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(d){this.params=d},e!=null&&this.setByParam(e)};pe(A.asn1.cades.SignaturePolicyId,A.asn1.ASN1Object);A.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.DEROctetString,s=n.x509,u=s.AlgorithmIdentifier,l=n.cades,f=l.OtherHashAlgAndValue;f.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params;if(d.alg==null)throw new t("property 'alg' not specified");if(d.hash==null&&d.cert==null)throw new t("property 'hash' nor 'cert' not specified");var m=null;if(d.hash!=null)m=d.hash;else if(d.cert!=null){if(typeof d.cert!="string")throw new t("cert not string");var p=d.cert;d.cert.indexOf("-----BEGIN")!=-1&&(p=hr(d.cert)),m=A.crypto.Util.hashHex(p,d.alg)}var h=[];h.push(new u({name:d.alg})),h.push(new a({hex:m}));var w=new i({array:h});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.cades.OtherHashAlgAndValue,A.asn1.ASN1Object);A.asn1.cades.OtherHashValue=function(e){A.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,r=A,n=r.lang.String.isHex,i=r.asn1,a=i.DEROctetString,s=r.crypto.Util.hashHex;this.params=null,this.tohex=function(){var u=this.params;if(u.hash==null&&u.cert==null)throw new t("hash or cert not specified");var l=null;if(u.hash!=null)l=u.hash;else if(u.cert!=null){if(typeof u.cert!="string")throw new t("cert not string");var f=u.cert;u.cert.indexOf("-----BEGIN")!=-1&&(f=hr(u.cert)),l=A.crypto.Util.hashHex(f,"sha1")}return new a({hex:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};pe(A.asn1.cades.OtherHashValue,A.asn1.ASN1Object);A.asn1.cades.SignatureTimeStamp=function(e){var t=Error,r=A,n=r.lang.String.isHex,i=r.asn1,a=i.ASN1Object,s=i.x509,u=i.cades;u.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var l=this.params;if(l.tst!=null)if(n(l.tst)){var f=new a;return f.hTLV=l.tst,[f]}else{if(l.tst instanceof a)return[l.tst];throw new t("params.tst has wrong value")}else if(l.res!=null){var d=l.res;if(d instanceof a&&(d=d.tohex()),typeof d!="string"||!n(d))throw new t("params.res has wrong value");var m=ye.getTLVbyList(d,0,[1]),f=new a;return f.hTLV=l.tst,[f]}},e!=null&&this.setByParam(e)};pe(A.asn1.cades.SignatureTimeStamp,A.asn1.cms.Attribute);A.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,a=n.cades,s=a.OtherCertID,u=r.lang.String.isHex;a.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var l=this.params,f=[],d=0;d"u"||!A.asn1.csr)&&(A.asn1.csr={});A.asn1.csr.CertificationRequest=function(e){var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.csr,s=r.x509,u=a.CertificationRequestInfo;a.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(l){this.params=l},this.sign=function(){var l=new u(this.params).tohex(),f=new A.crypto.Signature({alg:this.params.sigalg});f.init(this.params.sbjprvkey),f.updateHex(l);var d=f.sign();this.params.sighex=d},this.getPEM=function(){return Bn(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var l=this.params,f=new A.asn1.csr.CertificationRequestInfo(this.params),d=new A.asn1.x509.AlgorithmIdentifier({name:l.sigalg});if(l.sighex==null&&l.sbjprvkey!=null&&this.sign(),l.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var m=new n({hex:"00"+l.sighex}),p=new i({array:[f,d,m]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.csr.CertificationRequest,A.asn1.ASN1Object);A.asn1.csr.CertificationRequestInfo=function(e){var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,a=r.DERInteger,s=r.DERUTF8String,u=r.DERTaggedObject,l=r.ASN1Util.newObject,f=r.csr,d=r.x509,m=d.X500Name,p=d.Extensions,h=d.SubjectPublicKeyInfo,w=f.AttributeList;f.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(y){y!=null&&(this.params=y)},this.tohex=function(){var y=this.params,g=[];if(g.push(new a({int:0})),g.push(new m(y.subject)),g.push(new h(vt.getKey(y.sbjpubkey))),y.attrs!=null){var b=v(y.attrs),D=l({tag:{tage:"a0",obj:b}});g.push(D)}else if(y.extreq!=null){var _=new p(y.extreq),D=l({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[_]}]}}});g.push(D)}else g.push(new u({tag:"a0",explicit:!1,obj:new s({str:""})}));var F=new i({array:g});return F.tohex()},this.getEncodedHex=function(){return this.tohex()};function v(y){for(var g=Error,b=A.asn1.x509.Extensions,D=[],_=0;_"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.ocsp>"u"||!A.asn1.ocsp)&&(A.asn1.ocsp={});A.asn1.ocsp.DEFAULT_HASH="sha1";A.asn1.ocsp.OCSPResponse=function(e){A.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var t=A.asn1.DEREnumerated,r=A.asn1.ASN1Util.newObject,n=A.asn1.ocsp.ResponseBytes,i=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var a=this.params.resstatus;return typeof a=="number"?a:typeof a!="string"?-1:i.indexOf(a)},this.setByParam=function(a){this.params=a},this.tohex=function(){var a=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+a.resstatus);if(s!=0)return r({seq:[{enum:{int:s}}]}).tohex();var u=new n(a);return r({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:u}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.ocsp.OCSPResponse,A.asn1.ASN1Object);A.asn1.ocsp.ResponseBytes=function(e){A.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=A.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,i=t.DEROctetString,a=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(s){this.params=s},this.tohex=function(){var s=this.params;if(s.restype!="ocspBasic")throw new Error("not supported responseType: "+s.restype);var u=new a(s),l=[];l.push(new n({name:"ocspBasic"})),l.push(new i({hex:u.tohex()}));var f=new r({array:l});return f.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};pe(A.asn1.ocsp.ResponseBytes,A.asn1.ASN1Object);A.asn1.ocsp.BasicOCSPResponse=function(e){A.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.ASN1Object,i=r.DERSequence,a=r.DERGeneralizedTime,s=r.DERTaggedObject,u=r.DERBitString,l=r.x509.Extensions,f=r.x509.AlgorithmIdentifier,d=r.ocsp,m=d.ResponderID;_SingleResponseList=d.SingleResponseList,_ResponseData=d.ResponseData,this.params=null,this.setByParam=function(p){this.params=p},this.sign=function(){var p=this.params,h=p.tbsresp.tohex(),w=new A.crypto.Signature({alg:p.sigalg});w.init(p.reskey),w.updateHex(h),p.sighex=w.sign()},this.tohex=function(){var p=this.params;p.tbsresp==null&&(p.tbsresp=new _ResponseData(p)),p.sighex==null&&p.reskey!=null&&this.sign();var h=[];if(h.push(p.tbsresp),h.push(new f({name:p.sigalg})),h.push(new u({hex:"00"+p.sighex})),p.certs!=null&&p.certs.length!=null){for(var w=[],v=0;v"u"||!A)&&(A={});(typeof A.lang>"u"||!A.lang)&&(A.lang={});A.lang.String=function(){};function by(e){for(var t=new Array,r=0;r>6,l=128|s&63;return jt(u.toString(16)+l.toString(16))}var u=224|(a&240)>>4,l=128|(a&15)<<2|(s&192)>>6,f=128|s&63;return jt(u.toString(16)+l.toString(16)+f.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function sd(e){for(var t=encodeURIComponent(e),r="",n=0;n"7"?"00"+e:e}function ST(e){e=e.replace(/^\s*\[\s*/,""),e=e.replace(/\s*\]\s*$/,""),e=e.replace(/\s*/g,"");try{var t=e.split(/,/).map(function(r,n,i){var a=parseInt(r);if(a<0||255t.length&&(r=t.length);for(var n=0;n0&&(f=f+"."+u.join(".")),f}catch{return null}}function Iy(e){var t=new ee(String(e),10);return pf(t)}function pf(e){var t=e.toString(16);if(t.substr(0,1)!="-")return t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t),t;var r=t.substr(1),n=r.length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var i="",a=0;a=t?e:new Array(t-e.length+1).join(r)+e};function By(e){if(e.length%2!=0||(e=e.toLowerCase(),e.match(/^[0-9a-f]+$/)==null))return-1;try{var t=e.substr(0,2);if(t=="00")return parseInt(e.substr(2),16);var r=parseInt(t,16);if(r>7)return-1;var n=e.substr(2),i=parseInt(n,16).toString(2);i=="0"&&(i="00000000"),i=i.slice(0,0-r);var a=parseInt(i,2);return a==NaN?-1:a}catch{return-1}}function xy(e){if(typeof e!="number"||e<0)return null;var t=Number(e).toString(2),r=8-t.length%8;r==8&&(r=0),t=t+W0("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function Py(e){if(typeof e!="string"||e.length%2!=0||!e.match(/^[0-9a-f]+$/))return null;try{var t=parseInt(e.substr(0,2),16);if(t<0||7=0;n--)a+=i[n];return a}function Yt(e,n,r){if(typeof e=="object"){for(var n=String(n).split("."),i=0;i"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:Se.algo.MD5,sha1:Se.algo.SHA1,sha224:Se.algo.SHA224,sha256:Se.algo.SHA256,sha384:Se.algo.SHA384,sha512:Se.algo.SHA512,ripemd160:Se.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(typeof this.DIGESTINFOHEAD[t]>"u")throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,r){var n=this.getDigestInfoHex(e,t),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+t;for(var a="0001",s="00"+n,u="",l=i-a.length-s.length,f=0;f"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECDSA=function(e){var t="secp256r1",r=null,n=null,i=null,a=Error,s=ee,u=Rt,l=A.crypto.ECDSA,f=A.crypto.ECParameterDB,d=l.getName,m=ye,p=m.getVbyListEx,h=m.isASN1HEX,w=new Vl,v=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function y(g,b,D,_){for(var F=Math.max(b.bitLength(),_.bitLength()),L=g.add2D(D),N=g.curve.getInfinity(),S=F-1;S>=0;--S)N=N.twice2D(),N.z=s.ONE,b.testBit(S)?_.testBit(S)?N=N.add2D(L):N=N.add2D(g):_.testBit(S)&&(N=N.add2D(D));return N}this.getBigRandom=function(g){return new s(g.bitLength(),w).mod(g.subtract(s.ONE)).add(s.ONE)},this.setNamedCurve=function(g){this.ecparams=f.getByName(g),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=g},this.setPrivateKeyHex=function(g){this.isPrivate=!0,this.prvKeyHex=g},this.setPublicKeyHex=function(g){this.isPublic=!0,this.pubKeyHex=g},this.getPublicKeyXYHex=function(){var g=this.pubKeyHex;if(g.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var b=this.ecparams.keycharlen;if(g.length!==2+b*2)throw"malformed public key hex length";var D={};return D.x=g.substr(2,b),D.y=g.substr(2+b),D},this.getShortNISTPCurveName=function(){var g=this.curveName;return g==="secp256r1"||g==="NIST P-256"||g==="P-256"||g==="prime256v1"?"P-256":g==="secp384r1"||g==="NIST P-384"||g==="P-384"?"P-384":g==="secp521r1"||g==="NIST P-521"||g==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var g=this.ecparams.n,b=this.getBigRandom(g),D=this.ecparams.keycharlen,_=("0000000000"+b.toString(16)).slice(-D);this.setPrivateKeyHex(_);var F=this.generatePublicKeyHex();return{ecprvhex:_,ecpubhex:F}},this.generatePublicKeyHex=function(){var g=new s(this.prvKeyHex,16),b=this.ecparams.G.multiply(g),D=b.getX().toBigInteger(),_=b.getY().toBigInteger(),F=this.ecparams.keycharlen,L=("0000000000"+D.toString(16)).slice(-F),N=("0000000000"+_.toString(16)).slice(-F),S="04"+L+N;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(g){return this.signHex(g,this.prvKeyHex)},this.signHex=function(g,b){var D=new s(b,16),_=this.ecparams.n,F=new s(g.substring(0,this.ecparams.keycharlen),16);do var L=this.getBigRandom(_),N=this.ecparams.G,S=N.multiply(L),B=S.getX().toBigInteger().mod(_);while(B.compareTo(s.ZERO)<=0);var O=L.modInverse(_).multiply(F.add(D.multiply(B))).mod(_);return l.biRSSigToASN1Sig(B,O)},this.sign=function(g,b){var D=b,_=this.ecparams.n,F=s.fromByteArrayUnsigned(g);do var L=this.getBigRandom(_),N=this.ecparams.G,S=N.multiply(L),B=S.getX().toBigInteger().mod(_);while(B.compareTo(ee.ZERO)<=0);var O=L.modInverse(_).multiply(F.add(D.multiply(B))).mod(_);return this.serializeSig(B,O)},this.verifyWithMessageHash=function(g,b){return this.verifyHex(g,b,this.pubKeyHex)},this.verifyHex=function(g,b,D){try{var _,F,L=l.parseSigHex(b);_=L.r,F=L.s;var N=u.decodeFromHex(this.ecparams.curve,D),S=new s(g.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,_,F,N)}catch{return!1}},this.verify=function(g,b,D){var _,F;if(Bitcoin.Util.isArray(b)){var L=this.parseSig(b);_=L.r,F=L.s}else if(typeof b=="object"&&b.r&&b.s)_=b.r,F=b.s;else throw"Invalid value for signature";var N;if(D instanceof Rt)N=D;else if(Bitcoin.Util.isArray(D))N=u.decodeFrom(this.ecparams.curve,D);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=s.fromByteArrayUnsigned(g);return this.verifyRaw(S,_,F,N)},this.verifyRaw=function(g,b,D,_){var F=this.ecparams.n,L=this.ecparams.G;if(b.compareTo(s.ONE)<0||b.compareTo(F)>=0||D.compareTo(s.ONE)<0||D.compareTo(F)>=0)return!1;var N=D.modInverse(F),S=g.multiply(N).mod(F),B=b.multiply(N).mod(F),O=L.multiply(S).add(_.multiply(B)),P=O.getX().toBigInteger().mod(F);return P.equals(b)},this.serializeSig=function(g,b){var D=g.toByteArraySigned(),_=b.toByteArraySigned(),F=[];return F.push(2),F.push(D.length),F=F.concat(D),F.push(2),F.push(_.length),F=F.concat(_),F.unshift(F.length),F.unshift(48),F},this.parseSig=function(g){var b;if(g[0]!=48)throw new Error("Signature not a valid DERSequence");if(b=2,g[b]!=2)throw new Error("First element in signature must be a DERInteger");var D=g.slice(b+2,b+2+g[b+1]);if(b+=2+g[b+1],g[b]!=2)throw new Error("Second element in signature must be a DERInteger");var _=g.slice(b+2,b+2+g[b+1]);b+=2+g[b+1];var F=s.fromByteArrayUnsigned(D),L=s.fromByteArrayUnsigned(_);return{r:F,s:L}},this.parseSigCompact=function(g){if(g.length!==65)throw"Signature has the wrong length";var b=g[0]-27;if(b<0||b>7)throw"Invalid signature type";var D=this.ecparams.n,_=s.fromByteArrayUnsigned(g.slice(1,33)).mod(D),F=s.fromByteArrayUnsigned(g.slice(33,65)).mod(D);return{r:_,s:F,i:b}},this.readPKCS5PrvKeyHex=function(g){if(h(g)===!1)throw new Error("not ASN.1 hex string");var b,D,_;try{b=p(g,0,["[0]",0],"06"),D=p(g,0,[1],"04");try{_=p(g,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=d(b),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(_),this.setPrivateKeyHex(D),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(g){if(h(g)===!1)throw new a("not ASN.1 hex string");var b,D,_,F;try{b=p(g,0,[1,0],"06"),D=p(g,0,[1,1],"06"),_=p(g,0,[2,0,1],"04");try{F=p(g,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new a("malformed PKCS#8 plain ECC private key")}if(this.curveName=d(D),this.curveName===void 0)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(F),this.setPrivateKeyHex(_),this.isPublic=!1},this.readPKCS8PubKeyHex=function(g){if(h(g)===!1)throw new a("not ASN.1 hex string");var b,D,_;try{b=p(g,0,[0,0],"06"),D=p(g,0,[0,1],"06"),_=p(g,0,[1],"03")}catch{throw new a("malformed PKCS#8 ECC public key")}if(this.curveName=d(D),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(_)},this.readCertPubKeyHex=function(g,b){if(h(g)===!1)throw new a("not ASN.1 hex string");var D,_;try{D=p(g,0,[0,5,0,1],"06"),_=p(g,0,[0,5,1],"03")}catch{throw new a("malformed X.509 certificate ECC public key")}if(this.curveName=d(D),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(_)},e!==void 0&&e.curve!==void 0&&(this.curveName=e.curve),this.curveName===void 0&&(this.curveName=t),this.setNamedCurve(this.curveName),e!==void 0&&(e.prv!==void 0&&this.setPrivateKeyHex(e.prv),e.pub!==void 0&&this.setPublicKeyHex(e.pub))};A.crypto.ECDSA.parseSigHex=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=new ee(t.r,16),n=new ee(t.s,16);return{r,s:n}};A.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=ye,r=t.getChildIdx,n=t.getV;if(t.checkStrictDER(e,0),e.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var i=r(e,0);if(i.length!=2)throw new Error("signature shall have two elements");var a=i[0],s=i[1];if(e.substr(a,2)!="02")throw new Error("1st item not ASN.1 integer");if(e.substr(s,2)!="02")throw new Error("2nd item not ASN.1 integer");var u=n(e,a),l=n(e,s);return{r:u,s:l}};A.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=t.r,n=t.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var i=Math.max(r.length,n.length);return r=("000000"+r).slice(-i),n=("000000"+n).slice(-i),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};A.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),r=e.substr(e.length/2);return A.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};A.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new ee(e,16),n=new ee(t,16);return A.crypto.ECDSA.biRSSigToASN1Sig(r,n)};A.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=A.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t}),a=new r.DERSequence({array:[n,i]});return a.tohex()};A.crypto.ECDSA.getName=function(e){return e==="2b8104001f"?"secp192k1":e==="2a8648ce3d030107"?"secp256r1":e==="2b8104000a"?"secp256k1":e==="2b81040021"?"secp224r1":e==="2b81040022"?"secp384r1":e==="2b81040023"?"secp521r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)!==-1?"secp256r1":"|secp256k1|".indexOf(e)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(e)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(e)!==-1?"secp384r1":"|secp521r1|NIST P-521|P-521|".indexOf(e)!==-1?"secp521r1":null};(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECParameterDB=new function(){var e={},t={};function r(n){return new ee(n,16)}this.getByName=function(n){var i=n;if(typeof t[i]<"u"&&(i=t[n]),typeof e[i]<"u")return e[i];throw"unregistered EC curve name: "+i},this.regist=function(n,i,a,s,u,l,f,d,m,p,h,w){e[n]={};var v=r(a),y=r(s),g=r(u),b=r(l),D=r(f),_=new Ha(v,y,g),F=_.decodePointHex("04"+d+m);e[n].name=n,e[n].keylen=i,e[n].keycharlen=Math.ceil(i/8)*2,e[n].curve=_,e[n].G=F,e[n].n=b,e[n].h=D,e[n].oid=h,e[n].info=w;for(var L=0;L"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.DSA=function(){var e=ye,t=e.getVbyList,r=e.getVbyListEx,n=e.isASN1HEX,i=ee;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(a,s,u,l,f){this.isPrivate=!0,this.p=a,this.q=s,this.g=u,this.y=l,this.x=f},this.setPrivateHex=function(a,s,u,l,f){var d,m,p,h,w;d=new ee(a,16),m=new ee(s,16),p=new ee(u,16),typeof l=="string"&&l.length>1?h=new ee(l,16):h=null,w=new ee(f,16),this.setPrivate(d,m,p,h,w)},this.setPublic=function(a,s,u,l){this.isPublic=!0,this.p=a,this.q=s,this.g=u,this.y=l,this.x=null},this.setPublicHex=function(a,s,u,l){var f,d,m,p;f=new ee(a,16),d=new ee(s,16),m=new ee(u,16),p=new ee(l,16),this.setPublic(f,d,m,p)},this.signWithMessageHash=function(a){var s=this.p,u=this.q,l=this.g,f=this.y,d=this.x,m=A.crypto.Util.getRandomBigIntegerMinToMax(ee.ONE.add(ee.ONE),u.subtract(ee.ONE)),p=a.substr(0,u.bitLength()/4),h=new ee(p,16),w=l.modPow(m,s).mod(u),v=m.modInverse(u).multiply(h.add(d.multiply(w))).mod(u),y=A.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:w}},{int:{bigint:v}}]});return y},this.verifyWithMessageHash=function(a,s){var u=this.p,l=this.q,f=this.g,d=this.y,m=this.parseASN1Signature(s),p=m[0],h=m[1],w=a.substr(0,l.bitLength()/4),v=new ee(w,16);if(ee.ZERO.compareTo(p)>0||p.compareTo(l)>0||ee.ZERO.compareTo(h)>=0||h.compareTo(l)>0)throw"invalid DSA signature";var y=h.modInverse(l),g=v.multiply(y).mod(l),b=p.multiply(y).mod(l),D=f.modPow(g,u).multiply(d.modPow(b,u)).mod(u).mod(l);return D.compareTo(p)==0},this.parseASN1Signature=function(a){try{var s=new i(r(a,0,[0],"02"),16),u=new i(r(a,0,[1],"02"),16);return[s,u]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(a){var s,u,l,f,d;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[1],"02"),u=r(a,0,[2],"02"),l=r(a,0,[3],"02"),f=r(a,0,[4],"02"),d=r(a,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(s,u,l,f,d)},this.readPKCS8PrvKeyHex=function(a){var s,u,l,f;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[1,1,0],"02"),u=r(a,0,[1,1,1],"02"),l=r(a,0,[1,1,2],"02"),f=r(a,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(s,u,l,null,f)},this.readPKCS8PubKeyHex=function(a){var s,u,l,f;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{s=r(a,0,[0,1,0],"02"),u=r(a,0,[0,1,1],"02"),l=r(a,0,[0,1,2],"02"),f=r(a,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(s,u,l,f)},this.readCertPubKeyHex=function(a,s){var u,l,f,d;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[0,5,0,1,0],"02"),l=r(a,0,[0,5,0,1,1],"02"),f=r(a,0,[0,5,0,1,2],"02"),d=r(a,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(u,l,f,d)}};var vt=function(){var e=function(v,y,g){return n(Se.AES,v,y,g)},t=function(v,y,g){return n(Se.TripleDES,v,y,g)},r=function(v,y,g){return n(Se.DES,v,y,g)},n=function(v,y,g,b){var D=Se.enc.Hex.parse(y),_=Se.enc.Hex.parse(g),F=Se.enc.Hex.parse(b),L={};L.key=_,L.iv=F,L.ciphertext=D;var N=v.decrypt(L,_,{iv:F});return Se.enc.Hex.stringify(N)},i=function(v,y,g){return u(Se.AES,v,y,g)},a=function(v,y,g){return u(Se.TripleDES,v,y,g)},s=function(v,y,g){return u(Se.DES,v,y,g)},u=function(v,y,g,b){var D=Se.enc.Hex.parse(y),_=Se.enc.Hex.parse(g),F=Se.enc.Hex.parse(b),L=v.encrypt(D,_,{iv:F}),N=Se.enc.Hex.parse(L.toString()),S=Se.enc.Base64.stringify(N);return S},l={"AES-256-CBC":{proc:e,eproc:i,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:i,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:i,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:t,eproc:a,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:s,keylen:8,ivlen:8}},f=function(v){return l[v].proc},d=function(v){var y=Se.lib.WordArray.random(v),g=Se.enc.Hex.stringify(y);return g},m=function(v){var y={},g=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));g&&(y.cipher=g[1],y.ivsalt=g[2]);var b=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));b&&(y.type=b[1]);var D=-1,_=0;v.indexOf(`\r \r `)!=-1&&(D=v.indexOf(`\r \r `),_=2),v.indexOf(` `)!=-1&&(D=v.indexOf(` `),_=1);var F=v.indexOf("-----END");if(D!=-1&&F!=-1){var L=v.substring(D+_*2,F-_);L=L.replace(/\s+/g,""),y.data=L}return y},p=function(v,y,g){for(var b=g.substring(0,16),D=Se.enc.Hex.parse(b),_=Se.enc.Utf8.parse(y),F=l[v].keylen+l[v].ivlen,L="",N=null;;){var S=Se.algo.MD5.create();if(N!=null&&S.update(N),S.update(_),S.update(D),N=S.finalize(),L=L+Se.enc.Hex.stringify(N),L.length>=F*2)break}var B={};return B.keyhex=L.substr(0,l[v].keylen*2),B.ivhex=L.substr(l[v].keylen*2,l[v].ivlen*2),B},h=function(v,y,g,b){var D=Se.enc.Base64.parse(v),_=Se.enc.Hex.stringify(D),F=l[y].proc,L=F(_,g,b);return L},w=function(v,y,g,b){var D=l[y].eproc,_=D(v,g,b);return _};return{version:"1.0.0",parsePKCS5PEM:function(v){return m(v)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(v,y,g){return p(v,y,g)},decryptKeyB64:function(v,y,g,b){return h(v,y,g,b)},getDecryptedKeyHex:function(v,y){var g=m(v),b=g.type,D=g.cipher,_=g.ivsalt,F=g.data,L=p(D,y,_),N=L.keyhex,S=h(F,D,N,_);return S},getEncryptedPKCS5PEMFromPrvKeyHex:function(v,y,g,b,D){var O="";if((typeof b>"u"||b==null)&&(b="AES-256-CBC"),typeof l[b]>"u")throw new Error("KEYUTIL unsupported algorithm: "+b);if(typeof D>"u"||D==null){var _=l[b].ivlen,F=d(_);D=F.toUpperCase()}var L=p(b,g,D),N=L.keyhex,S=w(y,b,N,D),B=S.replace(/(.{64})/g,`$1\r `),O="-----BEGIN "+v+` PRIVATE KEY-----\r `;return O+=`Proc-Type: 4,ENCRYPTED\r `,O+="DEK-Info: "+b+","+D+`\r `,O+=`\r `,O+=B,O+=`\r -----END `+v+` PRIVATE KEY-----\r `,O},getEncryptedPKCS8PEM:function(v,y,g){var b=this.getEncryptedPKCS8Hex(v,y,g);return Bn(b,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(v,y,g){var b;g==null||g==null?b={}:b=JSON.parse(JSON.stringify(g)),b.plain=v,this.initPBES2Param(b),this.encryptPBES2Param(b,y);var D=this.generatePBES2ASN1Param(b);return A.asn1.ASN1Util.newObject(D).tohex()},initPBES2Param:function(v){if(Yt(v,"encalg")==null&&(v.encalg="aes256-CBC"),Yt(v,"iter")==null&&(v.iter=2048),Yt(v,"prf")==null&&(v.prf="hmacWithSHA256"),Yt(v,"salt")==null&&(v.salt=Se.enc.Hex.stringify(Se.lib.WordArray.random(8))),Yt(v,"enciv")==null){var y;v.encalg=="des-EDE3-CBC"&&(y=8),v.encalg=="aes128-CBC"&&(y=16),v.encalg=="aes256-CBC"&&(y=16),v.enciv=Se.enc.Hex.stringify(Se.lib.WordArray.random(y))}},encryptPBES2Param:function(v,y){var g=vt.getDKFromPBES2Param(v,y);try{var b=A.crypto.Cipher.encrypt(v.plain,g,v.encalg,{iv:v.enciv})}catch{throw new Error("encrypt error: "+v.plain+" "+g+" "+v.encalg+" "+v.enciv)}v.enc=b},generatePBES2ASN1Param:function(v){var y={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:v.salt}},{int:{hex:Iy(v.iter)}}]}]},{seq:[{oid:v.encalg},{octstr:{hex:v.enciv}}]}]}]},{octstr:{hex:v.enc}}]};return v.prf!="hmacWithSHA1"&&y.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:v.prf},{null:""}]}),y},parseHexOfEncryptedPKCS8:function(v){var y=ye,g=y.getChildIdx,b=y.getV,D={},_=g(v,0);if(_.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+_.length);D.ciphertext=b(v,_[1]);var F=g(v,_[0]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+F.length);if(b(v,F[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var L=g(v,F[1]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+L.length);var N=g(v,L[1]);if(N.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+N.length);if(b(v,N[0])!="2a864886f70d0307")throw"this only supports TripleDES";D.encryptionSchemeAlg="TripleDES",D.encryptionSchemeIV=b(v,N[1]);var S=g(v,L[0]);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length);if(b(v,S[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var B=g(v,S[1]);if(B.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+B.length);D.pbkdf2Salt=b(v,B[0]);var O=b(v,B[1]);try{D.pbkdf2Iter=parseInt(O,16)}catch{throw new Error("malformed format pbkdf2Iter: "+O)}return D},getPBKDF2KeyHexFromParam:function(v,y){var g=Se.enc.Hex.parse(v.pbkdf2Salt),b=v.pbkdf2Iter,D=Se.PBKDF2(y,g,{keySize:192/32,iterations:b}),_=Se.enc.Hex.stringify(D);return _},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,y){var g=hr(v,"ENCRYPTED PRIVATE KEY"),b=this.parseHexOfEncryptedPKCS8(g),D=vt.getPBKDF2KeyHexFromParam(b,y),_={};_.ciphertext=Se.enc.Hex.parse(b.ciphertext);var F=Se.enc.Hex.parse(D),L=Se.enc.Hex.parse(b.encryptionSchemeIV),N=Se.TripleDES.decrypt(_,F,{iv:L}),S=Se.enc.Hex.stringify(N);return S},parsePBES2:function(v){var y=ye.parse(v);if(Yt(y,"seq.0.seq.0.oid")!="pkcs5PBES2"||Yt(y,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var g=Yt(y,"seq.0.seq.1.seq.0.seq.1.seq");if(g==null)throw new Error("PBKDF2 parameter not found");var b=Yt(g,"0.octstr.hex"),D=Yt(g,"1.int.hex"),_=Yt(g,"2.seq.0.oid","hmacWithSHA1"),F=-1;try{F=parseInt(D,16)}catch{throw new Error("iter not proper value")}var L=Yt(y,"seq.0.seq.1.seq.1.seq.0.oid"),N=Yt(y,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),S=Yt(y,"seq.1.octstr.hex");if(L==null||N==null||S==null)throw new Error("encalg, enciv or enc is undefined");var B={salt:b,iter:F,prf:_,encalg:L,enciv:N,enc:S};return B},getDKFromPBES2Param:function(v,y){var g={hmacWithSHA1:Se.algo.SHA1,hmacWithSHA224:Se.algo.SHA224,hmacWithSHA256:Se.algo.SHA256,hmacWithSHA384:Se.algo.SHA384,hmacWithSHA512:Se.algo.SHA512},b={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},D=g[v.prf];if(D==null)throw new Error("unsupported prf");var _=b[v.encalg];if(_==null)throw new Error("unsupported encalg");var F=Se.enc.Hex.parse(v.salt),L=v.iter;try{var N=Se.PBKDF2(y,F,{keySize:_,iterations:L,hasher:D});return Se.enc.Hex.stringify(N)}catch(S){throw new Error("PBKDF2 error: "+S+" "+JSON.stringify(v)+" "+y)}},getPlainHexFromEncryptedPKCS8PEM:function(v,y){if(v.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var g=hr(v),b;try{b=vt.parsePBES2(g)}catch(_){throw new Error("malformed PBES2 format: "+_.message)}var D=vt.getDKFromPBES2Param(b,y);return A.crypto.Cipher.decrypt(b.enc,D,b.encalg,{iv:b.enciv})},getKeyFromEncryptedPKCS8PEM:function(v,y){var g=this.getPlainHexFromEncryptedPKCS8PEM(v,y),b=this.getKeyFromPlainPrivatePKCS8Hex(g);return b},parsePlainPrivatePKCS8Hex:function(v){var y=ye,g=y.getChildIdx,b=y.getV,D={};if(D.algparam=null,v.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var _=g(v,0);if(_.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(v.substr(_[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var F=g(v,_[1]);if(F.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(v.substr(F[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(D.algoid=b(v,F[0]),v.substr(F[1],2)=="06"&&(D.algparam=b(v,F[1])),v.substr(_[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return D.keyidx=y.getVidx(v,_[2]),D},getKeyFromPlainPrivatePKCS8PEM:function(v){var y=hr(v,"PRIVATE KEY"),g=this.getKeyFromPlainPrivatePKCS8Hex(y);return g},getKeyFromPlainPrivatePKCS8Hex:function(v){var y=this.parsePlainPrivatePKCS8Hex(v),g;if(y.algoid=="2a864886f70d010101")g=new Je;else if(y.algoid=="2a8648ce380401")g=new A.crypto.DSA;else if(y.algoid=="2a8648ce3d0201")g=new A.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return g.readPKCS8PrvKeyHex(v),g},_getKeyFromPublicPKCS8Hex:function(v){var y,g=ye.getVbyList(v,0,[0,0],"06");if(g==="2a864886f70d010101")y=new Je;else if(g==="2a8648ce380401")y=new A.crypto.DSA;else if(g==="2a8648ce3d0201")y=new A.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return y.readPKCS8PubKeyHex(v),y},parsePublicRawRSAKeyHex:function(v){var y=ye,g=y.getChildIdx,b=y.getV,D={};if(v.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var _=g(v,0);if(_.length!=2)throw new Error("malformed RSA key(code:002)");if(v.substr(_[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(D.n=b(v,_[0]),v.substr(_[1],2)!="02")throw new Error("malformed RSA key(code:004)");return D.e=b(v,_[1]),D},parsePublicPKCS8Hex:function(v){var y=ye,g=y.getChildIdx,b=y.getV,D={};D.algparam=null;var _=g(v,0);if(_.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+_.length);var F=_[0];if(v.substr(F,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var L=g(v,F);if(L.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(v.substr(L[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(D.algoid=b(v,L[0]),v.substr(L[1],2)=="06"?D.algparam=b(v,L[1]):v.substr(L[1],2)=="30"&&(D.algparam={},D.algparam.p=y.getVbyList(v,L[1],[0],"02"),D.algparam.q=y.getVbyList(v,L[1],[1],"02"),D.algparam.g=y.getVbyList(v,L[1],[2],"02")),v.substr(_[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return D.key=b(v,_[1]).substr(2),D}}}();vt.getKey=function(e,t,r){var n=ye,i=n.getChildIdx,a=n.getV,s=n.getVbyList,u=A.crypto,l=u.ECDSA,f=u.DSA,d=Je,m=hr,p=vt;if(typeof d<"u"&&e instanceof d||typeof l<"u"&&e instanceof l||typeof f<"u"&&e instanceof f)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new l({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new l({prv:e.d,curve:e.curve});if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var h=new d;return h.setPublic(e.n,e.e),h}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.co!==void 0&&e.qi===void 0){var h=new d;return h.setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),h}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p===void 0){var h=new d;return h.setPrivate(e.n,e.e,e.d),h}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x===void 0){var h=new f;return h.setPublic(e.p,e.q,e.g,e.y),h}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x!==void 0){var h=new f;return h.setPrivate(e.p,e.q,e.g,e.y,e.x),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var h=new d;return h.setPublic(sr(e.n),sr(e.e)),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.qi!==void 0){var h=new d;return h.setPrivateEx(sr(e.n),sr(e.e),sr(e.d),sr(e.p),sr(e.q),sr(e.dp),sr(e.dq),sr(e.qi)),h}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var h=new d;return h.setPrivate(sr(e.n),sr(e.e),sr(e.d)),h}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var w=new l({curve:e.crv}),v=w.ecparams.keycharlen,y=("0000000000"+sr(e.x)).slice(-v),g=("0000000000"+sr(e.y)).slice(-v),b="04"+y+g;return w.setPublicKeyHex(b),w}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var w=new l({curve:e.crv}),v=w.ecparams.keycharlen,y=("0000000000"+sr(e.x)).slice(-v),g=("0000000000"+sr(e.y)).slice(-v),b="04"+y+g,D=("0000000000"+sr(e.d)).slice(-v);return w.setPublicKeyHex(b),w.setPrivateKeyHex(D),w}if(r==="pkcs5prv"){var _=e,n=ye,F,h;if(F=i(_,0),F.length===9)h=new d,h.readPKCS5PrvKeyHex(_);else if(F.length===6)h=new f,h.readPKCS5PrvKeyHex(_);else if(F.length>2&&_.substr(F[1],2)==="04")h=new l,h.readPKCS5PrvKeyHex(_);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return h}if(r==="pkcs8prv"){var h=p.getKeyFromPlainPrivatePKCS8Hex(e);return h}if(r==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(e);if(r==="x509pub")return Ke.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return Ke.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var L=hr(e,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(L)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var N=m(e,"RSA PRIVATE KEY");return p.getKey(N,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var S=m(e,"DSA PRIVATE KEY"),B=s(S,0,[1],"02"),O=s(S,0,[2],"02"),P=s(S,0,[3],"02"),U=s(S,0,[4],"02"),G=s(S,0,[5],"02"),h=new f;return h.setPrivate(new ee(B,16),new ee(O,16),new ee(P,16),new ee(U,16),new ee(G,16)),h}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var N=m(e,"EC PRIVATE KEY");return p.getKey(N,null,"pkcs5prv")}if(e.indexOf("-END PRIVATE KEY-")!=-1)return p.getKeyFromPlainPrivatePKCS8PEM(e);if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var H=p.getDecryptedKeyHex(e,t),K=new Je;return K.readPKCS5PrvKeyHex(H),K}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),h=s(S,0,[1],"04"),Y=s(S,0,[2,0],"06"),ie=s(S,0,[3,0],"03").substr(2),_e="";if(A.crypto.OID.oidhex2name[Y]!==void 0)_e=A.crypto.OID.oidhex2name[Y];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+Y);var w=new l({curve:_e});return w.setPublicKeyHex(ie),w.setPrivateKeyHex(h),w.isPublic=!1,w}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),B=s(S,0,[1],"02"),O=s(S,0,[2],"02"),P=s(S,0,[3],"02"),U=s(S,0,[4],"02"),G=s(S,0,[5],"02"),h=new f;return h.setPrivate(new ee(B,16),new ee(O,16),new ee(P,16),new ee(U,16),new ee(G,16)),h}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};vt.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new Je;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new Je,a=n.n.toString(16),s=n.e.toString(16);i.setPublic(a,s),i.isPrivate=!1,i.isPublic=!0;var u={};return u.prvKeyObj=n,u.pubKeyObj=i,u}else if(e=="EC"){var l=t,f=new A.crypto.ECDSA({curve:l}),d=f.generateKeyPairHex(),n=new A.crypto.ECDSA({curve:l});n.setPublicKeyHex(d.ecpubhex),n.setPrivateKeyHex(d.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new A.crypto.ECDSA({curve:l});i.setPublicKeyHex(d.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var u={};return u.prvKeyObj=n,u.pubKeyObj=i,u}else throw new Error("unknown algorithm: "+e)};vt.getPEM=function(e,t,r,n,i,a){var s=A,u=s.asn1,l=u.DERObjectIdentifier,f=u.DERInteger,d=u.ASN1Util.newObject,m=u.x509,p=m.SubjectPublicKeyInfo,h=s.crypto,w=h.DSA,v=h.ECDSA,y=Je;function g(K){var Y=d({seq:[{int:0},{int:{bigint:K.n}},{int:K.e},{int:{bigint:K.d}},{int:{bigint:K.p}},{int:{bigint:K.q}},{int:{bigint:K.dmp1}},{int:{bigint:K.dmq1}},{int:{bigint:K.coeff}}]});return Y}function b(K){var Y=d({seq:[{int:1},{octstr:{hex:K.prvKeyHex}},{tag:["a0",!0,{oid:{name:K.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+K.pubKeyHex}}]}]});return Y}function D(K){var Y=d({seq:[{int:0},{int:{bigint:K.p}},{int:{bigint:K.q}},{int:{bigint:K.g}},{int:{bigint:K.y}},{int:{bigint:K.x}}]});return Y}if((y!==void 0&&e instanceof y||w!==void 0&&e instanceof w||v!==void 0&&e instanceof v)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var _=new p(e),F=_.tohex();return Bn(F,"PUBLIC KEY")}if(t=="PKCS1PRV"&&y!==void 0&&e instanceof y&&(r===void 0||r==null)&&e.isPrivate==!0){var _=g(e),F=_.tohex();return Bn(F,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&v!==void 0&&e instanceof v&&(r===void 0||r==null)&&e.isPrivate==!0){var L=new l({name:e.curveName}),N=L.tohex(),S=b(e),B=S.tohex(),O="";return O+=Bn(N,"EC PARAMETERS"),O+=Bn(B,"EC PRIVATE KEY"),O}if(t=="PKCS1PRV"&&w!==void 0&&e instanceof w&&(r===void 0||r==null)&&e.isPrivate==!0){var _=D(e),F=_.tohex();return Bn(F,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&y!==void 0&&e instanceof y&&r!==void 0&&r!=null&&e.isPrivate==!0){var _=g(e),F=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",F,r,n,a)}if(t=="PKCS5PRV"&&v!==void 0&&e instanceof v&&r!==void 0&&r!=null&&e.isPrivate==!0){var _=b(e),F=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",F,r,n,a)}if(t=="PKCS5PRV"&&w!==void 0&&e instanceof w&&r!==void 0&&r!=null&&e.isPrivate==!0){var _=D(e),F=_.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",F,r,n,a)}var P=function(K,Y){if(typeof Y=="string")return vt.getEncryptedPKCS8PEM(K,Y);if(typeof Y=="object"&&Yt(Y,"passcode")!=null){var ie=JSON.parse(JSON.stringify(Y)),_e=ie.passcode;return delete ie.passcode,vt.getEncryptedPKCS8PEM(K,_e,ie)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var U=g(e),G=U.tohex(),_=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:G}}]}),F=_.tohex();return r===void 0||r==null?Bn(F,"PRIVATE KEY"):P(F,r)}if(t=="PKCS8PRV"&&v!==void 0&&e instanceof v&&e.isPrivate==!0){var H={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&H.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var U=new d(H),G=U.tohex(),_=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:G}}]}),F=_.tohex();return r===void 0||r==null?Bn(F,"PRIVATE KEY"):P(F,r)}if(t=="PKCS8PRV"&&w!==void 0&&e instanceof w&&e.isPrivate==!0){var U=new f({bigint:e.x}),G=U.tohex(),_=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:G}}]}),F=_.tohex();return r===void 0||r==null?Bn(F,"PRIVATE KEY"):P(F,r)}throw new Error("unsupported object nor format")};vt.getKeyFromCSRPEM=function(e){var t=hr(e,"CERTIFICATE REQUEST"),r=vt.getKeyFromCSRHex(t);return r};vt.getKeyFromCSRHex=function(e){var t=vt.parseCSRHex(e),r=vt.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};vt.parseCSRHex=function(e){var t=ye,r=t.getChildIdx,n=t.getTLV,i={},a=e;if(a.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var s=r(a,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if(a.substr(s[0],2)!="30")throw new Error("malformed CSR(code:003)");var u=r(a,s[0]);if(u.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(a,u[2]),i};vt.getKeyID=function(e){var t=vt,r=ye;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=hr(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),a=r.getV(n,i).substring(2);return A.crypto.Util.hashHex(a,"sha1")};vt.getJWK=function(e,t,r,n,i){var a,s={},u,l=A.crypto.Util.hashHex;if(typeof e=="string")a=vt.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(u=hr(e));else if(typeof e=="object")e instanceof Ke?(a=e.getPublicKey(),u=e.hex):a=e;else throw new Error("unsupported keyinfo type");if(a instanceof Je&&a.isPrivate)s.kty="RSA",s.n=Hr(a.n.toString(16)),s.e=Hr(a.e.toString(16)),s.d=Hr(a.d.toString(16)),s.p=Hr(a.p.toString(16)),s.q=Hr(a.q.toString(16)),s.dp=Hr(a.dmp1.toString(16)),s.dq=Hr(a.dmq1.toString(16)),s.qi=Hr(a.coeff.toString(16));else if(a instanceof Je&&a.isPublic)s.kty="RSA",s.n=Hr(a.n.toString(16)),s.e=Hr(a.e.toString(16));else if(a instanceof A.crypto.ECDSA&&a.isPrivate){var f=a.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var d=a.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Hr(d.x),s.y=Hr(d.y),s.d=Hr(a.prvKeyHex)}else if(a instanceof A.crypto.ECDSA&&a.isPublic){var f=a.getShortNISTPCurveName();if(f!=="P-256"&&f!=="P-384"&&f!=="P-521")throw new Error("unsupported curve name for JWT: "+f);var d=a.getPublicKeyXYHex();s.kty="EC",s.crv=f,s.x=Hr(d.x),s.y=Hr(d.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!a.isPrivate&&t!=!0&&(s.kid=A.jws.JWS.getJWKthumbprint(s)),u!=null&&r!=!0&&(s.x5c=[ja(u)]),u!=null&&n!=!0&&(s.x5t=jl(ja(l(u,"sha1")))),u!=null&&i!=!0&&(s["x5t#S256"]=jl(ja(l(u,"sha256")))),s};vt.getJWKFromKey=function(e){return vt.getJWK(e,!0,!0,!0,!0)};Je.getPosArrayOfChildrenFromHex=function(e){return ye.getChildIdx(e,0)};Je.getHexValueArrayOfChildrenFromHex=function(e){var t=ye,r=t.getV,p=Je.getPosArrayOfChildrenFromHex(e),n=r(e,p[0]),i=r(e,p[1]),a=r(e,p[2]),s=r(e,p[3]),u=r(e,p[4]),l=r(e,p[5]),f=r(e,p[6]),d=r(e,p[7]),m=r(e,p[8]),p=new Array;return p.push(n,i,a,s,u,l,f,d,m),p};Je.prototype.readPrivateKeyFromPEMString=function(e){var t=hr(e),r=Je.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};Je.prototype.readPKCS5PrvKeyHex=function(e){var t=Je.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};Je.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,a,s,u,l,f=ye,d=f.getVbyListEx;if(f.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");try{t=d(e,0,[2,0,1],"02"),r=d(e,0,[2,0,2],"02"),n=d(e,0,[2,0,3],"02"),i=d(e,0,[2,0,4],"02"),a=d(e,0,[2,0,5],"02"),s=d(e,0,[2,0,6],"02"),u=d(e,0,[2,0,7],"02"),l=d(e,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,i,a,s,u,l)};Je.prototype.readPKCS5PubKeyHex=function(e){var t=ye,r=t.getV;if(t.isASN1HEX(e)===!1)throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(n.length!==2||e.substr(n[0],2)!=="02"||e.substr(n[1],2)!=="02")throw new Error("wrong hex for PKCS#5 public key");var i=r(e,n[0]),a=r(e,n[1]);this.setPublic(i,a)};Je.prototype.readPKCS8PubKeyHex=function(e){var t=ye;if(t.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");if(t.getTLVbyListEx(e,0,[0,0])!=="06092a864886f70d010101")throw new Error("not PKCS8 RSA public key");var r=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(r)};Je.prototype.readCertPubKeyHex=function(e,t){var r,n;r=new Ke,r.readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var bK=new RegExp("[^0-9a-f]","gi");function $y(e,t){for(var r="",n=t/4-e.length,i=0;i>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}Je.prototype.signPSS=function(e,t,r){var n=function(a){return A.crypto.Util.hashHex(a,t)},i=n(zs(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,t,r)};Je.prototype.signWithMessageHashPSS=function(e,t,r){var n=hi(e),i=n.length,a=this.n.bitLength()-1,s=Math.ceil(a/8),u,l=function(y){return A.crypto.Util.hashHex(y,t)};if(r===-1||r===void 0)r=i;else if(r===-2)r=s-i-2;else if(r<-2)throw new Error("invalid salt length");if(s0&&(f=new Array(r),new Vl().nextBytes(f),f=String.fromCharCode.apply(String,f));var d=hi(l(zs("\0\0\0\0\0\0\0\0"+n+f))),m=[];for(u=0;u>8*s-a&255;for(w[0]&=~v,u=0;un)return!1;var i=this.doPublic(r),a=i.toString(16);if(a.length+3!=n/4)return!1;var s=a.replace(/^1f+00/,""),u=Ty(s);if(u.length==0)return!1;var l=u[0],f=u[1],d=function(p){return A.crypto.Util.hashString(p,l)},m=d(e);return f==m};Je.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=ci(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),a=Ty(i);if(a.length==0)return!1;var s=a[0],u=a[1];return u==e};Je.prototype.verifyPSS=function(e,t,r,n){var i=function(s){return A.crypto.Util.hashHex(s,r)},a=i(zs(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(a,t,r,n)};Je.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new ee(t,16),a=function(b){return A.crypto.Util.hashHex(b,r)},s=hi(e),u=s.length,l=this.n.bitLength()-1,f=Math.ceil(l/8),d;if(n===-1||n===void 0)n=u;else if(n===-2)n=f-u-2;else if(n<-2)throw new Error("invalid salt length");if(f>8*f-l&255;if(p.charCodeAt(0)&w)throw new Error("bits beyond keysize not zero");var v=Ry(h,p.length,a),y=[];for(d=0;d0?B:void 0}catch{return}},this._asn1ToNoticeRef=function(S){try{for(var B={},O=Yt(S,"seq"),P=0;P0?B:void 0}catch{return}},this._asn1ToNoticeNum=function(S){try{for(var B=Yt(S,"seq"),O=[],P=0;P1){var G=s(S,U[1]),H=this.getGeneralName(G);H.uri!=null&&(P.uri=H.uri)}if(U.length>2){var K=s(S,U[2]);K=="0101ff"&&(P.reqauth=!0),K=="010100"&&(P.reqauth=!1)}return P},this.getExtSubjectDirectoryAttributes=function(S,B){if(S===void 0&&B===void 0){var O=this.getExtInfo("subjectDirectoryAttributes");if(O===void 0)return;S=s(this.hex,O.vidx),B=O.critical}var P={extname:"subjectDirectoryAttributes"};B&&(P.critical=!0);try{for(var U=a(S),G=[],H=0;H0&&(B.ext=this.getExtParamArray()),B.sighex=this.getSignatureValueHex(),S.tbshex==!0&&(B.tbshex=f(this.hex,0,[0])),S.nodnarray==!0&&(delete B.issuer.array,delete B.subject.array),B},this.getExtParamArray=function(S){if(S==null){var B=p(this.hex,0,[0,"[3]"]);B!=-1&&(S=d(this.hex,0,[0,"[3]",0],"30"))}for(var O=[],P=r(S,0),U=0;U"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWS=function(){var e=A,t=e.jws.JWS,r=t.isSafeJSONString;this.parseJWS=function(n,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var a=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(a==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=a[1],u=a[2],l=a[3],f=s+"."+u;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=u,this.parsedJWS.sigvalB64U=l,this.parsedJWS.si=f,!i){var d=sr(l),m=ci(d,16);this.parsedJWS.sigvalH=d,this.parsedJWS.sigvalBI=m}var p=ps(s),h=ps(u);if(this.parsedJWS.headS=p,this.parsedJWS.payloadS=h,!r(p,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+p}}};A.jws.JWS.sign=function(e,t,r,n,i){var a=A,s=a.jws,u=s.JWS,l=u.readSafeJSONString,f=u.isSafeJSONString,d=a.crypto,m=d.ECDSA,p=d.Mac,h=d.Signature,w=JSON,v,y,g;if(typeof t!="string"&&typeof t!="object")throw"spHeader must be JSON string or object: "+t;if(typeof t=="object"&&(y=t,v=w.stringify(y)),typeof t=="string"){if(v=t,!f(v))throw"JWS Head is not safe JSON string: "+v;y=l(v)}if(g=r,typeof r=="object"&&(g=w.stringify(r)),(e==""||e==null)&&y.alg!==void 0&&(e=y.alg),e!=""&&e!=null&&y.alg===void 0&&(y.alg=e,v=w.stringify(y)),e!==y.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+y.alg;var b=null;if(u.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;b=u.jwsalg2sigalg[e];var D=ff(v),_=ff(g),F=D+"."+_,L="";if(b.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var N=new p({alg:b,prov:"cryptojs",pass:n});N.updateString(F),L=N.doFinal()}else if(b.indexOf("withECDSA")!=-1){var S=new h({alg:b});S.init(n,i),S.updateString(F);var B=S.sign();L=A.crypto.ECDSA.asn1SigToConcatSig(B)}else if(b!="none"){var S=new h({alg:b});S.init(n,i),S.updateString(F),L=S.sign()}var O=Hr(L);return F+"."+O};A.jws.JWS.verify=function(e,t,r){var n=A,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=n.crypto,l=u.ECDSA,f=u.Mac,d=u.Signature,m;if(typeof Je!==void 0&&(m=Je),!$g(e))return!1;var p=e.split(".");if(p.length!==3)return!1;var h=p[0],w=p[1],v=h+"."+w,y=sr(p[2]),g=s(ps(p[0])),b=null,D=null;if(g.alg===void 0)throw"algorithm not specified in header";if(b=g.alg,D=b.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var _=":"+r.join(":")+":";if(_.indexOf(":"+b+":")==-1)throw"algorithm '"+b+"' not accepted in the list"}if(b!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=vt.getKey(t)),(D=="RS"||D=="PS")&&!(t instanceof m))throw"key shall be a RSAKey obj for RS* and PS* algs";if(D=="ES"&&!(t instanceof l))throw"key shall be a ECDSA obj for ES* algs";b=="none";var F=null;if(a.jwsalg2sigalg[g.alg]===void 0)throw"unsupported alg name: "+b;if(F=a.jwsalg2sigalg[b],F=="none")throw"not supported";if(F.substr(0,4)=="Hmac"){var L=null;if(t===void 0)throw"hexadecimal key shall be specified for HMAC";var N=new f({alg:F,pass:t});return N.updateString(v),L=N.doFinal(),y==L}else if(F.indexOf("withECDSA")!=-1){var S=null;try{S=l.concatSigToASN1Sig(y)}catch{return!1}var B=new d({alg:F});return B.init(t),B.updateString(v),B.verify(S)}else{var B=new d({alg:F});return B.init(t),B.updateString(v),B.verify(y)}};A.jws.JWS.parse=function(e){var t=e.split("."),r={},n,i,a;if(t.length!=2&&t.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return n=t[0],i=t[1],t.length==3&&(a=t[2]),r.headerObj=A.jws.JWS.readSafeJSONString(ps(n)),r.payloadObj=A.jws.JWS.readSafeJSONString(ps(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=ps(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),a!==void 0&&(r.sigHex=sr(a)),r};A.jws.JWS.verifyJWT=function(e,t,r){var n=A,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=a.inArray,l=a.includedArray;if(!$g(e))return!1;var f=e.split(".");if(f.length!=3)return!1;var d=f[0],m=f[1],p=d+"."+m,h=sr(f[2]),w=s(ps(d)),v=s(ps(m));if(w.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!u(w.alg,r.alg)||v.iss!==void 0&&typeof r.iss=="object"&&!u(v.iss,r.iss)||v.sub!==void 0&&typeof r.sub=="object"&&!u(v.sub,r.sub))return!1;if(v.aud!==void 0&&typeof r.aud=="object"){if(typeof v.aud=="string"){if(!u(v.aud,r.aud))return!1}else if(typeof v.aud=="object"&&!l(v.aud,r.aud))return!1}var y=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(y=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(v.exp!==void 0&&typeof v.exp=="number"&&v.exp+r.gracePeriod"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWSJS=function(){var e=A,t=e.jws,r=t.JWS,n=r.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(i){this.init();var a=i.split(".");if(a.length!=3)throw"malformed input JWS";this.aHeader.push(a[0]),this.sPayload=a[1],this.aSignature.push(a[2])},this.addSignature=function(i,a,s,u){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var l=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var f=A.jws.JWS.sign(i,a,this.sPayload,s,u),d=f.split("."),m=d[0],p=d[2];this.aHeader.push(d[0]),this.aSignature.push(d[2])}catch(h){throw this.aHeader.length>l&&this.aHeader.pop(),this.aSignature.length>l&&this.aSignature.pop(),"addSignature failed: "+h}},this.verifyAll=function(i){if(this.aHeader.length!==i.length||this.aSignature.length!==i.length)return!1;for(var a=0;a0)this.aHeader=i.headers;else throw"malformed header";if(typeof i.payload=="string")this.sPayload=i.payload;else throw"malformed signatures";if(i.signatures.length>0)this.aSignature=i.signatures;else throw"malformed signatures"}catch(s){throw"malformed JWS-JS JSON object: "+s}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return this.aHeader.length==0?1:0}};Ce.SecureRandom=Vl;Ce.rng_seed_time=Sg;Ce.BigInteger=ee;Ce.RSAKey=Je;Ce.ECDSA=A.crypto.ECDSA;Ce.DSA=A.crypto.DSA;Ce.Signature=A.crypto.Signature;Ce.MessageDigest=A.crypto.MessageDigest;Ce.Mac=A.crypto.Mac;Ce.KEYUTIL=vt;Ce.ASN1HEX=ye;Ce.X509=Ke;Ce.X509CRL=xT;Ce.CryptoJS=Se;Ce.b64tohex=Hl;Ce.b64toBA=gy;Ce.ECFieldElementFp=Mr;Ce.ECPointFp=Rt;Ce.ECCurveFp=Ha;Ce.stoBA=by;Ce.BAtos=yy;Ce.BAtohex=Q0;Ce.stohex=fi;Ce.stob64=cT;Ce.stob64u=fT;Ce.b64utos=hT;Ce.b64tob64u=jl;Ce.b64utob64=df;Ce.hex2b64=ja;Ce.hextob64u=Hr;Ce.b64utohex=sr;Ce.utf8tob64u=ff;Ce.b64utoutf8=ps;Ce.utf8tob64=dT;Ce.b64toutf8=pT;Ce.utf8tohex=ed;Ce.hextoutf8=jt;Ce.hextorstr=hi;Ce.rstrtohex=zs;Ce.hextob64=Ig;Ce.hextob64nl=vT;Ce.b64nltohex=Cy;Ce.hextopem=Bn;Ce.pemtohex=hr;Ce.hextoArrayBuffer=ET;Ce.ArrayBuffertohex=bT;Ce.zulutomsec=Bg;Ce.msectozulu=yT;Ce.zulutosec=_y;Ce.zulutodate=CT;Ce.datetozulu=_T;Ce.uricmptohex=rd;Ce.hextouricmp=nd;Ce.ipv6tohex=bg;Ce.hextoipv6=yg;Ce.hextoip=Y0;Ce.iptohex=xg;Ce.ucs2hextoutf8=Pg;Ce.encodeURIComponentAll=sd;Ce.newline_toUnix=DT;Ce.newline_toDos=FT;Ce.hextoposhex=Cg;Ce.intarystrtohex=ST;Ce.strdiffidx=IT;Ce.oidtohex=Sy;Ce.hextooid=ad;Ce.strpad=W0;Ce.bitstrtoint=By;Ce.inttobitstr=xy;Ce.bitstrtobinstr=Py;Ce.binstrtobitstr=BT;Ce.isBase64URLDot=$g;Ce.namearraytobinstr=X0;Ce.extendClass=pe;Ce.foldnl=td;Ce.b64topem=wT;Ce.pemtob64=AT;Ce.timeogen=Dy;Ce.aryval=Yt;Ce.inttohex=Iy;Ce.twoscompl=pf;Ce.KJUR=A;Ce.crypto=A.crypto;Ce.asn1=A.asn1;Ce.jws=A.jws;Ce.lang=A.lang;Ce.VERSION=UP;Ce.VERSION_FULL=jP});var Ly=he(Ng=>{"use strict";Ng.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e};Ng.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":return 255;case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}});var Uy=he(Lg=>{"use strict";Lg.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e};Lg.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}});var jy=he(Ug=>{"use strict";Ug.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e};Ug.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}});var Hy=he(jg=>{"use strict";jg.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e};jg.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}});var My=he(Hg=>{"use strict";Hg.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:`OPTION_${e}`};Hg.toCode=function(e){if(typeof e=="number")return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}let t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}});var Ky=he((Vy,Mg)=>{var qy=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=m,e.encode=d,e.familyOf=f,e.name=void 0,e.sizeOf=l,e.v6=e.v4=void 0;let t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=4,n=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,i=16,a={name:"v4",size:r,isFormat:p=>t.test(p),encode(p,h,w){w=~~w,h=h||new Uint8Array(w+r);let v=p.length,y=0;for(let g=0;gp.length>0&&n.test(p),encode(p,h,w){w=~~w;let v=w+i,y=-1,g=0,b=0,D=!0,_=!1;h=h||new Uint8Array(w+i);for(let F=0;F>8),w=97?L-=87:L>=65?L-=55:(L-=48,b=b*10+L),g=(g<<4)+L)}if(D===!1)_===!0?(w>8),w=y+2;F--)h[F]=h[F-2];h[y]=0,h[y+1]=0,y=w}if(y!==w&&y!==-1)for(w>v-2&&(w=v-2);v>y;)h[--v]=wy?h[--w]:0;else for(;w{"use strict";var He=z0().Buffer,Za=Ly(),RT=Uy(),TT=jy(),cd=Hy(),qg=My(),xo=Ky(),OT=0,zy=32768,Vg=32768,kT=~Vg,Gy=32768,NT=~Gy,xe=je.name={};xe.encode=function(e,t,r,{mail:n=!1}={}){t||(t=He.alloc(xe.encodingLength(e))),r||(r=0);let i=r,a=e.replace(/^\.|\.$/gm,"");if(a.length){let s=[];if(n){let u="";a.split(".").forEach(l=>{l.endsWith("\\")?u+=(u.length?".":"")+l.slice(0,-1):s.length===0&&u.length?s.push(u+"."+l):s.push(l)})}else s=a.split(".");for(let u=0;u=e.length)throw new Error("Cannot decode name (buffer overflow)");let l=e[t++];if(s+=u?0:1,l===0)break;if(l&192)if((l&192)===192){if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");let f=e.readUInt16BE(t-1)-49152;if(f>=i)throw new Error("Cannot decode name (bad pointer)");t=f,i=f,s+=u?0:1,u=!0}else throw new Error("Cannot decode name (bad label)");else{if(t+l>e.length)throw new Error("Cannot decode name (buffer overflow)");if(a+=l+1,a>254)throw new Error("Cannot decode name (name too long)");let f=e.toString("utf-8",t,t+l);r&&(f=f.replace(/\./g,"\\.")),n.push(f),t+=l,s+=u?0:l}}return xe.decode.bytes=s,n.length===0?".":n.join(".")};xe.decode.bytes=0;xe.encodingLength=function(e){return e==="."||e===".."?1:He.byteLength(e.replace(/^\.|\.$/gm,""))+2};var mt={};mt.encode=function(e,t,r){t||(t=He.alloc(mt.encodingLength(e))),r||(r=0);let n=t.write(e,r+1);return t[r]=n,mt.encode.bytes=n+1,t};mt.encode.bytes=0;mt.decode=function(e,t){t||(t=0);let r=e[t],n=e.toString("utf-8",t+1,t+1+r);return mt.decode.bytes=r+1,n};mt.decode.bytes=0;mt.encodingLength=function(e){return He.byteLength(e)+1};var vs={};vs.encode=function(e,t,r){t||(t=vs.encodingLength(e)),r||(r=0);let n=(e.flags||0)&32767,i=e.type==="response"?zy:OT;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(n|i,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t};vs.encode.bytes=12;vs.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");let r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:r&zy?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:TT.toString(r>>11&15),flag_aa:(r>>10&1)===1,flag_tc:(r>>9&1)===1,flag_rd:(r>>8&1)===1,flag_ra:(r>>7&1)===1,flag_z:(r>>6&1)===1,flag_ad:(r>>5&1)===1,flag_cd:(r>>4&1)===1,rcode:RT.toString(r&15),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}};vs.decode.bytes=12;vs.encodingLength=function(){return 12};var Ma=je.unknown={};Ma.encode=function(e,t,r){return t||(t=He.alloc(Ma.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),Ma.encode.bytes=e.length+2,t};Ma.encode.bytes=0;Ma.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return Ma.decode.bytes=r+2,n};Ma.decode.bytes=0;Ma.encodingLength=function(e){return e.length+2};var qa=je.ns={};qa.encode=function(e,t,r){return t||(t=He.alloc(qa.encodingLength(e))),r||(r=0),xe.encode(e,t,r+2),t.writeUInt16BE(xe.encode.bytes,r),qa.encode.bytes=xe.encode.bytes+2,t};qa.encode.bytes=0;qa.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=xe.decode(e,t+2);return qa.decode.bytes=r+2,n};qa.decode.bytes=0;qa.encodingLength=function(e){return xe.encodingLength(e)+2};var Va=je.soa={};Va.encode=function(e,t,r){t||(t=He.alloc(Va.encodingLength(e))),r||(r=0);let n=r;return r+=2,xe.encode(e.mname,t,r),r+=xe.encode.bytes,xe.encode(e.rname,t,r,{mail:!0}),r+=xe.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-n-2,n),Va.encode.bytes=r-n,t};Va.encode.bytes=0;Va.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=xe.decode(e,t),t+=xe.decode.bytes,n.rname=xe.decode(e,t,{mail:!0}),t+=xe.decode.bytes,n.serial=e.readUInt32BE(t),t+=4,n.refresh=e.readUInt32BE(t),t+=4,n.retry=e.readUInt32BE(t),t+=4,n.expire=e.readUInt32BE(t),t+=4,n.minimum=e.readUInt32BE(t),t+=4,Va.decode.bytes=t-r,n};Va.decode.bytes=0;Va.encodingLength=function(e){return 22+xe.encodingLength(e.mname)+xe.encodingLength(e.rname)};var Ka=je.txt={};Ka.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let i=0;i0;){let a=e[t++];if(--n,n0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let a=0;a0;)n[a++]=di.decode(e,t),t+=di.decode.bytes,i-=di.decode.bytes;return $i.decode.bytes=t-r,n};$i.decode.bytes=0;$i.encodingLength=function(e){return 2+zl(e||[],di)};var zn=je.dnskey={};zn.PROTOCOL_DNSSEC=3;zn.ZONE_KEY=128;zn.SECURE_ENTRYPOINT=32768;zn.encode=function(e,t,r){t||(t=He.alloc(zn.encodingLength(e))),r||(r=0);let n=r,i=e.key;if(!He.isBuffer(i))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(zn.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,zn.encode.bytes=r-n,t.writeUInt16BE(zn.encode.bytes-2,n),t};zn.encode.bytes=0;zn.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);if(t+=2,n.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==zn.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e.readUInt8(t),t+=1,n.key=e.slice(t,r+i+2),t+=n.key.length,zn.decode.bytes=t-r,n};zn.decode.bytes=0;zn.encodingLength=function(e){return 6+He.byteLength(e.key)};var Gs=je.rrsig={};Gs.encode=function(e,t,r){t||(t=He.alloc(Gs.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!He.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(Za.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,xe.encode(e.signersName,t,r),r+=xe.encode.bytes,i.copy(t,r,0,i.length),r+=i.length,Gs.encode.bytes=r-n,t.writeUInt16BE(Gs.encode.bytes-2,n),t};Gs.encode.bytes=0;Gs.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=Za.toString(e.readUInt16BE(t)),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.labels=e.readUInt8(t),t+=1,n.originalTTL=e.readUInt32BE(t),t+=4,n.expiration=e.readUInt32BE(t),t+=4,n.inception=e.readUInt32BE(t),t+=4,n.keyTag=e.readUInt16BE(t),t+=2,n.signersName=xe.decode(e,t),t+=xe.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,Gs.decode.bytes=t-r,n};Gs.decode.bytes=0;Gs.encodingLength=function(e){return 20+xe.encodingLength(e.signersName)+He.byteLength(e.signature)};var Ys=je.rp={};Ys.encode=function(e,t,r){t||(t=He.alloc(Ys.encodingLength(e))),r||(r=0);let n=r;return r+=2,xe.encode(e.mbox||".",t,r,{mail:!0}),r+=xe.encode.bytes,xe.encode(e.txt||".",t,r),r+=xe.encode.bytes,Ys.encode.bytes=r-n,t.writeUInt16BE(Ys.encode.bytes-2,n),t};Ys.encode.bytes=0;Ys.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=xe.decode(e,t,{mail:!0})||".",t+=xe.decode.bytes,n.txt=xe.decode(e,t)||".",t+=xe.decode.bytes,Ys.decode.bytes=t-r,n};Ys.decode.bytes=0;Ys.encodingLength=function(e){return 2+xe.encodingLength(e.mbox||".")+xe.encodingLength(e.txt||".")};var Jr={};Jr.encode=function(e,t,r){t||(t=He.alloc(Jr.encodingLength(e))),r||(r=0);let n=r;for(var i=[],a=0;a>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(a=0;a>8]=Math.max(t[n>>8]||0,n&255)}var i=0;for(r=0;r>15&1)===1,r.options=$i.decode(e,t+8),t+=8+$i.decode.bytes;else{let i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=cd.toString(i&kT),r.flush=!!(i&Vg);let a=Kg(r.type);r.data=a.decode(e,t+8),t+=8+a.decode.bytes}return dn.decode.bytes=t-n,r};dn.decode.bytes=0;dn.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return xe.encodingLength(e.name)+8+Kg(e.type).encodingLength(t)};var ms=je.question={};ms.encode=function(e,t,r){t||(t=He.alloc(ms.encodingLength(e))),r||(r=0);let n=r;return xe.encode(e.name,t,r),r+=xe.encode.bytes,t.writeUInt16BE(Za.toType(e.type),r),r+=2,t.writeUInt16BE(cd.toClass(e.class===void 0?"IN":e.class),r),r+=2,ms.encode.bytes=r-n,e};ms.encode.bytes=0;ms.decode=function(e,t){t||(t=0);let r=t,n={};return n.name=xe.decode(e,t),t+=xe.decode.bytes,n.type=Za.toString(e.readUInt16BE(t)),t+=2,n.class=cd.toString(e.readUInt16BE(t)),t+=2,!!(n.class&Gy)&&(n.class&=NT),ms.decode.bytes=t-r,n};ms.decode.bytes=0;ms.encodingLength=function(e){return xe.encodingLength(e.name)+4};je.AUTHORITATIVE_ANSWER=1024;je.TRUNCATED_RESPONSE=512;je.RECURSION_DESIRED=256;je.RECURSION_AVAILABLE=128;je.AUTHENTIC_DATA=32;je.CHECKING_DISABLED=16;je.DNSSEC_OK=32768;je.encode=function(e,t,r){let n=!t;n&&(t=He.alloc(je.encodingLength(e))),r||(r=0);let i=r;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),vs.encode(e,t,r),r+=vs.encode.bytes,r=mf(e.questions,ms,t,r),r=mf(e.answers,dn,t,r),r=mf(e.authorities,dn,t,r),r=mf(e.additionals,dn,t,r),je.encode.bytes=r-i,n&&je.encode.bytes!==t.length?t.slice(0,je.encode.bytes):t};je.encode.bytes=0;je.decode=function(e,t){t||(t=0);let r=t,n=vs.decode(e,t);return t+=vs.decode.bytes,t=ld(n.questions,ms,e,t),t=ld(n.answers,dn,e,t),t=ld(n.authorities,dn,e,t),t=ld(n.additionals,dn,e,t),je.decode.bytes=t-r,n};je.decode.bytes=0;je.encodingLength=function(e){return vs.encodingLength(e)+zl(e.questions||[],ms)+zl(e.answers||[],dn)+zl(e.authorities||[],dn)+zl(e.additionals||[],dn)};je.streamEncode=function(e){let t=je.encode(e),r=He.alloc(2);r.writeUInt16BE(t.byteLength);let n=He.concat([r,t]);return je.streamEncode.bytes=n.byteLength,n};je.streamEncode.bytes=0;je.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength{(function(){var e,t="4.17.21",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",a="Invalid `variable` option passed into `_.template`",s="__lodash_hash_undefined__",u=500,l="__lodash_placeholder__",f=1,d=2,m=4,p=1,h=2,w=1,v=2,y=4,g=8,b=16,D=32,_=64,F=128,L=256,N=512,S=30,B="...",O=800,P=16,U=1,G=2,H=3,K=1/0,Y=9007199254740991,ie=17976931348623157e292,_e=NaN,Fe=4294967295,$e=Fe-1,et=Fe>>>1,Qe=[["ary",F],["bind",w],["bindKey",v],["curry",g],["curryRight",b],["flip",N],["partial",D],["partialRight",_],["rearg",L]],at="[object Arguments]",ut="[object Array]",Qr="[object AsyncFunction]",Qt="[object Boolean]",Et="[object Date]",gr="[object DOMException]",tr="[object Error]",ct="[object Function]",Mt="[object GeneratorFunction]",tt="[object Map]",qe="[object Number]",rr="[object Null]",Ue="[object Object]",Pt="[object Promise]",en="[object Proxy]",Xt="[object RegExp]",qt="[object Set]",pt="[object String]",Br="[object Symbol]",Ai="[object Undefined]",tn="[object WeakMap]",Ct="[object WeakSet]",Ne="[object ArrayBuffer]",De="[object DataView]",mr="[object Float32Array]",rn="[object Float64Array]",rt="[object Int8Array]",ga="[object Int16Array]",nn="[object Int32Array]",ge="[object Uint8Array]",_s="[object Uint8ClampedArray]",It="[object Uint16Array]",Vr="[object Uint32Array]",ss=/\b__p \+= '';/g,ou=/\b(__p \+=) '' \+/g,Ds=/(__e\(.*?\)|\b__t\)) \+\n'';/g,lu=/&(?:amp|lt|gt|quot|#39);/g,Fs=/[&<>"']/g,as=RegExp(lu.source),$t=RegExp(Fs.source),Wn=/<%-([\s\S]+?)%>/g,cu=/<%([\s\S]+?)%>/g,fu=/<%=([\s\S]+?)%>/g,hu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ss=/^\w*$/,zu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Is=/[\\^$.*+?()[\]{}|]/g,Gu=RegExp(Is.source),ma=/^\s+/,re=/\s/,ce=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ke=/\{\n\/\* \[wrapped with (.+)\] \*/,Te=/,? & /,Me=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,nt=/[()=,{}\[\]\/\s]/,ot=/\\(\\)?/g,Dr=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nt=/\w*$/,Xn=/^[-+]0x[0-9a-f]+$/i,Hi=/^0b[01]+$/i,sn=/^\[object .+?Constructor\]$/,wn=/^0o[0-7]+$/i,vr=/^(?:0|[1-9]\d*)$/,an=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Nr=/($^)/,Yu=/['\n\r\u2028\u2029\\]/g,Bs="\\ud800-\\udfff",$n="\\u0300-\\u036f",xt="\\ufe20-\\ufe2f",wr="\\u20d0-\\u20ff",Xe=$n+xt+wr,nr="\\u2700-\\u27bf",Kr="a-z\\xdf-\\xf6\\xf8-\\xff",ir="\\xac\\xb1\\xd7\\xf7",Lt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Rn="\\u2000-\\u206f",Zn=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Jn="A-Z\\xc0-\\xd6\\xd8-\\xde",Tn="\\ufe0e\\ufe0f",xr=ir+Lt+Rn+Zn,ur="['\u2019]",_c="["+Bs+"]",Wu="["+xr+"]",zr="["+Xe+"]",Xu="\\d+",Go="["+nr+"]",Yo="["+Kr+"]",Zu="[^"+Bs+xr+Xu+nr+Kr+Jn+"]",xs="\\ud83c[\\udffb-\\udfff]",Ju="(?:"+zr+"|"+xs+")",Wo="[^"+Bs+"]",Qu="(?:\\ud83c[\\udde6-\\uddff]){2}",eo="[\\ud800-\\udbff][\\udc00-\\udfff]",On="["+Jn+"]",R="\\u200d",k="(?:"+Yo+"|"+Zu+")",V="(?:"+On+"|"+Zu+")",Q="(?:"+ur+"(?:d|ll|m|re|s|t|ve))?",ve="(?:"+ur+"(?:D|LL|M|RE|S|T|VE))?",Ee=Ju+"?",Ie="["+Tn+"]?",Re="(?:"+R+"(?:"+[Wo,Qu,eo].join("|")+")"+Ie+Ee+")*",Vt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ar="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",un=Ie+Ee+Re,on="(?:"+[Go,Qu,eo].join("|")+")"+un,Ei="(?:"+[Wo+zr+"?",zr,Qu,eo,_c].join("|")+")",du=RegExp(ur,"g"),kn=RegExp(zr,"g"),ln=RegExp(xs+"(?="+xs+")|"+Ei+un,"g"),pu=RegExp([On+"?"+Yo+"+"+Q+"(?="+[Wu,On,"$"].join("|")+")",V+"+"+ve+"(?="+[Wu,On+k,"$"].join("|")+")",On+"?"+k+"+"+Q,On+"+"+ve,Ar,Vt,Xu,on].join("|"),"g"),Mi=RegExp("["+R+Bs+Xe+Tn+"]"),to=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,dp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],pp=-1,Zt={};Zt[mr]=Zt[rn]=Zt[rt]=Zt[ga]=Zt[nn]=Zt[ge]=Zt[_s]=Zt[It]=Zt[Vr]=!0,Zt[at]=Zt[ut]=Zt[Ne]=Zt[Qt]=Zt[De]=Zt[Et]=Zt[tr]=Zt[ct]=Zt[tt]=Zt[qe]=Zt[Ue]=Zt[Xt]=Zt[qt]=Zt[pt]=Zt[tn]=!1;var Gt={};Gt[at]=Gt[ut]=Gt[Ne]=Gt[De]=Gt[Qt]=Gt[Et]=Gt[mr]=Gt[rn]=Gt[rt]=Gt[ga]=Gt[nn]=Gt[tt]=Gt[qe]=Gt[Ue]=Gt[Xt]=Gt[qt]=Gt[pt]=Gt[Br]=Gt[ge]=Gt[_s]=Gt[It]=Gt[Vr]=!0,Gt[tr]=Gt[ct]=Gt[tn]=!1;var gp={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},mp={"&":"&","<":"<",">":">",'"':""","'":"'"},vp={"&":"&","<":"<",">":">",""":'"',"'":"'"},wp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ap=parseFloat,Ep=parseInt,gh=typeof global=="object"&&global&&global.Object===Object&&global,bp=typeof self=="object"&&self&&self.Object===Object&&self,Pr=gh||bp||Function("return this")(),Dc=typeof Yl=="object"&&Yl&&!Yl.nodeType&&Yl,va=Dc&&typeof vf=="object"&&vf&&!vf.nodeType&&vf,mh=va&&va.exports===Dc,Fc=mh&&gh.process,Qn=function(){try{var ne=va&&va.require&&va.require("util").types;return ne||Fc&&Fc.binding&&Fc.binding("util")}catch{}}(),vh=Qn&&Qn.isArrayBuffer,wh=Qn&&Qn.isDate,Ah=Qn&&Qn.isMap,Eh=Qn&&Qn.isRegExp,bh=Qn&&Qn.isSet,yh=Qn&&Qn.isTypedArray;function Nn(ne,fe,oe){switch(oe.length){case 0:return ne.call(fe);case 1:return ne.call(fe,oe[0]);case 2:return ne.call(fe,oe[0],oe[1]);case 3:return ne.call(fe,oe[0],oe[1],oe[2])}return ne.apply(fe,oe)}function yp(ne,fe,oe,Oe){for(var Ze=-1,_t=ne==null?0:ne.length;++Ze<_t;){var cr=ne[Ze];fe(Oe,cr,oe(cr),ne)}return Oe}function ei(ne,fe){for(var oe=-1,Oe=ne==null?0:ne.length;++oe-1}function ro(ne,fe,oe){for(var Oe=-1,Ze=ne==null?0:ne.length;++Oe-1;);return oe}function Fh(ne,fe){for(var oe=ne.length;oe--&&gu(fe,ne[oe],0)>-1;);return oe}function Sh(ne,fe){for(var oe=ne.length,Oe=0;oe--;)ne[oe]===fe&&++Oe;return Oe}var $c=me(gp),Dp=me(mp);function Ih(ne){return"\\"+wp[ne]}function Fp(ne,fe){return ne==null?e:ne[fe]}function Aa(ne){return Mi.test(ne)}function Sp(ne){return to.test(ne)}function Ip(ne){for(var fe,oe=[];!(fe=ne.next()).done;)oe.push(fe.value);return oe}function Rc(ne){var fe=-1,oe=Array(ne.size);return ne.forEach(function(Oe,Ze){oe[++fe]=[Ze,Oe]}),oe}function cn(ne,fe){return function(oe){return ne(fe(oe))}}function Ci(ne,fe){for(var oe=-1,Oe=ne.length,Ze=0,_t=[];++oe-1}function KD(o,c){var E=this.__data__,I=jh(E,o);return I<0?(++this.size,E.push([o,c])):E[I][1]=c,this}_a.prototype.clear=HD,_a.prototype.delete=MD,_a.prototype.get=qD,_a.prototype.has=VD,_a.prototype.set=KD;function Da(o){var c=-1,E=o==null?0:o.length;for(this.clear();++c=c?o:c)),o}function zi(o,c,E,I,T,q){var W,Z=c&f,se=c&d,we=c&m;if(E&&(W=T?E(o,I,T,q):E(o)),W!==e)return W;if(!fr(o))return o;var Ae=st(o);if(Ae){if(W=W5(o),!Z)return ni(o,W)}else{var be=bn(o),Be=be==ct||be==Mt;if(Eu(o))return ew(o,Z);if(be==Ue||be==at||Be&&!T){if(W=se||Be?{}:Aw(o),!Z)return se?L5(o,u5(W,o)):N5(o,xv(W,o))}else{if(!Gt[be])return T?o:{};W=X5(o,be,Z)}}q||(q=new os);var Le=q.get(o);if(Le)return Le;q.set(o,W),Yw(o)?o.forEach(function(We){W.add(zi(We,c,E,We,o,q))}):zw(o)&&o.forEach(function(We,wt){W.set(wt,zi(We,c,E,wt,o,q))});var Ye=we?se?u1:a1:se?si:Gr,ht=Ae?e:Ye(o);return ei(ht||o,function(We,wt){ht&&(wt=We,We=o[wt]),Lc(W,wt,zi(We,c,E,wt,o,q))}),W}function o5(o){var c=Gr(o);return function(E){return Pv(E,o,c)}}function Pv(o,c,E){var I=E.length;if(o==null)return!I;for(o=Kt(o);I--;){var T=E[I],q=c[T],W=o[T];if(W===e&&!(T in o)||!q(W))return!1}return!0}function $v(o,c,E){if(typeof o!="function")throw new ri(i);return Kc(function(){o.apply(e,E)},c)}function Uc(o,c,E,I){var T=-1,q=Ln,W=!0,Z=o.length,se=[],we=c.length;if(!Z)return se;E&&(c=te(c,An(E))),I?(q=ro,W=!1):c.length>=r&&(q=io,W=!1,c=new ao(c));e:for(;++TT?0:T+E),I=I===e||I>T?T:ft(I),I<0&&(I+=T),I=E>I?0:Xw(I);E0&&E(Z)?c>1?fn(Z,c-1,E,I,T):yi(T,Z):I||(T[T.length]=Z)}return T}var Mp=aw(),Ov=aw(!0);function $s(o,c){return o&&Mp(o,c,Gr)}function qp(o,c){return o&&Ov(o,c,Gr)}function Mh(o,c){return bi(c,function(E){return xa(o[E])})}function oo(o,c){c=wu(c,o);for(var E=0,I=c.length;o!=null&&Ec}function f5(o,c){return o!=null&&Bt.call(o,c)}function h5(o,c){return o!=null&&c in Kt(o)}function d5(o,c,E){return o>=En(c,E)&&o=120&&Ae.length>=120)?new ao(W&&Ae):e}Ae=o[0];var be=-1,Be=Z[0];e:for(;++be-1;)Z!==o&&Tt.call(Z,se,1),Tt.call(o,se,1);return o}function zv(o,c){for(var E=o?c.length:0,I=E-1;E--;){var T=c[E];if(E==I||T!==q){var q=T;Ba(T)?Tt.call(o,T,1):Qp(o,T)}}return o}function Xp(o,c){return o+ae(Fv()*(c-o+1))}function F5(o,c,E,I){for(var T=-1,q=Lr(z((c-o)/(E||1)),0),W=oe(q);q--;)W[I?q:++T]=o,o+=E;return W}function Zp(o,c){var E="";if(!o||c<1||c>Y)return E;do c%2&&(E+=o),c=ae(c/2),c&&(o+=o);while(c);return E}function gt(o,c){return p1(yw(o,c,ai),o+"")}function S5(o){return Bv(ml(o))}function I5(o,c){var E=ml(o);return Qh(E,uo(c,0,E.length))}function Mc(o,c,E,I){if(!fr(o))return o;c=wu(c,o);for(var T=-1,q=c.length,W=q-1,Z=o;Z!=null&&++TT?0:T+c),E=E>T?T:E,E<0&&(E+=T),T=c>E?0:E-c>>>0,c>>>=0;for(var q=oe(T);++I>>1,W=o[q];W!==null&&!Fi(W)&&(E?W<=c:W=r){var we=c?null:M5(o);if(we)return _i(we);W=!1,T=io,se=new ao}else se=c?[]:Z;e:for(;++I=I?o:Gi(o,c,E)}var Qv=C||function(o){return Pr.clearTimeout(o)};function ew(o,c){if(c)return o.slice();var E=o.length,I=Rh?Rh(E):new o.constructor(E);return o.copy(I),I}function n1(o){var c=new o.constructor(o.byteLength);return new al(c).set(new al(o)),c}function R5(o,c){var E=c?n1(o.buffer):o.buffer;return new o.constructor(E,o.byteOffset,o.byteLength)}function T5(o){var c=new o.constructor(o.source,Nt.exec(o));return c.lastIndex=o.lastIndex,c}function O5(o){return Nc?Kt(Nc.call(o)):{}}function tw(o,c){var E=c?n1(o.buffer):o.buffer;return new o.constructor(E,o.byteOffset,o.length)}function rw(o,c){if(o!==c){var E=o!==e,I=o===null,T=o===o,q=Fi(o),W=c!==e,Z=c===null,se=c===c,we=Fi(c);if(!Z&&!we&&!q&&o>c||q&&W&&se&&!Z&&!we||I&&W&&se||!E&&se||!T)return 1;if(!I&&!q&&!we&&o=Z)return se;var we=E[I];return se*(we=="desc"?-1:1)}}return o.index-c.index}function nw(o,c,E,I){for(var T=-1,q=o.length,W=E.length,Z=-1,se=c.length,we=Lr(q-W,0),Ae=oe(se+we),be=!I;++Z1?E[T-1]:e,W=T>2?E[2]:e;for(q=o.length>3&&typeof q=="function"?(T--,q):e,W&&jn(E[0],E[1],W)&&(q=T<3?e:q,T=1),c=Kt(c);++I-1?T[q?c[W]:W]:e}}function lw(o){return Ia(function(c){var E=c.length,I=E,T=Ki.prototype.thru;for(o&&c.reverse();I--;){var q=c[I];if(typeof q!="function")throw new ri(i);if(T&&!W&&Zh(q)=="wrapper")var W=new Ki([],!0)}for(I=W?I:E;++I1&&Dt.reverse(),Ae&&seZ))return!1;var we=q.get(o),Ae=q.get(c);if(we&&Ae)return we==c&&Ae==o;var be=-1,Be=!0,Le=E&h?new ao:e;for(q.set(o,c),q.set(c,o);++be1?"& ":"")+c[I],c=c.join(E>2?", ":" "),o.replace(ce,`{ /* [wrapped with `+c+`] */ `)}function J5(o){return st(o)||fo(o)||!!(kh&&o&&o[kh])}function Ba(o,c){var E=typeof o;return c=c??Y,!!c&&(E=="number"||E!="symbol"&&vr.test(o))&&o>-1&&o%1==0&&o0){if(++c>=O)return arguments[0]}else c=0;return o.apply(e,arguments)}}function Qh(o,c){var E=-1,I=o.length,T=I-1;for(c=c===e?I:c;++E1?o[c-1]:e;return E=typeof E=="function"?(o.pop(),E):e,Tw(o,E)});function Ow(o){var c=M(o);return c.__chain__=!0,c}function l8(o,c){return c(o),o}function e0(o,c){return c(o)}var c8=Ia(function(o){var c=o.length,E=c?o[0]:0,I=this.__wrapped__,T=function(q){return Hp(q,o)};return c>1||this.__actions__.length||!(I instanceof bt)||!Ba(E)?this.thru(T):(I=I.slice(E,+E+(c?1:0)),I.__actions__.push({func:e0,args:[T],thisArg:e}),new Ki(I,this.__chain__).thru(function(q){return c&&!q.length&&q.push(e),q}))});function f8(){return Ow(this)}function h8(){return new Ki(this.value(),this.__chain__)}function d8(){this.__values__===e&&(this.__values__=Ww(this.value()));var o=this.__index__>=this.__values__.length,c=o?e:this.__values__[this.__index__++];return{done:o,value:c}}function p8(){return this}function g8(o){for(var c,E=this;E instanceof Uh;){var I=Iw(E);I.__index__=0,I.__values__=e,c?T.__wrapped__=I:c=I;var T=I;E=E.__wrapped__}return T.__wrapped__=o,c}function m8(){var o=this.__wrapped__;if(o instanceof bt){var c=o;return this.__actions__.length&&(c=new bt(this)),c=c.reverse(),c.__actions__.push({func:e0,args:[g1],thisArg:e}),new Ki(c,this.__chain__)}return this.thru(g1)}function v8(){return Zv(this.__wrapped__,this.__actions__)}var w8=zh(function(o,c,E){Bt.call(o,E)?++o[E]:Fa(o,E,1)});function A8(o,c,E){var I=st(o)?it:l5;return E&&jn(o,c,E)&&(c=e),I(o,ze(c,3))}function E8(o,c){var E=st(o)?bi:Tv;return E(o,ze(c,3))}var b8=ow(Bw),y8=ow(xw);function C8(o,c){return fn(t0(o,c),1)}function _8(o,c){return fn(t0(o,c),K)}function D8(o,c,E){return E=E===e?1:ft(E),fn(t0(o,c),E)}function kw(o,c){var E=st(o)?ei:mu;return E(o,ze(c,3))}function Nw(o,c){var E=st(o)?x:Rv;return E(o,ze(c,3))}var F8=zh(function(o,c,E){Bt.call(o,E)?o[E].push(c):Fa(o,E,[c])});function S8(o,c,E,I){o=ii(o)?o:ml(o),E=E&&!I?ft(E):0;var T=o.length;return E<0&&(E=Lr(T+E,0)),a0(o)?E<=T&&o.indexOf(c,E)>-1:!!T&&gu(o,c,E)>-1}var I8=gt(function(o,c,E){var I=-1,T=typeof c=="function",q=ii(o)?oe(o.length):[];return mu(o,function(W){q[++I]=T?Nn(c,W,E):jc(W,c,E)}),q}),B8=zh(function(o,c,E){Fa(o,E,c)});function t0(o,c){var E=st(o)?te:jv;return E(o,ze(c,3))}function x8(o,c,E,I){return o==null?[]:(st(c)||(c=c==null?[]:[c]),E=I?e:E,st(E)||(E=E==null?[]:[E]),Vv(o,c,E))}var P8=zh(function(o,c,E){o[E?0:1].push(c)},function(){return[[],[]]});function $8(o,c,E){var I=st(o)?Sc:_h,T=arguments.length<3;return I(o,ze(c,4),E,T,mu)}function R8(o,c,E){var I=st(o)?_v:_h,T=arguments.length<3;return I(o,ze(c,4),E,T,Rv)}function T8(o,c){var E=st(o)?bi:Tv;return E(o,i0(ze(c,3)))}function O8(o){var c=st(o)?Bv:S5;return c(o)}function k8(o,c,E){(E?jn(o,c,E):c===e)?c=1:c=ft(c);var I=st(o)?i5:I5;return I(o,c)}function N8(o){var c=st(o)?s5:x5;return c(o)}function L8(o){if(o==null)return 0;if(ii(o))return a0(o)?Ea(o):o.length;var c=bn(o);return c==tt||c==qt?o.size:Gp(o).length}function U8(o,c,E){var I=st(o)?Ch:P5;return E&&jn(o,c,E)&&(c=e),I(o,ze(c,3))}var j8=gt(function(o,c){if(o==null)return[];var E=c.length;return E>1&&jn(o,c[0],c[1])?c=[]:E>2&&jn(c[0],c[1],c[2])&&(c=[c[0]]),Vv(o,fn(c,1),[])}),r0=j||function(){return Pr.Date.now()};function H8(o,c){if(typeof c!="function")throw new ri(i);return o=ft(o),function(){if(--o<1)return c.apply(this,arguments)}}function Lw(o,c,E){return c=E?e:c,c=o&&c==null?o.length:c,Sa(o,F,e,e,e,e,c)}function Uw(o,c){var E;if(typeof c!="function")throw new ri(i);return o=ft(o),function(){return--o>0&&(E=c.apply(this,arguments)),o<=1&&(c=e),E}}var v1=gt(function(o,c,E){var I=w;if(E.length){var T=Ci(E,pl(v1));I|=D}return Sa(o,I,c,E,T)}),jw=gt(function(o,c,E){var I=w|v;if(E.length){var T=Ci(E,pl(jw));I|=D}return Sa(c,I,o,E,T)});function Hw(o,c,E){c=E?e:c;var I=Sa(o,g,e,e,e,e,e,c);return I.placeholder=Hw.placeholder,I}function Mw(o,c,E){c=E?e:c;var I=Sa(o,b,e,e,e,e,e,c);return I.placeholder=Mw.placeholder,I}function qw(o,c,E){var I,T,q,W,Z,se,we=0,Ae=!1,be=!1,Be=!0;if(typeof o!="function")throw new ri(i);c=Wi(c)||0,fr(E)&&(Ae=!!E.leading,be="maxWait"in E,q=be?Lr(Wi(E.maxWait)||0,c):q,Be="trailing"in E?!!E.trailing:Be);function Le(Sr){var cs=I,$a=T;return I=T=e,we=Sr,W=o.apply($a,cs),W}function Ye(Sr){return we=Sr,Z=Kc(wt,c),Ae?Le(Sr):W}function ht(Sr){var cs=Sr-se,$a=Sr-we,oA=c-cs;return be?En(oA,q-$a):oA}function We(Sr){var cs=Sr-se,$a=Sr-we;return se===e||cs>=c||cs<0||be&&$a>=q}function wt(){var Sr=r0();if(We(Sr))return Dt(Sr);Z=Kc(wt,ht(Sr))}function Dt(Sr){return Z=e,Be&&I?Le(Sr):(I=T=e,W)}function Si(){Z!==e&&Qv(Z),we=0,I=se=T=Z=e}function Hn(){return Z===e?W:Dt(r0())}function Ii(){var Sr=r0(),cs=We(Sr);if(I=arguments,T=this,se=Sr,cs){if(Z===e)return Ye(se);if(be)return Qv(Z),Z=Kc(wt,c),Le(se)}return Z===e&&(Z=Kc(wt,c)),W}return Ii.cancel=Si,Ii.flush=Hn,Ii}var M8=gt(function(o,c){return $v(o,1,c)}),q8=gt(function(o,c,E){return $v(o,Wi(c)||0,E)});function V8(o){return Sa(o,N)}function n0(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new ri(i);var E=function(){var I=arguments,T=c?c.apply(this,I):I[0],q=E.cache;if(q.has(T))return q.get(T);var W=o.apply(this,I);return E.cache=q.set(T,W)||q,W};return E.cache=new(n0.Cache||Da),E}n0.Cache=Da;function i0(o){if(typeof o!="function")throw new ri(i);return function(){var c=arguments;switch(c.length){case 0:return!o.call(this);case 1:return!o.call(this,c[0]);case 2:return!o.call(this,c[0],c[1]);case 3:return!o.call(this,c[0],c[1],c[2])}return!o.apply(this,c)}}function K8(o){return Uw(2,o)}var z8=$5(function(o,c){c=c.length==1&&st(c[0])?te(c[0],An(ze())):te(fn(c,1),An(ze()));var E=c.length;return gt(function(I){for(var T=-1,q=En(I.length,E);++T=c}),fo=Nv(function(){return arguments}())?Nv:function(o){return br(o)&&Bt.call(o,"callee")&&!Oh.call(o,"callee")},st=oe.isArray,uS=vh?An(vh):g5;function ii(o){return o!=null&&s0(o.length)&&!xa(o)}function Fr(o){return br(o)&&ii(o)}function oS(o){return o===!0||o===!1||br(o)&&Un(o)==Qt}var Eu=zt||B1,lS=wh?An(wh):m5;function cS(o){return br(o)&&o.nodeType===1&&!zc(o)}function fS(o){if(o==null)return!0;if(ii(o)&&(st(o)||typeof o=="string"||typeof o.splice=="function"||Eu(o)||gl(o)||fo(o)))return!o.length;var c=bn(o);if(c==tt||c==qt)return!o.size;if(Vc(o))return!Gp(o).length;for(var E in o)if(Bt.call(o,E))return!1;return!0}function hS(o,c){return Hc(o,c)}function dS(o,c,E){E=typeof E=="function"?E:e;var I=E?E(o,c):e;return I===e?Hc(o,c,e,E):!!I}function A1(o){if(!br(o))return!1;var c=Un(o);return c==tr||c==gr||typeof o.message=="string"&&typeof o.name=="string"&&!zc(o)}function pS(o){return typeof o=="number"&&Er(o)}function xa(o){if(!fr(o))return!1;var c=Un(o);return c==ct||c==Mt||c==Qr||c==en}function Kw(o){return typeof o=="number"&&o==ft(o)}function s0(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=Y}function fr(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function br(o){return o!=null&&typeof o=="object"}var zw=Ah?An(Ah):w5;function gS(o,c){return o===c||zp(o,c,l1(c))}function mS(o,c,E){return E=typeof E=="function"?E:e,zp(o,c,l1(c),E)}function vS(o){return Gw(o)&&o!=+o}function wS(o){if(tF(o))throw new Ze(n);return Lv(o)}function AS(o){return o===null}function ES(o){return o==null}function Gw(o){return typeof o=="number"||br(o)&&Un(o)==qe}function zc(o){if(!br(o)||Un(o)!=Ue)return!1;var c=ul(o);if(c===null)return!0;var E=Bt.call(c,"constructor")&&c.constructor;return typeof E=="function"&&E instanceof E&&rl.call(E)==Op}var E1=Eh?An(Eh):A5;function bS(o){return Kw(o)&&o>=-Y&&o<=Y}var Yw=bh?An(bh):E5;function a0(o){return typeof o=="string"||!st(o)&&br(o)&&Un(o)==pt}function Fi(o){return typeof o=="symbol"||br(o)&&Un(o)==Br}var gl=yh?An(yh):b5;function yS(o){return o===e}function CS(o){return br(o)&&bn(o)==tn}function _S(o){return br(o)&&Un(o)==Ct}var DS=Xh(Yp),FS=Xh(function(o,c){return o<=c});function Ww(o){if(!o)return[];if(ii(o))return a0(o)?ti(o):ni(o);if(ya&&o[ya])return Ip(o[ya]());var c=bn(o),E=c==tt?Rc:c==qt?_i:ml;return E(o)}function Pa(o){if(!o)return o===0?o:0;if(o=Wi(o),o===K||o===-K){var c=o<0?-1:1;return c*ie}return o===o?o:0}function ft(o){var c=Pa(o),E=c%1;return c===c?E?c-E:c:0}function Xw(o){return o?uo(ft(o),0,Fe):0}function Wi(o){if(typeof o=="number")return o;if(Fi(o))return _e;if(fr(o)){var c=typeof o.valueOf=="function"?o.valueOf():o;o=fr(c)?c+"":c}if(typeof o!="string")return o===0?o:+o;o=Pc(o);var E=Hi.test(o);return E||wn.test(o)?Ep(o.slice(2),E?2:8):Xn.test(o)?_e:+o}function Zw(o){return Rs(o,si(o))}function SS(o){return o?uo(ft(o),-Y,Y):o===0?o:0}function Ut(o){return o==null?"":Di(o)}var IS=hl(function(o,c){if(Vc(c)||ii(c)){Rs(c,Gr(c),o);return}for(var E in c)Bt.call(c,E)&&Lc(o,E,c[E])}),Jw=hl(function(o,c){Rs(c,si(c),o)}),u0=hl(function(o,c,E,I){Rs(c,si(c),o,I)}),BS=hl(function(o,c,E,I){Rs(c,Gr(c),o,I)}),xS=Ia(Hp);function PS(o,c){var E=fl(o);return c==null?E:xv(E,c)}var $S=gt(function(o,c){o=Kt(o);var E=-1,I=c.length,T=I>2?c[2]:e;for(T&&jn(c[0],c[1],T)&&(I=1);++E1),q}),Rs(o,u1(o),E),I&&(E=zi(E,f|d|m,q5));for(var T=c.length;T--;)Qp(E,c[T]);return E});function XS(o,c){return eA(o,i0(ze(c)))}var ZS=Ia(function(o,c){return o==null?{}:_5(o,c)});function eA(o,c){if(o==null)return{};var E=te(u1(o),function(I){return[I]});return c=ze(c),Kv(o,E,function(I,T){return c(I,T[0])})}function JS(o,c,E){c=wu(c,o);var I=-1,T=c.length;for(T||(T=1,o=e);++Ic){var I=o;o=c,c=I}if(E||o%1||c%1){var T=Fv();return En(o+T*(c-o+Ap("1e-"+((T+"").length-1))),c)}return Xp(o,c)}var lI=dl(function(o,c,E){return c=c.toLowerCase(),o+(E?nA(c):c)});function nA(o){return C1(Ut(o).toLowerCase())}function iA(o){return o=Ut(o),o&&o.replace(an,$c).replace(kn,"")}function cI(o,c,E){o=Ut(o),c=Di(c);var I=o.length;E=E===e?I:uo(ft(E),0,I);var T=E;return E-=c.length,E>=0&&o.slice(E,T)==c}function fI(o){return o=Ut(o),o&&$t.test(o)?o.replace(Fs,Dp):o}function hI(o){return o=Ut(o),o&&Gu.test(o)?o.replace(Is,"\\$&"):o}var dI=dl(function(o,c,E){return o+(E?"-":"")+c.toLowerCase()}),pI=dl(function(o,c,E){return o+(E?" ":"")+c.toLowerCase()}),gI=uw("toLowerCase");function mI(o,c,E){o=Ut(o),c=ft(c);var I=c?Ea(o):0;if(!c||I>=c)return o;var T=(c-I)/2;return Wh(ae(T),E)+o+Wh(z(T),E)}function vI(o,c,E){o=Ut(o),c=ft(c);var I=c?Ea(o):0;return c&&I>>0,E?(o=Ut(o),o&&(typeof c=="string"||c!=null&&!E1(c))&&(c=Di(c),!c&&Aa(o))?Au(ti(o),0,E):o.split(c,E)):[]}var _I=dl(function(o,c,E){return o+(E?" ":"")+C1(c)});function DI(o,c,E){return o=Ut(o),E=E==null?0:uo(ft(E),0,o.length),c=Di(c),o.slice(E,E+c.length)==c}function FI(o,c,E){var I=M.templateSettings;E&&jn(o,c,E)&&(c=e),o=Ut(o),c=u0({},c,I,pw);var T=u0({},c.imports,I.imports,pw),q=Gr(T),W=no(T,q),Z,se,we=0,Ae=c.interpolate||Nr,be="__p += '",Be=el((c.escape||Nr).source+"|"+Ae.source+"|"+(Ae===fu?Dr:Nr).source+"|"+(c.evaluate||Nr).source+"|$","g"),Le="//# sourceURL="+(Bt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++pp+"]")+` `;o.replace(Be,function(We,wt,Dt,Si,Hn,Ii){return Dt||(Dt=Si),be+=o.slice(we,Ii).replace(Yu,Ih),wt&&(Z=!0,be+=`' + __e(`+wt+`) + '`),Hn&&(se=!0,be+=`'; `+Hn+`; __p += '`),Dt&&(be+=`' + ((__t = (`+Dt+`)) == null ? '' : __t) + '`),we=Ii+We.length,We}),be+=`'; `;var Ye=Bt.call(c,"variable")&&c.variable;if(!Ye)be=`with (obj) { `+be+` } `;else if(nt.test(Ye))throw new Ze(a);be=(se?be.replace(ss,""):be).replace(ou,"$1").replace(Ds,"$1;"),be="function("+(Ye||"obj")+`) { `+(Ye?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(se?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+be+`return __p }`;var ht=aA(function(){return _t(q,Le+"return "+be).apply(e,W)});if(ht.source=be,A1(ht))throw ht;return ht}function SI(o){return Ut(o).toLowerCase()}function II(o){return Ut(o).toUpperCase()}function BI(o,c,E){if(o=Ut(o),o&&(E||c===e))return Pc(o);if(!o||!(c=Di(c)))return o;var I=ti(o),T=ti(c),q=Zo(I,T),W=Fh(I,T)+1;return Au(I,q,W).join("")}function xI(o,c,E){if(o=Ut(o),o&&(E||c===e))return o.slice(0,Qo(o)+1);if(!o||!(c=Di(c)))return o;var I=ti(o),T=Fh(I,ti(c))+1;return Au(I,0,T).join("")}function PI(o,c,E){if(o=Ut(o),o&&(E||c===e))return o.replace(ma,"");if(!o||!(c=Di(c)))return o;var I=ti(o),T=Zo(I,ti(c));return Au(I,T).join("")}function $I(o,c){var E=S,I=B;if(fr(c)){var T="separator"in c?c.separator:T;E="length"in c?ft(c.length):E,I="omission"in c?Di(c.omission):I}o=Ut(o);var q=o.length;if(Aa(o)){var W=ti(o);q=W.length}if(E>=q)return o;var Z=E-Ea(I);if(Z<1)return I;var se=W?Au(W,0,Z).join(""):o.slice(0,Z);if(T===e)return se+I;if(W&&(Z+=se.length-Z),E1(T)){if(o.slice(Z).search(T)){var we,Ae=se;for(T.global||(T=el(T.source,Ut(Nt.exec(T))+"g")),T.lastIndex=0;we=T.exec(Ae);)var be=we.index;se=se.slice(0,be===e?Z:be)}}else if(o.indexOf(Di(T),Z)!=Z){var Be=se.lastIndexOf(T);Be>-1&&(se=se.slice(0,Be))}return se+I}function RI(o){return o=Ut(o),o&&as.test(o)?o.replace(lu,xh):o}var TI=dl(function(o,c,E){return o+(E?" ":"")+c.toUpperCase()}),C1=uw("toUpperCase");function sA(o,c,E){return o=Ut(o),c=E?e:c,c===e?Sp(o)?Pp(o):Ic(o):o.match(c)||[]}var aA=gt(function(o,c){try{return Nn(o,e,c)}catch(E){return A1(E)?E:new Ze(E)}}),OI=Ia(function(o,c){return ei(c,function(E){E=Ts(E),Fa(o,E,v1(o[E],o))}),o});function kI(o){var c=o==null?0:o.length,E=ze();return o=c?te(o,function(I){if(typeof I[1]!="function")throw new ri(i);return[E(I[0]),I[1]]}):[],gt(function(I){for(var T=-1;++TY)return[];var E=Fe,I=En(o,Fe);c=ze(c),o-=Fe;for(var T=xc(I,c);++E0||c<0)?new bt(E):(o<0?E=E.takeRight(-o):o&&(E=E.drop(o)),c!==e&&(c=ft(c),E=c<0?E.dropRight(-c):E.take(c-o)),E)},bt.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},bt.prototype.toArray=function(){return this.take(Fe)},$s(bt.prototype,function(o,c){var E=/^(?:filter|find|map|reject)|While$/.test(c),I=/^(?:head|last)$/.test(c),T=M[I?"take"+(c=="last"?"Right":""):c],q=I||/^find/.test(c);T&&(M.prototype[c]=function(){var W=this.__wrapped__,Z=I?[1]:arguments,se=W instanceof bt,we=Z[0],Ae=se||st(W),be=function(wt){var Dt=T.apply(M,yi([wt],Z));return I&&Be?Dt[0]:Dt};Ae&&E&&typeof we=="function"&&we.length!=1&&(se=Ae=!1);var Be=this.__chain__,Le=!!this.__actions__.length,Ye=q&&!Be,ht=se&&!Le;if(!q&&Ae){W=ht?W:new bt(this);var We=o.apply(W,Z);return We.__actions__.push({func:e0,args:[be],thisArg:e}),new Ki(We,Be)}return Ye&&ht?o.apply(this,Z):(We=this.thru(be),Ye?I?We.value()[0]:We.value():We)})}),ei(["pop","push","shift","sort","splice","unshift"],function(o){var c=tl[o],E=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",I=/^(?:pop|shift)$/.test(o);M.prototype[o]=function(){var T=arguments;if(I&&!this.__chain__){var q=this.value();return c.apply(st(q)?q:[],T)}return this[E](function(W){return c.apply(st(W)?W:[],T)})}}),$s(bt.prototype,function(o,c){var E=M[c];if(E){var I=E.name+"";Bt.call(cl,I)||(cl[I]=[]),cl[I].push({name:c,func:E})}}),cl[Gh(e,v).name]=[{name:"wrapper",func:e}],bt.prototype.clone=RD,bt.prototype.reverse=TD,bt.prototype.value=OD,M.prototype.at=c8,M.prototype.chain=f8,M.prototype.commit=h8,M.prototype.next=d8,M.prototype.plant=g8,M.prototype.reverse=m8,M.prototype.toJSON=M.prototype.valueOf=M.prototype.value=v8,M.prototype.first=M.prototype.head,ya&&(M.prototype[ya]=p8),M},Vi=$p();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Pr._=Vi,define(function(){return Vi})):va?((va.exports=Vi)._=Vi,Dc._=Vi):Pr._=Vi}).call(Yl)});var nm=he((Sz,rm)=>{var uC=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);uC?(em=new Uint8Array(16),rm.exports=function(){return uC(em),em}):(tm=new Array(16),rm.exports=function(){for(var t=0,r;t<16;t++)t&3||(r=Math.random()*4294967296),tm[t]=r>>>((t&3)<<3)&255;return tm});var em,tm});var im=he((Iz,lC)=>{var oC=[];for(Ef=0;Ef<256;++Ef)oC[Ef]=(Ef+256).toString(16).substr(1);var Ef;function jO(e,t){var r=t||0,n=oC;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")}lC.exports=jO});var hC=he((Bz,fC)=>{var HO=nm(),MO=im(),cC,sm,am=0,um=0;function qO(e,t,r){var n=t&&r||0,i=t||[];e=e||{};var a=e.node||cC,s=e.clockseq!==void 0?e.clockseq:sm;if(a==null||s==null){var u=HO();a==null&&(a=cC=[u[0]|1,u[1],u[2],u[3],u[4],u[5]]),s==null&&(s=sm=(u[6]<<8|u[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),f=e.nsecs!==void 0?e.nsecs:um+1,d=l-am+(f-um)/1e4;if(d<0&&e.clockseq===void 0&&(s=s+1&16383),(d<0||l>am)&&e.nsecs===void 0&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");am=l,um=f,sm=s,l+=122192928e5;var m=((l&268435455)*1e4+f)%4294967296;i[n++]=m>>>24&255,i[n++]=m>>>16&255,i[n++]=m>>>8&255,i[n++]=m&255;var p=l/4294967296*1e4&268435455;i[n++]=p>>>8&255,i[n++]=p&255,i[n++]=p>>>24&15|16,i[n++]=p>>>16&255,i[n++]=s>>>8|128,i[n++]=s&255;for(var h=0;h<6;++h)i[n+h]=a[h];return t||MO(i)}fC.exports=qO});var pC=he((xz,dC)=>{var VO=nm(),KO=im();function zO(e,t,r){var n=t&&r||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||VO)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var a=0;a<16;++a)t[n+a]=i[a];return t||KO(i)}dC.exports=zO});var vC=he((Pz,mC)=>{var GO=hC(),gC=pC(),om=gC;om.v1=GO;om.v4=gC;mC.exports=om});var md=he(($z,AC)=>{var{v4:YO}=vC();function wC(){return YO().replace(/-/g,"")}var lm=wC;function cm(){return lm()}cm.setFactory=e=>{lm=e};cm.reset=()=>{lm=wC};AC.exports=cm});var Qa=he((Rz,EC)=>{var WO=Symbol("_options"),XO=Symbol("_cache"),ZO=Symbol("_state"),JO=Symbol("_objectId"),QO=Symbol("_conflicts"),ek=Symbol("_change"),tk=Symbol("_elemIds");EC.exports={OPTIONS:WO,CACHE:XO,STATE:ZO,OBJECT_ID:JO,CONFLICTS:QO,CHANGE:ek,ELEM_IDS:tk}});var ws=he((Tz,yC)=>{function bC(e){return typeof e=="object"&&e!==null}function rk(e){if(!bC(e))return{};let t={};for(let r of Object.keys(e))t[r]=e[r];return t}function nk(e){let t=/^(\d+)@(.*)$/.exec(e||"");if(!t)throw new RangeError(`Not a valid opId: ${e}`);return{counter:parseInt(t[1],10),actorId:t[2]}}function ik(e,t){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array))throw new TypeError("equalBytes can only compare Uint8Arrays");if(e.byteLength!==t.byteLength)return!1;for(let r=0;r{var{OBJECT_ID:Ro}=Qa(),{isObject:ak}=ws(),yf=class{constructor(t){if(typeof t=="string"){let r=[...t].map(n=>({value:n}));return bf(void 0,r)}else if(Array.isArray(t)){let r=t.map(n=>({value:n}));return bf(void 0,r)}else{if(t===void 0)return bf(void 0,[]);throw new TypeError(`Unsupported initial value for Text: ${t}`)}}get length(){return this.elems.length}get(t){let r=this.elems[t].value;if(this.context&&ak(r)){let n=r[Ro],i=this.path.concat([{key:t,objectId:n}]);return this.context.instantiateObject(i,n)}else return r}getElemId(t){return this.elems[t].elemId}[Symbol.iterator](){let t=this.elems,r=-1;return{next(){return r+=1,r0&&(t.push(r),r=""),t.push(n.value));return r.length>0&&t.push(r),t}toJSON(){return this.toString()}getWriteable(t,r){if(!this[Ro])throw new RangeError("getWriteable() requires the objectId to be set");let n=bf(this[Ro],this.elems);return n.context=t,n.path=r,n}set(t,r){if(this.context)this.context.setListIndex(this.path,t,r);else if(!this[Ro])this.elems[t].value=r;else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}insertAt(t,...r){if(this.context)this.context.splice(this.path,t,0,r);else if(!this[Ro])this.elems.splice(t,0,...r.map(n=>({value:n})));else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}deleteAt(t,r=1){if(this.context)this.context.splice(this.path,t,r,[]);else if(!this[Ro])this.elems.splice(t,r);else throw new TypeError("Automerge.Text object cannot be modified outside of a change block");return this}};for(let e of["concat","every","filter","find","findIndex","forEach","includes","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toLocaleString"])yf.prototype[e]=function(...t){return[...this][e](...t)};function bf(e,t){let r=Object.create(yf.prototype);return r[Ro]=e,r.elems=t,r}CC.exports={Text:yf,instantiateText:bf}});var Df=he((kz,FC)=>{var{OBJECT_ID:To,CONFLICTS:uk}=Qa(),{isObject:vd,copyObject:_C}=ws();function fm(e,t,r){for(let n of e)if(t[n]!==r[n]){if(typeof t[n]=="number"&&typeof r[n]=="number")return t[n]-r[n];{let i=""+t[n],a=""+r[n];if(i===a)continue;return i{let r=this.entries[t];return vd(r)&&r.id===t})}get count(){return this.ids.length}get rows(){return this.ids.map(t=>this.byId(t))}filter(t,r){return this.rows.filter(t,r)}find(t,r){return this.rows.find(t,r)}map(t,r){return this.rows.map(t,r)}sort(t){if(typeof t=="function")return this.rows.sort(t);if(typeof t=="string")return this.rows.sort((r,n)=>fm([t],r,n));if(Array.isArray(t))return this.rows.sort((r,n)=>fm(t,r,n));if(t===void 0)return this.rows.sort((r,n)=>fm(["id"],r,n));throw new TypeError(`Unsupported sorting argument: ${t}`)}[Symbol.iterator](){let t=this.rows,r=-1;return{next(){return r+=1,r{var wd=class{constructor(t){this.value=t||0,Object.freeze(this)}valueOf(){return this.value}toString(){return this.valueOf().toString()}toJSON(){return this.value}},dm=class extends wd{increment(t){return t=typeof t=="number"?t:1,this.context.increment(this.path,this.key,t),this.value+=t,this.value}decrement(t){return this.increment(typeof t=="number"?-t:-1)}};function ok(e,t,r,n,i){let a=Object.create(dm.prototype);return a.value=e,a.context=t,a.path=r,a.objectId=n,a.key=i,a}SC.exports={Counter:wd,getWriteableCounter:ok}});var pm=he((Lz,PC)=>{var{isObject:lk,copyObject:IC,parseOpId:bd}=ws(),{OBJECT_ID:Ff,CONFLICTS:Oo,ELEM_IDS:Ed}=Qa(),{instantiateText:ck}=Cf(),{instantiateTable:fk}=Df(),{Counter:hk}=Ad();function eu(e,t,r){return e.objectId?(t&&t[Ff]!==e.objectId&&(t=void 0),xC(e,t,r)):e.datatype==="timestamp"?new Date(e.value):e.datatype==="counter"?new hk(e.value):e.value}function dk(e,t){let r=/^(\d+)@(.*)$/,n=r.test(e)?bd(e):{counter:0,actorId:e},i=r.test(t)?bd(t):{counter:0,actorId:t};return n.counteri.counter?1:n.actorIdi.actorId?1:0}function pk(e,t,r,n){if(e)for(let i of Object.keys(e)){let a={},s=Object.keys(e[i]).sort(dk).reverse();for(let u of s){let l=e[i][u];r[i]&&r[i][u]?a[u]=eu(l,r[i][u],n):a[u]=eu(l,void 0,n)}s.length===0?(delete t[i],delete r[i]):(t[i]=a[s[0]],r[i]=a)}}function BC(e,t){let r=IC(e),n=IC(e?e[Oo]:void 0);return Object.defineProperty(r,Ff,{value:t}),Object.defineProperty(r,Oo,{value:n}),r}function gk(e,t,r){let n=e.objectId;r[n]||(r[n]=BC(t,n));let i=r[n];return pk(e.props,i,i[Oo],r),i}function mk(e,t,r){let n=e.objectId;r[n]||(r[n]=t?t._clone():fk(n));let i=r[n];for(let a of Object.keys(e.props||{})){let s=Object.keys(e.props[a]);if(s.length===0)i.remove(a);else if(s.length===1){let u=e.props[a][s[0]];i._set(a,eu(u,i.byId(a),r),s[0])}else throw new RangeError("Conflicts are not supported on properties of a table")}return i}function vk(e,t){let r=e?e.slice():[],n=e&&e[Oo]?e[Oo].slice():[],i=e&&e[Ed]?e[Ed].slice():[];return Object.defineProperty(r,Ff,{value:t}),Object.defineProperty(r,Oo,{value:n}),Object.defineProperty(r,Ed,{value:i}),r}function wk(e,t,r){let n=e.objectId;r[n]||(r[n]=vk(t,n));let i=r[n],a=i[Oo],s=i[Ed];for(let u=0;u{let y=`${f.counter+v}@${f.actorId}`;w=eu({value:w,datatype:h},void 0,r),m.push(w),p.push({[y]:{value:w,datatype:h,type:"value"}}),d.push(y)}),i.splice(l.index,0,...m),a.splice(l.index,0,...p),s.splice(l.index,0,...d)}else l.action==="remove"&&(i.splice(l.index,l.count),a.splice(l.index,l.count),s.splice(l.index,l.count))}return i}function Ak(e,t,r){let n=e.objectId,i;r[n]?i=r[n].elems:t?i=t.elems.slice():i=[];for(let a of e.edits)if(a.action==="insert"){let s=eu(a.value,void 0,r),u={elemId:a.elemId,pred:[a.opId],value:s};i.splice(a.index,0,u)}else if(a.action==="multi-insert"){let s=bd(a.elemId),u=a.datatype,l=a.values.map((f,d)=>{f=eu({datatype:u,value:f},void 0,r);let m=`${s.counter+d}@${s.actorId}`;return{elemId:m,pred:[m],value:f}});i.splice(a.index,0,...l)}else if(a.action==="update"){let s=i[a.index].elemId,u=eu(a.value,i[a.index].value,r);i[a.index]={elemId:s,pred:[a.opId],value:u}}else a.action==="remove"&&i.splice(a.index,a.count);return r[n]=ck(n,i),r[n]}function xC(e,t,r){if(lk(t)&&(!e.props||Object.keys(e.props).length===0)&&(!e.edits||e.edits.length===0)&&!r[e.objectId])return t;if(e.type==="map")return gk(e,t,r);if(e.type==="table")return mk(e,t,r);if(e.type==="list")return wk(e,t,r);if(e.type==="text")return Ak(e,t,r);throw new TypeError(`Unknown object type: ${e.type}`)}function Ek(e){if(e[Ff]!=="_root")throw new RangeError(`Not the root object: ${e[Ff]}`);return BC(e,"_root")}PC.exports={interpretPatch:xC,cloneRootObject:Ek}});var TC=he((Uz,RC)=>{var{OBJECT_ID:ko,CHANGE:yd,STATE:bk}=Qa(),{createArrayOfNulls:yk}=ws(),{Text:Ck}=Cf(),{Table:_k}=Df();function ta(e){if(typeof e=="string"&&/^[0-9]+$/.test(e)&&(e=parseInt(e,10)),typeof e!="number")throw new TypeError("A list index must be a number, but you passed "+JSON.stringify(e));if(e<0||isNaN(e)||e===1/0||e===-1/0)throw new RangeError("A list index must be positive, but you passed "+e);return e}function Dk(e,t,r){let n={deleteAt(i,a){return e.splice(r,ta(i),a||1,[]),this},fill(i,a,s){let u=e.getObject(t);for(let l=ta(a||0);lu.length-i)&&(a=u.length-i);let l=[];for(let f=0;fa[i]()}for(let i of["concat","every","filter","find","findIndex","forEach","includes","join","lastIndexOf","map","reduce","reduceRight","slice","some","toLocaleString","toString"])n[i]=(...a)=>e.getObject(t).map((u,l)=>e.getObjectField(r,t,l))[i](...a);return n}var Fk={get(e,t){let{context:r,objectId:n,path:i}=e;return t===ko?n:t===yd?r:t===bk?{actorId:r.actorId}:r.getObjectField(i,n,t)},set(e,t,r){let{context:n,path:i,readonly:a}=e;if(Array.isArray(a)&&a.indexOf(t)>=0)throw new RangeError(`Object property "${t}" cannot be modified`);return n.setMapKey(i,t,r),!0},deleteProperty(e,t){let{context:r,path:n,readonly:i}=e;if(Array.isArray(i)&&i.indexOf(t)>=0)throw new RangeError(`Object property "${t}" cannot be modified`);return r.deleteMapKey(n,t),!0},has(e,t){let{context:r,objectId:n}=e;return[ko,yd].includes(t)||t in r.getObject(n)},getOwnPropertyDescriptor(e,t){let{context:r,objectId:n}=e,i=r.getObject(n);if(t in i)return{configurable:!0,enumerable:!0,value:r.getObjectField(n,t)}},ownKeys(e){let{context:t,objectId:r}=e;return Object.keys(t.getObject(r))}},Sk={get(e,t){let[r,n,i]=e;return t===Symbol.iterator?r.getObject(n)[Symbol.iterator]:t===ko?n:t===yd?r:t==="length"?r.getObject(n).length:typeof t=="string"&&/^[0-9]+$/.test(t)?r.getObjectField(i,n,ta(t)):Dk(r,n,i)[t]},set(e,t,r){let[n,i,a]=e;if(t==="length"){if(typeof r!="number")throw new RangeError("Invalid array length");let s=n.getObject(i).length;s>r?n.splice(a,r,s-r,[]):n.splice(a,s,0,yk(r-s))}else n.setListIndex(a,ta(t),r);return!0},deleteProperty(e,t){let[r,,n]=e;return r.splice(n,ta(t),1,[]),!0},has(e,t){let[r,n]=e;return typeof t=="string"&&/^[0-9]+$/.test(t)?ta(t){var gm=class{constructor(t){if(!(Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER))throw new RangeError(`Value ${t} cannot be a uint`);this.value=t,Object.freeze(this)}},mm=class{constructor(t){if(!(Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=0))throw new RangeError(`Value ${t} cannot be a uint`);this.value=t,Object.freeze(this)}},vm=class{constructor(t){if(typeof t!="number")throw new RangeError(`Value ${t} cannot be a float64`);this.value=t||0,Object.freeze(this)}};OC.exports={Int:gm,Uint:mm,Float64:vm}});var UC=he((Hz,LC)=>{var{CACHE:Pk,OBJECT_ID:Cd,CONFLICTS:No,ELEM_IDS:kC,STATE:$k}=Qa(),{interpretPatch:Rk}=pm(),{Text:Bf}=Cf(),{Table:xf}=Df(),{Counter:Pu,getWriteableCounter:Tk}=Ad(),{Int:Am,Uint:Em,Float64:bm}=wm(),{isObject:Sf,parseOpId:NC,createArrayOfNulls:Ok}=ws(),kk=md(),ym=class{constructor(t,r,n){this.actorId=r,this.nextOpNum=t[$k].maxOp+1,this.cache=t[Pk],this.updated={},this.ops=[],this.applyPatch=n||Rk}addOp(t){this.ops.push(t),t.action==="set"&&t.values?this.nextOpNum+=t.values.length:t.action==="del"&&t.multiOp?this.nextOpNum+=t.multiOp:this.nextOpNum+=1}nextOpId(){return`${this.nextOpNum}@${this.actorId}`}getValueDescription(t){if(!["object","boolean","number","string"].includes(typeof t))throw new TypeError(`Unsupported type of value: ${typeof t}`);if(Sf(t)){if(t instanceof Date)return{type:"value",value:t.getTime(),datatype:"timestamp"};if(t instanceof Am)return{type:"value",value:t.value,datatype:"int"};if(t instanceof Em)return{type:"value",value:t.value,datatype:"uint"};if(t instanceof bm)return{type:"value",value:t.value,datatype:"float64"};if(t instanceof Pu)return{type:"value",value:t.value,datatype:"counter"};{let r=t[Cd],n=this.getObjectType(r);if(!r)throw new RangeError(`Object ${JSON.stringify(t)} has no objectId`);return n==="list"||n==="text"?{objectId:r,type:n,edits:[]}:{objectId:r,type:n,props:{}}}}else return typeof t=="number"?Number.isInteger(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER?{type:"value",value:t,datatype:"int"}:{type:"value",value:t,datatype:"float64"}:{type:"value",value:t}}getValuesDescriptions(t,r,n){if(r instanceof xf){let i=r.byId(n),a=r.opIds[n];return i?{[a]:this.getValueDescription(i)}:{}}else if(r instanceof Bf){let i=r.get(n),a=r.getElemId(n);return i?{[a]:this.getValueDescription(i)}:{}}else{let i=r[No][n],a={};if(!i)throw new RangeError(`No children at key ${n} of path ${JSON.stringify(t)}`);for(let s of Object.keys(i))a[s]=this.getValueDescription(i[s]);return a}}getPropertyValue(t,r,n){return t instanceof xf?t.byId(r):t instanceof Bf?t.get(r):t[No][r][n]}getSubpatch(t,r){if(r.length==0)return t;let n=t,i=this.getObject("_root");for(let a of r){let s=this.getValuesDescriptions(r,i,a.key);if(n.props)n.props[a.key]||(n.props[a.key]=s);else if(n.edits)for(let l of Object.keys(s))n.edits.push({action:"update",index:a.key,opId:l,value:s[l]});let u=null;for(let l of Object.keys(s))s[l].objectId===a.objectId&&(u=l);if(!u)throw new RangeError(`Cannot find path object with objectId ${a.objectId}`);n=s[u],i=this.getPropertyValue(i,a.key,u)}return n}getObject(t){let r=this.updated[t]||this.cache[t];if(!r)throw new RangeError(`Target object does not exist: ${t}`);return r}getObjectType(t){if(t==="_root")return"map";let r=this.getObject(t);return r instanceof Bf?"text":r instanceof xf?"table":Array.isArray(r)?"list":"map"}getObjectField(t,r,n){if(!["string","number"].includes(typeof n))return;let i=this.getObject(r);if(i[n]instanceof Pu)return Tk(i[n].value,this,t,r,n);if(Sf(i[n])){let a=i[n][Cd],s=t.concat([{key:n,objectId:a}]);return this.instantiateObject(s,a)}else return i[n]}createNestedObjects(t,r,n,i,a,s){if(n[Cd])throw new RangeError("Cannot create a reference to an existing document object");let u=this.nextOpId();if(n instanceof Bf){this.addOp(s?{action:"makeText",obj:t,elemId:s,insert:i,pred:a}:{action:"makeText",obj:t,key:r,insert:i,pred:a});let l={objectId:u,type:"text",edits:[]};return this.insertListItems(l,0,[...n],!0),l}else if(n instanceof xf){if(n.count>0)throw new RangeError("Assigning a non-empty Table object is not supported");return this.addOp(s?{action:"makeTable",obj:t,elemId:s,insert:i,pred:a}:{action:"makeTable",obj:t,key:r,insert:i,pred:a}),{objectId:u,type:"table",props:{}}}else if(Array.isArray(n)){this.addOp(s?{action:"makeList",obj:t,elemId:s,insert:i,pred:a}:{action:"makeList",obj:t,key:r,insert:i,pred:a});let l={objectId:u,type:"list",edits:[]};return this.insertListItems(l,0,n,!0),l}else{this.addOp(s?{action:"makeMap",obj:t,elemId:s,insert:i,pred:a}:{action:"makeMap",obj:t,key:r,insert:i,pred:a});let l={};for(let f of Object.keys(n).sort()){let d=this.nextOpId(),m=this.setValue(u,f,n[f],!1,[]);l[f]={[d]:m}}return{objectId:u,type:"map",props:l}}}setValue(t,r,n,i,a,s){if(!t)throw new RangeError("setValue needs an objectId");if(r==="")throw new RangeError("The key of a map entry must not be an empty string");if(Sf(n)&&!(n instanceof Date)&&!(n instanceof Pu)&&!(n instanceof Am)&&!(n instanceof Em)&&!(n instanceof bm))return this.createNestedObjects(t,r,n,i,a,s);{let u=this.getValueDescription(n),l={action:"set",obj:t,insert:i,value:u.value,pred:a};return s?l.elemId=s:l.key=r,u.datatype&&(l.datatype=u.datatype),this.addOp(l),u}}applyAtPath(t,r){let n={objectId:"_root",type:"map",props:{}};r(this.getSubpatch(n,t)),this.applyPatch(n,this.cache._root,this.updated)}setMapKey(t,r,n){if(typeof r!="string")throw new RangeError(`The key of a map entry must be a string, not ${typeof r}`);let i=t.length===0?"_root":t[t.length-1].objectId,a=this.getObject(i);if(a[r]instanceof Pu)throw new RangeError("Cannot overwrite a Counter object; use .increment() or .decrement() to change its value.");(a[r]!==n||Object.keys(a[No][r]||{}).length>1||n===void 0)&&this.applyAtPath(t,s=>{let u=If(a,r),l=this.nextOpId(),f=this.setValue(i,r,n,!1,u);s.props[r]={[l]:f}})}deleteMapKey(t,r){let n=t.length===0?"_root":t[t.length-1].objectId,i=this.getObject(n);if(i[r]!==void 0){let a=If(i,r);this.addOp({action:"del",obj:n,key:r,insert:!1,pred:a}),this.applyAtPath(t,s=>{s.props[r]={}})}}insertListItems(t,r,n,i){let a=i?[]:this.getObject(t.objectId);if(r<0||r>a.length)throw new RangeError(`List index ${r} is out of bounds for list of length ${a.length}`);if(n.length===0)return;let s=_d(a,r,!0),u=n.every(d=>typeof d=="string"||typeof d=="number"||typeof d=="boolean"||d===null||Sf(d)&&(d instanceof Date||d instanceof Pu||d instanceof Am||d instanceof Em||d instanceof bm)),l=u?n.map(d=>this.getValueDescription(d)):[],f=l.every(d=>d.datatype===l[0].datatype);if(u&&f&&n.length>1){let d=this.nextOpId(),m=l[0].datatype,p=l.map(v=>v.value),h={action:"set",obj:t.objectId,elemId:s,insert:!0,values:p,pred:[]},w={action:"multi-insert",elemId:d,index:r,values:p};m&&(h.datatype=m,w.datatype=m),this.addOp(h),t.edits.push(w)}else for(let d=0;d=a.length){let s=Ok(r-a.length);return s.push(n),this.splice(t,a.length,0,s)}if(a[r]instanceof Pu)throw new RangeError("Cannot overwrite a Counter object; use .increment() or .decrement() to change its value.");(a[r]!==n||Object.keys(a[No][r]||{}).length>1||n===void 0)&&this.applyAtPath(t,s=>{let u=If(a,r),l=this.nextOpId(),f=this.setValue(i,r,n,!1,u,_d(a,r));s.edits.push({action:"update",index:r,opId:l,value:f})})}splice(t,r,n,i){let a=t.length===0?"_root":t[t.length-1].objectId,s=this.getObject(a);if(r<0||n<0||r>s.length-n)throw new RangeError(`${n} deletions starting at index ${r} are out of bounds for list of length ${s.length}`);if(n===0&&i.length===0)return;let u={diffs:{objectId:"_root",type:"map",props:{}}},l=this.getSubpatch(u.diffs,t);if(n>0){let f,d,m;for(let p=0;p0&&this.insertListItems(l,r,i,!1),this.applyPatch(u.diffs,this.cache._root,this.updated)}addTableRow(t,r){if(!Sf(r)||Array.isArray(r))throw new TypeError("A table row must be an object");if(r[Cd])throw new TypeError("Cannot reuse an existing object as table row");if(r.id)throw new TypeError('A table row must not have an "id" property; it is generated automatically');let n=kk(),i=this.setValue(t[t.length-1].objectId,n,r,!1,[]);return this.applyAtPath(t,a=>{a.props[n]={[i.objectId]:i}}),n}deleteTableRow(t,r,n){let i=t[t.length-1].objectId;this.getObject(i).byId(r)&&(this.addOp({action:"del",obj:i,key:r,insert:!1,pred:[n]}),this.applyAtPath(t,s=>{s.props[r]={}}))}increment(t,r,n){let i=t.length===0?"_root":t[t.length-1].objectId,a=this.getObject(i);if(!(a[r]instanceof Pu))throw new TypeError("Only counter values can be incremented");let s=this.getObjectType(i),u=a[r].value+n,l=this.nextOpId(),f=If(a,r);if(s==="list"||s==="text"){let d=_d(a,r,!1);this.addOp({action:"inc",obj:i,elemId:d,value:n,insert:!1,pred:f})}else this.addOp({action:"inc",obj:i,key:r,value:n,insert:!1,pred:f});this.applyAtPath(t,d=>{s==="list"||s==="text"?d.edits.push({action:"update",index:r,opId:l,value:{value:u,datatype:"counter"}}):d.props[r]={[l]:{value:u,datatype:"counter"}}})}};function If(e,t){return e instanceof xf?[e.opIds[t]]:e instanceof Bf?e.elems[t].pred:e[No]?e[No][t]?Object.keys(e[No][t]):[]:[]}function _d(e,t,r=!1){if(r){if(t===0)return"_head";t-=1}if(e[kC])return e[kC][t];if(e.getElemId)return e.getElemId(t);throw new RangeError(`Cannot find elemId at list index ${t}`)}LC.exports={Context:ym}});var HC=he((Mz,jC)=>{var{OBJECT_ID:Nk,CONFLICTS:Gn}=Qa(),Cm=class{constructor(){this.observers={}}patchCallback(t,r,n,i,a){this._objectUpdate(t.diffs,r,n,i,a)}_objectUpdate(t,r,n,i,a){if(t.objectId){if(this.observers[t.objectId])for(let s of this.observers[t.objectId])s(t,r,n,i,a);if(t.type==="map"&&t.props)for(let s of Object.keys(t.props))for(let u of Object.keys(t.props[s]))this._objectUpdate(t.props[s][u],r&&r[Gn]&&r[Gn][s]&&r[Gn][s][u],n&&n[Gn]&&n[Gn][s]&&n[Gn][s][u],i,a);else if(t.type==="table"&&t.props)for(let s of Object.keys(t.props))for(let u of Object.keys(t.props[s]))this._objectUpdate(t.props[s][u],r&&r.byId(s),n&&n.byId(s),i,a);else if(t.type==="list"&&t.edits){let s=0;for(let u of t.edits)u.action==="insert"?(s-=1,this._objectUpdate(u.value,void 0,n&&n[Gn]&&n[Gn][u.index]&&n[Gn][u.index][u.elemId],i,a)):u.action==="multi-insert"?s-=u.values.length:u.action==="update"?this._objectUpdate(u.value,r&&r[Gn]&&r[Gn][u.index+s]&&r[Gn][u.index+s][u.opId],n&&n[Gn]&&n[Gn][u.index]&&n[Gn][u.index][u.opId],i,a):u.action==="remove"&&(s+=u.count)}else if(t.type==="text"&&t.edits){let s=0;for(let u of t.edits)u.action==="insert"?(s-=1,this._objectUpdate(u.value,void 0,n&&n.get(u.index),i,a)):u.action==="multi-insert"?s-=u.values.length:u.action==="update"?this._objectUpdate(u.value,r&&r.get(u.index+s),n&&n.get(u.index),i,a):u.action==="remove"&&(s+=u.count)}}}observe(t,r){let n=t[Nk];if(!n)throw new TypeError("The observed object must be part of an Automerge document");this.observers[n]||(this.observers[n]=[]),this.observers[n].push(r)}};jC.exports={Observable:Cm}});var XC=he((qz,WC)=>{var{OPTIONS:ra,CACHE:Xl,STATE:na,OBJECT_ID:Jl,CONFLICTS:Zl,CHANGE:MC,ELEM_IDS:Lk}=Qa(),{isObject:Fm,copyObject:_m}=ws(),Uk=md(),{interpretPatch:jk,cloneRootObject:Hk}=pm(),{rootObjectProxy:Mk}=TC(),{Context:qC}=UC(),{Text:Sm}=Cf(),{Table:VC}=Df(),{Counter:qk}=Ad(),{Float64:Vk,Int:Kk,Uint:zk}=wm(),{Observable:Gk}=HC();function KC(e){if(typeof e!="string")throw new TypeError(`Unsupported type of actorId: ${typeof e}`);if(!/^[0-9a-f]+$/.test(e))throw new RangeError("actorId must consist only of lowercase hex digits");if(e.length%2!==0)throw new RangeError("actorId must consist of an even number of digits")}function Dd(e,t,r){let n=t._root;if(n||(n=Hk(e[Xl]._root),t._root=n),Object.defineProperty(n,ra,{value:e[ra]}),Object.defineProperty(n,Xl,{value:t}),Object.defineProperty(n,na,{value:r}),e[ra].freeze)for(let i of Object.keys(t))t[i]instanceof VC?t[i]._freeze():t[i]instanceof Sm?(Object.freeze(t[i].elems),Object.freeze(t[i])):(Object.freeze(t[i]),Object.freeze(t[i][Zl]));for(let i of Object.keys(e[Xl]))t[i]||(t[i]=e[Xl][i]);return e[ra].freeze&&Object.freeze(t),n}function zC(e,t,r){let n=Ql(e);if(!n)throw new Error("Actor ID must be initialized with setActorId() before making a change");let i=_m(e[na]);i.seq+=1;let a={actor:n,seq:i.seq,startOp:i.maxOp+1,deps:i.deps,time:r&&typeof r.time=="number"?r.time:Math.round(new Date().getTime()/1e3),message:r&&typeof r.message=="string"?r.message:"",ops:t.ops};if(e[ra].backend){let[s,u,l]=e[ra].backend.applyLocalChange(i.backendState,a);i.backendState=s,i.lastLocalChange=l;let f=Dm(e,u,i,!0),d=r&&r.patchCallback||e[ra].patchCallback;return d&&d(u,e,f,!0,[l]),[f,a]}else{let s={actor:n,seq:a.seq,before:e};return i.requests=i.requests.concat([s]),i.maxOp=i.maxOp+Yk(a.ops),i.deps=[],[Dd(e,t?t.updated:{},i),a]}}function Yk(e){let t=0;for(let r of e)r.action==="set"&&r.values?t+=r.values.length:t+=1;return t}function Wk(e){return e[na]&&e[na].lastLocalChange?e[na].lastLocalChange:null}function Dm(e,t,r,n){let i=Ql(e),a={};if(jk(t.diffs,e,a),n){if(!t.clock)throw new RangeError("patch is missing clock field");t.clock[i]&&t.clock[i]>r.seq&&(r.seq=t.clock[i]),r.clock=t.clock,r.deps=t.deps,r.maxOp=Math.max(r.maxOp,t.maxOp)}return Dd(e,a,r)}function GC(e){if(typeof e=="string")e={actorId:e};else if(typeof e>"u")e={};else if(!Fm(e))throw new TypeError(`Unsupported value for init() options: ${e}`);if(e.deferActorId||(e.actorId===void 0&&(e.actorId=Uk()),KC(e.actorId)),e.observable){let i=e.patchCallback,a=e.observable;e.patchCallback=(s,u,l,f,d)=>{i&&i(s,u,l,f,d),a.patchCallback(s,u,l,f,d)}}let t={},r={_root:t},n={seq:0,maxOp:0,requests:[],clock:{},deps:[]};return e.backend&&(n.backendState=e.backend.init(),n.lastLocalChange=null),Object.defineProperty(t,Jl,{value:"_root"}),Object.defineProperty(t,ra,{value:Object.freeze(e)}),Object.defineProperty(t,Zl,{value:Object.freeze({})}),Object.defineProperty(t,Xl,{value:Object.freeze(r)}),Object.defineProperty(t,na,{value:Object.freeze(n)}),Object.freeze(t)}function Xk(e,t){return YC(GC(t),"Initialization",r=>Object.assign(r,e))}function YC(e,t,r){if(e[Jl]!=="_root")throw new TypeError("The first argument to Automerge.change must be the document root");if(e[MC])throw new TypeError("Calls to Automerge.change cannot be nested");if(typeof t=="function"&&r===void 0&&([t,r]=[r,t]),typeof t=="string"&&(t={message:t}),t!==void 0&&!Fm(t))throw new TypeError("Unsupported type of options");let n=Ql(e);if(!n)throw new Error("Actor ID must be initialized with setActorId() before making a change");let i=new qC(e,n);return r(Mk(i)),Object.keys(i.updated).length===0?[e,null]:zC(e,i,t)}function Zk(e,t){if(e[Jl]!=="_root")throw new TypeError("The first argument to Automerge.emptyChange must be the document root");if(typeof t=="string"&&(t={message:t}),t!==void 0&&!Fm(t))throw new TypeError("Unsupported type of options");let r=Ql(e);if(!r)throw new Error("Actor ID must be initialized with setActorId() before making a change");return zC(e,new qC(e,r),t)}function Jk(e,t,r=void 0){if(e[Jl]!=="_root")throw new TypeError("The first argument to Frontend.applyPatch must be the document root");let n=_m(e[na]);if(e[ra].backend){if(!r)throw new RangeError("applyPatch must be called with the updated backend state");return n.backendState=r,Dm(e,t,n,!0)}let i;if(n.requests.length>0)if(i=n.requests[0].before,t.actor===Ql(e)){if(n.requests[0].seq!==t.seq)throw new RangeError(`Mismatched sequence number: patch ${t.seq} does not match next request ${n.requests[0].seq}`);n.requests=n.requests.slice(1)}else n.requests=n.requests.slice();else i=e,n.requests=[];let a=Dm(i,t,n,!0);return n.requests.length===0?a:(n.requests[0]=_m(n.requests[0]),n.requests[0].before=a,Dd(e,{},n))}function Qk(e){return e[Jl]}function eN(e,t){if(e[MC])throw new TypeError("Cannot use getObjectById in a change callback");return e[Xl][t]}function Ql(e){return e[na].actorId||e[ra].actorId}function tN(e,t){KC(t);let r=Object.assign({},e[na],{actorId:t});return Dd(e,{},r)}function rN(e,t){if(e[Zl]&&e[Zl][t]&&Object.keys(e[Zl][t]).length>1)return e[Zl][t]}function nN(e,t=null,r="first"){if(e[Jl]!=="_root"){let n=Array.isArray(e)?". Note: Automerge.applyChanges now returns an array.":"";throw t?new TypeError(`The ${r} argument to Automerge.${t} must be the document root${n}`):new TypeError(`Argument is not an Automerge document root${n}`)}return e[na].backendState}function iN(e){return e instanceof Sm?e.elems.map(t=>t.elemId):e[Lk]}WC.exports={init:GC,from:Xk,change:YC,emptyChange:Zk,applyPatch:Jk,getObjectId:Qk,getObjectById:eN,getActorId:Ql,setActorId:tN,getConflicts:rN,getLastLocalChange:Wk,getBackendState:nN,getElementIds:iN,Text:Sm,Table:VC,Counter:qk,Observable:Gk,Float64:Vk,Int:Kk,Uint:zk}});var v_=he((Vz,rc)=>{"use strict";function tc(e){let t=e.length;for(;--t>=0;)e[t]=0}var sN=0,r_=1,aN=2,uN=3,oN=258,Tm=29,kf=256,$f=kf+1+Tm,ec=30,Om=19,n_=2*$f+1,Lo=15,Im=16,lN=7,km=256,i_=16,s_=17,a_=18,$m=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Fd=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),cN=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),u_=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fN=512,tu=new Array(($f+2)*2);tc(tu);var Pf=new Array(ec*2);tc(Pf);var Rf=new Array(fN);tc(Rf);var Tf=new Array(oN-uN+1);tc(Tf);var Nm=new Array(Tm);tc(Nm);var Sd=new Array(ec);tc(Sd);function Bm(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var o_,l_,c_;function xm(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}var f_=e=>e<256?Rf[e]:Rf[256+(e>>>7)],Of=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},pi=(e,t,r)=>{e.bi_valid>Im-r?(e.bi_buf|=t<>Im-e.bi_valid,e.bi_valid+=r-Im):(e.bi_buf|=t<{pi(e,r[t*2],r[t*2+1])},h_=(e,t)=>{let r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1},hN=e=>{e.bi_valid===16?(Of(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},dN=(e,t)=>{let r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,u=t.stat_desc.extra_base,l=t.stat_desc.max_length,f,d,m,p,h,w,v=0;for(p=0;p<=Lo;p++)e.bl_count[p]=0;for(r[e.heap[e.heap_max]*2+1]=0,f=e.heap_max+1;fl&&(p=l,v++),r[d*2+1]=p,!(d>n)&&(e.bl_count[p]++,h=0,d>=u&&(h=s[d-u]),w=r[d*2],e.opt_len+=w*(p+h),a&&(e.static_len+=w*(i[d*2+1]+h)));if(v!==0){do{for(p=l-1;e.bl_count[p]===0;)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[l]--,v-=2}while(v>0);for(p=l;p!==0;p--)for(d=e.bl_count[p];d!==0;)m=e.heap[--f],!(m>n)&&(r[m*2+1]!==p&&(e.opt_len+=(p-r[m*2+1])*r[m*2],r[m*2+1]=p),d--)}},d_=(e,t,r)=>{let n=new Array(Lo+1),i=0,a,s;for(a=1;a<=Lo;a++)i=i+r[a-1]<<1,n[a]=i;for(s=0;s<=t;s++){let u=e[s*2+1];u!==0&&(e[s*2]=h_(n[u]++,u))}},pN=()=>{let e,t,r,n,i,a=new Array(Lo+1);for(r=0,n=0;n>=7;n{let t;for(t=0;t<$f;t++)e.dyn_ltree[t*2]=0;for(t=0;t{e.bi_valid>8?Of(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},ZC=(e,t,r,n)=>{let i=t*2,a=r*2;return e[i]{let n=e.heap[r],i=r<<1;for(;i<=e.heap_len&&(i{let n,i,a=0,s,u;if(e.sym_next!==0)do n=e.pending_buf[e.sym_buf+a++]&255,n+=(e.pending_buf[e.sym_buf+a++]&255)<<8,i=e.pending_buf[e.sym_buf+a++],n===0?ia(e,i,t):(s=Tf[i],ia(e,s+kf+1,t),u=$m[s],u!==0&&(i-=Nm[s],pi(e,i,u)),n--,s=f_(n),ia(e,s,r),u=Fd[s],u!==0&&(n-=Sd[s],pi(e,n,u)));while(a{let r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,a=t.stat_desc.elems,s,u,l=-1,f;for(e.heap_len=0,e.heap_max=n_,s=0;s>1;s>=1;s--)Pm(e,r,s);f=a;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Pm(e,r,1),u=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=u,r[f*2]=r[s*2]+r[u*2],e.depth[f]=(e.depth[s]>=e.depth[u]?e.depth[s]:e.depth[u])+1,r[s*2+1]=r[u*2+1]=f,e.heap[1]=f++,Pm(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],dN(e,t),d_(r,l,e.bl_count)},QC=(e,t,r)=>{let n,i=-1,a,s=t[0*2+1],u=0,l=7,f=4;for(s===0&&(l=138,f=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)a=s,s=t[(n+1)*2+1],!(++u{let n,i=-1,a,s=t[0*2+1],u=0,l=7,f=4;for(s===0&&(l=138,f=3),n=0;n<=r;n++)if(a=s,s=t[(n+1)*2+1],!(++u{let t;for(QC(e,e.dyn_ltree,e.l_desc.max_code),QC(e,e.dyn_dtree,e.d_desc.max_code),Rm(e,e.bl_desc),t=Om-1;t>=3&&e.bl_tree[u_[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},mN=(e,t,r,n)=>{let i;for(pi(e,t-257,5),pi(e,r-1,5),pi(e,n-4,4),i=0;i{let t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return 0;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return 1;for(r=32;r{t_||(pN(),t_=!0),e.l_desc=new xm(e.dyn_ltree,o_),e.d_desc=new xm(e.dyn_dtree,l_),e.bl_desc=new xm(e.bl_tree,c_),e.bi_buf=0,e.bi_valid=0,p_(e)},m_=(e,t,r,n)=>{pi(e,(sN<<1)+(n?1:0),3),g_(e),Of(e,r),Of(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r},AN=e=>{pi(e,r_<<1,3),ia(e,km,tu),hN(e)},EN=(e,t,r,n)=>{let i,a,s=0;e.level>0?(e.strm.data_type===2&&(e.strm.data_type=vN(e)),Rm(e,e.l_desc),Rm(e,e.d_desc),s=gN(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&t!==-1?m_(e,t,r,n):e.strategy===4||a===i?(pi(e,(r_<<1)+(n?1:0),3),JC(e,tu,Pf)):(pi(e,(aN<<1)+(n?1:0),3),mN(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),JC(e,e.dyn_ltree,e.dyn_dtree)),p_(e),n&&g_(e)},bN=(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(Tf[r]+kf+1)*2]++,e.dyn_dtree[f_(t)*2]++),e.sym_next===e.sym_end);rc.exports._tr_init=wN;rc.exports._tr_stored_block=m_;rc.exports._tr_flush_block=EN;rc.exports._tr_tally=bN;rc.exports._tr_align=AN});var Lm=he((Kz,w_)=>{"use strict";var yN=(e,t,r,n)=>{let i=e&65535|0,a=e>>>16&65535|0,s=0;for(;r!==0;){s=r>2e3?2e3:r,r-=s;do i=i+t[n++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0};w_.exports=yN});var Um=he((zz,A_)=>{"use strict";var CN=()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t},_N=new Uint32Array(CN()),DN=(e,t,r,n)=>{let i=_N,a=n+r;e^=-1;for(let s=n;s>>8^i[(e^t[s])&255];return e^-1};A_.exports=DN});var Id=he((Gz,E_)=>{"use strict";E_.exports={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"}});var $u=he((Yz,b_)=>{"use strict";b_.exports={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}});var P_=he((Wz,la)=>{"use strict";var{_tr_init:FN,_tr_stored_block:Mm,_tr_flush_block:SN,_tr_tally:ku,_tr_align:IN}=v_(),D_=Lm(),Ru=Um(),BN=Id(),{Z_NO_FLUSH:Nu,Z_PARTIAL_FLUSH:xN,Z_FULL_FLUSH:PN,Z_FINISH:ts,Z_BLOCK:y_,Z_OK:pn,Z_STREAM_END:C_,Z_STREAM_ERROR:aa,Z_DATA_ERROR:$N,Z_BUF_ERROR:jm,Z_DEFAULT_COMPRESSION:RN,Z_FILTERED:TN,Z_HUFFMAN_ONLY:Bd,Z_RLE:ON,Z_FIXED:kN,Z_DEFAULT_STRATEGY:NN,Z_UNKNOWN:LN,Z_DEFLATED:xd}=$u(),UN=9,jN=15,HN=8,MN=29,qN=256,qm=qN+1+MN,VN=30,KN=19,zN=2*qm+1,GN=15,St=3,Ou=258,oa=Ou+St+1,YN=32,ic=42,Wm=57,Vm=69,Km=73,zm=91,Gm=103,Uo=113,Lf=666,Yn=1,ac=2,Ho=3,uc=4,WN=3,jo=(e,t)=>(e.msg=BN[t],t),__=e=>e*2-(e>4?9:0),Tu=e=>{let t=e.length;for(;--t>=0;)e[t]=0},XN=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do r=e.head[--n],e.head[n]=r>=i?r-i:0;while(--t);t=i,n=t;do r=e.prev[--n],e.prev[n]=r>=i?r-i:0;while(--t)},ZN=(e,t,r)=>(t<{let t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))},Oi=(e,t)=>{SN(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ti(e.strm)},Ot=(e,t)=>{e.pending_buf[e.pending++]=t},Nf=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},Ym=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),e.state.wrap===1?e.adler=D_(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Ru(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},F_=(e,t)=>{let r=e.max_chain_length,n=e.strstart,i,a,s=e.prev_length,u=e.nice_match,l=e.strstart>e.w_size-oa?e.strstart-(e.w_size-oa):0,f=e.window,d=e.w_mask,m=e.prev,p=e.strstart+Ou,h=f[n+s-1],w=f[n+s];e.prev_length>=e.good_match&&(r>>=2),u>e.lookahead&&(u=e.lookahead);do if(i=t,!(f[i+s]!==w||f[i+s-1]!==h||f[i]!==f[n]||f[++i]!==f[n+1])){n+=2,i++;do;while(f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&ns){if(e.match_start=t,s=a,a>=u)break;h=f[n+s-1],w=f[n+s]}}while((t=m[t&d])>l&&--r!==0);return s<=e.lookahead?s:e.lookahead},sc=e=>{let t=e.w_size,r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-oa)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),XN(e),n+=t),e.strm.avail_in===0)break;if(r=Ym(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=St)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Lu(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Lu(e,e.ins_h,e.window[i+St-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert{let r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,n,i,a,s=0,u=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Ti(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(Ym(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(s===0);return u-=e.strm.avail_in,u&&(u>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=u&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-u,e.strm.next_in),e.strstart),e.strstart+=u,e.insert+=u>e.w_size-e.insert?e.w_size-e.insert:u),e.block_start=e.strstart),e.high_watera&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(Ym(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,r=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=r||(i||t===ts)&&t!==Nu&&e.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,s=t===ts&&e.strm.avail_in===0&&n===i?1:0,Mm(e,e.block_start,n,s),e.block_start+=n,Ti(e.strm)),s?Ho:Yn)},Hm=(e,t)=>{let r,n;for(;;){if(e.lookahead=St&&(e.ins_h=Lu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-oa&&(e.match_length=F_(e,r)),e.match_length>=St)if(n=ku(e,e.strstart-e.match_start,e.match_length-St),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=St){e.match_length--;do e.strstart++,e.ins_h=Lu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Lu(e,e.ins_h,e.window[e.strstart+1]);else n=ku(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Oi(e,!1),e.strm.avail_out===0))return Yn}return e.insert=e.strstart{let r,n,i;for(;;){if(e.lookahead=St&&(e.ins_h=Lu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=St-1,r!==0&&e.prev_length4096)&&(e.match_length=St-1)),e.prev_length>=St&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-St,n=ku(e,e.strstart-1-e.prev_match,e.prev_length-St),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=Lu(e,e.ins_h,e.window[e.strstart+St-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=St-1,e.strstart++,n&&(Oi(e,!1),e.strm.avail_out===0))return Yn}else if(e.match_available){if(n=ku(e,0,e.window[e.strstart-1]),n&&Oi(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return Yn}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=ku(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart{let r,n,i,a,s=e.window;for(;;){if(e.lookahead<=Ou){if(sc(e),e.lookahead<=Ou&&t===Nu)return Yn;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=St&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){a=e.strstart+Ou;do;while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=St?(r=ku(e,1,e.match_length-St),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=ku(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Oi(e,!1),e.strm.avail_out===0))return Yn}return e.insert=0,t===ts?(Oi(e,!0),e.strm.avail_out===0?Ho:uc):e.sym_next&&(Oi(e,!1),e.strm.avail_out===0)?Yn:ac},QN=(e,t)=>{let r;for(;;){if(e.lookahead===0&&(sc(e),e.lookahead===0)){if(t===Nu)return Yn;break}if(e.match_length=0,r=ku(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Oi(e,!1),e.strm.avail_out===0))return Yn}return e.insert=0,t===ts?(Oi(e,!0),e.strm.avail_out===0?Ho:uc):e.sym_next&&(Oi(e,!1),e.strm.avail_out===0)?Yn:ac};function sa(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var Uf=[new sa(0,0,0,0,S_),new sa(4,4,8,4,Hm),new sa(4,5,16,8,Hm),new sa(4,6,32,32,Hm),new sa(4,4,16,16,nc),new sa(8,16,32,32,nc),new sa(8,16,128,128,nc),new sa(8,32,128,256,nc),new sa(32,128,258,1024,nc),new sa(32,258,258,4096,nc)],eL=e=>{e.window_size=2*e.w_size,Tu(e.head),e.max_lazy_match=Uf[e.level].max_lazy,e.good_match=Uf[e.level].good_length,e.nice_match=Uf[e.level].nice_length,e.max_chain_length=Uf[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=St-1,e.match_available=0,e.ins_h=0};function tL(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=xd,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(zN*2),this.dyn_dtree=new Uint16Array((2*VN+1)*2),this.bl_tree=new Uint16Array((2*KN+1)*2),Tu(this.dyn_ltree),Tu(this.dyn_dtree),Tu(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(GN+1),this.heap=new Uint16Array(2*qm+1),Tu(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*qm+1),Tu(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var jf=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.status!==ic&&t.status!==Wm&&t.status!==Vm&&t.status!==Km&&t.status!==zm&&t.status!==Gm&&t.status!==Uo&&t.status!==Lf?1:0},I_=e=>{if(jf(e))return jo(e,aa);e.total_in=e.total_out=0,e.data_type=LN;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Wm:t.wrap?ic:Uo,e.adler=t.wrap===2?0:1,t.last_flush=-2,FN(t),pn},B_=e=>{let t=I_(e);return t===pn&&eL(e.state),t},rL=(e,t)=>jf(e)||e.state.wrap!==2?aa:(e.state.gzhead=t,pn),x_=(e,t,r,n,i,a)=>{if(!e)return aa;let s=1;if(t===RN&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>UN||r!==xd||n<8||n>15||t<0||t>9||a<0||a>kN||n===8&&s!==1)return jo(e,aa);n===8&&(n=9);let u=new tL;return e.state=u,u.strm=e,u.status=ic,u.wrap=s,u.gzhead=null,u.w_bits=n,u.w_size=1<x_(e,t,xd,jN,HN,NN),iL=(e,t)=>{if(jf(e)||t>y_||t<0)return e?jo(e,aa):aa;let r=e.state;if(!e.output||e.avail_in!==0&&!e.input||r.status===Lf&&t!==ts)return jo(e,e.avail_out===0?jm:aa);let n=r.last_flush;if(r.last_flush=t,r.pending!==0){if(Ti(e),e.avail_out===0)return r.last_flush=-1,pn}else if(e.avail_in===0&&__(t)<=__(n)&&t!==ts)return jo(e,jm);if(r.status===Lf&&e.avail_in!==0)return jo(e,jm);if(r.status===ic&&r.wrap===0&&(r.status=Uo),r.status===ic){let i=xd+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Bd||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=YN),i+=31-i%31,Nf(r,i),r.strstart!==0&&(Nf(r,e.adler>>>16),Nf(r,e.adler&65535)),e.adler=1,r.status=Uo,Ti(e),r.pending!==0)return r.last_flush=-1,pn}if(r.status===Wm){if(e.adler=0,Ot(r,31),Ot(r,139),Ot(r,8),r.gzhead)Ot(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Ot(r,r.gzhead.time&255),Ot(r,r.gzhead.time>>8&255),Ot(r,r.gzhead.time>>16&255),Ot(r,r.gzhead.time>>24&255),Ot(r,r.level===9?2:r.strategy>=Bd||r.level<2?4:0),Ot(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(Ot(r,r.gzhead.extra.length&255),Ot(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Ru(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Vm;else if(Ot(r,0),Ot(r,0),Ot(r,0),Ot(r,0),Ot(r,0),Ot(r,r.level===9?2:r.strategy>=Bd||r.level<2?4:0),Ot(r,WN),r.status=Uo,Ti(e),r.pending!==0)return r.last_flush=-1,pn}if(r.status===Vm){if(r.gzhead.extra){let i=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let u=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+u),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>i&&(e.adler=Ru(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=u,Ti(e),r.pending!==0)return r.last_flush=-1,pn;i=0,a-=u}let s=new Uint8Array(r.gzhead.extra);r.pending_buf.set(s.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>i&&(e.adler=Ru(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Km}if(r.status===Km){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=Ru(e.adler,r.pending_buf,r.pending-i,i)),Ti(e),r.pending!==0)return r.last_flush=-1,pn;i=0}r.gzindexi&&(e.adler=Ru(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=zm}if(r.status===zm){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=Ru(e.adler,r.pending_buf,r.pending-i,i)),Ti(e),r.pending!==0)return r.last_flush=-1,pn;i=0}r.gzindexi&&(e.adler=Ru(e.adler,r.pending_buf,r.pending-i,i))}r.status=Gm}if(r.status===Gm){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Ti(e),r.pending!==0))return r.last_flush=-1,pn;Ot(r,e.adler&255),Ot(r,e.adler>>8&255),e.adler=0}if(r.status=Uo,Ti(e),r.pending!==0)return r.last_flush=-1,pn}if(e.avail_in!==0||r.lookahead!==0||t!==Nu&&r.status!==Lf){let i=r.level===0?S_(r,t):r.strategy===Bd?QN(r,t):r.strategy===ON?JN(r,t):Uf[r.level].func(r,t);if((i===Ho||i===uc)&&(r.status=Lf),i===Yn||i===Ho)return e.avail_out===0&&(r.last_flush=-1),pn;if(i===ac&&(t===xN?IN(r):t!==y_&&(Mm(r,0,0,!1),t===PN&&(Tu(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Ti(e),e.avail_out===0))return r.last_flush=-1,pn}return t!==ts?pn:r.wrap<=0?C_:(r.wrap===2?(Ot(r,e.adler&255),Ot(r,e.adler>>8&255),Ot(r,e.adler>>16&255),Ot(r,e.adler>>24&255),Ot(r,e.total_in&255),Ot(r,e.total_in>>8&255),Ot(r,e.total_in>>16&255),Ot(r,e.total_in>>24&255)):(Nf(r,e.adler>>>16),Nf(r,e.adler&65535)),Ti(e),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?pn:C_)},sL=e=>{if(jf(e))return aa;let t=e.state.status;return e.state=null,t===Uo?jo(e,$N):pn},aL=(e,t)=>{let r=t.length;if(jf(e))return aa;let n=e.state,i=n.wrap;if(i===2||i===1&&n.status!==ic||n.lookahead)return aa;if(i===1&&(e.adler=D_(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Tu(n.head),n.strstart=0,n.block_start=0,n.insert=0);let l=new Uint8Array(n.w_size);l.set(t.subarray(r-n.w_size,r),0),t=l,r=n.w_size}let a=e.avail_in,s=e.next_in,u=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,sc(n);n.lookahead>=St;){let l=n.strstart,f=n.lookahead-(St-1);do n.ins_h=Lu(n,n.ins_h,n.window[l+St-1]),n.prev[l&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=l,l++;while(--f);n.strstart=l,n.lookahead=St-1,sc(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=St-1,n.match_available=0,e.next_in=s,e.input=u,e.avail_in=a,n.wrap=i,pn};la.exports.deflateInit=nL;la.exports.deflateInit2=x_;la.exports.deflateReset=B_;la.exports.deflateResetKeep=I_;la.exports.deflateSetHeader=rL;la.exports.deflate=iL;la.exports.deflateEnd=sL;la.exports.deflateSetDictionary=aL;la.exports.deflateInfo="pako deflate (from Nodeca project)"});var Zm=he((Xz,Xm)=>{"use strict";var uL=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);Xm.exports.assign=function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let n in r)uL(r,n)&&(e[n]=r[n])}}return e};Xm.exports.flattenChunks=e=>{let t=0;for(let n=0,i=e.length;n{"use strict";var $_=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{$_=!1}var Hf=new Uint8Array(256);for(let e=0;e<256;e++)Hf[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Hf[254]=Hf[254]=1;Pd.exports.string2buf=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,r,n,i,a,s=e.length,u=0;for(i=0;i>>6,t[a++]=128|r&63):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|r&63):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|r&63);return t};var oL=(e,t)=>{if(t<65534&&e.subarray&&$_)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n{let r=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let n,i,a=new Array(r*2);for(i=0,n=0;n4){a[i++]=65533,n+=u-1;continue}for(s&=u===2?31:u===3?15:7;u>1&&n1){a[i++]=65533;continue}s<65536?a[i++]=s:(s-=65536,a[i++]=55296|s>>10&1023,a[i++]=56320|s&1023)}return oL(a,i)};Pd.exports.utf8border=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let r=t-1;for(;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Hf[e[r]]>t?r:t}});var Qm=he((Jz,R_)=>{"use strict";function lL(){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}R_.exports=lL});var N_=he((Qz,oc)=>{"use strict";var Mf=P_(),T_=Zm(),O_=Jm(),e2=Id(),cL=Qm(),k_=Object.prototype.toString,{Z_NO_FLUSH:fL,Z_SYNC_FLUSH:hL,Z_FULL_FLUSH:dL,Z_FINISH:pL,Z_OK:$d,Z_STREAM_END:gL,Z_DEFAULT_COMPRESSION:mL,Z_DEFAULT_STRATEGY:vL,Z_DEFLATED:wL}=$u();function qf(e){this.options=T_.assign({level:mL,method:wL,chunkSize:16384,windowBits:15,memLevel:8,strategy:vL},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new cL,this.strm.avail_out=0;let r=Mf.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==$d)throw new Error(e2[r]);if(t.header&&Mf.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=O_.string2buf(t.dictionary):k_.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Mf.deflateSetDictionary(this.strm,n),r!==$d)throw new Error(e2[r]);this._dict_set=!0}}qf.prototype.push=function(e,t){let r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(t===~~t?a=t:a=t===!0?pL:fL,typeof e=="string"?r.input=O_.string2buf(e):k_.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(a===hL||a===dL)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=Mf.deflate(r,a),i===gL)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Mf.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===$d;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};qf.prototype.onData=function(e){this.chunks.push(e)};qf.prototype.onEnd=function(e){e===$d&&(this.result=T_.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function t2(e,t){let r=new qf(t);if(r.push(e,!0),r.err)throw r.msg||e2[r.err];return r.result}function AL(e,t){return t=t||{},t.raw=!0,t2(e,t)}function EL(e,t){return t=t||{},t.gzip=!0,t2(e,t)}oc.exports.Deflate=qf;oc.exports.deflate=t2;oc.exports.deflateRaw=AL;oc.exports.gzip=EL;oc.exports.constants=$u()});var U_=he((eG,L_)=>{"use strict";L_.exports=function(t,r){let n,i,a,s,u,l,f,d,m,p,h,w,v,y,g,b,D,_,F,L,N,S,B,O,P=t.state;n=t.next_in,B=t.input,i=n+(t.avail_in-5),a=t.next_out,O=t.output,s=a-(r-t.avail_out),u=a+(t.avail_out-257),l=P.dmax,f=P.wsize,d=P.whave,m=P.wnext,p=P.window,h=P.hold,w=P.bits,v=P.lencode,y=P.distcode,g=(1<>>24,h>>>=_,w-=_,_=D>>>16&255,_===0)O[a++]=D&65535;else if(_&16){F=D&65535,_&=15,_&&(w<_&&(h+=B[n++]<>>=_,w-=_),w<15&&(h+=B[n++]<>>24,h>>>=_,w-=_,_=D>>>16&255,_&16){if(L=D&65535,_&=15,w<_&&(h+=B[n++]<l){t.msg="invalid distance too far back",P.mode=16209;break e}if(h>>>=_,w-=_,_=a-s,L>_){if(_=L-_,_>d&&P.sane){t.msg="invalid distance too far back",P.mode=16209;break e}if(N=0,S=p,m===0){if(N+=f-_,_2;)O[a++]=S[N++],O[a++]=S[N++],O[a++]=S[N++],F-=3;F&&(O[a++]=S[N++],F>1&&(O[a++]=S[N++]))}else{N=a-L;do O[a++]=O[N++],O[a++]=O[N++],O[a++]=O[N++],F-=3;while(F>2);F&&(O[a++]=O[N++],F>1&&(O[a++]=O[N++]))}}else if(_&64){t.msg="invalid distance code",P.mode=16209;break e}else{D=y[(D&65535)+(h&(1<<_)-1)];continue r}break}}else if(_&64)if(_&32){P.mode=16191;break e}else{t.msg="invalid literal/length code",P.mode=16209;break e}else{D=v[(D&65535)+(h&(1<<_)-1)];continue t}break}}while(n>3,n-=F,w-=F<<3,h&=(1<{"use strict";var bL=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),yL=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),CL=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),_L=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),DL=(e,t,r,n,i,a,s,u)=>{let l=u.bits,f=0,d=0,m=0,p=0,h=0,w=0,v=0,y=0,g=0,b=0,D,_,F,L,N,S=null,B,O=new Uint16Array(16),P=new Uint16Array(16),U=null,G,H,K;for(f=0;f<=15;f++)O[f]=0;for(d=0;d=1&&O[p]===0;p--);if(h>p&&(h=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,u.bits=1,0;for(m=1;m0&&(e===0||p!==1))return-1;for(P[1]=0,f=1;f<15;f++)P[f+1]=P[f]+O[f];for(d=0;d852||e===2&&g>592)return 1;for(;;){G=f-v,s[d]+1=B?(H=U[s[d]-B],K=S[s[d]-B]):(H=96,K=0),D=1<>v)+_]=G<<24|H<<16|K|0;while(_!==0);for(D=1<>=1;if(D!==0?(b&=D-1,b+=D):b=0,d++,--O[f]===0){if(f===p)break;f=t[r+s[d]]}if(f>h&&(b&L)!==F){for(v===0&&(v=h),N+=m,w=f-v,y=1<852||e===2&&g>592)return 1;F=b&L,i[F]=h<<24|w<<16|N-a|0}}return b!==0&&(i[N+b]=f-v<<24|64<<16|0),u.bits=h,0};j_.exports=DL});var y6=he((rG,As)=>{"use strict";var u2=Lm(),ca=Um(),FL=U_(),Vf=H_(),SL=0,d6=1,p6=2,{Z_FINISH:M_,Z_BLOCK:IL,Z_TREES:Rd,Z_OK:Mo,Z_STREAM_END:BL,Z_NEED_DICT:xL,Z_STREAM_ERROR:rs,Z_DATA_ERROR:g6,Z_MEM_ERROR:o2,Z_BUF_ERROR:PL,Z_DEFLATED:q_}=$u(),Nd=16180,V_=16181,K_=16182,z_=16183,G_=16184,Y_=16185,W_=16186,X_=16187,Z_=16188,J_=16189,kd=16190,ru=16191,r2=16192,Q_=16193,n2=16194,e6=16195,t6=16196,r6=16197,n6=16198,Td=16199,Od=16200,i6=16201,s6=16202,a6=16203,u6=16204,o6=16205,i2=16206,l6=16207,c6=16208,or=16209,l2=16210,m6=16211,$L=852,RL=592,TL=15,OL=TL,f6=e=>(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24);function kL(){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}var qo=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.modem6?1:0},v6=e=>{if(qo(e))return rs;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Nd,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array($L),t.distcode=t.distdyn=new Int32Array(RL),t.sane=1,t.back=-1,Mo},w6=e=>{if(qo(e))return rs;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,v6(e)},A6=(e,t)=>{let r;if(qo(e))return rs;let n=e.state;return t<0?(r=0,t=-t):(r=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?rs:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,w6(e))},E6=(e,t)=>{if(!e)return rs;let r=new kL;e.state=r,r.strm=e,r.window=null,r.mode=Nd;let n=A6(e,t);return n!==Mo&&(e.state=null),n},NL=e=>E6(e,OL),h6=!0,s2,a2,LL=e=>{if(h6){s2=new Int32Array(512),a2=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Vf(d6,e.lens,0,288,s2,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Vf(p6,e.lens,0,32,a2,0,e.work,{bits:5}),h6=!1}e.lencode=s2,e.lenbits=9,e.distcode=a2,e.distbits=5},b6=(e,t,r,n)=>{let i,a=e.state;return a.window===null&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(t.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(t.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave{let r,n,i,a,s,u,l,f,d,m,p,h,w,v,y=0,g,b,D,_,F,L,N,S,B=new Uint8Array(4),O,P,U=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(qo(e)||!e.output||!e.input&&e.avail_in!==0)return rs;r=e.state,r.mode===ru&&(r.mode=r2),s=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,n=e.input,u=e.avail_in,f=r.hold,d=r.bits,m=u,p=l,S=Mo;e:for(;;)switch(r.mode){case Nd:if(r.wrap===0){r.mode=r2;break}for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>>8&255,r.check=ca(r.check,B,2,0),f=0,d=0,r.mode=V_;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((f&255)<<8)+(f>>8))%31){e.msg="incorrect header check",r.mode=or;break}if((f&15)!==q_){e.msg="unknown compression method",r.mode=or;break}if(f>>>=4,d-=4,N=(f&15)+8,r.wbits===0&&(r.wbits=N),N>15||N>r.wbits){e.msg="invalid window size",r.mode=or;break}r.dmax=1<>8&1),r.flags&512&&r.wrap&4&&(B[0]=f&255,B[1]=f>>>8&255,r.check=ca(r.check,B,2,0)),f=0,d=0,r.mode=K_;case K_:for(;d<32;){if(u===0)break e;u--,f+=n[a++]<>>8&255,B[2]=f>>>16&255,B[3]=f>>>24&255,r.check=ca(r.check,B,4,0)),f=0,d=0,r.mode=z_;case z_:for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>8),r.flags&512&&r.wrap&4&&(B[0]=f&255,B[1]=f>>>8&255,r.check=ca(r.check,B,2,0)),f=0,d=0,r.mode=G_;case G_:if(r.flags&1024){for(;d<16;){if(u===0)break e;u--,f+=n[a++]<>>8&255,r.check=ca(r.check,B,2,0)),f=0,d=0}else r.head&&(r.head.extra=null);r.mode=Y_;case Y_:if(r.flags&1024&&(h=r.length,h>u&&(h=u),h&&(r.head&&(N=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+h),N)),r.flags&512&&r.wrap&4&&(r.check=ca(r.check,n,h,a)),u-=h,a+=h,r.length-=h),r.length))break e;r.length=0,r.mode=W_;case W_:if(r.flags&2048){if(u===0)break e;h=0;do N=n[a+h++],r.head&&N&&r.length<65536&&(r.head.name+=String.fromCharCode(N));while(N&&h>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=ru;break;case J_:for(;d<32;){if(u===0)break e;u--,f+=n[a++]<>>=d&7,d-=d&7,r.mode=i2;break}for(;d<3;){if(u===0)break e;u--,f+=n[a++]<>>=1,d-=1,f&3){case 0:r.mode=Q_;break;case 1:if(LL(r),r.mode=Td,t===Rd){f>>>=2,d-=2;break e}break;case 2:r.mode=t6;break;case 3:e.msg="invalid block type",r.mode=or}f>>>=2,d-=2;break;case Q_:for(f>>>=d&7,d-=d&7;d<32;){if(u===0)break e;u--,f+=n[a++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=or;break}if(r.length=f&65535,f=0,d=0,r.mode=n2,t===Rd)break e;case n2:r.mode=e6;case e6:if(h=r.length,h){if(h>u&&(h=u),h>l&&(h=l),h===0)break e;i.set(n.subarray(a,a+h),s),u-=h,a+=h,l-=h,s+=h,r.length-=h;break}r.mode=ru;break;case t6:for(;d<14;){if(u===0)break e;u--,f+=n[a++]<>>=5,d-=5,r.ndist=(f&31)+1,f>>>=5,d-=5,r.ncode=(f&15)+4,f>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=or;break}r.have=0,r.mode=r6;case r6:for(;r.have>>=3,d-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},S=Vf(SL,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid code lengths set",r.mode=or;break}r.have=0,r.mode=n6;case n6:for(;r.have>>24,b=y>>>16&255,D=y&65535,!(g<=d);){if(u===0)break e;u--,f+=n[a++]<>>=g,d-=g,r.lens[r.have++]=D;else{if(D===16){for(P=g+2;d>>=g,d-=g,r.have===0){e.msg="invalid bit length repeat",r.mode=or;break}N=r.lens[r.have-1],h=3+(f&3),f>>>=2,d-=2}else if(D===17){for(P=g+3;d>>=g,d-=g,N=0,h=3+(f&7),f>>>=3,d-=3}else{for(P=g+7;d>>=g,d-=g,N=0,h=11+(f&127),f>>>=7,d-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=or;break}for(;h--;)r.lens[r.have++]=N}}if(r.mode===or)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=or;break}if(r.lenbits=9,O={bits:r.lenbits},S=Vf(d6,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid literal/lengths set",r.mode=or;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},S=Vf(p6,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,S){e.msg="invalid distances set",r.mode=or;break}if(r.mode=Td,t===Rd)break e;case Td:r.mode=Od;case Od:if(u>=6&&l>=258){e.next_out=s,e.avail_out=l,e.next_in=a,e.avail_in=u,r.hold=f,r.bits=d,FL(e,p),s=e.next_out,i=e.output,l=e.avail_out,a=e.next_in,n=e.input,u=e.avail_in,f=r.hold,d=r.bits,r.mode===ru&&(r.back=-1);break}for(r.back=0;y=r.lencode[f&(1<>>24,b=y>>>16&255,D=y&65535,!(g<=d);){if(u===0)break e;u--,f+=n[a++]<>_)],g=y>>>24,b=y>>>16&255,D=y&65535,!(_+g<=d);){if(u===0)break e;u--,f+=n[a++]<>>=_,d-=_,r.back+=_}if(f>>>=g,d-=g,r.back+=g,r.length=D,b===0){r.mode=o6;break}if(b&32){r.back=-1,r.mode=ru;break}if(b&64){e.msg="invalid literal/length code",r.mode=or;break}r.extra=b&15,r.mode=i6;case i6:if(r.extra){for(P=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=s6;case s6:for(;y=r.distcode[f&(1<>>24,b=y>>>16&255,D=y&65535,!(g<=d);){if(u===0)break e;u--,f+=n[a++]<>_)],g=y>>>24,b=y>>>16&255,D=y&65535,!(_+g<=d);){if(u===0)break e;u--,f+=n[a++]<>>=_,d-=_,r.back+=_}if(f>>>=g,d-=g,r.back+=g,b&64){e.msg="invalid distance code",r.mode=or;break}r.offset=D,r.extra=b&15,r.mode=a6;case a6:if(r.extra){for(P=r.extra;d>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=or;break}r.mode=u6;case u6:if(l===0)break e;if(h=p-l,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=or;break}h>r.wnext?(h-=r.wnext,w=r.wsize-h):w=r.wnext-h,h>r.length&&(h=r.length),v=r.window}else v=i,w=s-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do i[s++]=v[w++];while(--h);r.length===0&&(r.mode=Od);break;case o6:if(l===0)break e;i[s++]=r.length,l--,r.mode=Od;break;case i2:if(r.wrap){for(;d<32;){if(u===0)break e;u--,f|=n[a++]<{if(qo(e))return rs;let t=e.state;return t.window&&(t.window=null),e.state=null,Mo},HL=(e,t)=>{if(qo(e))return rs;let r=e.state;return r.wrap&2?(r.head=t,t.done=!1,Mo):rs},ML=(e,t)=>{let r=t.length,n,i,a;return qo(e)||(n=e.state,n.wrap!==0&&n.mode!==kd)?rs:n.mode===kd&&(i=1,i=u2(i,t,r,0),i!==n.check)?g6:(a=b6(e,t,r,r),a?(n.mode=l2,o2):(n.havedict=1,Mo))};As.exports.inflateReset=w6;As.exports.inflateReset2=A6;As.exports.inflateResetKeep=v6;As.exports.inflateInit=NL;As.exports.inflateInit2=E6;As.exports.inflate=UL;As.exports.inflateEnd=jL;As.exports.inflateGetHeader=HL;As.exports.inflateSetDictionary=ML;As.exports.inflateInfo="pako inflate (from Nodeca project)"});var _6=he((nG,C6)=>{"use strict";function qL(){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}C6.exports=qL});var I6=he((iG,lc)=>{"use strict";var nu=y6(),F6=Zm(),h2=Jm(),d2=Id(),VL=Qm(),KL=_6(),S6=Object.prototype.toString,{Z_NO_FLUSH:zL,Z_FINISH:GL,Z_OK:Kf,Z_STREAM_END:c2,Z_NEED_DICT:f2,Z_STREAM_ERROR:YL,Z_DATA_ERROR:D6,Z_MEM_ERROR:WL}=$u();function zf(e){this.options=F6.assign({chunkSize:1024*64,windowBits:15,to:""},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new VL,this.strm.avail_out=0;let r=nu.inflateInit2(this.strm,t.windowBits);if(r!==Kf)throw new Error(d2[r]);if(this.header=new KL,nu.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=h2.string2buf(t.dictionary):S6.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=nu.inflateSetDictionary(this.strm,t.dictionary),r!==Kf)))throw new Error(d2[r])}zf.prototype.push=function(e,t){let r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,s,u;if(this.ended)return!1;for(t===~~t?s=t:s=t===!0?GL:zL,S6.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),a=nu.inflate(r,s),a===f2&&i&&(a=nu.inflateSetDictionary(r,i),a===Kf?a=nu.inflate(r,s):a===D6&&(a=f2));r.avail_in>0&&a===c2&&r.state.wrap>0&&e[r.next_in]!==0;)nu.inflateReset(r),a=nu.inflate(r,s);switch(a){case YL:case D6:case f2:case WL:return this.onEnd(a),this.ended=!0,!1}if(u=r.avail_out,r.next_out&&(r.avail_out===0||a===c2))if(this.options.to==="string"){let l=h2.utf8border(r.output,r.next_out),f=r.next_out-l,d=h2.buf2string(r.output,l);r.next_out=f,r.avail_out=n-f,f&&r.output.set(r.output.subarray(l,l+f),0),this.onData(d)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===Kf&&u===0)){if(a===c2)return a=nu.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};zf.prototype.onData=function(e){this.chunks.push(e)};zf.prototype.onEnd=function(e){e===Kf&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=F6.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function p2(e,t){let r=new zf(t);if(r.push(e),r.err)throw r.msg||d2[r.err];return r.result}function XL(e,t){return t=t||{},t.raw=!0,p2(e,t)}lc.exports.Inflate=zf;lc.exports.inflate=p2;lc.exports.inflateRaw=XL;lc.exports.ungzip=p2;lc.exports.constants=$u()});var B6=he((sG,fa)=>{"use strict";var{Deflate:ZL,deflate:JL,deflateRaw:QL,gzip:eU}=N_(),{Inflate:tU,inflate:rU,inflateRaw:nU,ungzip:iU}=I6(),sU=$u();fa.exports.Deflate=ZL;fa.exports.deflate=JL;fa.exports.deflateRaw=QL;fa.exports.gzip=eU;fa.exports.Inflate=tU;fa.exports.inflate=rU;fa.exports.inflateRaw=nU;fa.exports.ungzip=iU;fa.exports.constants=sU});var A2=he((aG,T6)=>{var aU=new TextEncoder,uU=new TextDecoder("utf-8");function g2(e){return aU.encode(e)}function m2(e){return uU.decode(e)}function P6(e){if(typeof e!="string")throw new TypeError("value is not a string");if(!/^([0-9a-f][0-9a-f])*$/.test(e))throw new RangeError("value is not hexadecimal");return e===""?new Uint8Array(0):new Uint8Array(e.match(/../g).map(t=>parseInt(t,16)))}var x6=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],$6=new Array(256);for(let e=0;e<256;e++)$6[e]=`${x6[e>>>4&15]}${x6[e&15]}`;function R6(e){let t="",r=e.byteLength;for(let n=0;n=this.buf.byteLength&&this.grow(),this.buf[this.offset]=t,this.offset+=1}appendUint32(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<0||t>4294967295)throw new RangeError("number out of range");let r=Math.max(1,Math.ceil((32-Math.clz32(t))/7));this.offset+r>this.buf.byteLength&&this.grow();for(let n=0;n>>=7;return this.offset+=r,r}appendInt32(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<-2147483648||t>2147483647)throw new RangeError("number out of range");let r=Math.ceil((33-Math.clz32(t>=0?t:-t-1))/7);this.offset+r>this.buf.byteLength&&this.grow();for(let n=0;n>=7;return this.offset+=r,r}appendUint53(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(t<0||t>Number.MAX_SAFE_INTEGER)throw new RangeError("number out of range");let r=Math.floor(t/4294967296),n=(t&4294967295)>>>0;return this.appendUint64(r,n)}appendInt53(t){if(!Number.isInteger(t))throw new RangeError("value is not an integer");if(tNumber.MAX_SAFE_INTEGER)throw new RangeError("number out of range");let r=Math.floor(t/4294967296),n=(t&4294967295)>>>0;return this.appendInt64(r,n)}appendUint64(t,r){if(!Number.isInteger(t)||!Number.isInteger(r))throw new RangeError("value is not an integer");if(t<0||t>4294967295||r<0||r>4294967295)throw new RangeError("number out of range");if(t===0)return this.appendUint32(r);let n=Math.ceil((64-Math.clz32(t))/7);this.offset+n>this.buf.byteLength&&this.grow();for(let i=0;i<4;i++)this.buf[this.offset+i]=r&127|128,r>>>=7;this.buf[this.offset+4]=r&15|(t&7)<<4|(n===5?0:128),t>>>=3;for(let i=5;i>>=7;return this.offset+=n,n}appendInt64(t,r){if(!Number.isInteger(t)||!Number.isInteger(r))throw new RangeError("value is not an integer");if(t<-2147483648||t>2147483647||r<-2147483648||r>4294967295)throw new RangeError("number out of range");if(r>>>=0,t===0&&r<=2147483647)return this.appendInt32(r);if(t===-1&&r>=2147483648)return this.appendInt32(r-4294967296);let n=Math.ceil((65-Math.clz32(t>=0?t:-t-1))/7);this.offset+n>this.buf.byteLength&&this.grow();for(let i=0;i<4;i++)this.buf[this.offset+i]=r&127|128,r>>>=7;this.buf[this.offset+4]=r&15|(t&7)<<4|(n===5?0:128),t>>=3;for(let i=5;i>=7;return this.offset+=n,n}appendRawBytes(t){return this.offset+t.byteLength>this.buf.byteLength&&this.grow(this.offset+t.byteLength),this.buf.set(t,this.offset),this.offset+=t.byteLength,t.byteLength}appendRawString(t){if(typeof t!="string")throw new TypeError("value is not a string");return this.appendRawBytes(g2(t))}appendPrefixedBytes(t){return this.appendUint53(t.byteLength),this.appendRawBytes(t),this}appendPrefixedString(t){if(typeof t!="string")throw new TypeError("value is not a string");return this.appendPrefixedBytes(g2(t)),this}appendHexString(t){return this.appendPrefixedBytes(P6(t)),this}finish(){}},Yf=class{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError(`Not a byte array: ${t}`);this.buf=t,this.offset=0}get done(){return this.offset===this.buf.byteLength}reset(){this.offset=0}skip(t){if(this.offset+t>this.buf.byteLength)throw new RangeError("cannot skip beyond end of buffer");this.offset+=t}readByte(){return this.offset+=1,this.buf[this.offset-1]}readUint32(){let t=0,r=0;for(;this.offset>>0,r+=7,this.offset++,!(n&128))return t}throw new RangeError("buffer ended with incomplete number")}readInt32(){let t=0,r=0;for(;this.offset28?t:t|-1<2097151)throw new RangeError("number out of range");return r*4294967296+t}readInt53(){let{low32:t,high32:r}=this.readInt64();if(r<-2097152||r===-2097152&&t===0||r>2097151)throw new RangeError("number out of range");return r*4294967296+t}readUint64(){let t=0,r=0,n=0;for(;this.offset>>0,n===28&&(r=(i&112)>>>4),n+=7,this.offset++,!(i&128))return{high32:r,low32:t}}for(n=3;this.offset>>0,n+=7,this.offset++,!(i&128))return{high32:r,low32:t}}throw new RangeError("buffer ended with incomplete number")}readInt64(){let t=0,r=0,n=0;for(;this.offset>>0,n===28&&(r=(i&112)>>>4),n+=7,this.offset++,!(i&128))return i&64&&(n<32&&(t=(t|-1<>>0),r|=-1<this.buf.byteLength)throw new RangeError("subarray exceeds buffer size");return this.offset+=t,this.buf.subarray(r,this.offset)}readRawString(t){return m2(this.readRawBytes(t))}readPrefixedBytes(){return this.readRawBytes(this.readUint53())}readPrefixedString(){return m2(this.readPrefixedBytes())}readHexString(){return R6(this.readPrefixedBytes())}},Ld=class extends Gf{constructor(t){super(),this.type=t,this.state="empty",this.lastValue=void 0,this.count=0,this.literal=[]}appendValue(t,r=1){this._appendValue(t,r)}_appendValue(t,r=1){r<=0||(this.state==="empty"?(this.state=t===null?"nulls":r===1?"loneValue":"repetition",this.lastValue=t,this.count=r):this.state==="loneValue"?t===null?(this.flush(),this.state="nulls",this.count=r):t===this.lastValue?(this.state="repetition",this.count=1+r):r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.state="literal",this.literal=[this.lastValue],this.lastValue=t):this.state==="repetition"?t===null?(this.flush(),this.state="nulls",this.count=r):t===this.lastValue?this.count+=r:r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.flush(),this.state="loneValue",this.lastValue=t):this.state==="literal"?t===null?(this.literal.push(this.lastValue),this.flush(),this.state="nulls",this.count=r):t===this.lastValue?(this.flush(),this.state="repetition",this.count=1+r):r>1?(this.literal.push(this.lastValue),this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.literal.push(this.lastValue),this.lastValue=t):this.state==="nulls"&&(t===null?this.count+=r:r>1?(this.flush(),this.state="repetition",this.count=r,this.lastValue=t):(this.flush(),this.state="loneValue",this.lastValue=t)))}copyFrom(t,r={}){let{count:n,sumValues:i,sumShift:a}=r;if(!(t instanceof Wf)||t.type!==this.type)throw new TypeError("incompatible type of decoder");let s=typeof n=="number"?n:Number.MAX_SAFE_INTEGER,u=0,l=0;if(n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:l}:{nonNullValues:u};let f=t.readValue();if(f===null){let m=Math.min(t.count+1,s);if(s-=m,t.count-=m-1,this.appendValue(null,m),n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:l}:{nonNullValues:u};if(f=t.readValue(),f===null)throw new RangeError("null run must be followed by non-null value")}if(this.appendValue(f),s--,u++,i&&(l+=a?f>>>a:f),n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(s===0||t.done)return i?{nonNullValues:u,sum:l}:{nonNullValues:u};let d=t.count>0;for(;s>0&&!t.done;){d||t.readRecord();let m=Math.min(t.count,s);if(t.count-=m,t.state==="literal"){u+=m;for(let p=0;p>>a:h)}}else if(t.state==="repetition"){u+=m,i&&(l+=m*(a?t.lastValue>>>a:t.lastValue));let p=t.lastValue;if(this._appendValue(p),m>1){if(this._appendValue(p),this.state!=="repetition")throw new RangeError(`Unexpected state ${this.state}`);this.count+=m-2}}else if(t.state==="nulls"){if(this._appendValue(null),this.state!=="nulls")throw new RangeError(`Unexpected state ${this.state}`);this.count+=m-1}d=!1,s-=m}if(n&&s>0&&t.done)throw new RangeError(`cannot copy ${n} values`);return i?{nonNullValues:u,sum:l}:{nonNullValues:u}}flush(){if(this.state==="loneValue")this.appendInt32(-1),this.appendRawValue(this.lastValue);else if(this.state==="repetition")this.appendInt53(this.count),this.appendRawValue(this.lastValue);else if(this.state==="literal"){this.appendInt53(-this.literal.length);for(let t of this.literal)this.appendRawValue(t)}else this.state==="nulls"&&(this.appendInt32(0),this.appendUint53(this.count));this.state="empty"}appendRawValue(t){if(this.type==="int")this.appendInt53(t);else if(this.type==="uint")this.appendUint53(t);else if(this.type==="utf8")this.appendPrefixedString(t);else throw new RangeError(`Unknown RLEEncoder datatype: ${this.type}`)}finish(){this.state==="literal"&&this.literal.push(this.lastValue),(this.state!=="nulls"||this.offset>0)&&this.flush()}},Wf=class extends Yf{constructor(t,r){super(r),this.type=t,this.lastValue=void 0,this.count=0,this.state=void 0}get done(){return this.count===0&&this.offset===this.buf.byteLength}reset(){this.offset=0,this.lastValue=void 0,this.count=0,this.state=void 0}readValue(){if(this.done)return null;if(this.count===0&&this.readRecord(),this.count-=1,this.state==="literal"){let t=this.readRawValue();if(t===this.lastValue)throw new RangeError("Repetition of values is not allowed in literal");return this.lastValue=t,t}else return this.lastValue}skipValues(t){for(;t>0&&!this.done;){this.count===0&&(this.count=this.readInt53(),this.count>0?(this.lastValue=this.count<=t?this.skipRawValues(1):this.readRawValue(),this.state="repetition"):this.count<0?(this.count=-this.count,this.state="literal"):(this.count=this.readUint53(),this.lastValue=null,this.state="nulls"));let r=Math.min(t,this.count);this.state==="literal"&&this.skipRawValues(r),t-=r,this.count-=r}}readRecord(){if(this.count=this.readInt53(),this.count>1){let t=this.readRawValue();if((this.state==="repetition"||this.state==="literal")&&this.lastValue===t)throw new RangeError("Successive repetitions with the same value are not allowed");this.state="repetition",this.lastValue=t}else{if(this.count===1)throw new RangeError("Repetition count of 1 is not allowed, use a literal instead");if(this.count<0){if(this.count=-this.count,this.state==="literal")throw new RangeError("Successive literals are not allowed");this.state="literal"}else{if(this.state==="nulls")throw new RangeError("Successive null runs are not allowed");if(this.count=this.readUint53(),this.count===0)throw new RangeError("Zero-length null runs are not allowed");this.lastValue=null,this.state="nulls"}}}readRawValue(){if(this.type==="int")return this.readInt53();if(this.type==="uint")return this.readUint53();if(this.type==="utf8")return this.readPrefixedString();throw new RangeError(`Unknown RLEDecoder datatype: ${this.type}`)}skipRawValues(t){if(this.type==="utf8")for(let r=0;r0&&this.offset0)throw new RangeError("cannot skip beyond end of buffer")}}},v2=class extends Ld{constructor(){super("int"),this.absoluteValue=0}appendValue(t,r=1){r<=0||(typeof t=="number"?(super.appendValue(t-this.absoluteValue,1),this.absoluteValue=t,r>1&&super.appendValue(0,r-1)):super.appendValue(t,r))}copyFrom(t,r={}){if(r.sumValues)throw new RangeError("unsupported options for DeltaEncoder.copyFrom()");if(!(t instanceof Ud))throw new TypeError("incompatible type of decoder");let n=r.count;if(n>0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(n===0||t.done)return;let i=t.readValue(),a=0;if(this.appendValue(i),i===null){if(a=t.count+1,n!==void 0&&na&&t.done)throw new RangeError(`cannot copy ${n} values`);if(n===a||t.done)return;t.count===0&&this.appendValue(t.readValue())}n!==void 0&&(n-=a+1);let{nonNullValues:s,sum:u}=super.copyFrom(t,{count:n,sumValues:!0});s>0&&(this.absoluteValue=u,t.absoluteValue=u)}},Ud=class extends Wf{constructor(t){super("int",t),this.absoluteValue=0}reset(){this.offset=0,this.lastValue=void 0,this.count=0,this.state=void 0,this.absoluteValue=0}readValue(){let t=super.readValue();return t===null?null:(this.absoluteValue+=t,this.absoluteValue)}skipValues(t){for(;t>0&&!this.done;){this.count===0&&this.readRecord();let r=Math.min(t,this.count);if(this.state==="literal")for(let n=0;n0&&t.done)throw new RangeError(`cannot copy ${n} values`);if(i===0||t.done)return;this.appendValue(t.readValue()),i--;let a=Math.min(t.count,i);for(this.count+=a,t.count-=a,i-=a;i>0&&!t.done;){if(t.count=t.readUint53(),t.count===0)throw new RangeError("Zero-length runs are not allowed");t.lastValue=!t.lastValue,this.appendUint53(this.count);let s=Math.min(t.count,i);this.count=s,this.lastValue=t.lastValue,t.count-=s,i-=s}if(n&&i>0&&t.done)throw new RangeError(`cannot copy ${n} values`)}finish(){this.count>0&&(this.appendUint53(this.count),this.count=0)}},jd=class extends Yf{constructor(t){super(t),this.lastValue=!0,this.firstRun=!0,this.count=0}get done(){return this.count===0&&this.offset===this.buf.byteLength}reset(){this.offset=0,this.lastValue=!0,this.firstRun=!0,this.count=0}readValue(){if(this.done)return!1;for(;this.count===0;){if(this.count=this.readUint53(),this.lastValue=!this.lastValue,this.count===0&&!this.firstRun)throw new RangeError("Zero-length runs are not allowed");this.firstRun=!1}return this.count-=1,this.lastValue}skipValues(t){for(;t>0&&!this.done;){if(this.count===0){if(this.count=this.readUint53(),this.lastValue=!this.lastValue,this.count===0&&!this.firstRun)throw new RangeError("Zero-length runs are not allowed");this.firstRun=!1}this.count{(function(e,t){var r={};t(r);var n=r.default;for(var i in r)n[i]=r[i];typeof Hd=="object"&&typeof Hd.exports=="object"?Hd.exports=n:typeof define=="function"&&define.amd?define(function(){return n}):e.sha256=n})(O6,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(m,p,h,w,v){for(var y,g,b,D,_,F,L,N,S,B,O,P,U;v>=64;){for(y=p[0],g=p[1],b=p[2],D=p[3],_=p[4],F=p[5],L=p[6],N=p[7],B=0;B<16;B++)O=w+B*4,m[B]=(h[O]&255)<<24|(h[O+1]&255)<<16|(h[O+2]&255)<<8|h[O+3]&255;for(B=16;B<64;B++)S=m[B-2],P=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,S=m[B-15],U=(S>>>7|S<<25)^(S>>>18|S<<14)^S>>>3,m[B]=(P+m[B-7]|0)+(U+m[B-16]|0);for(B=0;B<64;B++)P=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&F^~_&L)|0)+(N+(t[B]+m[B]|0)|0)|0,U=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&g^y&b^g&b)|0,N=L,L=F,F=_,_=D+P|0,D=b,b=g,g=y,y=P+U|0;p[0]+=y,p[1]+=g,p[2]+=b,p[3]+=D,p[4]+=_,p[5]+=F,p[6]+=L,p[7]+=N,w+=64,v-=64}return w}var n=function(){function m(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return m.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},m.prototype.clean=function(){for(var p=0;p0){for(;this.bufferLength<64&&h>0;)this.buffer[this.bufferLength++]=p[w++],h--;this.bufferLength===64&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(h>=64&&(w=r(this.temp,this.state,p,w,h),h%=64);h>0;)this.buffer[this.bufferLength++]=p[w++],h--;return this},m.prototype.finish=function(p){if(!this.finished){var h=this.bytesHashed,w=this.bufferLength,v=h/536870912|0,y=h<<3,g=h%64<56?64:128;this.buffer[w]=128;for(var b=w+1;b>>24&255,this.buffer[g-7]=v>>>16&255,this.buffer[g-6]=v>>>8&255,this.buffer[g-5]=v>>>0&255,this.buffer[g-4]=y>>>24&255,this.buffer[g-3]=y>>>16&255,this.buffer[g-2]=y>>>8&255,this.buffer[g-1]=y>>>0&255,r(this.temp,this.state,this.buffer,0,g),this.finished=!0}for(var b=0;b<8;b++)p[b*4+0]=this.state[b]>>>24&255,p[b*4+1]=this.state[b]>>>16&255,p[b*4+2]=this.state[b]>>>8&255,p[b*4+3]=this.state[b]>>>0&255;return this},m.prototype.digest=function(){var p=new Uint8Array(this.digestLength);return this.finish(p),p},m.prototype._saveState=function(p){for(var h=0;hthis.blockSize)new n().update(p).finish(h).clean();else for(var w=0;w1&&p.update(m),h&&p.update(h),p.update(w),p.finish(m),w[0]++}var l=new Uint8Array(e.digestLength);function f(m,p,h,w){p===void 0&&(p=l),w===void 0&&(w=32);for(var v=new Uint8Array([1]),y=s(p,m),g=new i(y),b=new Uint8Array(g.digestLength),D=b.length,_=new Uint8Array(w),F=0;F>>24&255,g[1]=L>>>16&255,g[2]=L>>>8&255,g[3]=L>>>0&255,v.reset(),v.update(p),v.update(g),v.finish(D);for(var N=0;N{var Vd=B6(),{copyObject:N6,parseOpId:iu,equalBytes:L6}=ws(),{utf8ToString:oU,hexStringToBytes:V6,bytesToHexString:Kd,Encoder:hc,Decoder:mi,RLEEncoder:gi,RLEDecoder:U6,DeltaEncoder:cc,DeltaDecoder:lU,BooleanEncoder:K6,BooleanDecoder:cU}=A2(),{Hash:z6}=k6(),fc=new Uint8Array([133,111,74,131]),_2=0,dc=1,Jf=2,G6=256,dt={GROUP_CARD:0,ACTOR_ID:1,INT_RLE:2,INT_DELTA:3,BOOLEAN:4,STRING_RLE:5,VALUE_LEN:6,VALUE_RAW:7},Zf=8,Wt={NULL:0,FALSE:1,TRUE:2,LEB128_UINT:3,LEB128_INT:4,IEEE754:5,UTF8:6,BYTES:7,COUNTER:8,TIMESTAMP:9,MIN_UNKNOWN:10,MAX_UNKNOWN:15},Xf=["makeMap","set","makeList","del","makeText","inc","makeTable","link"],fU={makeMap:"map",makeList:"list",makeText:"text",makeTable:"table"},Y6=[{columnName:"objActor",columnId:0|dt.ACTOR_ID},{columnName:"objCtr",columnId:0|dt.INT_RLE},{columnName:"keyActor",columnId:16|dt.ACTOR_ID},{columnName:"keyCtr",columnId:16|dt.INT_DELTA},{columnName:"keyStr",columnId:16|dt.STRING_RLE},{columnName:"idActor",columnId:32|dt.ACTOR_ID},{columnName:"idCtr",columnId:32|dt.INT_DELTA},{columnName:"insert",columnId:48|dt.BOOLEAN},{columnName:"action",columnId:64|dt.INT_RLE},{columnName:"valLen",columnId:80|dt.VALUE_LEN},{columnName:"valRaw",columnId:80|dt.VALUE_RAW},{columnName:"chldActor",columnId:96|dt.ACTOR_ID},{columnName:"chldCtr",columnId:96|dt.INT_DELTA}],D2=Y6.concat([{columnName:"predNum",columnId:112|dt.GROUP_CARD},{columnName:"predActor",columnId:112|dt.ACTOR_ID},{columnName:"predCtr",columnId:112|dt.INT_DELTA}]),F2=Y6.concat([{columnName:"succNum",columnId:128|dt.GROUP_CARD},{columnName:"succActor",columnId:128|dt.ACTOR_ID},{columnName:"succCtr",columnId:128|dt.INT_DELTA}]),W6=[{columnName:"actor",columnId:0|dt.ACTOR_ID},{columnName:"seq",columnId:0|dt.INT_DELTA},{columnName:"maxOp",columnId:16|dt.INT_DELTA},{columnName:"time",columnId:32|dt.INT_DELTA},{columnName:"message",columnId:48|dt.STRING_RLE},{columnName:"depsNum",columnId:64|dt.GROUP_CARD},{columnName:"depsIndex",columnId:64|dt.INT_DELTA},{columnName:"extraLen",columnId:80|dt.VALUE_LEN},{columnName:"extraRaw",columnId:80|dt.VALUE_RAW}];function Md(e,t){if(!e||!e.actorId)return e;let r=e.counter,n=t.indexOf(e.actorId);if(n<0)throw new RangeError("missing actorId");return{counter:r,actorNum:n,actorId:e.actorId}}function E2(e,t){return e.countert.counter?1:e.actorIdt.actorId?1:0}function hU(e,t){let r={},n=[];for(let a of e)a=N6(a),r[a.actor]=!0,a.ops=EU(a.ops,a.startOp,a.actor),a.ops=a.ops.map(s=>{s=N6(s),s.obj!=="_root"&&(s.obj=iu(s.obj)),s.elemId&&s.elemId!=="_head"&&(s.elemId=iu(s.elemId)),s.child&&(s.child=iu(s.child)),s.pred&&(s.pred=s.pred.map(iu)),s.obj.actorId&&(r[s.obj.actorId]=!0),s.elemId&&s.elemId.actorId&&(r[s.elemId.actorId]=!0),s.child&&s.child.actorId&&(r[s.child.actorId]=!0);for(let u of s.pred)r[u.actorId]=!0;return s}),n.push(a);let i=Object.keys(r).sort();t&&(i=[e[0].actor].concat(i.filter(a=>a!==e[0].actor)));for(let a of n){a.actorNum=i.indexOf(a.actor);for(let s=0;sMd(l,i))}}return{changes:n,actorIds:i}}function dU(e,t){if(e.obj==="_root")t.objActor.appendValue(null),t.objCtr.appendValue(null);else if(e.obj.actorNum>=0&&e.obj.counter>0)t.objActor.appendValue(e.obj.actorNum),t.objCtr.appendValue(e.obj.counter);else throw new RangeError(`Unexpected objectId reference: ${JSON.stringify(e.obj)}`)}function pU(e,t){if(e.key)t.keyActor.appendValue(null),t.keyCtr.appendValue(null),t.keyStr.appendValue(e.key);else if(e.elemId==="_head"&&e.insert)t.keyActor.appendValue(null),t.keyCtr.appendValue(0),t.keyStr.appendValue(null);else if(e.elemId&&e.elemId.actorNum>=0&&e.elemId.counter>0)t.keyActor.appendValue(e.elemId.actorNum),t.keyCtr.appendValue(e.elemId.counter),t.keyStr.appendValue(null);else throw new RangeError(`Unexpected operation key: ${JSON.stringify(e)}`)}function gU(e,t){let r=Xf.indexOf(e.action);if(r>=0)t.action.appendValue(r);else if(typeof e.action=="number")t.action.appendValue(e.action);else throw new RangeError(`Unexpected operation action: ${e.action}`)}function mU(e){switch(e.datatype){case"counter":return[Wt.COUNTER,e.value];case"timestamp":return[Wt.TIMESTAMP,e.value];case"uint":return[Wt.LEB128_UINT,e.value];case"int":return[Wt.LEB128_INT,e.value];case"float64":{let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e.value,!0),[Wt.IEEE754,new Uint8Array(t)]}default:if(Number.isInteger(e.value)&&e.value<=Number.MAX_SAFE_INTEGER&&e.value>=Number.MIN_SAFE_INTEGER)return[Wt.LEB128_INT,e.value];{let t=new ArrayBuffer(8);return new DataView(t).setFloat64(0,e.value,!0),[Wt.IEEE754,new Uint8Array(t)]}}}function vU(e,t){if(e.action!=="set"&&e.action!=="inc"||e.value===null)t.valLen.appendValue(Wt.NULL);else if(e.value===!1)t.valLen.appendValue(Wt.FALSE);else if(e.value===!0)t.valLen.appendValue(Wt.TRUE);else if(typeof e.value=="string"){let r=t.valRaw.appendRawString(e.value);t.valLen.appendValue(r<<4|Wt.UTF8)}else if(ArrayBuffer.isView(e.value)){let r=t.valRaw.appendRawBytes(new Uint8Array(e.value.buffer));t.valLen.appendValue(r<<4|Wt.BYTES)}else if(typeof e.value=="number"){let[r,n]=mU(e),i;r===Wt.LEB128_UINT?i=t.valRaw.appendUint53(n):r===Wt.IEEE754?i=t.valRaw.appendRawBytes(n):i=t.valRaw.appendInt53(n),t.valLen.appendValue(i<<4|r)}else if(typeof e.datatype=="number"&&e.datatype>=Wt.MIN_UNKNOWN&&e.datatype<=Wt.MAX_UNKNOWN&&e.value instanceof Uint8Array){let r=t.valRaw.appendRawBytes(e.value);t.valLen.appendValue(r<<4|e.datatype)}else throw e.datatype?new RangeError(`Unknown datatype ${e.datatype} for value ${e.value}`):new RangeError(`Unsupported value in operation: ${e.value}`)}function X6(e,t){if(e===Wt.NULL)return{value:null};if(e===Wt.FALSE)return{value:!1};if(e===Wt.TRUE)return{value:!0};if(e%16===Wt.UTF8)return{value:oU(t)};if(e%16===Wt.LEB128_UINT)return{value:new mi(t).readUint53(),datatype:"uint"};if(e%16===Wt.LEB128_INT)return{value:new mi(t).readInt53(),datatype:"int"};if(e%16===Wt.IEEE754){let r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.byteLength===8)return{value:r.getFloat64(0,!0),datatype:"float64"};throw new RangeError(`Invalid length for floating point number: ${t.byteLength}`)}else return e%16===Wt.COUNTER?{value:new mi(t).readInt53(),datatype:"counter"}:e%16===Wt.TIMESTAMP?{value:new mi(t).readInt53(),datatype:"timestamp"}:{value:t,datatype:e%16}}function j6(e,t,r,n){let{columnId:i,columnName:a,decoder:s}=e[t];if(i%8===dt.VALUE_LEN&&t+1>4),{value:f,datatype:d}=X6(u,l);return n[a]=f,d&&(n[a+"_datatype"]=d),2}else if(i%8===dt.ACTOR_ID){let u=s.readValue();if(u===null)n[a]=null;else{if(!r[u])throw new RangeError(`No actor index ${u}`);n[a]=r[u]}}else n[a]=s.readValue();return 1}function wU(e,t){let r={objActor:new gi("uint"),objCtr:new gi("uint"),keyActor:new gi("uint"),keyCtr:new cc,keyStr:new gi("utf8"),insert:new K6,action:new gi("uint"),valLen:new gi("uint"),valRaw:new hc,chldActor:new gi("uint"),chldCtr:new cc};t?(r.idActor=new gi("uint"),r.idCtr=new cc,r.succNum=new gi("uint"),r.succActor=new gi("uint"),r.succCtr=new cc):(r.predNum=new gi("uint"),r.predCtr=new cc,r.predActor=new gi("uint"));for(let i of e)if(dU(i,r),pU(i,r),r.insert.appendValue(!!i.insert),gU(i,r),vU(i,r),i.child&&i.child.counter?(r.chldActor.appendValue(i.child.actorNum),r.chldCtr.appendValue(i.child.counter)):(r.chldActor.appendValue(null),r.chldCtr.appendValue(null)),t){r.idActor.appendValue(i.id.actorNum),r.idCtr.appendValue(i.id.counter),r.succNum.appendValue(i.succ.length),i.succ.sort(E2);for(let a=0;ai.columnId-a.columnId)}function AU(e,t){return t===void 0?typeof e=="string"||typeof e=="boolean"||e===null:typeof e=="number"}function EU(e,t,r){let n=t,i=[];for(let a of e)if(a.action==="set"&&a.values&&a.insert){if(a.pred.length!==0)throw new RangeError("multi-insert pred must be empty");let s=a.elemId,u=a.datatype;for(let l of a.values){if(!AU(l,u))throw new RangeError(`Decode failed: bad value/datatype association (${l},${u})`);i.push({action:"set",obj:a.obj,elemId:s,datatype:u,value:l,pred:[],insert:!0}),s=`${n}@${r}`,n+=1}}else if(a.action==="del"&&a.multiOp>1){if(a.pred.length!==1)throw new RangeError("multiOp deletion must have exactly one pred");let s=iu(a.elemId),u=iu(a.pred[0]);for(let l=0;l`${l.succCtr}@${l.succActor}`),H6(n.succNum.map(l=>({counter:l.succCtr,actorId:l.succActor})))):(u.pred=n.predNum.map(l=>`${l.predCtr}@${l.predActor}`),H6(n.predNum.map(l=>({counter:l.predCtr,actorId:l.predActor})))),r.push(u)}return r}function H6(e){let t=null;for(let r of e){if(t&&E2(t,r)!==-1)throw new RangeError("operation IDs are not in ascending order");t=r}}function bU(e){return(e&7)===dt.INT_DELTA?new cc:(e&7)===dt.BOOLEAN?new K6:(e&7)===dt.STRING_RLE?new gi("utf8"):(e&7)===dt.VALUE_RAW?new hc:new gi("uint")}function qd(e,t){return(e&7)===dt.INT_DELTA?new lU(t):(e&7)===dt.BOOLEAN?new cU(t):(e&7)===dt.STRING_RLE?new U6("utf8",t):(e&7)===dt.VALUE_RAW?new mi(t):new U6("uint",t)}function J6(e,t){let r=new Uint8Array(0),n=[],i=0,a=0;for(;i!i.decoder.done);){let i={},a=0;for(;a>4,l=1;for(;a+l>4===u;)l++;if(s%8===dt.GROUP_CARD){let f=[],d=e[a].decoder.readValue();for(let m=0;m>>0,r=-1,n=[],i=e.readUint53();for(let a=0;an.encoder.buffer.byteLength>0);e.appendUint53(r.length);for(let n of r)e.appendUint53(n.columnId),e.appendUint53(n.encoder.buffer.byteLength)}function Q6(e){let t=e.readUint53(),r=[];for(let s=0;s{if(!Array.isArray(n.deps))throw new TypeError("deps is not an array");u.appendUint53(n.deps.length);for(let f of n.deps.slice().sort())u.appendRawBytes(V6(f));u.appendHexString(n.actor),u.appendUint53(n.seq),u.appendUint53(n.startOp),u.appendInt53(n.time),u.appendPrefixedString(n.message||""),u.appendUint53(r.length-1);for(let f of r.slice(1))u.appendHexString(f);let l=wU(n.ops,!1);C2(u,l);for(let f of l)u.appendRawBytes(f.encoder.buffer);n.extraBytes&&u.appendRawBytes(n.extraBytes)}),s=Kd(i);if(e.hash&&e.hash!==s)throw new RangeError(`Change hash does not match encoding: ${e.hash} != ${s}`);return a.byteLength>=G6?CU(a):a}function r4(e){e[8]===Jf&&(e=n4(e));let t=new mi(e),r=pc(t,!0),n=new mi(r.chunkData);if(!t.done)throw new RangeError("Encoded change has trailing data");if(r.chunkType!==dc)throw new RangeError(`Unexpected chunk type: ${r.chunkType}`);let i=Q6(n),a=y2(n);for(let s=0;sn.counter?1:r.actorIdn.actorId?1:0}function FU(e,t){let r={};for(let i of e){if(i.ops=[],r[i.actor]||(r[i.actor]=[]),i.seq!==r[i.actor].length+1)throw new RangeError(`Expected seq = ${r[i.actor].length+1}, got ${i.seq}`);if(i.seq>1&&r[i.actor][i.seq-2].maxOp>i.maxOp)throw new RangeError("maxOp must increase monotonically per actor");r[i.actor].push(i)}let n={};for(let i of t){if(i.action==="del")throw new RangeError("document should not contain del operations");i.pred=n[i.id]?n[i.id].pred:[],n[i.id]=i;for(let a of i.succ){if(!n[a])if(i.elemId){let s=i.insert?i.id:i.elemId;n[a]={id:a,action:"del",obj:i.obj,elemId:s,pred:[]}}else n[a]={id:a,action:"del",obj:i.obj,key:i.key,pred:[]};n[a].pred.push(i.id)}delete i.succ}for(let i of Object.values(n))i.action==="del"&&t.push(i);for(let i of t){let{counter:a,actorId:s}=iu(i.id),u=r[s],l=0,f=u.length;for(;l=u.length)throw new RangeError(`Operation ID ${i.id} outside of allowed range`);u[l].ops.push(i)}for(let i of e){i.ops.sort((a,s)=>DU(a.id,s.id)),i.startOp=i.maxOp-i.ops.length+1,delete i.maxOp;for(let a=0;af.depsIndex)){if(!e[l]||!e[l].hash)throw new RangeError(`No hash for index ${l} while processing index ${s}`);let f=e[l].hash;u.deps.push(f),r[f]&&delete r[f]}if(u.deps.sort(),delete u.depsNum,u.extraLen_datatype!==Wt.BYTES)throw new RangeError(`Bad datatype for extra bytes: ${Wt.BYTES}`);u.extraBytes=u.extraLen,delete u.extraLen_datatype,e[s]=S2(t4(u)),r[e[s].hash]=!0}let n=Object.keys(r).sort(),i=n.length===t.length,a=0;for(;i&&a{u.appendUint53(n.length);for(let l of n)u.appendHexString(l);u.appendUint53(i.length);for(let l of i.sort())u.appendRawBytes(V6(l));C2(u,t),C2(u,r);for(let l of t)u.appendRawBytes(l.encoder.buffer);for(let l of r)u.appendRawBytes(l.encoder.buffer);for(let l of a)u.appendUint53(l);s&&u.appendRawBytes(s)}).bytes}function s4(e){let t=new mi(e),r=pc(t,!0),n=new mi(r.chunkData);if(!t.done)throw new RangeError("Encoded document has trailing data");if(r.chunkType!==_2)throw new RangeError(`Unexpected chunk type: ${r.chunkType}`);let i=[],a=n.readUint53();for(let p=0;p=G6&&(e.encoder={buffer:Vd.deflateRaw(e.encoder.buffer)},e.columnId|=Zf)}function q6(e){e.columnId&Zf&&(e.buffer=Vd.inflateRaw(e.buffer),e.columnId^=Zf)}u4.exports={COLUMN_TYPE:dt,VALUE_TYPE:Wt,ACTIONS:Xf,OBJECT_TYPE:fU,DOC_OPS_COLUMNS:F2,CHANGE_COLUMNS:D2,DOCUMENT_COLUMNS:W6,encoderByColumnId:bU,decoderByColumnId:qd,makeDecoders:J6,decodeValue:X6,splitContainers:i4,encodeChange:t4,decodeChangeColumns:r4,decodeChange:S2,decodeChangeMeta:yU,decodeChanges:_U,encodeDocumentHeader:IU,decodeDocumentHeader:s4,decodeDocument:a4}});var _4=he((oG,C4)=>{var{parseOpId:Yd,copyObject:Wd}=ws(),{COLUMN_TYPE:vn,VALUE_TYPE:B2,ACTIONS:su,OBJECT_TYPE:o4,DOC_OPS_COLUMNS:l4,CHANGE_COLUMNS:Ht,DOCUMENT_COLUMNS:Es,encoderByColumnId:Ac,decoderByColumnId:N2,makeDecoders:eh,decodeValue:zd,encodeChange:BU,decodeChangeColumns:xU,decodeChangeMeta:PU,decodeChanges:$U,decodeDocumentHeader:RU,encodeDocumentHeader:TU}=Qf(),rh=600,OU=10,g4=7,m4=Math.floor(OU*rh/8),_r=0,pr=1,gn=2,mn=3,At=4,xn=5,ar=6,Pn=7,Or=8,Uu=9,Vo=10,ju=13,gc=14,mc=15,bs=13,x2=14,vc=15,c4=Ht.filter(e=>["predNum","predActor","predCtr"].includes(e.columnName)).map(e=>e.columnId);function P2(e,t,r){if(t.length===1)e[t[0]]=r;else{let n=Object.assign({},e[t[0]]);P2(n,t.slice(1),r),e[t[0]]=n}}function f4(e,t,r,n){for(let H of t)H.decoder.reset();let{objActor:i,objCtr:a,keyActor:s,keyCtr:u,keyStr:l,idActor:f,idCtr:d,insert:m}=e,[p,h,,,w,v,y,g,b,,,,,D]=t.map(H=>H.decoder),_=0,F=0,L=!1,N=null,S=null,B=null,O=null,P=null,U=null,G=0;if(a!==null&&!n)for(;(!h.done||!p.done||!b.done)&&(S=h.readValue(),N=r[p.readValue()],b.skipValues(1),S===null||!N||S0&&s!==null){for(_+=1;!y.done&&!v.done&&(O!==u||B!==s)&&(U&&(L=!1),G===0&&!L&&(F+=1,L=!0),O=y.readValue(),B=r[v.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue(),S===a&&N===i);)_+=1;if(S!==a||N!==i||O!==u||B!==s||!U)return{found:!1,skipCount:_,visibleCount:F};if(U&&(L=!1),G===0&&!L&&(F+=1,L=!0),y.done||v.done)return{found:!0,skipCount:_,visibleCount:F};O=y.readValue(),B=r[v.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue()}for(;(!U||O>d||O===d&&B>f)&&S===a&&N===i&&(_+=1,U&&(L=!1),G===0&&!L&&(F+=1,L=!0),!y.done&&!v.done);)O=y.readValue(),B=r[v.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue()}else if(u!==null&&u>0&&s!==null){for(;(!U||O!==u||B!==s)&&S===a&&N===i&&(_+=1,U&&(L=!1),G===0&&!L&&(F+=1,L=!0),!y.done&&!v.done);)O=y.readValue(),B=r[v.readValue()],S=h.readValue(),N=r[p.readValue()],U=g.readValue(),G=D.readValue();if(S!==a||N!==i||O!==u||B!==s||!U)return{found:!1,skipCount:_,visibleCount:F}}return{found:!0,skipCount:_,visibleCount:F}}function h4(e,t,r,n){let i=e.blocks[t],a=e.blocks[t+1];return i.lastObjectActor!==r||i.lastObjectCtr!==n||i.numVisible===void 0?0:i.lastVisibleActor===a.firstVisibleActor&&i.lastVisibleActor!==void 0&&i.lastVisibleCtr===a.firstVisibleCtr&&i.lastVisibleCtr!==void 0?i.numVisible-1:i.numVisible}function v4(e,t){let{objActor:r,objActorNum:n,objCtr:i,keyActor:a,keyCtr:s,keyStr:u}=t,l=0,f=0;if(i!==null)for(;li)throw new RangeError(`Reference element not found: ${s}@${a}`);f+=h4(e,l,n,i),l++}let{found:h,skipCount:w,visibleCount:v}=f4(t,e.blocks[l].columns,e.actorIds,p);if(l===e.blocks.length-1||e.blocks[l].lastObjectActor!==n||e.blocks[l].lastObjectCtr!==i){if(h)return{blockIndex:l,skipCount:w,visibleCount:f+v};throw new RangeError(`Reference element not found: ${s}@${a}`)}else if(h&&w>>0)%n;for(let u=0;u>>3]|=1<<(i&7),i=(i+a)%n,a=(a+s)%n}function A4(e,t,r){let n=8*e.byteLength,i=r%n,a=t%n,s=((r^t)*16777619>>>0)%n;for(let u=0;u>>3]&1<<(i&7)))return!1;i=(i+a)%n,a=(a+s)%n}return!0}function E4(e){e.bloom=new Uint8Array(m4),e.numOps=0,e.lastKey=void 0,e.numVisible=void 0,e.lastObjectActor=void 0,e.lastObjectCtr=void 0,e.firstVisibleActor=void 0,e.firstVisibleCtr=void 0,e.lastVisibleActor=void 0,e.lastVisibleCtr=void 0;for(let d of e.columns)d.decoder.reset();let[t,r,n,i,a,s,u,l,,,,,,f]=e.columns.map(d=>d.decoder);for(;!u.done;){e.numOps+=1;let d=t.readValue(),m=r.readValue(),p=n.readValue(),h=i.readValue(),w=a.readValue(),v=s.readValue(),y=u.readValue(),g=l.readValue(),b=f.readValue();if((e.lastObjectActor!==d||e.lastObjectCtr!==m)&&(e.numVisible=0,e.lastObjectActor=d,e.lastObjectCtr=m),w!==null)e.lastKey=w;else if(g||h!==null){e.lastKey=void 0;let D=g?v:p,_=g?y:h;w4(e.bloom,D,_),b===0&&(e.firstVisibleActor===void 0&&(e.firstVisibleActor=D),e.firstVisibleCtr===void 0&&(e.firstVisibleCtr=_),(e.lastVisibleActor!==D||e.lastVisibleCtr!==_)&&(e.numVisible+=1,e.lastVisibleActor=D,e.lastVisibleCtr=_))}}}function I2(e,t,r,n){if(t[At]!==null)e.lastObjectCtr===t[pr]&&e.lastObjectActor===t[_r]&&(e.lastKey===void 0||e.lastKey({columnId:f.columnId,encoder:Ac(f.columnId)}));Ec(s,e.columns,a);let l={columns:s.map(f=>{let d=N2(f.columnId,f.encoder.buffer);return{columnId:f.columnId,decoder:d}})};E4(l),r.push(l),n+=a}return r}function kU(e){let t=e[0].columns.map(r=>({columnId:r.columnId,encoder:Ac(r.columnId)}));for(let r of e){for(let n of r.columns)n.decoder.reset();Ec(t,r.columns,r.numOps)}return t}function Ec(e,t,r){if(r===0)return;let n=0,i=-1,a=0,s=-1,u=0;for(let l of e){for(;n0&&(f=t[n].decoder);let d=l.columnId>>4===i?a:r;if(l.columnId%8===vn.GROUP_CARD)i=l.columnId>>4,f?a=l.encoder.copyFrom(f,{count:r,sumValues:!0}).sum:(l.encoder.appendValue(0,r),a=0);else if(l.columnId%8===vn.VALUE_LEN)if(f){if(n+1===t.length||t[n+1].columnId!==l.columnId+1)throw new RangeError("VALUE_LEN column without accompanying VALUE_RAW column");s=l.columnId+1,u=l.encoder.copyFrom(f,{count:d,sumValues:!0,sumShift:4}).sum}else l.encoder.appendValue(null,d),s=l.columnId+1,u=0;else if(l.columnId%8===vn.VALUE_RAW){if(l.columnId!==s)throw new RangeError("VALUE_RAW column without accompanying VALUE_LEN column");u>0&&l.encoder.appendRawBytes(f.readRawBytes(u))}else if(f)l.encoder.copyFrom(f,{count:d});else{let m=l.columnId%8===vn.BOOLEAN?!1:null;l.encoder.appendValue(m,d)}}}function $2(e,t){let r=[],n,i=-1,a=0,s=-1,u=0;for(let l of e){if(l.columnId%8===vn.VALUE_RAW){if(l.columnId!==s)throw new RangeError("unexpected VALUE_RAW column");n=l.decoder.readRawBytes(u)}else if(l.columnId%8===vn.GROUP_CARD)i=l.columnId>>4,a=l.decoder.readValue()||0,n=a;else if(l.columnId>>4===i){n=[],l.columnId%8===vn.VALUE_LEN&&(s=l.columnId+1,u=0);for(let f=0;f>>4),n.push(d)}}else n=l.decoder.readValue(),l.columnId%8===vn.ACTOR_ID&&t&&typeof n=="number"&&(n=t[n]),l.columnId%8===vn.VALUE_LEN&&(s=l.columnId+1,u=n>>>4);r.push(n)}return r}function Gd(e,t,r){let n=0,i=-1,a=0;for(let s of e){for(;n>4,a=u,s.encoder.appendValue(u);else if(s.columnId>>4===i){if(!Array.isArray(u)||u.length!==a)throw new RangeError("bad group value");for(let l of u)s.encoder.appendValue(l)}else s.columnId%8===vn.VALUE_RAW?u&&s.encoder.appendRawBytes(u):s.encoder.appendValue(u)}else if(s.columnId%8===vn.GROUP_CARD)i=s.columnId>>4,a=0,s.encoder.appendValue(0);else if(s.columnId%8!==vn.VALUE_RAW){let u=s.columnId>>4===i?a:1,l=null;s.columnId%8===vn.BOOLEAN&&(l=!1),s.columnId%8===vn.VALUE_LEN&&(l=0),s.encoder.appendValue(l,u)}}}function R2(e,t){let r=e.blocks[t];if(r.columns[Or].decoder.done){if(t===e.blocks.length-1)return{docOp:null,blockIndex:t};t+=1,r=e.blocks[t];for(let n of r.columns)n.decoder.reset();return{docOp:$2(r.columns),blockIndex:t}}else return{docOp:$2(r.columns),blockIndex:t}}function y4(e,t){for(;t.changeIndexe.maxOp&&(e.maxOp=t.opCtr),t.opCtr+=1;let r=t.nextOp;if(r[pr]===null&&r[_r]!==null||r[pr]!==null&&r[_r]===null)throw new RangeError(`Mismatched object reference: (${r[pr]}, ${r[_r]})`);if(r[mn]===null&&r[gn]!==null||r[mn]===0&&r[gn]!==null||r[mn]>0&&r[gn]===null)throw new RangeError(`Mismatched operation key: (${r[mn]}, ${r[gn]})`)}function wc(e,t){return t==="list"||t==="text"?{objectId:e,type:t,edits:[]}:{objectId:e,type:t,props:{}}}function d4(e,t,r=1){let n=Yd(e),i=Yd(t);return n.actorId===i.actorId&&n.counter+r===i.counter}function th(e,t){if(e.length===0){e.push(t);return}let r=e[e.length-1];r.action==="insert"&&t.action==="insert"&&r.index===t.index-1&&r.value.type==="value"&&t.value.type==="value"&&r.elemId===r.opId&&t.elemId===t.opId&&d4(r.elemId,t.elemId,1)&&r.value.datatype===t.value.datatype&&typeof r.value.value==typeof t.value.value?(r.action="multi-insert",t.value.datatype&&(r.datatype=t.value.datatype),r.values=[r.value.value,t.value.value],delete r.value,delete r.opId):r.action==="multi-insert"&&t.action==="insert"&&r.index+r.values.length===t.index&&t.value.type==="value"&&t.elemId===t.opId&&d4(r.elemId,t.elemId,r.values.length)&&r.datatype===t.value.datatype&&typeof r.values[0]==typeof t.value.value?r.values.push(t.value.value):r.action==="remove"&&t.action==="remove"&&r.index===t.index?r.count+=t.count:e.push(t)}function T2(e,t,r,n,i,a){let s=!1;if(a)for(;!s&&e.length>0;){let u=e[e.length-1];if((u.action==="insert"||u.action==="update")&&u.index===t)e.pop(),s=u.action==="insert";else if(u.action==="multi-insert"&&u.index+u.values.length-1===t)u.values.pop(),s=!0;else break}s?th(e,{action:"insert",index:t,elemId:r,opId:n,value:i}):th(e,{action:"update",index:t,opId:n,value:i})}function NU(e,t,r){let n=[];for(;e.length>0;){let a=e[e.length-1];if(a.action==="insert"){if(a.index!==t)throw new RangeError("last edit has unexpected index");n.unshift(e.pop());break}else if(a.action==="update"){if(a.index!==t)throw new RangeError("last edit has unexpected index");n.unshift(e.pop())}else throw new RangeError("last edit has unexpected action")}let i=!0;for(let a of n)T2(e,t,r,a.opId,a.value,i),i=!1}function O2(e,t,r,n,i,a,s,u){let l=!t,f=n[Or]0;v||(a[h].visibleOps.push(n),a[h].hasChild=a[h].hasChild||n[Or]%2===0);let y=i.objectMeta[r].children[h];if(a[h].hasChild||y&&Object.keys(y).length>0){let _={};for(let F of a[h].visibleOps){let L=`${F[ar]}@${i.actorIds[F[xn]]}`;if(su[F[Or]]==="set")_[L]=Object.assign({type:"value"},zd(F[Uu],F[Vo]));else if(F[Or]%2===0){let N=F[Or]1?_.count-=1:D.edits.pop(),a[h].action="update",T2(D.edits,s,h,g,b,!0),t&&t.lastObjectActor===n[_r]&&t.lastObjectCtr===n[pr]&&(t.numVisible+=1)}else T2(D.edits,s,h,g,b,!a[h].action),a[h].action||(a[h].action="update");else u===0&&!a[h].action&&(a[h].action="remove",th(D.edits,{action:"remove",index:s,count:1}),t&&t.lastObjectActor===n[_r]&&t.lastObjectCtr===n[pr]&&(t.numVisible-=1));else(b||!l)&&((w||!D.props[n[At]])&&(D.props[n[At]]={}),b&&(D.props[n[At]][g]=b))}function LU(e,t,r,n,i,a,s){let u=n.nextOp,l=u[Pn],f=u[_r],d=u[pr],m=f===null?"_root":`${d}@${i.actorIds[f]}`,p=n.actorIndex,h=i.actorIds[p],w=!1,v=!1,y={},g;({docOp:g,blockIndex:s}=R2(i,s));let b=g===null?0:1,D=g===null?0:g[bs],_=null,F=[],L=[],N=[],S=null;for(n.objectIds.add(m);;){if(F.length===0){w=!1;let H=n.nextOp;for(;!n.done&&H[xn]===p&&H[Pn]===l&&H[_r]===u[_r]&&H[pr]===u[pr];){let K=F.length>0?F[F.length-1]:null,Y=!1;for(let ie=0;ie0&&(_=F[0]);let B=g&&g[_r]===_[_r]&&g[pr]===_[pr],O=g&&g[At]!==null&&g[At]===_[At],P=g&&g[At]===null&&_[At]===null&&(!g[Pn]&&g[gn]===_[gn]&&g[mn]===_[mn]||g[Pn]&&g[xn]===_[gn]&&g[ar]===_[mn]);if(F.length===0&&!(B&&(O||P)))break;let U=!1,G=0;if(l||!B||g[At]===null&&_[At]!==null||g[At]!==null&&_[At]!==null&&_[At]=0;H--){let K=!0;for(let Y=0;Y0){for(let H=0;H({columnId:B.columnId,encoder:Ac(B.columnId)}));Ec(_,g.columns,v);let{blockIndex:F,docOpsConsumed:L}=LU(e,D,_,t,r,y,w),N=r.blocks[F],S=-v-L;for(let B=w;B<=F;B++)S+=r.blocks[B].numOps;Ec(_,N.columns,S),D.numOps+=S;for(let B of N.columns)if(!B.decoder.done)throw new RangeError(`excess ops in column ${B.columnId}`);if(D.columns=_.map(B=>{let O=N2(B.columnId,B.encoder.buffer);return{columnId:B.columnId,decoder:O}}),w===F&&D.numOps<=rh)S>0&&g.lastVisibleActor!==void 0&&g.lastVisibleCtr!==void 0&&(D.lastVisibleActor=g.lastVisibleActor,D.lastVisibleCtr=g.lastVisibleCtr),r.blocks[w]=D;else{let B=b4(D);r.blocks.splice(w,F-w+1,...B)}}function jU(e,t){if(t[_r].columnId!==Ht[_r].columnId||Ht[_r].columnName!=="objActor"||t[pr].columnId!==Ht[pr].columnId||Ht[pr].columnName!=="objCtr"||t[gn].columnId!==Ht[gn].columnId||Ht[gn].columnName!=="keyActor"||t[mn].columnId!==Ht[mn].columnId||Ht[mn].columnName!=="keyCtr"||t[At].columnId!==Ht[At].columnId||Ht[At].columnName!=="keyStr"||t[xn].columnId!==Ht[xn].columnId||Ht[xn].columnName!=="idActor"||t[ar].columnId!==Ht[ar].columnId||Ht[ar].columnName!=="idCtr"||t[Pn].columnId!==Ht[Pn].columnId||Ht[Pn].columnName!=="insert"||t[Or].columnId!==Ht[Or].columnId||Ht[Or].columnName!=="action"||t[Uu].columnId!==Ht[Uu].columnId||Ht[Uu].columnName!=="valLen"||t[Vo].columnId!==Ht[Vo].columnId||Ht[Vo].columnName!=="valRaw"||t[ju].columnId!==Ht[ju].columnId||Ht[ju].columnName!=="predNum"||t[gc].columnId!==Ht[gc].columnId||Ht[gc].columnName!=="predActor"||t[mc].columnId!==Ht[mc].columnId||Ht[mc].columnName!=="predCtr")throw new RangeError("unexpected columnId");let r=e.blocks[0].columns;if(!t.every(n=>c4.includes(n.columnId)||r.find(i=>i.columnId===n.columnId))){let n=r.map(i=>({columnId:i.columnId}));for(let i of t){let{columnId:a}=i;!c4.includes(a)&&!r.find(s=>s.columnId===a)&&n.push({columnId:a})}n.sort((i,a)=>i.columnId-a.columnId);for(let i=0;i({columnId:s.columnId,buffer:s.decoder.buf})),n),e.blocks[i]=a}}}function HU(e,t){if(e.indexOf(t.actorIds[0])<0){if(t.seq!==1)throw new RangeError(`Seq ${t.seq} is the first change for actor ${t.actorIds[0]}`);e=e.concat([t.actorIds[0]])}let r=[];for(let n of t.actorIds){let i=e.indexOf(n);if(i<0)throw new RangeError(`actorId ${n} is not known to document`);r.push(i)}return{actorIds:e,actorTable:r}}function MU(e,t,r){for(let n of t){let i=r.objectMeta[n],a=null,s=!1;for(;;){let u=a&&Object.keys(i.children[a.parentKey]).length>0;if(e[n]||(e[n]=wc(n,i.type)),a&&u)if(i.type==="list"||i.type==="text"){for(let l of e[n].edits)l.opId&&i.children[a.parentKey][l.opId]&&(s=!0);if(!s){let l=Yd(n),f=Yd(a.parentKey),d={objActor:l.actorId,objCtr:l.counter,keyActor:f.actorId,keyCtr:f.counter,objActorNum:r.actorIds.indexOf(l.actorId),keyActorNum:r.actorIds.indexOf(f.actorId),keyStr:null,insert:!1,objId:n},{visibleCount:m}=v4(r,d);for(let[p,h]of Object.entries(i.children[a.parentKey])){let w=h;h.objectId&&(e[h.objectId]||(e[h.objectId]=wc(h.objectId,h.type)),w=e[h.objectId]);let v={action:"update",index:m,opId:p,value:w};th(e[n].edits,v)}}}else{e[n].props[a.parentKey]||(e[n].props[a.parentKey]={});let l=e[n].props[a.parentKey];for(let[f,d]of Object.entries(i.children[a.parentKey]))l[f]?s=!0:d.objectId?(e[d.objectId]||(e[d.objectId]=wc(d.objectId,d.type)),l[f]=e[d.objectId]):l[f]=d}if(s||!i.parentObj||a&&!u)break;a=i,n=i.parentObj,i=r.objectMeta[n]}}return e}function qU(e,t,r,n,i){let a=new Set(r.heads),s=new Set,u=Wd(r.clock),l=[],f=[];for(let d of t){if(r.changeIndexByHash[d.hash]!==void 0||s.has(d.hash))continue;let m=(u[d.actor]||0)+1,p=!0;for(let h of d.deps){let w=r.changeIndexByHash[h];(w===void 0||w===-1)&&!s.has(h)&&(p=!1)}if(!p)f.push(d);else if(d.seqm)throw new RangeError(`Skipped sequence number ${m} for actor ${d.actor}`);u[d.actor]=d.seq,s.add(d.hash);for(let h of d.deps)a.delete(h);a.add(d.hash),l.push(d)}}if(l.length>0){let d={changes:l,changeIndex:-1,objectIds:n};for(y4(r,d);!d.done;)UU(e,d,r);r.heads=[...a].sort(),r.clock=u}return[l,f]}function p4(e){for(let d of e.blocks[0].columns)d.decoder.reset();let t={},r=null,n=0,i={_root:{objectId:"_root",type:"map",props:{}}},a=null,s=null,u="_root",l=!1,f=0;for(;{docOp:r,blockIndex:n}=R2(e,n),r!==null;){(r[_r]!==a||r[pr]!==s)&&(u=`${r[pr]}@${e.actorIds[r[_r]]}`,a=r[_r],s=r[pr],t={},f=0,l=!1),r[Pn]&&l&&(l=!1,f++),r[bs]===0&&(l=!0),r[ar]>e.maxOp&&(e.maxOp=r[ar]);for(let d=0;de.maxOp&&(e.maxOp=r[vc][d]);O2(i,null,u,r,e,t,f,r[bs])}return i._root}function VU(e){let t=eh(e.changesColumns,Es),r=t[0].decoder,n=t[1].decoder,i=t[5].decoder,a=t[6].decoder;if(t[0].columnId!==Es[0].columnId||Es[0].columnName!=="actor"||t[1].columnId!==Es[1].columnId||Es[1].columnName!=="seq"||t[5].columnId!==Es[5].columnId||Es[5].columnName!=="depsNum"||t[6].columnId!==Es[6].columnId||Es[6].columnName!=="depsIndex")throw new RangeError("unexpected columnId");let s=0,u={},l=[],f=new Set;for(;!r.done;){let p=r.readValue(),h=n.readValue(),w=i.readValue(),v=e.actorIds[p];if(h!==1&&h!==u[v]+1)throw new RangeError(`Expected seq ${u[v]+1}, got ${h} for actor ${v}`);l.push(p),u[v]=h,f.add(s);for(let y=0;ye.actorIds[l[p]]).sort();for(let p of t)p.decoder.reset();let m=t.map(p=>({columnId:p.columnId,encoder:Ac(p.columnId)}));return Ec(m,t,s),{clock:u,headActors:d,encoders:m,numChanges:s}}function KU(e,t,r,n){Gd(e,Es,[r.indexOf(t.actor),t.seq,t.maxOp,t.time,t.message,t.deps.length,t.deps.map(i=>n[i]),t.extraBytes?t.extraBytes.byteLength<<4|B2.BYTES:B2.BYTES,t.extraBytes])}var k2=class e{constructor(t){if(this.maxOp=0,this.haveHashGraph=!1,this.changes=[],this.changeIndexByHash={},this.dependenciesByHash={},this.dependentsByHash={},this.hashesByActor={},this.actorIds=[],this.heads=[],this.clock={},this.queue=[],this.objectMeta={_root:{parentObj:null,parentKey:null,opId:null,type:"map",children:{}}},t){let r=RU(t),{clock:n,headActors:i,encoders:a,numChanges:s}=VU(r);if(this.binaryDoc=t,this.changes=new Array(s),this.actorIds=r.actorIds,this.heads=r.heads,this.clock=n,this.changesEncoders=a,this.extraBytes=r.extraBytes,r.heads.length===1&&i.length===1&&(this.hashesByActor[i[0]]=[],this.hashesByActor[i[0]][n[i[0]]-1]=r.heads[0]),r.heads.length===r.headsIndexes.length)for(let l=0;lrh&&(this.blocks=b4(this.blocks[0]));let u={blocks:this.blocks,actorIds:this.actorIds,objectMeta:this.objectMeta,maxOp:0};this.initPatch=p4(u),this.maxOp=u.maxOp}else this.haveHashGraph=!0,this.changesEncoders=Es.map(r=>({columnId:r.columnId,encoder:Ac(r.columnId)})),this.blocks=[{columns:eh([],l4),bloom:new Uint8Array(m4),numOps:0,lastKey:void 0,numVisible:void 0,lastObjectActor:void 0,lastObjectCtr:void 0,firstVisibleActor:void 0,firstVisibleCtr:void 0,lastVisibleActor:void 0,lastVisibleCtr:void 0}]}clone(){let t=new e;return t.maxOp=this.maxOp,t.haveHashGraph=this.haveHashGraph,t.changes=this.changes.slice(),t.changeIndexByHash=Wd(this.changeIndexByHash),t.dependenciesByHash=Wd(this.dependenciesByHash),t.dependentsByHash=Object.entries(this.dependentsByHash).reduce((r,[n,i])=>(r[n]=i.slice(),r),{}),t.hashesByActor=Object.entries(this.hashesByActor).reduce((r,[n,i])=>(r[n]=i.slice(),r),{}),t.actorIds=this.actorIds,t.heads=this.heads,t.clock=this.clock,t.blocks=this.blocks,t.objectMeta=this.objectMeta,t.queue=this.queue,t}applyChanges(t,r=!1){let n=t.map(d=>{let m=xU(d);return m.buffer=d,m}),i={_root:{objectId:"_root",type:"map",props:{}}},a={maxOp:this.maxOp,changeIndexByHash:this.changeIndexByHash,actorIds:this.actorIds,heads:this.heads,clock:this.clock,blocks:this.blocks.slice(),objectMeta:Object.assign({},this.objectMeta)},s=this.queue.length===0?n:n.concat(this.queue),u=[],l=new Set;for(;;){let[d,m]=qU(i,s,a,l,this.haveHashGraph);s=m;for(let p=0;p0&&(u=u.concat(d)),s.length===0)break;if(d.length===0){if(this.haveHashGraph)break;this.computeHashGraph(),a.changeIndexByHash=this.changeIndexByHash}}MU(i,l,a);for(let d of u){this.changes.push(d.buffer),this.hashesByActor[d.actor]||(this.hashesByActor[d.actor]=[]),this.hashesByActor[d.actor][d.seq-1]=d.hash,this.changeIndexByHash[d.hash]=this.changes.length-1,this.dependenciesByHash[d.hash]=d.deps,this.dependentsByHash[d.hash]=[];for(let m of d.deps)this.dependentsByHash[m]||(this.dependentsByHash[m]=[]),this.dependentsByHash[m].push(d.hash);KU(this.changesEncoders,d,a.actorIds,this.changeIndexByHash)}this.maxOp=a.maxOp,this.actorIds=a.actorIds,this.heads=a.heads,this.clock=a.clock,this.blocks=a.blocks,this.objectMeta=a.objectMeta,this.queue=s,this.binaryDoc=null,this.initPatch=null;let f={maxOp:this.maxOp,clock:this.clock,deps:this.heads,pendingChanges:this.queue.length,diffs:i._root};return r&&n.length===1&&(f.actor=n[0].actor,f.seq=n[0].seq),f}computeHashGraph(){let t=this.save();this.haveHashGraph=!0,this.changes=[],this.changeIndexByHash={},this.dependenciesByHash={},this.dependentsByHash={},this.hashesByActor={},this.clock={};for(let r of $U([t])){let n=BU(r);this.changes.push(n),this.changeIndexByHash[r.hash]=this.changes.length-1,this.dependenciesByHash[r.hash]=r.deps,this.dependentsByHash[r.hash]=[];for(let a of r.deps)this.dependentsByHash[a].push(r.hash);r.seq===1&&(this.hashesByActor[r.actor]=[]),this.hashesByActor[r.actor].push(r.hash);let i=(this.clock[r.actor]||0)+1;if(r.seq!==i)throw new RangeError(`Expected seq ${i}, got seq ${r.seq} from actor ${r.actor}`);this.clock[r.actor]=r.seq}}getChanges(t){if(this.haveHashGraph||this.computeHashGraph(),t.length===0)return this.changes.slice();let r=[],n={},i=[];for(let a of t){n[a]=!0;let s=this.dependentsByHash[a];if(!s)throw new RangeError(`hash not found: ${a}`);r.push(...s)}for(;r.length>0;){let a=r.pop();if(n[a]=!0,i.push(a),!this.dependenciesByHash[a].every(s=>n[s]))break;r.push(...this.dependentsByHash[a])}if(r.length===0&&this.heads.every(a=>n[a]))return i.map(a=>this.changes[this.changeIndexByHash[a]]);for(r=t.slice(),n={};r.length>0;){let a=r.pop();if(!n[a]){let s=this.dependenciesByHash[a];if(!s)throw new RangeError(`hash not found: ${a}`);r.push(...s),n[a]=!0}}return this.changes.filter(a=>!n[PU(a,!0).hash])}getChangesAdded(t){this.haveHashGraph||this.computeHashGraph();let r=this.heads.slice(),n={},i=[];for(;r.length>0;){let a=r.pop();!n[a]&&t.changeIndexByHash[a]===void 0&&(n[a]=!0,i.push(a),r.push(...this.dependenciesByHash[a]))}return i.reverse().map(a=>this.changes[this.changeIndexByHash[a]])}getChangeByHash(t){return this.haveHashGraph||this.computeHashGraph(),this.changes[this.changeIndexByHash[t]]}getMissingDeps(t=[]){this.haveHashGraph||this.computeHashGraph();let r=new Set(t),n=new Set;for(let a of this.queue){n.add(a.hash);for(let s of a.deps)r.add(s)}let i=[];for(let a of r)this.changeIndexByHash[a]===void 0&&!n.has(a)&&i.push(a);return i.sort()}save(){if(this.binaryDoc)return this.binaryDoc;let t=this.changesEncoders.map(n=>({columnId:n.columnId,encoder:Ac(n.columnId)})),r=this.changesEncoders.map(n=>{let i=N2(n.columnId,n.encoder.buffer);return{columnId:n.columnId,decoder:i}});return Ec(t,r,this.changes.length),this.binaryDoc=TU({changesColumns:this.changesEncoders,opsColumns:kU(this.blocks),actorIds:this.actorIds,heads:this.heads,headsIndexes:this.heads.map(n=>this.changeIndexByHash[n]),extraBytes:this.extraBytes}),this.changesEncoders=t,this.binaryDoc}getPatch(){let t={_root:{parentObj:null,parentKey:null,opId:null,type:"map",children:{}}},r={blocks:this.blocks,actorIds:this.actorIds,objectMeta:t,maxOp:0},n=this.initPatch?this.initPatch:p4(r);return{maxOp:this.maxOp,clock:this.clock,deps:this.heads,pendingChanges:this.queue.length,diffs:n}}};C4.exports={MAX_BLOCK_SIZE:rh,BackendDoc:k2,bloomFilterContains:A4}});var F4=he((lG,D4)=>{function zU(e){if(e.frozen)throw new Error("Attempting to use an outdated Automerge document that has already been updated. Please use the latest document state, or call Automerge.clone() if you really need to use this old document state.");return e.state}D4.exports={backendState:zU}});var L2=he((cG,x4)=>{var{encodeChange:GU}=Qf(),{BackendDoc:I4}=_4(),{backendState:ys}=F4();function YU(){return{state:new I4,heads:[]}}function WU(e){return{state:ys(e).clone(),heads:e.heads}}function XU(e){e.state=null,e.frozen=!0}function ZU(e,t){let r=ys(e),n=r.applyChanges(t);return e.frozen=!0,[{state:r,heads:r.heads},n]}function S4(e,t,r){if(e.hashesByActor[t]&&e.hashesByActor[t][r]||!e.haveHashGraph&&(e.computeHashGraph(),e.hashesByActor[t]&&e.hashesByActor[t][r]))return e.hashesByActor[t][r];throw new RangeError(`Unknown change: actorId = ${t}, seq = ${r+1}`)}function JU(e,t){let r=ys(e);if(t.seq<=r.clock[t.actor])throw new RangeError("Change request has already been applied");if(t.seq>1){let s=S4(r,t.actor,t.seq-2);if(!s)throw new RangeError(`Cannot find hash of localChange before seq=${t.seq}`);let u={[s]:!0};for(let l of t.deps)u[l]=!0;t.deps=Object.keys(u).sort()}let n=GU(t),i=r.applyChanges([n],!0);e.frozen=!0;let a=S4(r,t.actor,t.seq-1);return i.deps=i.deps.filter(s=>s!==a),[{state:r,heads:r.heads},i,n]}function QU(e){return ys(e).save()}function ej(e){let t=new I4(e);return{state:t,heads:t.heads}}function tj(e,t){let r=ys(e);return r.applyChanges(t),e.frozen=!0,{state:r,heads:r.heads}}function rj(e){return ys(e).getPatch()}function nj(e){return e.heads}function ij(e){return B4(e,[])}function B4(e,t){if(!Array.isArray(t))throw new TypeError("Pass an array of hashes to Backend.getChanges()");return ys(e).getChanges(t)}function sj(e,t){return ys(t).getChangesAdded(ys(e))}function aj(e,t){return ys(e).getChangeByHash(t)}function uj(e,t=[]){return ys(e).getMissingDeps(t)}x4.exports={init:YU,clone:WU,free:XU,applyChanges:ZU,applyLocalChange:JU,save:QU,load:ej,loadChanges:tj,getPatch:rj,getHeads:nj,getAllChanges:ij,getChanges:B4,getChangesAdded:sj,getChangeByHash:aj,getMissingDeps:uj}});var L4=he((fG,N4)=>{var Cs=L2(),{hexStringToBytes:P4,bytesToHexString:oj,Encoder:H2,Decoder:M2}=A2(),{decodeChangeMeta:Jd}=Qf(),{copyObject:lj}=ws(),$4=32,R4=66,T4=67,cj=10,fj=7,nh=class{constructor(t){if(Array.isArray(t)){this.numEntries=t.length,this.numBitsPerEntry=cj,this.numProbes=fj,this.bits=new Uint8Array(Math.ceil(this.numEntries*this.numBitsPerEntry/8));for(let r of t)this.addHash(r)}else if(t instanceof Uint8Array)if(t.byteLength===0)this.numEntries=0,this.numBitsPerEntry=0,this.numProbes=0,this.bits=t;else{let r=new M2(t);this.numEntries=r.readUint32(),this.numBitsPerEntry=r.readUint32(),this.numProbes=r.readUint32(),this.bits=r.readRawBytes(Math.ceil(this.numEntries*this.numBitsPerEntry/8))}else throw new TypeError("invalid argument")}get bytes(){if(this.numEntries===0)return new Uint8Array(0);let t=new H2;return t.appendUint32(this.numEntries),t.appendUint32(this.numBitsPerEntry),t.appendUint32(this.numProbes),t.appendRawBytes(this.bits),t.buffer}getProbes(t){let r=P4(t),n=8*this.bits.byteLength;if(r.byteLength!==32)throw new RangeError(`Not a 256-bit hash: ${t}`);let i=((r[0]|r[1]<<8|r[2]<<16|r[3]<<24)>>>0)%n,a=((r[4]|r[5]<<8|r[6]<<16|r[7]<<24)>>>0)%n,s=((r[8]|r[9]<<8|r[10]<<16|r[11]<<24)>>>0)%n,u=[i];for(let l=1;l>>3]|=1<<(r&7)}containsHash(t){if(this.numEntries===0)return!1;for(let r of this.getProbes(t))if(!(this.bits[r>>>3]&1<<(r&7)))return!1;return!0}};function Xd(e,t){if(!Array.isArray(t))throw new TypeError("hashes must be an array");e.appendUint32(t.length);for(let r=0;r0&&t[r-1]>=t[r])throw new RangeError("hashes must be sorted");let n=P4(t[r]);if(n.byteLength!==$4)throw new TypeError("heads hashes must be 256 bits");e.appendRawBytes(n)}}function Zd(e){let t=e.readUint32(),r=[];for(let n=0;nJd(i,!0).hash);return{lastSync:t,bloom:new nh(n).bytes}}function gj(e,t,r){if(t.length===0)return r.map(m=>Cs.getChangeByHash(e,m)).filter(m=>m!==void 0);let n={},i=[];for(let m of t){for(let p of m.lastSync)n[p]=!0;i.push(new nh(m.bloom))}let a=Cs.getChanges(e,Object.keys(n)).map(m=>Jd(m,!0)),s={},u={},l={};for(let m of a){s[m.hash]=!0;for(let p of m.deps)u[p]||(u[p]=[]),u[p].push(m.hash);i.every(p=>!p.containsHash(m.hash))&&(l[m.hash]=!0)}let f=Object.keys(l);for(;f.length>0;){let m=f.pop();if(u[m])for(let p of u[m])l[p]||(l[p]=!0,f.push(p))}let d=[];for(let m of r)if(l[m]=!0,!s[m]){let p=Cs.getChangeByHash(e,m);p&&d.push(p)}for(let m of a)l[m.hash]&&d.push(m.change);return d}function k4(){return{sharedHeads:[],lastSentHeads:[],theirHeads:null,theirNeed:null,theirHave:null,sentHashes:{}}}function j2(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function mj(e,t){if(!e)throw new Error("generateSyncMessage called with no Automerge document");if(!t)throw new Error("generateSyncMessage requires a syncState, which can be created with initSyncState()");let{sharedHeads:r,lastSentHeads:n,theirHeads:i,theirNeed:a,theirHave:s,sentHashes:u}=t,l=Cs.getHeads(e),f=Cs.getMissingDeps(e,i||[]),d=[];if((!i||f.every(v=>i.includes(v)))&&(d=[pj(e,r)]),s&&s.length>0&&!s[0].lastSync.every(y=>Cs.getChangeByHash(e,y))){let y={heads:l,need:[],have:[{lastSync:[],bloom:new Uint8Array(0)}],changes:[]};return[t,U2(y)]}let m=Array.isArray(s)&&Array.isArray(a)?gj(e,s,a):[],p=Array.isArray(n)&&j2(l,n),h=Array.isArray(i)&&j2(l,i);if(p&&h&&m.length===0)return[t,null];m=m.filter(v=>!u[Jd(v,!0).hash]);let w={heads:l,have:d,need:f,changes:m};if(m.length>0){u=lj(u);for(let v of m)u[Jd(v,!0).hash]=!0}return t=Object.assign({},t,{lastSentHeads:l,sentHashes:u}),[t,U2(w)]}function vj(e,t,r){let n=t.filter(s=>!e.includes(s)),i=r.filter(s=>t.includes(s));return[...new Set([...n,...i])].sort()}function wj(e,t,r){if(!e)throw new Error("generateSyncMessage called with no Automerge document");if(!t)throw new Error("generateSyncMessage requires a syncState, which can be created with initSyncState()");let{sharedHeads:n,lastSentHeads:i,sentHashes:a}=t,s=null,u=O4(r),l=Cs.getHeads(e);u.changes.length>0&&([e,s]=Cs.applyChanges(e,u.changes),n=vj(l,Cs.getHeads(e),n)),u.changes.length===0&&j2(u.heads,l)&&(i=u.heads);let f=u.heads.filter(m=>Cs.getChangeByHash(e,m));f.length===u.heads.length?(n=u.heads,u.heads.length===0&&(i=[],a=[])):n=[...new Set(f.concat(n))].sort();let d={sharedHeads:n,lastSentHeads:i,theirHave:u.have,theirHeads:u.heads,theirNeed:u.need,sentHashes:a};return[e,d,s]}N4.exports={receiveSyncMessage:wj,generateSyncMessage:mj,encodeSyncMessage:U2,decodeSyncMessage:O4,initSyncState:k4,encodeSyncState:hj,decodeSyncState:dj,BloomFilter:nh}});var j4=he((hG,U4)=>{var{init:Aj,clone:Ej,free:bj,applyChanges:yj,applyLocalChange:Cj,save:_j,load:Dj,loadChanges:Fj,getPatch:Sj,getHeads:Ij,getAllChanges:Bj,getChanges:xj,getChangesAdded:Pj,getChangeByHash:$j,getMissingDeps:Rj}=L2(),{receiveSyncMessage:Tj,generateSyncMessage:Oj,encodeSyncMessage:kj,decodeSyncMessage:Nj,encodeSyncState:Lj,decodeSyncState:Uj,initSyncState:jj}=L4();U4.exports={init:Aj,clone:Ej,free:bj,applyChanges:yj,applyLocalChange:Cj,save:_j,load:Dj,loadChanges:Fj,getPatch:Sj,getHeads:Ij,getAllChanges:Bj,getChanges:xj,getChangesAdded:Pj,getChangeByHash:$j,getMissingDeps:Rj,receiveSyncMessage:Tj,generateSyncMessage:Oj,encodeSyncMessage:kj,decodeSyncMessage:Nj,encodeSyncState:Lj,decodeSyncState:Uj,initSyncState:jj}});var G4=he((dG,V2)=>{var Hj=md(),qr=XC(),{OPTIONS:H4}=Qa(),{encodeChange:Mj,decodeChange:M4}=Qf(),{isObject:q2}=ws(),Ir=j4();function ih(e){if(typeof e=="string")e={actorId:e};else if(typeof e>"u")e={};else if(!q2(e))throw new TypeError(`Unsupported options for init(): ${e}`);return qr.init(Object.assign({backend:Ir},e))}function qj(e,t){let r={message:"Initialization"};return q4(ih(t),r,n=>Object.assign(n,e))}function q4(e,t,r){let[n]=qr.change(e,t,r);return n}function Vj(e,t){let[r]=qr.emptyChange(e,t);return r}function Kj(e,t={}){let r=Ir.clone(qr.getBackendState(e,"clone"));return Qd(ih(t),Ir.getPatch(r),r,[],t)}function zj(e){Ir.free(qr.getBackendState(e,"free"))}function Gj(e,t={}){let r=Ir.load(e);return Qd(ih(t),Ir.getPatch(r),r,[e],t)}function Yj(e){return Ir.save(qr.getBackendState(e,"save"))}function Wj(e,t){let r=qr.getBackendState(e,"merge"),n=qr.getBackendState(t,"merge","second"),i=Ir.getChangesAdded(r,n),[a]=K4(e,i);return a}function Xj(e,t){let r=qr.getBackendState(e,"getChanges"),n=qr.getBackendState(t,"getChanges","second");return Ir.getChanges(n,Ir.getHeads(r))}function V4(e){return Ir.getAllChanges(qr.getBackendState(e,"getAllChanges"))}function Qd(e,t,r,n,i){let a=qr.applyPatch(e,t,r),s=i.patchCallback||e[H4].patchCallback;return s&&s(t,e,a,!1,n),a}function K4(e,t,r={}){let n=qr.getBackendState(e,"applyChanges"),[i,a]=Ir.applyChanges(n,t);return[Qd(e,a,i,t,r),a]}function z4(e,t){if(!q2(e)||!q2(t))return e===t;let r=Object.keys(e).sort(),n=Object.keys(t).sort();if(r.length!==n.length)return!1;for(let i=0;i({get change(){return M4(n)},get snapshot(){let a=Ir.loadChanges(Ir.init(),r.slice(0,i+1));return qr.applyPatch(ih(t),Ir.getPatch(a),a)}}))}function Jj(e,t){let r=qr.getBackendState(e,"generateSyncMessage");return Ir.generateSyncMessage(r,t)}function Qj(e,t,r){let n=qr.getBackendState(e,"receiveSyncMessage"),[i,a,s]=Ir.receiveSyncMessage(n,t,r);if(!s)return[e,a,s];let u=null;return e[H4].patchCallback&&(u=Ir.decodeSyncMessage(r).changes),[Qd(e,s,i,u,{}),a,s]}function eH(){return Ir.initSyncState()}function tH(e){Ir=e}V2.exports={init:ih,from:qj,change:q4,emptyChange:Vj,clone:Kj,free:zj,load:Gj,save:Yj,merge:Wj,getChanges:Xj,getAllChanges:V4,applyChanges:K4,encodeChange:Mj,decodeChange:M4,equals:z4,getHistory:Zj,uuid:Hj,Frontend:qr,setDefaultBackend:tH,generateSyncMessage:Jj,receiveSyncMessage:Qj,initSyncState:eH,get Backend(){return Ir}};for(let e of["getObjectId","getObjectById","getActorId","setActorId","getConflicts","getLastLocalChange","Text","Table","Counter","Observable","Int","Uint","Float64"])V2.exports[e]=qr[e]});var np=he((JG,e3)=>{"use strict";var RH=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},G2=class e extends Error{constructor(t,r,n){super(t),RH(this,e.prototype),this.name="GrammarError",this.location=r,n===void 0&&(n=[]),this.diagnostics=n,this.stage=null,this.problems=[["error",t,r,n]]}toString(){let t=super.toString();this.location&&(t+=` at `,this.location.source!==void 0&&this.location.source!==null&&(t+=`${this.location.source}:`),t+=`${this.location.start.line}:${this.location.start.column}`);for(let r of this.diagnostics)t+=` from `,r.location.source!==void 0&&r.location.source!==null&&(t+=`${r.location.source}:`),t+=`${r.location.start.line}:${r.location.start.column}: ${r.message}`;return t}format(t){let r=t.map(({source:a,text:s})=>({source:a,text:s.split(/\r\n|\n|\r/g)}));function n(a,s,u=""){let l="",f=r.find(({source:m})=>m===a.source),d=a.start;if(f){let m=a.end,p=f.text[d.line-1],w=(d.line===m.line?m.column:p.length+1)-d.column||1;u&&(l+=` note: ${u}`),l+=` --> ${a.source}:${d.line}:${d.column} ${"".padEnd(s)} | ${d.line.toString().padStart(s)} | ${p} ${"".padEnd(s)} | ${"".padEnd(d.column-1)}${"".padEnd(w,"^")}`}else l+=` at ${a.source}:${d.line}:${d.column}`,u&&(l+=`: ${u}`);return l}function i(a,s,u,l=[]){let f;u?f=l.reduce((m,{location:p})=>Math.max(m,p.start.line),u.start.line):f=Math.max.apply(null,l.map(m=>m.location.start.line)),f=f.toString().length;let d=`${a}: ${s}`;u&&(d+=n(u,f));for(let m of l)d+=n(m.location,f,m.message);return d}return this.problems.filter(a=>a[0]!=="info").map(a=>i(...a)).join(` `)}};e3.exports=G2});var ns=he((QG,t3)=>{"use strict";var TH={build(e){function t(s,...u){return e[s.type](s,...u)}function r(){}function n(s,...u){return t(s.expression,...u)}function i(s){return function(u,...l){u[s].forEach(f=>t(f,...l))}}let a={grammar(s,...u){s.topLevelInitializer&&t(s.topLevelInitializer,...u),s.initializer&&t(s.initializer,...u),s.rules.forEach(l=>t(l,...u))},top_level_initializer:r,initializer:r,rule:n,named:n,choice:i("alternatives"),action:n,sequence:i("elements"),labeled:n,text:n,simple_and:n,simple_not:n,optional:n,zero_or_more:n,one_or_more:n,group:n,semantic_and:r,semantic_not:r,rule_ref:r,literal:r,class:r,any:r};return Object.keys(a).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||(e[s]=a[s])}),t}};t3.exports=TH});var Mu=he((eY,n3)=>{"use strict";var OH=ns(),r3={findRule(e,t){for(let r=0;r{"use strict";var kH={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29};i3.exports=kH});var W2=he((rY,s3)=>{"use strict";var NH=ns(),LH=Mu(),UH=np(),oh=1,Ko=0,lh=-1;function ip(e){function t(s){return s.match=Ko}function r(s){return a(s.expression),s.match=oh}function n(s){return s.match=a(s.expression)}function i(s,u){let l=s.length,f=0,d=0;for(let m=0;m0?lh:Ko}let a=NH.build({rule(s){let u,l=0;if(typeof s.match>"u"){s.match=Ko;do if(u=s.match,s.match=a(s.expression),++l>6)throw new UH("Infinity cycle detected when trying to evaluate node match result",s.location);while(u!==s.match)}return s.match},named:n,choice(s){return s.match=i(s.alternatives,!0)},action:n,sequence(s){return s.match=i(s.elements,!1)},labeled:n,text:n,simple_and:n,simple_not(s){return s.match=-a(s.expression)},optional:r,zero_or_more:r,one_or_more:n,group:n,semantic_and:t,semantic_not:t,rule_ref(s){let u=LH.findRule(e,s.name);return s.match=a(u)},literal(s){let u=s.value.length===0?oh:Ko;return s.match=u},class(s){let u=s.parts.length===0?lh:Ko;return s.match=u},any:t});a(e)}ip.ALWAYS_MATCH=oh;ip.SOMETIMES_MATCH=Ko;ip.NEVER_MATCH=lh;s3.exports=ip});var u3=he((nY,a3)=>{"use strict";var jH=Mu(),Pe=Y2(),HH=ns(),{ALWAYS_MATCH:yc,SOMETIMES_MATCH:X2,NEVER_MATCH:Z2}=W2();function MH(e){let t=[],r=[],n=[],i=[];function a(b){let D=t.indexOf(b);return D===-1?t.push(b)-1:D}function s(b){let D={value:b.parts,inverted:b.inverted,ignoreCase:b.ignoreCase},_=JSON.stringify(D),F=r.findIndex(L=>JSON.stringify(L)===_);return F===-1?r.push(D)-1:F}function u(b){let D=JSON.stringify(b),_=n.findIndex(F=>JSON.stringify(F)===D);return _===-1?n.push(b)-1:_}function l(b,D,_){let F={predicate:b,params:D,body:_.code,location:_.codeLocation},L=JSON.stringify(F),N=i.findIndex(S=>JSON.stringify(S)===L);return N===-1?i.push(F)-1:N}function f(b){let D={};return Object.keys(b).forEach(_=>{D[_]=b[_]}),D}function d(b,...D){return b.concat(...D)}function m(b,D,_,F){return b===yc?_:b===Z2?F:D.concat([_.length,F.length],_,F)}function p(b,D){return b.concat([D.length],D)}function h(b,D,_,F){let L=Object.keys(_).map(N=>F-_[N]);return[Pe.CALL,b,D,L.length].concat(L)}function w(b,D,_){let F=b.match|0;return d([Pe.PUSH_CURR_POS],[Pe.SILENT_FAILS_ON],g(b,{sp:_.sp+1,env:f(_.env),action:null}),[Pe.SILENT_FAILS_OFF],m(D?-F:F,[D?Pe.IF_ERROR:Pe.IF_NOT_ERROR],d([Pe.POP],[D?Pe.POP:Pe.POP_CURR_POS],[Pe.PUSH_UNDEFINED]),d([Pe.POP],[D?Pe.POP_CURR_POS:Pe.POP],[Pe.PUSH_FAILED])))}function v(b,D,_){let F=l(!0,Object.keys(_.env),b);return d([Pe.UPDATE_SAVED_POS],h(F,0,_.env,_.sp),m(b.match|0,[Pe.IF],d([Pe.POP],D?[Pe.PUSH_FAILED]:[Pe.PUSH_UNDEFINED]),d([Pe.POP],D?[Pe.PUSH_UNDEFINED]:[Pe.PUSH_FAILED])))}function y(b){return p([Pe.WHILE_NOT_ERROR],d([Pe.APPEND],b))}let g=HH.build({grammar(b){b.rules.forEach(g),b.literals=t,b.classes=r,b.expectations=n,b.functions=i},rule(b){b.bytecode=g(b.expression,{sp:-1,env:{},pluck:[],action:null})},named(b,D){let _=b.match|0,F=_===Z2?null:u({type:"rule",value:b.name});return d([Pe.SILENT_FAILS_ON],g(b.expression,D),[Pe.SILENT_FAILS_OFF],m(_,[Pe.IF_ERROR],[Pe.FAIL,F],[]))},choice(b,D){function _(F,L){let N=F[0].match|0,S=g(F[0],{sp:L.sp,env:f(L.env),action:null});return N===yc?S:d(S,F.length>1?m(X2,[Pe.IF_ERROR],d([Pe.POP],_(F.slice(1),L)),[]):[])}return _(b.alternatives,D)},action(b,D){let _=f(D.env),F=b.expression.type!=="sequence"||b.expression.elements.length===0,L=g(b.expression,{sp:D.sp+(F?1:0),env:_,action:b}),N=b.expression.match|0,S=F&&N!==Z2?l(!1,Object.keys(_),b):null;return F?d([Pe.PUSH_CURR_POS],L,m(N,[Pe.IF_NOT_ERROR],d([Pe.LOAD_SAVED_POS,1],h(S,1,_,D.sp+2)),[]),[Pe.NIP]):L},sequence(b,D){function _(F,L){if(F.length>0){let N=b.elements.length-F.length+1;return d(g(F[0],{sp:L.sp,env:L.env,pluck:L.pluck,action:null}),m(F[0].match|0,[Pe.IF_NOT_ERROR],_(F.slice(1),{sp:L.sp+1,env:L.env,pluck:L.pluck,action:L.action}),d(N>1?[Pe.POP_N,N]:[Pe.POP],[Pe.POP_CURR_POS],[Pe.PUSH_FAILED])))}else{if(L.pluck.length>0)return d([Pe.PLUCK,b.elements.length+1,L.pluck.length],L.pluck.map(N=>L.sp-N));if(L.action){let N=l(!1,Object.keys(L.env),L.action);return d([Pe.LOAD_SAVED_POS,b.elements.length],h(N,b.elements.length+1,L.env,L.sp))}else return d([Pe.WRAP,b.elements.length],[Pe.NIP])}}return d([Pe.PUSH_CURR_POS],_(b.elements,{sp:D.sp+1,env:D.env,pluck:[],action:D.action}))},labeled(b,D){let _=D.env,F=b.label,L=D.sp+1;return F&&(_=f(D.env),D.env[b.label]=L),b.pick&&D.pluck.push(L),g(b.expression,{sp:D.sp,env:_,action:null})},text(b,D){return d([Pe.PUSH_CURR_POS],g(b.expression,{sp:D.sp+1,env:f(D.env),action:null}),m(b.match|0,[Pe.IF_NOT_ERROR],d([Pe.POP],[Pe.TEXT]),[Pe.NIP]))},simple_and(b,D){return w(b.expression,!1,D)},simple_not(b,D){return w(b.expression,!0,D)},optional(b,D){return d(g(b.expression,{sp:D.sp,env:f(D.env),action:null}),m(-(b.expression.match|0),[Pe.IF_ERROR],d([Pe.POP],[Pe.PUSH_NULL]),[]))},zero_or_more(b,D){let _=g(b.expression,{sp:D.sp+1,env:f(D.env),action:null});return d([Pe.PUSH_EMPTY_ARRAY],_,y(_),[Pe.POP])},one_or_more(b,D){let _=g(b.expression,{sp:D.sp+1,env:f(D.env),action:null});return d([Pe.PUSH_EMPTY_ARRAY],_,m(b.expression.match|0,[Pe.IF_NOT_ERROR],d(y(_),[Pe.POP]),d([Pe.POP],[Pe.POP],[Pe.PUSH_FAILED])))},group(b,D){return g(b.expression,{sp:D.sp,env:f(D.env),action:null})},semantic_and(b,D){return v(b,!1,D)},semantic_not(b,D){return v(b,!0,D)},rule_ref(b){return[Pe.RULE,jH.indexOfRule(e,b.name)]},literal(b){if(b.value.length>0){let D=b.match|0,F=D===X2||D===yc&&!b.ignoreCase?a(b.ignoreCase?b.value.toLowerCase():b.value):null,L=D!==yc?u({type:"literal",value:b.value,ignoreCase:b.ignoreCase}):null;return m(D,b.ignoreCase?[Pe.MATCH_STRING_IC,F]:[Pe.MATCH_STRING,F],b.ignoreCase?[Pe.ACCEPT_N,b.value.length]:[Pe.ACCEPT_STRING,F],[Pe.FAIL,L])}return[Pe.PUSH_EMPTY_STRING]},class(b){let D=b.match|0,_=D===X2?s(b):null,F=D!==yc?u({type:"class",value:b.parts,inverted:b.inverted,ignoreCase:b.ignoreCase}):null;return m(D,[Pe.MATCH_CHAR_CLASS,_],[Pe.ACCEPT_N,1],[Pe.FAIL,F])},any(b){let D=b.match|0,_=D!==yc?u({type:"any"}):null;return m(D,[Pe.MATCH_ANY],[Pe.ACCEPT_N,1],[Pe.FAIL,_])}});g(e)}a3.exports=MH});var l3=he((iY,o3)=>{"use strict";var J2=class{constructor(t,r,n){this.sp=-1,this.maxSp=-1,this.varName=r,this.ruleName=t,this.type=n}name(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack underflow: attempt to use a variable '${this.varName}' at an index ${t}`);return this.varName+t}push(t){let r=this.name(++this.sp)+" = "+t+";";return this.sp>this.maxSp&&(this.maxSp=this.sp),r}pop(t){return t!==void 0?(this.sp-=t,Array.from({length:t},(r,n)=>this.name(this.sp+1+n))):this.name(this.sp--)}top(){return this.name(this.sp)}index(t){if(t<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack overflow: attempt to get a variable at a negative index ${t}`);return this.name(this.sp-t)}result(){if(this.maxSp<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack is empty, can't get the result'`);return this.name(0)}defines(){return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(t,r)=>this.name(r)).join(", ")+";"}checkedIf(t,r,n){let i=this.sp;if(r(),n){let a=this.sp;if(this.sp=i,n(),a!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Branches of a condition can't move the stack pointer differently (before: "+i+", after then: "+a+", after else: "+this.sp+").")}}checkedLoop(t,r){let n=this.sp;if(r(),n!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+t+": Body of a loop can't move the stack pointer (before: "+n+", after: "+this.sp+").")}};o3.exports=J2});var Q2=he((sY,c3)=>{"use strict";c3.exports="2.0.1"});var f3=he(sp=>{"use strict";function au(e){return e.charCodeAt(0).toString(16).toUpperCase()}sp.hex=au;function qH(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+au(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+au(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+au(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+au(t))}sp.stringEscape=qH;function VH(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+au(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+au(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+au(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+au(t))}sp.regexpClassEscape=VH});var p3=he(d3=>{var h3="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");d3.encode=function(e){if(0<=e&&e{var KH=p3(),g3=5,m3=1<>>=g3,i>0&&(n|=GH),r+=KH.encode(n);while(i>0);return r}});var up=he(Vu=>{function WH(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}Vu.getArg=WH;var E3=function(){return!("__proto__"in Object.create(null))}();function b3(e){return e}function XH(e){return y3(e)?"$"+e:e}Vu.toSetString=E3?b3:XH;function ZH(e){return y3(e)?e.slice(1):e}Vu.fromSetString=E3?b3:ZH;function y3(e){if(!e)return!1;let t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(let r=t-10;r>=0;r--)if(e.charCodeAt(r)!==36)return!1;return!0}function A3(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function JH(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=A3(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:A3(e.name,t.name)}Vu.compareByGeneratedPositionsInflated=JH;var ev="http:",ch=`${ev}//host`;function C3(e){return t=>{let r=fh(t),n=tv(t),i=new URL(t,n);e(i);let a=i.toString();return r==="absolute"?a:r==="scheme-relative"?a.slice(ev.length):r==="path-absolute"?a.slice(ch.length):rv(n,a)}}function qu(e,t){return new URL(e,t).toString()}function QH(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function tv(e){let t=e.split("..").length-1,r=QH("p",e),n=`${ch}/`;for(let i=0;i0&&!n[n.length-1]&&n.pop();r.length>0&&n.length>0&&r[0]===n[0];)r.shift(),n.shift();return n.map(()=>"..").concat(r).join("/")+t.search+t.hash}var tM=C3(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),ap=C3(e=>{});Vu.normalize=ap;function rM(e,t){let r=fh(t),n=fh(e);if(e=tM(e),r==="absolute")return qu(t,void 0);if(n==="absolute")return qu(t,e);if(r==="scheme-relative")return ap(t);if(n==="scheme-relative")return qu(t,qu(e,ch)).slice(ev.length);if(r==="path-absolute")return ap(t);if(n==="path-absolute")return qu(t,qu(e,ch)).slice(ch.length);let i=tv(t+e),a=qu(t,qu(e,i));return rv(i,a)}Vu.join=rM;function nM(e,t){let r=iM(e,t);return typeof r=="string"?r:ap(t)}Vu.relative=nM;function iM(e,t){if(fh(e)!==fh(t))return null;let n=tv(e+t),i=new URL(e,n),a=new URL(t,n);try{new URL("",a.toString())}catch{return null}return a.protocol!==i.protocol||a.user!==i.user||a.password!==i.password||a.hostname!==i.hostname||a.port!==i.port?null:rv(i,a)}});var D3=he(_3=>{var nv=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){let n=new e;for(let i=0,a=t.length;i=0)return r;throw new Error('"'+t+'" is not in the set.')}at(t){if(t>=0&&t{var F3=up();function sM(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=i||F3.compareByGeneratedPositionsInflated(e,t)<=0}var iv=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){sM(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(F3.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};S3.MappingList=iv});var sv=he(B3=>{var hh=w3(),kr=up(),op=D3().ArraySet,aM=I3().MappingList,lp=class e{constructor(t){t||(t={}),this._file=kr.getArg(t,"file",null),this._sourceRoot=kr.getArg(t,"sourceRoot",null),this._skipValidation=kr.getArg(t,"skipValidation",!1),this._sources=new op,this._names=new op,this._mappings=new aM,this._sourcesContents=null}static fromSourceMap(t){let r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping(function(i){let a={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(a.source=i.source,r!=null&&(a.source=kr.relative(r,a.source)),a.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(a.name=i.name)),n.addMapping(a)}),t.sources.forEach(function(i){let a=i;r!=null&&(a=kr.relative(r,i)),n._sources.has(a)||n._sources.add(a);let s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n}addMapping(t){let r=kr.getArg(t,"generated"),n=kr.getArg(t,"original",null),i=kr.getArg(t,"source",null),a=kr.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,i,a),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:i,name:a})}setSourceContent(t,r){let n=t;this._sourceRoot!=null&&(n=kr.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[kr.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[kr.toSetString(n)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(t,r,n){let i=r;if(r==null){if(t.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);i=t.file}let a=this._sourceRoot;a!=null&&(i=kr.relative(a,i));let s=this._mappings.toArray().length>0?new op:this._sources,u=new op;this._mappings.unsortedForEach(function(l){if(l.source===i&&l.originalLine!=null){let m=t.originalPositionFor({line:l.originalLine,column:l.originalColumn});m.source!=null&&(l.source=m.source,n!=null&&(l.source=kr.join(n,l.source)),a!=null&&(l.source=kr.relative(a,l.source)),l.originalLine=m.line,l.originalColumn=m.column,m.name!=null&&(l.name=m.name))}let f=l.source;f!=null&&!s.has(f)&&s.add(f);let d=l.name;d!=null&&!u.has(d)&&u.add(d)},this),this._sources=s,this._names=u,t.sources.forEach(function(l){let f=t.sourceContentFor(l);f!=null&&(n!=null&&(l=kr.join(n,l)),a!=null&&(l=kr.relative(a,l)),this.setSourceContent(l,f))},this)}_validateMapping(t,r,n,i){if(r&&typeof r.line!="number"&&typeof r.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0&&!r&&!n&&!i)){if(!(t&&"line"in t&&"column"in t&&r&&"line"in r&&"column"in r&&t.line>0&&t.column>=0&&r.line>0&&r.column>=0&&n))throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:i}))}}_serializeMappings(){let t=0,r=1,n=0,i=0,a=0,s=0,u="",l,f,d,m,p=this._mappings.toArray();for(let h=0,w=p.length;h0){if(!kr.compareByGeneratedPositionsInflated(f,p[h-1]))continue;l+=","}l+=hh.encode(f.generatedColumn-t),t=f.generatedColumn,f.source!=null&&(m=this._sources.indexOf(f.source),l+=hh.encode(m-s),s=m,l+=hh.encode(f.originalLine-1-i),i=f.originalLine-1,l+=hh.encode(f.originalColumn-n),n=f.originalColumn,f.name!=null&&(d=this._names.indexOf(f.name),l+=hh.encode(d-a),a=d)),u+=l}return u}_generateSourcesContent(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=kr.relative(r,n));let i=kr.toSetString(n);return Object.prototype.hasOwnProperty.call(this._sourcesContents,i)?this._sourcesContents[i]:null},this)}toJSON(){let t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(t.file=this._file),this._sourceRoot!=null&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t}toString(){return JSON.stringify(this.toJSON())}};lp.prototype._version=3;B3.SourceMapGenerator=lp});var P3=he(x3=>{var uM=sv().SourceMapGenerator,cp=up(),oM=/(\r?\n)/,lM=10,Cc="$$$isSourceNode$$$",av=class e{constructor(t,r,n,i,a){this.children=[],this.sourceContents={},this.line=t??null,this.column=r??null,this.source=n??null,this.name=a??null,this[Cc]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,a=t.split(oM),s=0,u=function(){let h=v(),w=v()||"";return h+w;function v(){return s=0;r--)this.prepend(t[r]);else if(t[Cc]||typeof t=="string")this.children.unshift(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this}walk(t){let r;for(let n=0,i=this.children.length;n0){for(r=[],n=0;n{uv.SourceMapGenerator=sv().SourceMapGenerator;uv.SourceNode=P3().SourceNode});var k3=he((gY,O3)=>{"use strict";var cM=Mu(),kt=Y2(),fM=l3(),hM=Q2(),{stringEscape:Li,regexpClassEscape:ov}=f3(),{SourceNode:is}=$3();function T3(e,t,r){let n=t.start.line,i=t.start.column-1,a=e.split(` `);return a.length===1?new is(n,i,t.source,e,r):new is(null,null,t.source,a.map((s,u)=>new is(n+u,u===0?i:0,t.source,u===a.length-1?s:[s,` `],r)))}function R3(e,t,r,n,i){return r?new is(null,null,r.source,[e,T3(t,r,i),new is(r.end.line,r.end.column-1,r.source,n)]):new is(null,null,null,[e,t,n])}function dM(e,t){function r(v){return v instanceof is?v:v.replace(/^(.+)$/gm," $1")}function n(v){return"peg$c"+v}function i(v){return"peg$r"+v}function a(v){return"peg$e"+v}function s(v){return"peg$f"+v}function u(v){return"peg$parse"+v}function l(){function v(D){return'"'+Li(D)+'"'}function y(D){return"/^["+(D.inverted?"^":"")+D.value.map(_=>Array.isArray(_)?ov(_[0])+"-"+ov(_[1]):ov(_)).join("")+"]/"+(D.ignoreCase?"i":"")}function g(D){switch(D.type){case"rule":return'peg$otherExpectation("'+Li(D.value)+'")';case"literal":return'peg$literalExpectation("'+Li(D.value)+'", '+D.ignoreCase+")";case"class":return"peg$classExpectation(["+D.value.map(F=>Array.isArray(F)?'["'+Li(F[0])+'", "'+Li(F[1])+'"]':'"'+Li(F)+'"').join(", ")+"], "+D.inverted+", "+D.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(D)+")")}}function b(D,_){return R3(` var ${s(_)} = function(${D.params.join(", ")}) {`,D.body,D.location,"};")}return new is(null,null,t.grammarSource,[e.literals.map((D,_)=>" var "+n(_)+" = "+v(D)+";").concat("",e.classes.map((D,_)=>" var "+i(_)+" = "+y(D)+";")).concat("",e.expectations.map((D,_)=>" var "+a(_)+" = "+g(D)+";")).concat("").join(` `),e.functions.map(b)])}function f(v,y){let g=[];return g.push(""),t.trace&&g.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+v+","," location: peg$computeLocation(startPos, startPos)","});",""),t.cache&&(g.push("var key = peg$currPos * "+e.rules.length+" + "+y+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&g.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+v+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+v+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),g.push(" return cached.result;","}","")),g}function d(v,y){let g=[];return t.cache&&g.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+y+" };"),t.trace&&g.push("","if ("+y+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+v+","," result: "+y+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+v+","," location: peg$computeLocation(startPos, startPos)"," });","}"),g.push("","return "+y+";"),g}function m(v){let y=[],g=new fM(v.name,"s","var");function b(_){let F=0,L=_.length,N=[],S;function B(U,G){let H=G+3,K=_[F+H-2],Y=_[F+H-1],ie,_e;g.checkedIf(F,()=>{F+=H,ie=b(_.slice(F,F+K)),F+=K},Y>0?()=>{_e=b(_.slice(F,F+Y)),F+=Y}:null),N.push("if ("+U+") {"),N.push(...ie.map(r)),Y>0&&(N.push("} else {"),N.push(..._e.map(r))),N.push("}")}function O(U){let H=_[F+2-1],K;g.checkedLoop(F,()=>{F+=2,K=b(_.slice(F,F+H)),F+=H}),N.push("while ("+U+") {"),N.push(...K.map(r)),N.push("}")}function P(){let G=_[F+4-1],H=s(_[F+1])+"("+_.slice(F+4,F+4+G).map(K=>g.index(K)).join(", ")+")";g.pop(_[F+2]),N.push(g.push(H)),F+=4+G}for(;Fg.index(K)).join(", ")} ]`,g.pop(_[F+1]),N.push(g.push(S)),F+=H;break}case kt.IF:B(g.top(),0);break;case kt.IF_ERROR:B(g.top()+" === peg$FAILED",0);break;case kt.IF_NOT_ERROR:B(g.top()+" !== peg$FAILED",0);break;case kt.WHILE_NOT_ERROR:O(g.top()+" !== peg$FAILED");break;case kt.MATCH_ANY:B("input.length > peg$currPos",0);break;case kt.MATCH_STRING:B(e.literals[_[F+1]].length>1?"input.substr(peg$currPos, "+e.literals[_[F+1]].length+") === "+n(_[F+1]):"input.charCodeAt(peg$currPos) === "+e.literals[_[F+1]].charCodeAt(0),1);break;case kt.MATCH_STRING_IC:B("input.substr(peg$currPos, "+e.literals[_[F+1]].length+").toLowerCase() === "+n(_[F+1]),1);break;case kt.MATCH_CHAR_CLASS:B(i(_[F+1])+".test(input.charAt(peg$currPos))",1);break;case kt.ACCEPT_N:N.push(g.push(_[F+1]>1?"input.substr(peg$currPos, "+_[F+1]+")":"input.charAt(peg$currPos)")),N.push(_[F+1]>1?"peg$currPos += "+_[F+1]+";":"peg$currPos++;"),F+=2;break;case kt.ACCEPT_STRING:N.push(g.push(n(_[F+1]))),N.push(e.literals[_[F+1]].length>1?"peg$currPos += "+e.literals[_[F+1]].length+";":"peg$currPos++;"),F+=2;break;case kt.FAIL:N.push(g.push("peg$FAILED")),N.push("if (peg$silentFails === 0) { peg$fail("+a(_[F+1])+"); }"),F+=2;break;case kt.LOAD_SAVED_POS:N.push("peg$savedPos = "+g.index(_[F+1])+";"),F+=2;break;case kt.UPDATE_SAVED_POS:N.push("peg$savedPos = peg$currPos;"),F++;break;case kt.CALL:P();break;case kt.RULE:N.push(g.push(u(e.rules[_[F+1]].name)+"()")),F+=2;break;case kt.SILENT_FAILS_ON:N.push("peg$silentFails++;"),F++;break;case kt.SILENT_FAILS_OFF:N.push("peg$silentFails--;"),F++;break;default:throw new Error("Invalid opcode: "+_[F]+".")}return N}let D=b(v.bytecode);return y.push(R3(" function ",u(v.name),v.nameLocation,`() { `,v.name)),t.trace&&y.push(" var startPos = peg$currPos;"),y.push(r(g.defines())),y.push(...f('"'+Li(v.name)+'"',cM.indexOfRule(e,v.name)).map(r)),y.push(...D.map(r)),y.push(...d('"'+Li(v.name)+'"',g.result()).map(r)),y.push("}"),y}function p(v){return v.codeLocation?T3(v.code,v.codeLocation,"$"+v.type):v.code}function h(){let v=[];e.topLevelInitializer&&(v.push(p(e.topLevelInitializer)),v.push("")),v.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var loc = this.location.source + ":" + s.line + ":" + s.column;'," if (src) {"," var e = this.location.end;",` var filler = peg$padEnd("", s.line.toString().length, ' ');`," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --> " + loc + "\\n"',' + filler + " |\\n"',' + s.line + " | " + line + "\\n"',` + filler + " | " + peg$padEnd("", s.column - 1, ' ')`,' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),t.trace&&v.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");let y="{ "+t.allowedStartRules.map(b=>b+": "+u(b)).join(", ")+" }",g=u(t.allowedStartRules[0]);return v.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+y+";"," var peg$startRuleFunction = "+g+";","",l(),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),t.cache&&v.push(" var peg$resultsCache = {};",""),t.trace&&v.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),v.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",` throw new Error("Can't start parsing from rule \\"" + options.startRule + "\\".");`," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," p = pos - 1;"," while (!peg$posDetailsCache[p]) {"," p--;"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," return {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach(b=>{v.push(...m(b).map(r)),v.push("")}),e.initializer&&(v.push(p(e.initializer)),v.push("")),v.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new is(null,null,t.grammarSource,v.map(b=>b instanceof is?b:b+` `))}function w(v){function y(){return[`// Generated by Peggy ${hM}.`,"//","// https://peggyjs.org/"]}function g(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(` `):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(` `)}let D={bare(){return[...y(),"(function() {",' "use strict";',"",v,"",r("return "+g()+";"),"})()"]},commonjs(){let _=Object.keys(t.dependencies),F=y();return F.push("",'"use strict";',""),_.length>0&&(_.forEach(L=>{F.push("var "+L+' = require("'+Li(t.dependencies[L])+'");')}),F.push("")),F.push(v,"","module.exports = "+g()+";"),F},es(){let _=Object.keys(t.dependencies),F=y();return F.push(""),_.length>0&&(_.forEach(L=>{F.push("import "+L+' from "'+Li(t.dependencies[L])+'";')}),F.push("")),F.push(v,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),F},amd(){let _=Object.keys(t.dependencies),L="["+_.map(S=>t.dependencies[S]).map(S=>'"'+Li(S)+'"').join(", ")+"]",N=_.join(", ");return[...y(),"define("+L+", function("+N+") {",' "use strict";',"",v,"",r("return "+g()+";"),"});"]},globals(){return[...y(),"(function(root) {",' "use strict";',"",v,"",r("root."+t.exportVar+" = "+g()+";"),"})(this);"]},umd(){let _=Object.keys(t.dependencies),F=_.map(O=>t.dependencies[O]),L="["+F.map(O=>'"'+Li(O)+'"').join(", ")+"]",N=F.map(O=>'require("'+Li(O)+'")').join(", "),S=_.join(", "),B=y();return B.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+L+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+N+");"),t.exportVar!==null&&B.push(" } else {"," root."+t.exportVar+" = factory();"),B.push(" }","})(this, function("+S+") {",' "use strict";',"",v,"",r("return "+g()+";"),"});"),B}}[t.format]();return new is(null,null,t.grammarSource,D.map(_=>_ instanceof is?_:_+` `))}e.code=w(h())}O3.exports=dM});var L3=he((mY,N3)=>{"use strict";var pM=Mu(),gM=ns();function mM(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,u,l){gM.build({rule_ref(d){d.name===u&&(d.name=l,r.info(`Proxy rule "${u}" replaced by the rule "${l}"`,d.location,[{message:"This rule will be used",location:pM.findRule(s,l).nameLocation}]))}})(s)}let a=[];e.rules.forEach((s,u)=>{n(s)&&(i(e,s.name,s.expression.name),t.allowedStartRules.indexOf(s.name)===-1&&a.push(u))}),a.reverse(),a.forEach(s=>{e.rules.splice(s,1)})}N3.exports=mM});var j3=he((vY,U3)=>{"use strict";var vM=ns();function wM(e,t,r){function n(s){let u={};return Object.keys(s).forEach(l=>{u[l]=s[l]}),u}function i(s,u){a(s.expression,n(u))}let a=vM.build({rule(s){a(s.expression,{})},choice(s,u){s.alternatives.forEach(l=>{a(l,n(u))})},action:i,labeled(s,u){let l=s.label;l&&Object.prototype.hasOwnProperty.call(u,l)&&r.error(`Label "${s.label}" is already defined`,s.labelLocation,[{message:"Original label location",location:u[l]}]),a(s.expression,u),u[s.label]=s.labelLocation},text:i,simple_and:i,simple_not:i,optional:i,zero_or_more:i,one_or_more:i,group:i});a(e)}U3.exports=wM});var M3=he((wY,H3)=>{"use strict";var AM=ns();function EM(e,t,r){let n={};AM.build({rule(a){if(Object.prototype.hasOwnProperty.call(n,a.name)){r.error(`Rule "${a.name}" is already defined`,a.nameLocation,[{message:"Original rule location",location:n[a.name]}]);return}n[a.name]=a.nameLocation}})(e)}H3.exports=EM});var K3=he((AY,V3)=>{"use strict";var q3=Mu(),bM=ns();function yM(e,t,r){let n=[],i=[],a=bM.build({rule(s){n.push(s.name),a(s.expression),n.pop()},sequence(s){s.elements.every(u=>(a(u),!q3.alwaysConsumesOnSuccess(e,u)))},rule_ref(s){i.push(s);let u=q3.findRule(e,s.name);if(n.indexOf(s.name)!==-1){n.push(s.name),r.error("Possible infinite loop when parsing (left recursion: "+n.join(" -> ")+")",u.nameLocation,i.map((l,f,d)=>({message:f+1!==d.length?`Step ${f+1}: call of the rule "${l.name}" without input consumption`:`Step ${f+1}: call itself without input consumption - left recursion`,location:l.location})));return}u&&a(u),i.pop()}});a(e)}V3.exports=yM});var Y3=he((EY,G3)=>{"use strict";var z3=Mu(),CM=ns();function _M(e,t,r){CM.build({zero_or_more(i){z3.alwaysConsumesOnSuccess(e,i.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)},one_or_more(i){z3.alwaysConsumesOnSuccess(e,i.expression)||r.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",i.location)}})(e)}G3.exports=_M});var X3=he((bY,W3)=>{"use strict";var DM=Mu(),FM=ns();function SM(e,t,r){FM.build({rule_ref(i){DM.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}W3.exports=SM});var J3=he((yY,Z3)=>{"use strict";var IM=ns();function BM(e,t,r){let n=IM.build({action(i){n(i.expression,i)},labeled(i,a){i.pick&&a&&r.error('"@" cannot be used with an action block',i.labelLocation,[{message:"Action block location",location:a.codeLocation}]),n(i.expression)}});n(e)}Z3.exports=BM});var eD=he((CY,Q3)=>{"use strict";var xM=np(),lv=class{constructor(t){t=typeof t<"u"?t:{},typeof t.error=="function"&&(this.error=t.error),typeof t.warning=="function"&&(this.warning=t.warning),typeof t.info=="function"&&(this.info=t.info)}error(){}warning(){}info(){}},cv=class{constructor(t){this._callbacks=new lv(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new xM(...t),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(["error",...t]),this._callbacks.error(this.stage,...t)}warning(...t){this.problems.push(["warning",...t]),this._callbacks.warning(this.stage,...t)}info(...t){this.problems.push(["info",...t]),this._callbacks.info(this.stage,...t)}checkErrors(){if(this.errors!==0)throw this._firstError}};Q3.exports=cv});var tD=he((exports,module)=>{"use strict";var generateBytecode=u3(),generateJS=k3(),inferenceMatchResult=W2(),removeProxyRules=L3(),reportDuplicateLabels=j3(),reportDuplicateRules=M3(),reportInfiniteRecursion=K3(),reportInfiniteRepetition=Y3(),reportUndefinedRules=X3(),reportIncorrectPlucking=J3(),Session=eD(),visitor=ns();function processOptions(e,t){let r={};return Object.keys(e).forEach(n=>{r[n]=e[n]}),Object.keys(t).forEach(n=>{Object.prototype.hasOwnProperty.call(r,n)||(r[n]=t[n])}),r}var compiler={visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile(ast,passes,options){if(options=options!==void 0?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(options.allowedStartRules.length===0)throw new Error("Must have at least one start rule");let allRules=ast.rules.map(e=>e.name);for(let e of options.allowedStartRules)if(allRules.indexOf(e)===-1)throw new Error(`Unknown start rule "${e}"`);let session=new Session(options);switch(Object.keys(passes).forEach(e=>{session.stage=e,session.info(`Process stage ${e}`),passes[e].forEach(t=>{session.info(`Process pass ${e}.${t.name}`),t(ast,options,session)}),session.checkErrors()}),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;default:throw new Error("Invalid output format: "+options.output+".")}}};module.exports=compiler});var nD=he((_Y,rD)=>{"use strict";var PM={$:"text","&":"simple_and","!":"simple_not"},$M={"?":"optional","*":"zero_or_more","+":"one_or_more"},RM={"&":"semantic_and","!":"semantic_not"};function TM(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function Ku(e,t,r,n){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Ku.prototype),i.expected=t,i.found=r,i.location=n,i.name="SyntaxError",i}TM(Ku,Error);function fv(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}Ku.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n `+a+` `+u+` | `+i.line+" | "+l+` `+u+" | "+fv("",i.column-1," ")+fv("",d,"^")}else t+=` at `+a}return t};Ku.buildMessage=function(e,t){var r={literal:function(f){return'"'+i(f.text)+'"'},class:function(f){var d=f.parts.map(function(m){return Array.isArray(m)?a(m[0])+"-"+a(m[1]):a(m)});return"["+(f.inverted?"^":"")+d.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(f){return f.description}};function n(f){return f.charCodeAt(0).toString(16).toUpperCase()}function i(f){return f.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function a(f){return f.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function s(f){return r[f.type](f)}function u(f){var d=f.map(s),m,p;if(d.sort(),d.length>0){for(m=1,p=1;m0?{type:"choice",alternatives:[C].concat(j),location:lr()}:C},Mi=function(C,j){return j!==null?{type:"action",expression:C,code:j[0],codeLocation:j[1],location:lr()}:C},to=function(C,j){return j.length>0||C.type==="labeled"&&C.pick?{type:"sequence",elements:[C].concat(j),location:lr()}:C},dp=function(C,j,X){return X.type.startsWith("semantic_")&&Ic('"@" cannot be used on a semantic predicate',C),{type:"labeled",label:j!==null?j[0]:null,labelLocation:j!==null?j[1]:C,pick:!0,expression:X,location:lr()}},pp=function(C,j){return{type:"labeled",label:C[0],labelLocation:C[1],expression:j,location:lr()}},Zt=function(){return lr()},Gt=function(C){return ol.indexOf(C[0])>=0&&Ic(`Label can't be a reserved word "${C[0]}"`,C[1]),C},gp=function(C,j){return{type:PM[C],expression:j,location:lr()}},mp=function(C,j){return{type:$M[j],expression:C,location:lr()}},vp=function(C){return C.type==="labeled"||C.type==="sequence"?{type:"group",expression:C,location:lr()}:C},wp=function(C){return{type:"rule_ref",name:C[0],location:lr()}},Ap=function(C,j){return{type:RM[C],code:j[0],codeLocation:j[1],location:lr()}},Ep=function(C,j){return[C+j.join(""),lr()]},gh=function(C,j){return{type:"literal",value:C,ignoreCase:j!==null,location:lr()}},bp=function(C){return C.join("")},Pr=function(C){return C.join("")},Dc=function(C,j,X){return{type:"class",parts:j.filter(z=>z!==""),inverted:C!==null,ignoreCase:X!==null,location:lr()}},va=function(C,j){return C.charCodeAt(0)>j.charCodeAt(0)&&Ic("Invalid character range: "+Sc()+"."),[C,j]},mh=function(){return""},Fc=function(){return"\0"},Qn=function(){return"\b"},vh=function(){return"\f"},wh=function(){return` `},Ah=function(){return"\r"},Eh=function(){return" "},bh=function(){return"\v"},yh=function(C){return String.fromCharCode(parseInt(C,16))},Nn=function(C){return String.fromCharCode(parseInt(C,16))},yp=function(){return{type:"any",location:lr()}},ei=function(C){return[C,lr()]},x=0,it=0,bi=[{line:1,column:1}],Ln=0,ro=[],te=0,yi;if("startRule"in t){if(!(t.startRule in i))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');a=i[t.startRule]}function Sc(){return e.substring(it,x)}function _v(){return it}function Ch(){return{source:n,start:it,end:x}}function lr(){return wa(it,x)}function Dv(C,j){throw j=j!==void 0?j:wa(it,x),Dh([qi(C)],e.substring(it,x),j)}function Ic(C,j){throw j=j!==void 0?j:wa(it,x),_h(C,j)}function Ve(C,j){return{type:"literal",text:C,ignoreCase:j}}function $r(C,j,X){return{type:"class",parts:C,inverted:j,ignoreCase:X}}function gu(){return{type:"any"}}function Cp(){return{type:"end"}}function qi(C){return{type:"other",description:C}}function Bc(C){var j=bi[C],X;if(j)return j;for(X=C-1;!bi[X];)X--;for(j=bi[X],j={line:j.line,column:j.column};XLn&&(Ln=x,ro=[]),ro.push(C))}function _h(C,j){return new Ku(C,null,null,j)}function Dh(C,j,X){return new Ku(Ku.buildMessage(C,j),C,j,X)}function Xo(){var C,j,X,z,ae,le,zt,Er;if(C=x,j=Tt(),X=x,z=xc(),z!==r?(ae=Tt(),X=z):(x=X,X=r),X===r&&(X=null),z=x,ae=_p(),ae!==r?(le=Tt(),z=ae):(x=z,z=r),z===r&&(z=null),ae=[],le=x,zt=Pc(),zt!==r?(Er=Tt(),le=zt):(x=le,le=r),le!==r)for(;le!==r;)ae.push(le),le=x,zt=Pc(),zt!==r?(Er=Tt(),le=zt):(x=le,le=r);else ae=r;return ae!==r?(it=C,C=Ei(X,z,ae)):(x=C,C=r),C}function xc(){var C,j,X,z,ae;return C=x,e.charCodeAt(x)===123?(j=s,x++):(j=r,te===0&&me(Vr)),j!==r?(X=Bt(),X!==r?(e.charCodeAt(x)===125?(z=u,x++):(z=r,te===0&&me(ss)),z!==r?(ae=ya(),ae!==r?(it=C,C=du(X)):(x=C,C=r)):(x=C,C=r)):(x=C,C=r)):(x=C,C=r),C}function _p(){var C,j,X;return C=x,j=Bt(),j!==r?(X=ya(),X!==r?(it=C,C=kn(j)):(x=C,C=r)):(x=C,C=r),C}function Pc(){var C,j,X,z,ae,le,zt,Er;return C=x,j=Qo(),j!==r?(X=Tt(),z=x,ae=Vi(),ae!==r?(le=Tt(),z=ae):(x=z,z=r),z===r&&(z=null),e.charCodeAt(x)===61?(ae=l,x++):(ae=r,te===0&&me(ou)),ae!==r?(le=Tt(),zt=An(),zt!==r?(Er=ya(),Er!==r?(it=C,C=ln(j,z,zt)):(x=C,C=r)):(x=C,C=r)):(x=C,C=r)):(x=C,C=r),C}function An(){var C,j,X,z,ae,le,zt,Er;if(C=x,j=no(),j!==r){for(X=[],z=x,ae=Tt(),e.charCodeAt(x)===47?(le=f,x++):(le=r,te===0&&me(Ds)),le!==r?(zt=Tt(),Er=no(),Er!==r?z=Er:(x=z,z=r)):(x=z,z=r);z!==r;)X.push(z),z=x,ae=Tt(),e.charCodeAt(x)===47?(le=f,x++):(le=r,te===0&&me(Ds)),le!==r?(zt=Tt(),Er=no(),Er!==r?z=Er:(x=z,z=r)):(x=z,z=r);it=C,C=pu(j,X)}else x=C,C=r;return C}function no(){var C,j,X,z,ae;return C=x,j=io(),j!==r?(X=x,z=Tt(),ae=Bt(),ae!==r?X=ae:(x=X,X=r),X===r&&(X=null),it=C,C=Mi(j,X)):(x=C,C=r),C}function io(){var C,j,X,z,ae,le;if(C=x,j=Zo(),j!==r){for(X=[],z=x,ae=Tt(),le=Zo(),le!==r?z=le:(x=z,z=r);z!==r;)X.push(z),z=x,ae=Tt(),le=Zo(),le!==r?z=le:(x=z,z=r);it=C,C=to(j,X)}else x=C,C=r;return C}function Zo(){var C,j,X,z;return C=x,j=Fh(),j!==r?(X=Sh(),X===r&&(X=null),z=$c(),z!==r?(it=C,C=dp(j,X,z)):(x=C,C=r)):(x=C,C=r),C===r&&(C=x,j=Sh(),j!==r?(X=Tt(),z=$c(),z!==r?(it=C,C=pp(j,z)):(x=C,C=r)):(x=C,C=r),C===r&&(C=$c())),C}function Fh(){var C,j;return C=x,e.charCodeAt(x)===64?(j=d,x++):(j=r,te===0&&me(lu)),j!==r&&(it=C,j=Zt()),C=j,C}function Sh(){var C,j,X,z;return C=x,j=Qo(),j!==r?(X=Tt(),e.charCodeAt(x)===58?(z=m,x++):(z=r,te===0&&me(Fs)),z!==r?(it=C,C=Gt(j)):(x=C,C=r)):(x=C,C=r),C}function $c(){var C,j,X,z;return C=x,j=Dp(),j!==r?(X=Tt(),z=Ih(),z!==r?(it=C,C=gp(j,z)):(x=C,C=r)):(x=C,C=r),C===r&&(C=Ih()),C}function Dp(){var C;return e.charCodeAt(x)===36?(C=p,x++):(C=r,te===0&&me(as)),C===r&&(e.charCodeAt(x)===38?(C=h,x++):(C=r,te===0&&me($t)),C===r&&(e.charCodeAt(x)===33?(C=w,x++):(C=r,te===0&&me(Wn)))),C}function Ih(){var C,j,X,z;return C=x,j=Aa(),j!==r?(X=Tt(),z=Fp(),z!==r?(it=C,C=mp(j,z)):(x=C,C=r)):(x=C,C=r),C===r&&(C=Aa()),C}function Fp(){var C;return e.charCodeAt(x)===63?(C=v,x++):(C=r,te===0&&me(cu)),C===r&&(e.charCodeAt(x)===42?(C=y,x++):(C=r,te===0&&me(fu)),C===r&&(e.charCodeAt(x)===43?(C=g,x++):(C=r,te===0&&me(hu)))),C}function Aa(){var C,j,X,z,ae,le;return C=$p(),C===r&&(C=oe(),C===r&&(C=rl(),C===r&&(C=Sp(),C===r&&(C=Ip(),C===r&&(C=x,e.charCodeAt(x)===40?(j=b,x++):(j=r,te===0&&me(Ss)),j!==r?(X=Tt(),z=An(),z!==r?(ae=Tt(),e.charCodeAt(x)===41?(le=D,x++):(le=r,te===0&&me(zu)),le!==r?(it=C,C=vp(z)):(x=C,C=r)):(x=C,C=r)):(x=C,C=r)))))),C}function Sp(){var C,j,X,z,ae,le,zt,Er;return C=x,j=Qo(),j!==r?(X=x,te++,z=x,ae=Tt(),le=x,zt=Vi(),zt!==r?(Er=Tt(),zt=[zt,Er],le=zt):(x=le,le=r),le===r&&(le=null),e.charCodeAt(x)===61?(zt=l,x++):(zt=r,te===0&&me(ou)),zt!==r?(ae=[ae,le,zt],z=ae):(x=z,z=r),te--,z===r?X=void 0:(x=X,X=r),X!==r?(it=C,C=wp(j)):(x=C,C=r)):(x=C,C=r),C}function Ip(){var C,j,X,z;return C=x,j=Rc(),j!==r?(X=Tt(),z=Bt(),z!==r?(it=C,C=Ap(j,z)):(x=C,C=r)):(x=C,C=r),C}function Rc(){var C;return e.charCodeAt(x)===38?(C=h,x++):(C=r,te===0&&me($t)),C===r&&(e.charCodeAt(x)===33?(C=w,x++):(C=r,te===0&&me(Wn))),C}function cn(){var C;return e.length>x?(C=e.charAt(x),x++):(C=r,te===0&&me(Is)),C}function Ci(){var C,j;return te++,e.charCodeAt(x)===9?(C=_,x++):(C=r,te===0&&me(ma)),C===r&&(e.charCodeAt(x)===11?(C=F,x++):(C=r,te===0&&me(re)),C===r&&(e.charCodeAt(x)===12?(C=L,x++):(C=r,te===0&&me(ce)),C===r&&(e.charCodeAt(x)===32?(C=N,x++):(C=r,te===0&&me(ke)),C===r&&(e.charCodeAt(x)===160?(C=S,x++):(C=r,te===0&&me(Te)),C===r&&(e.charCodeAt(x)===65279?(C=B,x++):(C=r,te===0&&me(Me)),C===r&&(C=Oh())))))),te--,C===r&&(j=r,te===0&&me(Gu)),C}function _i(){var C;return pt.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(nt)),C}function Jo(){var C,j;return te++,e.charCodeAt(x)===10?(C=O,x++):(C=r,te===0&&me(Dr)),C===r&&(e.substr(x,2)===P?(C=P,x+=2):(C=r,te===0&&me(Nt)),C===r&&(e.charCodeAt(x)===13?(C=U,x++):(C=r,te===0&&me(Xn)),C===r&&(e.charCodeAt(x)===8232?(C=G,x++):(C=r,te===0&&me(Hi)),C===r&&(e.charCodeAt(x)===8233?(C=H,x++):(C=r,te===0&&me(sn)))))),te--,C===r&&(j=r,te===0&&me(ot)),C}function Bh(){var C,j;return te++,C=Bp(),C===r&&(C=ti()),te--,C===r&&(j=r,te===0&&me(wn)),C}function Bp(){var C,j,X,z,ae,le;if(C=x,e.substr(x,2)===K?(j=K,x+=2):(j=r,te===0&&me(vr)),j!==r){for(X=[],z=x,ae=x,te++,e.substr(x,2)===Y?(le=Y,x+=2):(le=r,te===0&&me(an)),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);z!==r;)X.push(z),z=x,ae=x,te++,e.substr(x,2)===Y?(le=Y,x+=2):(le=r,te===0&&me(an)),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);e.substr(x,2)===Y?(z=Y,x+=2):(z=r,te===0&&me(an)),z!==r?(j=[j,X,z],C=j):(x=C,C=r)}else x=C,C=r;return C}function Ea(){var C,j,X,z,ae,le;if(C=x,e.substr(x,2)===K?(j=K,x+=2):(j=r,te===0&&me(vr)),j!==r){for(X=[],z=x,ae=x,te++,e.substr(x,2)===Y?(le=Y,x+=2):(le=r,te===0&&me(an)),le===r&&(le=_i()),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);z!==r;)X.push(z),z=x,ae=x,te++,e.substr(x,2)===Y?(le=Y,x+=2):(le=r,te===0&&me(an)),le===r&&(le=_i()),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);e.substr(x,2)===Y?(z=Y,x+=2):(z=r,te===0&&me(an)),z!==r?(j=[j,X,z],C=j):(x=C,C=r)}else x=C,C=r;return C}function ti(){var C,j,X,z,ae,le;if(C=x,e.substr(x,2)===ie?(j=ie,x+=2):(j=r,te===0&&me(Nr)),j!==r){for(X=[],z=x,ae=x,te++,le=_i(),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);z!==r;)X.push(z),z=x,ae=x,te++,le=_i(),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);j=[j,X],C=j}else x=C,C=r;return C}function Qo(){var C,j,X,z;if(te++,C=x,j=xh(),j!==r){for(X=[],z=Ph();z!==r;)X.push(z),z=Ph();it=C,C=Ep(j,X)}else x=C,C=r;return te--,C===r&&(j=r,te===0&&me(Yu)),C}function xh(){var C,j,X;return C=xp(),C===r&&(e.charCodeAt(x)===36?(C=p,x++):(C=r,te===0&&me(as)),C===r&&(e.charCodeAt(x)===95?(C=_e,x++):(C=r,te===0&&me(Bs)),C===r&&(C=x,e.charCodeAt(x)===92?(j=Fe,x++):(j=r,te===0&&me($n)),j!==r?(X=$h(),X!==r?C=X:(x=C,C=r)):(x=C,C=r)))),C}function Ph(){var C;return C=xh(),C===r&&(C=Pp(),C===r&&(C=Rh(),C===r&&(C=Th(),C===r&&(e.charCodeAt(x)===8204?(C=$e,x++):(C=r,te===0&&me(xt)),C===r&&(e.charCodeAt(x)===8205?(C=et,x++):(C=r,te===0&&me(wr))))))),C}function xp(){var C;return C=sl(),C===r&&(C=il(),C===r&&(C=Np(),C===r&&(C=Op(),C===r&&(C=kp(),C===r&&(C=ul()))))),C}function Pp(){var C;return C=al(),C===r&&(C=Ps()),C}function $p(){var C,j,X;return te++,C=x,j=Vi(),j!==r?(e.charCodeAt(x)===105?(X=Qe,x++):(X=r,te===0&&me(nr)),X===r&&(X=null),it=C,C=gh(j,X)):(x=C,C=r),te--,C===r&&(j=r,te===0&&me(Xe)),C}function Vi(){var C,j,X,z;if(te++,C=x,e.charCodeAt(x)===34?(j=at,x++):(j=r,te===0&&me(ir)),j!==r){for(X=[],z=ne();z!==r;)X.push(z),z=ne();e.charCodeAt(x)===34?(z=at,x++):(z=r,te===0&&me(ir)),z!==r?(it=C,C=bp(X)):(x=C,C=r)}else x=C,C=r;if(C===r)if(C=x,e.charCodeAt(x)===39?(j=ut,x++):(j=r,te===0&&me(Lt)),j!==r){for(X=[],z=fe();z!==r;)X.push(z),z=fe();e.charCodeAt(x)===39?(z=ut,x++):(z=r,te===0&&me(Lt)),z!==r?(it=C,C=Pr(X)):(x=C,C=r)}else x=C,C=r;return te--,C===r&&(j=r,te===0&&me(Kr)),C}function ne(){var C,j,X,z;return C=x,j=x,X=x,te++,e.charCodeAt(x)===34?(z=at,x++):(z=r,te===0&&me(ir)),z===r&&(e.charCodeAt(x)===92?(z=Fe,x++):(z=r,te===0&&me($n)),z===r&&(z=_i())),te--,z===r?X=void 0:(x=X,X=r),X!==r?(z=cn(),z!==r?(X=[X,z],j=X):(x=j,j=r)):(x=j,j=r),j!==r?C=e.substring(C,x):C=j,C===r&&(C=x,e.charCodeAt(x)===92?(j=Fe,x++):(j=r,te===0&&me($n)),j!==r?(X=cr(),X!==r?C=X:(x=C,C=r)):(x=C,C=r),C===r&&(C=_t())),C}function fe(){var C,j,X,z;return C=x,j=x,X=x,te++,e.charCodeAt(x)===39?(z=ut,x++):(z=r,te===0&&me(Lt)),z===r&&(e.charCodeAt(x)===92?(z=Fe,x++):(z=r,te===0&&me($n)),z===r&&(z=_i())),te--,z===r?X=void 0:(x=X,X=r),X!==r?(z=cn(),z!==r?(X=[X,z],j=X):(x=j,j=r)):(x=j,j=r),j!==r?C=e.substring(C,x):C=j,C===r&&(C=x,e.charCodeAt(x)===92?(j=Fe,x++):(j=r,te===0&&me($n)),j!==r?(X=cr(),X!==r?C=X:(x=C,C=r)):(x=C,C=r),C===r&&(C=_t())),C}function oe(){var C,j,X,z,ae,le;if(te++,C=x,e.charCodeAt(x)===91?(j=Qr,x++):(j=r,te===0&&me(Zn)),j!==r){for(e.charCodeAt(x)===94?(X=Qt,x++):(X=r,te===0&&me(Jn)),X===r&&(X=null),z=[],ae=Oe(),ae===r&&(ae=Ze());ae!==r;)z.push(ae),ae=Oe(),ae===r&&(ae=Ze());e.charCodeAt(x)===93?(ae=Et,x++):(ae=r,te===0&&me(Tn)),ae!==r?(e.charCodeAt(x)===105?(le=Qe,x++):(le=r,te===0&&me(nr)),le===r&&(le=null),it=C,C=Dc(X,z,le)):(x=C,C=r)}else x=C,C=r;return te--,C===r&&(j=r,te===0&&me(Rn)),C}function Oe(){var C,j,X,z;return C=x,j=Ze(),j!==r?(e.charCodeAt(x)===45?(X=gr,x++):(X=r,te===0&&me(xr)),X!==r?(z=Ze(),z!==r?(it=C,C=va(j,z)):(x=C,C=r)):(x=C,C=r)):(x=C,C=r),C}function Ze(){var C,j,X,z;return C=x,j=x,X=x,te++,e.charCodeAt(x)===93?(z=Et,x++):(z=r,te===0&&me(Tn)),z===r&&(e.charCodeAt(x)===92?(z=Fe,x++):(z=r,te===0&&me($n)),z===r&&(z=_i())),te--,z===r?X=void 0:(x=X,X=r),X!==r?(z=cn(),z!==r?(X=[X,z],j=X):(x=j,j=r)):(x=j,j=r),j!==r?C=e.substring(C,x):C=j,C===r&&(C=x,e.charCodeAt(x)===92?(j=Fe,x++):(j=r,te===0&&me($n)),j!==r?(X=cr(),X!==r?C=X:(x=C,C=r)):(x=C,C=r),C===r&&(C=_t())),C}function _t(){var C,j,X;return C=x,e.charCodeAt(x)===92?(j=Fe,x++):(j=r,te===0&&me($n)),j!==r?(X=Jo(),X!==r?(it=C,C=mh()):(x=C,C=r)):(x=C,C=r),C}function cr(){var C,j,X,z;return C=Kt(),C===r&&(C=x,e.charCodeAt(x)===48?(j=tr,x++):(j=r,te===0&&me(ur)),j!==r?(X=x,te++,z=ba(),te--,z===r?X=void 0:(x=X,X=r),X!==r?(it=C,C=Fc()):(x=C,C=r)):(x=C,C=r),C===r&&(C=tl(),C===r&&(C=$h()))),C}function Kt(){var C;return C=el(),C===r&&(C=Rp()),C}function el(){var C,j;return e.charCodeAt(x)===39?(C=ut,x++):(C=r,te===0&&me(Lt)),C===r&&(e.charCodeAt(x)===34?(C=at,x++):(C=r,te===0&&me(ir)),C===r&&(e.charCodeAt(x)===92?(C=Fe,x++):(C=r,te===0&&me($n)),C===r&&(C=x,e.charCodeAt(x)===98?(j=ct,x++):(j=r,te===0&&me(_c)),j!==r&&(it=C,j=Qn()),C=j,C===r&&(C=x,e.charCodeAt(x)===102?(j=Mt,x++):(j=r,te===0&&me(Wu)),j!==r&&(it=C,j=vh()),C=j,C===r&&(C=x,e.charCodeAt(x)===110?(j=tt,x++):(j=r,te===0&&me(zr)),j!==r&&(it=C,j=wh()),C=j,C===r&&(C=x,e.charCodeAt(x)===114?(j=qe,x++):(j=r,te===0&&me(Xu)),j!==r&&(it=C,j=Ah()),C=j,C===r&&(C=x,e.charCodeAt(x)===116?(j=rr,x++):(j=r,te===0&&me(Go)),j!==r&&(it=C,j=Eh()),C=j,C===r&&(C=x,e.charCodeAt(x)===118?(j=Ue,x++):(j=r,te===0&&me(Yo)),j!==r&&(it=C,j=bh()),C=j)))))))),C}function Rp(){var C,j,X,z;return C=x,j=x,X=x,te++,z=ri(),z===r&&(z=_i()),te--,z===r?X=void 0:(x=X,X=r),X!==r?(z=cn(),z!==r?(X=[X,z],j=X):(x=j,j=r)):(x=j,j=r),j!==r?C=e.substring(C,x):C=j,C}function ri(){var C;return C=el(),C===r&&(C=ba(),C===r&&(e.charCodeAt(x)===120?(C=Pt,x++):(C=r,te===0&&me(Zu)),C===r&&(e.charCodeAt(x)===117?(C=en,x++):(C=r,te===0&&me(xs))))),C}function tl(){var C,j,X,z,ae,le;return C=x,e.charCodeAt(x)===120?(j=Pt,x++):(j=r,te===0&&me(Zu)),j!==r?(X=x,z=x,ae=us(),ae!==r?(le=us(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r),z!==r?X=e.substring(X,x):X=z,X!==r?(it=C,C=yh(X)):(x=C,C=r)):(x=C,C=r),C}function $h(){var C,j,X,z,ae,le,zt,Er;return C=x,e.charCodeAt(x)===117?(j=en,x++):(j=r,te===0&&me(xs)),j!==r?(X=x,z=x,ae=us(),ae!==r?(le=us(),le!==r?(zt=us(),zt!==r?(Er=us(),Er!==r?(ae=[ae,le,zt,Er],z=ae):(x=z,z=r)):(x=z,z=r)):(x=z,z=r)):(x=z,z=r),z!==r?X=e.substring(X,x):X=z,X!==r?(it=C,C=Nn(X)):(x=C,C=r)):(x=C,C=r),C}function ba(){var C;return Br.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Ju)),C}function us(){var C;return Ai.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Wo)),C}function rl(){var C,j;return C=x,e.charCodeAt(x)===46?(j=Xt,x++):(j=r,te===0&&me(Qu)),j!==r&&(it=C,j=yp()),C=j,C}function Bt(){var C,j,X,z;return te++,C=x,e.charCodeAt(x)===123?(j=s,x++):(j=r,te===0&&me(Vr)),j!==r?(X=Tp(),e.charCodeAt(x)===125?(z=u,x++):(z=r,te===0&&me(ss)),z!==r?C=X:(x=C,C=r)):(x=C,C=r),te--,C===r&&(j=r,te===0&&me(eo)),C}function Tp(){var C,j;return C=x,j=nl(),it=C,j=ei(j),C=j,C}function nl(){var C,j,X,z,ae,le;if(C=x,j=[],X=[],z=x,ae=x,te++,tn.test(e.charAt(x))?(le=e.charAt(x),x++):(le=r,te===0&&me(On)),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r),z!==r)for(;z!==r;)X.push(z),z=x,ae=x,te++,tn.test(e.charAt(x))?(le=e.charAt(x),x++):(le=r,te===0&&me(On)),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);else X=r;for(X===r&&(X=x,e.charCodeAt(x)===123?(z=s,x++):(z=r,te===0&&me(Vr)),z!==r?(ae=nl(),e.charCodeAt(x)===125?(le=u,x++):(le=r,te===0&&me(ss)),le!==r?(z=[z,ae,le],X=z):(x=X,X=r)):(x=X,X=r));X!==r;){if(j.push(X),X=[],z=x,ae=x,te++,tn.test(e.charAt(x))?(le=e.charAt(x),x++):(le=r,te===0&&me(On)),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r),z!==r)for(;z!==r;)X.push(z),z=x,ae=x,te++,tn.test(e.charAt(x))?(le=e.charAt(x),x++):(le=r,te===0&&me(On)),te--,le===r?ae=void 0:(x=ae,ae=r),ae!==r?(le=cn(),le!==r?(ae=[ae,le],z=ae):(x=z,z=r)):(x=z,z=r);else X=r;X===r&&(X=x,e.charCodeAt(x)===123?(z=s,x++):(z=r,te===0&&me(Vr)),z!==r?(ae=nl(),e.charCodeAt(x)===125?(le=u,x++):(le=r,te===0&&me(ss)),le!==r?(z=[z,ae,le],X=z):(x=X,X=r)):(x=X,X=r))}return C=e.substring(C,x),C}function il(){var C;return Ct.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(R)),C}function Op(){var C;return Ne.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(k)),C}function kp(){var C;return De.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(V)),C}function Np(){var C;return mr.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Q)),C}function sl(){var C;return rn.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(ve)),C}function Ps(){var C;return rt.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Ee)),C}function al(){var C;return ga.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Ie)),C}function Rh(){var C;return nn.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Re)),C}function ul(){var C;return ge.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Vt)),C}function Th(){var C;return _s.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(Ar)),C}function Oh(){var C;return It.test(e.charAt(x))?(C=e.charAt(x),x++):(C=r,te===0&&me(un)),C}function Tt(){var C,j;for(C=[],j=Ci(),j===r&&(j=Jo(),j===r&&(j=Bh()));j!==r;)C.push(j),j=Ci(),j===r&&(j=Jo(),j===r&&(j=Bh()));return C}function kh(){var C,j;for(C=[],j=Ci(),j===r&&(j=Ea());j!==r;)C.push(j),j=Ci(),j===r&&(j=Ea());return C}function ya(){var C,j,X,z;return C=x,j=Tt(),e.charCodeAt(x)===59?(X=qt,x++):(X=r,te===0&&me(on)),X!==r?(j=[j,X],C=j):(x=C,C=r),C===r&&(C=x,j=kh(),X=ti(),X===r&&(X=null),z=Jo(),z!==r?(j=[j,X,z],C=j):(x=C,C=r),C===r&&(C=x,j=Tt(),X=Ca(),X!==r?(j=[j,X],C=j):(x=C,C=r))),C}function Ca(){var C,j;return C=x,te++,e.length>x?(j=e.charAt(x),x++):(j=r,te===0&&me(Is)),te--,j===r?C=void 0:(x=C,C=r),C}let ol=t.reservedWords||[];if(yi=a(),yi!==r&&x===e.length)return yi;throw yi!==r&&x{"use strict";var kM=np(),NM=tD(),LM=nD(),UM=Q2(),jM=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","null","true","false","enum","implements","interface","let","package","private","protected","public","static","yield","await"],dh={VERSION:UM,RESERVED_WORDS:jM,GrammarError:kM,parser:LM,compiler:NM,generate(e,t){t=t!==void 0?t:{};function r(a){let s={};return Object.keys(a).forEach(u=>{s[u]=a[u].slice()}),s}let n="plugins"in t?t.plugins:[],i={parser:dh.parser,passes:r(dh.compiler.passes),reservedWords:dh.RESERVED_WORDS.slice()};return n.forEach(a=>{a.use(i,t)}),dh.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};iD.exports=dh});var Av=he((vv,wv)=>{(function(e,t){typeof vv=="object"&&typeof wv<"u"?wv.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(vv,function(){"use strict";function e(re,ce){return ce={exports:{}},re(ce,ce.exports),ce.exports}var t=e(function(re){var ce=re.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=ce)}),r=e(function(re){var ce=re.exports={version:"2.6.5"};typeof __e=="number"&&(__e=ce)}),n=r.version,i=function(re){return typeof re=="object"?re!==null:typeof re=="function"},a=function(re){if(!i(re))throw TypeError(re+" is not an object!");return re},s=function(re){try{return!!re()}catch{return!0}},u=!s(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),l=t.document,f=i(l)&&i(l.createElement),d=function(re){return f?l.createElement(re):{}},m=!u&&!s(function(){return Object.defineProperty(d("div"),"a",{get:function(){return 7}}).a!=7}),p=function(re,ce){if(!i(re))return re;var ke,Te;if(ce&&typeof(ke=re.toString)=="function"&&!i(Te=ke.call(re))||typeof(ke=re.valueOf)=="function"&&!i(Te=ke.call(re))||!ce&&typeof(ke=re.toString)=="function"&&!i(Te=ke.call(re)))return Te;throw TypeError("Can't convert object to primitive value")},h=Object.defineProperty,w=u?Object.defineProperty:function(ce,ke,Te){if(a(ce),ke=p(ke,!0),a(Te),m)try{return h(ce,ke,Te)}catch{}if("get"in Te||"set"in Te)throw TypeError("Accessors not supported!");return"value"in Te&&(ce[ke]=Te.value),ce},v={f:w},y=function(re,ce){return{enumerable:!(re&1),configurable:!(re&2),writable:!(re&4),value:ce}},g=u?function(re,ce,ke){return v.f(re,ce,y(1,ke))}:function(re,ce,ke){return re[ce]=ke,re},b={}.hasOwnProperty,D=function(re,ce){return b.call(re,ce)},_=0,F=Math.random(),L=function(re){return"Symbol(".concat(re===void 0?"":re,")_",(++_+F).toString(36))},N=!1,S=e(function(re){var ce="__core-js_shared__",ke=t[ce]||(t[ce]={});(re.exports=function(Te,Me){return ke[Te]||(ke[Te]=Me!==void 0?Me:{})})("versions",[]).push({version:r.version,mode:N?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),B=S("native-function-to-string",Function.toString),O=e(function(re){var ce=L("src"),ke="toString",Te=(""+B).split(ke);r.inspectSource=function(Me){return B.call(Me)},(re.exports=function(Me,nt,ot,Dr){var Nt=typeof ot=="function";Nt&&(D(ot,"name")||g(ot,"name",nt)),Me[nt]!==ot&&(Nt&&(D(ot,ce)||g(ot,ce,Me[nt]?""+Me[nt]:Te.join(String(nt)))),Me===t?Me[nt]=ot:Dr?Me[nt]?Me[nt]=ot:g(Me,nt,ot):(delete Me[nt],g(Me,nt,ot)))})(Function.prototype,ke,function(){return typeof this=="function"&&this[ce]||B.call(this)})}),P=function(re){if(typeof re!="function")throw TypeError(re+" is not a function!");return re},U=function(re,ce,ke){if(P(re),ce===void 0)return re;switch(ke){case 1:return function(Te){return re.call(ce,Te)};case 2:return function(Te,Me){return re.call(ce,Te,Me)};case 3:return function(Te,Me,nt){return re.call(ce,Te,Me,nt)}}return function(){return re.apply(ce,arguments)}},G="prototype",H=function(re,ce,ke){var Te=re&H.F,Me=re&H.G,nt=re&H.S,ot=re&H.P,Dr=re&H.B,Nt=Me?t:nt?t[ce]||(t[ce]={}):(t[ce]||{})[G],Xn=Me?r:r[ce]||(r[ce]={}),Hi=Xn[G]||(Xn[G]={}),sn,wn,vr,an;Me&&(ke=ce);for(sn in ke)wn=!Te&&Nt&&Nt[sn]!==void 0,vr=(wn?Nt:ke)[sn],an=Dr&&wn?U(vr,t):ot&&typeof vr=="function"?U(Function.call,vr):vr,Nt&&O(Nt,sn,vr,re&H.U),Xn[sn]!=vr&&g(Xn,sn,an),ot&&Hi[sn]!=vr&&(Hi[sn]=vr)};t.core=r,H.F=1,H.G=2,H.S=4,H.P=8,H.B=16,H.W=32,H.U=64,H.R=128;var K=H,Y=Math.ceil,ie=Math.floor,_e=function(re){return isNaN(re=+re)?0:(re>0?ie:Y)(re)},Fe=function(re){if(re==null)throw TypeError("Can't call method on "+re);return re},$e=function(re){return function(ce,ke){var Te=String(Fe(ce)),Me=_e(ke),nt=Te.length,ot,Dr;return Me<0||Me>=nt?re?"":void 0:(ot=Te.charCodeAt(Me),ot<55296||ot>56319||Me+1===nt||(Dr=Te.charCodeAt(Me+1))<56320||Dr>57343?re?Te.charAt(Me):ot:re?Te.slice(Me,Me+2):(ot-55296<<10)+(Dr-56320)+65536)}},et=$e(!1);K(K.P,"String",{codePointAt:function(ce){return et(this,ce)}});var Qe=r.String.codePointAt,at=Math.max,ut=Math.min,Qr=function(re,ce){return re=_e(re),re<0?at(re+ce,0):ut(re,ce)},Qt=String.fromCharCode,Et=String.fromCodePoint;K(K.S+K.F*(!!Et&&Et.length!=1),"String",{fromCodePoint:function(ce){for(var ke=arguments,Te=[],Me=arguments.length,nt=0,ot;Me>nt;){if(ot=+ke[nt++],Qr(ot,1114111)!==ot)throw RangeError(ot+" is not a valid code point");Te.push(ot<65536?Qt(ot):Qt(((ot-=65536)>>10)+55296,ot%1024+56320))}return Te.join("")}});var gr=r.String.fromCodePoint,tr=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ct=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Mt=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,tt={Space_Separator:tr,ID_Start:ct,ID_Continue:Mt},qe={isSpaceSeparator:function(ce){return typeof ce=="string"&&tt.Space_Separator.test(ce)},isIdStartChar:function(ce){return typeof ce=="string"&&(ce>="a"&&ce<="z"||ce>="A"&&ce<="Z"||ce==="$"||ce==="_"||tt.ID_Start.test(ce))},isIdContinueChar:function(ce){return typeof ce=="string"&&(ce>="a"&&ce<="z"||ce>="A"&&ce<="Z"||ce>="0"&&ce<="9"||ce==="$"||ce==="_"||ce==="\u200C"||ce==="\u200D"||tt.ID_Continue.test(ce))},isDigit:function(ce){return typeof ce=="string"&&/[0-9]/.test(ce)},isHexDigit:function(ce){return typeof ce=="string"&&/[0-9A-Fa-f]/.test(ce)}},rr,Ue,Pt,en,Xt,qt,pt,Br,Ai,tn=function(ce,ke){rr=String(ce),Ue="start",Pt=[],en=0,Xt=1,qt=0,pt=void 0,Br=void 0,Ai=void 0;do pt=ga(),lu[Ue]();while(pt.type!=="eof");return typeof ke=="function"?Ct({"":Ai},"",ke):Ai};function Ct(re,ce,ke){var Te=re[ce];if(Te!=null&&typeof Te=="object")if(Array.isArray(Te))for(var Me=0;Me0;){var ke=nn();if(!qe.isHexDigit(ke))throw $t(ge());re+=ge()}return String.fromCodePoint(parseInt(re,16))}var lu={start:function(){if(pt.type==="eof")throw Wn();Fs()},beforePropertyName:function(){switch(pt.type){case"identifier":case"string":Br=pt.value,Ue="afterPropertyName";return;case"punctuator":as();return;case"eof":throw Wn()}},afterPropertyName:function(){if(pt.type==="eof")throw Wn();Ue="beforePropertyValue"},beforePropertyValue:function(){if(pt.type==="eof")throw Wn();Fs()},beforeArrayValue:function(){if(pt.type==="eof")throw Wn();if(pt.type==="punctuator"&&pt.value==="]"){as();return}Fs()},afterPropertyValue:function(){if(pt.type==="eof")throw Wn();switch(pt.value){case",":Ue="beforePropertyName";return;case"}":as()}},afterArrayValue:function(){if(pt.type==="eof")throw Wn();switch(pt.value){case",":Ue="beforeArrayValue";return;case"]":as()}},end:function(){}};function Fs(){var re;switch(pt.type){case"punctuator":switch(pt.value){case"{":re={};break;case"[":re=[];break}break;case"null":case"boolean":case"numeric":case"string":re=pt.value;break}if(Ai===void 0)Ai=re;else{var ce=Pt[Pt.length-1];Array.isArray(ce)?ce.push(re):Object.defineProperty(ce,Br,{value:re,writable:!0,enumerable:!0,configurable:!0})}if(re!==null&&typeof re=="object")Pt.push(re),Array.isArray(re)?Ue="beforeArrayValue":Ue="beforePropertyName";else{var ke=Pt[Pt.length-1];ke==null?Ue="end":Array.isArray(ke)?Ue="afterArrayValue":Ue="afterPropertyValue"}}function as(){Pt.pop();var re=Pt[Pt.length-1];re==null?Ue="end":Array.isArray(re)?Ue="afterArrayValue":Ue="afterPropertyValue"}function $t(re){return Ss(re===void 0?"JSON5: invalid end of input at "+Xt+":"+qt:"JSON5: invalid character '"+hu(re)+"' at "+Xt+":"+qt)}function Wn(){return Ss("JSON5: invalid end of input at "+Xt+":"+qt)}function cu(){return qt-=5,Ss("JSON5: invalid identifier character at "+Xt+":"+qt)}function fu(re){console.warn("JSON5: '"+hu(re)+"' in strings is not valid ECMAScript; consider escaping")}function hu(re){var ce={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(ce[re])return ce[re];if(re<" "){var ke=re.charCodeAt(0).toString(16);return"\\x"+("00"+ke).substring(ke.length)}return re}function Ss(re){var ce=new SyntaxError(re);return ce.lineNumber=Xt,ce.columnNumber=qt,ce}var zu=function(ce,ke,Te){var Me=[],nt="",ot,Dr,Nt="",Xn;if(ke!=null&&typeof ke=="object"&&!Array.isArray(ke)&&(Te=ke.space,Xn=ke.quote,ke=ke.replacer),typeof ke=="function")Dr=ke;else if(Array.isArray(ke)){ot=[];for(var Hi=0,sn=ke;Hi0&&(Te=Math.min(10,Math.floor(Te)),Nt=" ".substr(0,Te)):typeof Te=="string"&&(Nt=Te.substr(0,10)),an("",{"":ce});function an(xt,wr){var Xe=wr[xt];switch(Xe!=null&&(typeof Xe.toJSON5=="function"?Xe=Xe.toJSON5(xt):typeof Xe.toJSON=="function"&&(Xe=Xe.toJSON(xt))),Dr&&(Xe=Dr.call(wr,xt,Xe)),Xe instanceof Number?Xe=Number(Xe):Xe instanceof String?Xe=String(Xe):Xe instanceof Boolean&&(Xe=Xe.valueOf()),Xe){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof Xe=="string")return Nr(Xe,!1);if(typeof Xe=="number")return String(Xe);if(typeof Xe=="object")return Array.isArray(Xe)?$n(Xe):Yu(Xe)}function Nr(xt){for(var wr={"'":.1,'"':.2},Xe={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},nr="",Kr=0;Kr=0)throw TypeError("Converting circular structure to JSON5");Me.push(xt);var wr=nt;nt=nt+Nt;for(var Xe=ot||Object.keys(xt),nr=[],Kr=0,ir=Xe;Kr=0)throw TypeError("Converting circular structure to JSON5");Me.push(xt);var wr=nt;nt=nt+Nt;for(var Xe=[],nr=0;nr{let t={};return e.forEach((r,n)=>t[r]=n),t})(Yc),BB=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,hn=String.fromCharCode.bind(String),mA=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),EA=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),bA=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),yA=e=>{let t,r,n,i,a="",s=e.length%3;for(let u=0;u255||(n=e.charCodeAt(u++))>255||(i=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,a+=Yc[t>>18&63]+Yc[t>>12&63]+Yc[t>>6&63]+Yc[t&63]}return s?a.slice(0,s-3)+"===".substring(s):a},$1=typeof btoa=="function"?e=>btoa(e):El?e=>Buffer.from(e,"binary").toString("base64"):yA,x1=El?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,i=e.length;nt?EA(x1(e)):x1(e),xB=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?hn(192|t>>>6)+hn(128|t&63):hn(224|t>>>12&15)+hn(128|t>>>6&63)+hn(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return hn(240|t>>>18&7)+hn(128|t>>>12&63)+hn(128|t>>>6&63)+hn(128|t&63)}},PB=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,CA=e=>e.replace(PB,xB),vA=El?e=>Buffer.from(e,"utf8").toString("base64"):gA?e=>x1(gA.encode(e)):e=>$1(CA(e)),Al=(e,t=!1)=>t?EA(vA(e)):vA(e),wA=e=>Al(e,!0),$B=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,RB=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return hn((r>>>10)+55296)+hn((r&1023)+56320);case 3:return hn((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return hn((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},_A=e=>e.replace($B,RB),DA=e=>{if(e=e.replace(/\s+/g,""),!BB.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,i;for(let a=0;a>16&255):i===64?hn(t>>16&255,t>>8&255):hn(t>>16&255,t>>8&255,t&255);return r},R1=typeof atob=="function"?e=>atob(bA(e)):El?e=>Buffer.from(e,"base64").toString("binary"):DA,FA=El?e=>mA(Buffer.from(e,"base64")):e=>mA(R1(e).split("").map(t=>t.charCodeAt(0))),SA=e=>FA(IA(e)),TB=El?e=>Buffer.from(e,"base64").toString("utf8"):pA?e=>pA.decode(FA(e)):e=>_A(R1(e)),IA=e=>bA(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),P1=e=>TB(IA(e)),OB=e=>{if(typeof e!="string")return!1;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},BA=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),xA=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,BA(r));e("fromBase64",function(){return P1(this)}),e("toBase64",function(t){return Al(this,t)}),e("toBase64URI",function(){return Al(this,!0)}),e("toBase64URL",function(){return Al(this,!0)}),e("toUint8Array",function(){return SA(this)})},PA=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,BA(r));e("toBase64",function(t){return p0(this,t)}),e("toBase64URI",function(){return p0(this,!0)}),e("toBase64URL",function(){return p0(this,!0)})},kB=()=>{xA(),PA()},yt={version:AA,VERSION:SB,atob:R1,atobPolyfill:DA,btoa:$1,btoaPolyfill:yA,fromBase64:P1,toBase64:Al,encode:Al,encodeURI:wA,encodeURL:wA,utob:CA,btou:_A,decode:P1,isValid:OB,fromUint8Array:p0,toUint8Array:SA,extendString:xA,extendUint8Array:PA,extendBuiltins:kB};var bu=typeof $task<"u",Ra=typeof $loon<"u",yu=typeof $httpClient<"u"&&!Ra,Os=eval('typeof process !== "undefined"'),$A=typeof $environment<"u"&&$environment["stash-version"],RA=typeof $rocket<"u",NB=typeof egern=="object",LB=typeof $native<"u",Cu=typeof $Plugins<"u";function g0(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function UB(e){let[t,r,n,i,a,s,u]=e.match(/^socks5:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(a)a=parseInt(a,10);else throw $.error(`port is not present in line: ${e}`),new Error(`port is not present in line: ${e}`);return{type:5,host:i,port:a,userId:r!=null?decodeURIComponent(r):void 0,password:n!=null?decodeURIComponent(n):void 0}}var m0=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=Ta(),this.env=ks(),Os){let dotenv=eval('require("dotenv")');dotenv.config()}this.node=(()=>{if(Os){let fs=eval("require('fs')");return{fs}}else return null})(),this.initCache();let delay=(e,t)=>new Promise(function(r){setTimeout(r.bind(null,t),e)});Promise.prototype.delay=async function(e){let t=await this;return await delay(e,t)}}initCache(){if(bu&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(Ra||yu)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),Cu&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),Os){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".",rootPath=`${basePath}/root.json`,backupRootPath=`${basePath}/root_${Date.now()}.json`;if(this.log(`Root path: ${rootPath}`),this.node.fs.existsSync(rootPath))try{this.root=JSON.parse(this.node.fs.readFileSync(`${rootPath}`))}catch(e){this.node.fs.copyFileSync(rootPath,backupRootPath),this.error(`Failed to parse ${rootPath}: ${e.message}. Backup created at ${backupRootPath}`)}g0(this.root)||(this.node.fs.writeFileSync(rootPath,JSON.stringify({}),{flag:"w"}),this.root={});let fpath=`${basePath}/${this.name}.json`,backupPath=`${basePath}/${this.name}_${Date.now()}.json`;if(this.log(`Data path: ${fpath}`),this.node.fs.existsSync(fpath))try{if(this.cache=JSON.parse(this.node.fs.readFileSync(`${fpath}`,"utf-8")),!g0(this.cache))throw new Error("Invalid Data")}catch{try{let t=yt.decode(this.node.fs.readFileSync(`${fpath}`,"utf-8"));if(this.cache=JSON.parse(t),this.node.fs.writeFileSync(fpath,t,{flag:"w"}),!g0(this.cache))throw new Error("Invalid Data")}catch(t){this.node.fs.copyFileSync(fpath,backupPath),this.error(`Failed to parse ${fpath}: ${t.message}. Backup created at ${backupPath}`)}}g0(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(bu&&$prefs.setValueForKey(data,this.name),(Ra||yu)&&$persistentStore.write(data,this.name),Cu&&$Plugins.SubStoreCache.set(this.name,data),Os){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".";this.node.fs.writeFileSync(`${basePath}/${this.name}.json`,data,{flag:"w"},e=>console.log(e)),this.node.fs.writeFileSync(`${basePath}/root.json`,JSON.stringify(this.root,null,2),{flag:"w"},e=>console.log(e))}}write(e,t){if(this.log(`SET ${t}`),t.indexOf("#")!==-1){if(t=t.substr(1),yu||Ra)return $persistentStore.write(e,t);if(bu)return $prefs.setValueForKey(e,t);if(Os&&(this.root[t]=e),Cu)return $Plugins.SubStoreCache.set(t,e)}else this.cache[t]=e;this.persistCache()}read(e){if(this.log(`READ ${e}`),e.indexOf("#")!==-1){if(e=e.substr(1),yu||Ra)return $persistentStore.read(e);if(bu)return $prefs.valueForKey(e);if(Os)return this.root[e];if(Cu)return $Plugins.SubStoreCache.get(e)}else return this.cache[e]}delete(e){if(this.log(`DELETE ${e}`),e.indexOf("#")!==-1){if(e=e.substr(1),yu||Ra)return $persistentStore.write(null,e);if(bu)return $prefs.removeValueForKey(e);if(Os&&delete this.root[e],Cu)return $Plugins.SubStoreCache.remove(e)}else delete this.cache[e];this.persistCache()}notify(title,subtitle="",content="",options={}){let openURL=options["open-url"],mediaURL=options["media-url"];if(bu&&$notify(title,subtitle,content,options),yu&&$notification.post(title,subtitle,content+`${mediaURL?` \u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),Ra){let e={};openURL&&(e.openUrl=openURL),mediaURL&&(e.mediaUrl=mediaURL),JSON.stringify(e)==="{}"?$notification.post(title,subtitle,content):$notification.post(title,subtitle,content,e)}if(Os){let content_=content+(openURL?` \u70B9\u51FB\u8DF3\u8F6C: ${openURL}`:"")+(mediaURL?` \u591A\u5A92\u4F53: ${mediaURL}`:"");console.log(`${title} ${subtitle} ${content_} `);let push=eval("process.env.SUB_STORE_PUSH_SERVICE");if(push)if(/^https?:\/\//.test(push)){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(` `)));Ta().get({url:e}).then(r=>{console.log(`[Push Service] URL: ${e} RES: ${r.statusCode} ${r.body}`)}).catch(r=>{console.log(`[Push Service] URL: ${e} ERROR: ${r}`)})}else{let{execFile}=eval('require("child_process")');execFile("shoutrrr",["send","--url",push,"--message",`${title} ${subtitle} ${content_}`],(e,t,r)=>{if(e){console.log(`[Push Service] URL: ${push} ERROR: ${e}`);return}r&&console.log(`[Push Service] URL: ${push} stderr: ${r}`),console.log(`[Push Service] URL: ${push} stdout: ${t}`)})}}Cu&&$Plugins.Notify(title,subtitle+` `+content)}log(e){this.debug&&console.log(`[${this.name}] LOG: ${e}`)}info(e){console.log(`[${this.name}] INFO: ${e}`)}error(e){console.log(`[${this.name}] ERROR: ${e}`)}wait(e){return new Promise(t=>setTimeout(t,e))}done(e={}){bu||Ra||yu||Cu?$done(e):Os&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function ks(){return{isQX:bu,isLoon:Ra,isSurge:yu,isNode:Os,isStash:$A,isShadowRocket:RA,isEgern:NB,isLanceX:LB,isGUIforCores:Cu}}function Ta(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores}=ks(),methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],URL_REGEX=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;function send(method,options){options=typeof options=="string"?{url:options}:options;let baseURL=defaultOptions.baseURL;baseURL&&!URL_REGEX.test(options.url||"")&&(options.url=baseURL?baseURL+options.url:options.url),options={...defaultOptions,...options};let timeout=options.timeout,events={onRequest:()=>{},onResponse:e=>e,onTimeout:()=>{},...options.events};if(events.onRequest(method,options),options.node&&isSurge){let e=$environment["surge-build"];e&&parseInt(e)>=2407&&(options["policy-descriptor"]=options.node,delete options.node)}let worker;isQX?worker=$task.fetch({method,url:options.url,headers:options.headers,body:options.body,opts:options.opts}):isLoon||isSurge||isNode?worker=new Promise(async(resolve,reject)=>{let body=options.body,opts=JSON.parse(JSON.stringify(options));if(opts.body=body,opts.timeout=opts.timeout||8e3,opts.timeout&&(opts.timeout++,isNaN(opts.timeout)&&(opts.timeout=8e3),!isNode)){let e="ms";(isSurge||$A||RA)&&(opts.timeout=Math.ceil(opts.timeout/1e3),e="s")}if(isNode){let undici=eval("require('undici')"),{socksDispatcher}=eval("require('fetch-socks')"),{ProxyAgent,EnvHttpProxyAgent,request,interceptors}=undici,agentOpts={connect:{rejectUnauthorized:!(opts.strictSSL===!1||opts.insecure===!0||opts.rejectUnauthorized===!1)},bodyTimeout:opts.timeout,headersTimeout:opts.timeout},tlsOptions={rejectUnauthorized:agentOpts.connect.rejectUnauthorized};opts.tls={...opts.tls||{},...tlsOptions};try{let url=new URL(opts.url);(url.username||url.password)&&(opts.headers={...opts.headers||{},Authorization:`Basic ${Buffer.from(`${url.username||""}:${url.password||""}`).toString("base64")}`});let dispatcher;if(!opts.proxy){let allProxy=eval("process.env.all_proxy")||eval("process.env.ALL_PROXY");allProxy&&/^socks5:\/\//.test(allProxy)&&(opts.proxy=allProxy)}opts.proxy?/^socks5:\/\//.test(opts.proxy)?dispatcher=socksDispatcher(UB(opts.proxy),{...agentOpts,requestTls:tlsOptions}):dispatcher=new ProxyAgent({...agentOpts,uri:opts.proxy,requestTls:tlsOptions}):dispatcher=new EnvHttpProxyAgent({...agentOpts,requestTls:tlsOptions});let response=await request(opts.url,{...opts,method:method.toUpperCase(),dispatcher:dispatcher.compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirects:!0}))});resolve({statusCode:response.statusCode,headers:response.headers,body:opts.encoding===null?await response.body.arrayBuffer():await response.body.text()})}catch(e){reject(e)}}else $httpClient[method.toLowerCase()](opts,(e,t,r)=>{e?reject(e):resolve({statusCode:t.status||t.statusCode,headers:t.headers,body:r})})}):isGUIforCores&&(worker=new Promise(async(e,t)=>{try{let r=await $Plugins.Requests({method,url:options.url,headers:options.headers,body:options.body,autoTransformBody:!1,options:{Proxy:options.proxy,Timeout:options.timeout?options.timeout/1e3:15}});e({statusCode:r.status,headers:r.headers,body:r.body})}catch(r){t(r)}}));let timeoutid,timer=timeout?new Promise((e,t)=>{timeoutid=setTimeout(()=>(events.onTimeout(),t(`${method} URL: ${options.url} exceeds the timeout ${timeout} ms`)),timeout)}):null;return(timer?Promise.race([timer,worker]).then(e=>(typeof clearTimeout<"u"&&clearTimeout(timeoutid),e)):worker).then(e=>events.onResponse(e))}let http={};return methods.forEach(e=>http[e.toLowerCase()]=t=>send(e,t)),http}var jB=new m0("sub-store"),J=jB;function Mn(e,t,r="name"){return e.find(n=>n[r]===t)}var T1=0;function hs(e){return MB(HB(qB(e)))}function HB(e){return KB(zB(VB(e),e.length*8))}function MB(e){try{}catch{T1=0}for(var t=T1?"0123456789ABCDEF":"0123456789abcdef",r="",n,i=0;i>>4&15)+t.charAt(n&15);return r}function qB(e){for(var t="",r=-1,n,i;++r>>6&31,128|n&63):n<=65535?t+=String.fromCharCode(224|n>>>12&15,128|n>>>6&63,128|n&63):n<=2097151&&(t+=String.fromCharCode(240|n>>>18&7,128|n>>>12&63,128|n>>>6&63,128|n&63));return t}function VB(e){for(var t=Array(e.length>>2),r=0;r>5]|=(e.charCodeAt(r/8)&255)<>5]>>>r%32&255);return t}function zB(e,t){e[t>>5]|=128<>>9<<4)+14]=t;for(var r=1732584193,n=-271733879,i=-1732584194,a=271733878,s=0;s>16)+(t>>16)+(r>>16);return n<<16|r&65535}function GB(e,t){return e<>>32-t}var F0=yn(zA()),A9=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,E9=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;function Rr(e){return A9.test(e)}function Ur(e){return E9.test(e)}function GA(e){return/^((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4}))$/.test(e)}function Hs(e){return typeof e=="string"&&e.trim().length>0}function Jt(e,t){return Hs(e)?e:t}function _l(e){return typeof e<"u"&&e!==null}function Dl(e,t){return _l(e)?e:t}function ka(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function b9(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function Zc(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return b9(n,i)}else return Number(r)}function YA(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function S0(e){return typeof e=="string"&&/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(e)}var z1=class{constructor(t){this.expires=t,J.read(po)||J.write("{}",po);try{this.resourceCache=JSON.parse(J.read(po))}catch(r){J.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${po} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${r?.message??r}`),this.resourceCache={},J.write("{}",po)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],J.delete(`#${n}`),t=!0),new Date().getTime()-i.time>this.expires&&(delete this.resourceCache[n],t=!0)}),t&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){J.write(JSON.stringify(this.resourceCache),po)}get(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].data:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}},Wr=new z1(36e5);var G1=class{constructor(){this.expires=C9(),J.read(go)||J.write("{}",go);try{this.resourceCache=JSON.parse(J.read(go))}catch(t){J.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${go} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},J.write("{}",go)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],J.delete(`#${n}`),t=!0),new Date().getTime()-i.time>this.expires&&(delete this.resourceCache[n],t=!0)}),t&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){J.write(JSON.stringify(this.resourceCache),go)}get(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].data:null}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].time:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}};function C9(){J.read(f0)||J.write("6e4",f0);let e=6e4;if(J.env.isLoon){let t={"1\u5206\u949F":6e4,"5\u5206\u949F":3e5,"10\u5206\u949F":6e5,"30\u5206\u949F":18e5,"1\u5C0F\u65F6":36e5,"2\u5C0F\u65F6":72e5,"3\u5C0F\u65F6":108e5,"6\u5C0F\u65F6":216e5,"12\u5C0F\u65F6":432e5,"24\u5C0F\u65F6":864e5,"48\u5C0F\u65F6":1728e5,"72\u5C0F\u65F6":2592e5,\u53C2\u6570\u4F20\u5165:"readcachets"},r=J.read("#\u54CD\u5E94\u5934\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=J.read(f0),e}var Jc=new G1;function Fl(e){let t=Object.keys(e),r="",n="";for(let i of t){let a=i.toLowerCase();a==="subscription-userinfo"?r=e[i]:a==="profile-web-page-url"&&(n=e[i])}return`${r||""}${n?`; app_url=${encodeURIComponent(n)}`:""}`}async function I0(rawUrl,ua,timeout,customProxy,flowUrl){let url=flowUrl||rawUrl||"",$arguments={},rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}if($arguments?.noFlow||!/^https?/.test(url))return;let{isStash,isLoon,isShadowRocket,isQX}=ks(),insecure=$arguments?.insecure?J.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=J.read(ui),proxy=customProxy||defaultProxy;J.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultFlowUserAgent||"clash",requestTimeout=timeout||defaultTimeout||8e3,id=hs(userAgent+url),cached=Jc.get(id),flowInfo;if(!$arguments?.noCache&&cached)J.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${userAgent}`),flowInfo=cached;else{let e=Ta();if(flowUrl){J.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${flowUrl}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{body:t,statusCode:r}=await e.get({url:flowUrl,headers:{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ka(proxy):{},...insecure||{}});if(r<200||r>=400)throw new Error(`statusCode: ${r}`);flowInfo=t}else{try{J.info(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await e.head({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ka(proxy):{},...insecure||{}});flowInfo=Fl(t)}catch(t){J.error(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${t.message??t}`)}if(!flowInfo){J.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, User-Agent: ${userAgent||""}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await e.get({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ka(proxy):{},...insecure||{}});flowInfo=Fl(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&Jc.set(id,flowInfo)}return flowInfo}function B0(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),r=t==null?0:Number(t[1]+t[2]),n=e.match(/download=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),i=Number(n[1]+n[2]),a=e.match(/total=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),s=Number(a[1]+a[2]),u=e.match(/expire=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),l=u?Number(u[1]+u[2]):void 0,f=e.match(/reset_day=([0-9]+)/),d=f?Number(f[1]):void 0,m=e.match(/app_url=(.*?)\s*?(;|$)/),p=m?decodeURIComponent(m[1]):void 0,h=e.match(/plan_name=(.*?)\s*?(;|$)/),w=h?decodeURIComponent(h[1]):void 0;return{expires:l,total:s,usage:{upload:r,download:i},remainingDays:d,appUrl:p,planName:w}}function Qc(e,t="B"){let r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=r.indexOf(t);return e<1024||n===r.length-1?{value:(Math.round(e*100)/100).toString(),unit:t}:Qc(e/1024,r[++n])}function x0(e){if(!e)throw new Error("\u6CA1\u6709\u6D41\u91CF\u4FE1\u606F");if(e?.expires&&e.expires*1e3a.getTime())throw new Error("\u5F00\u59CB\u65E5\u671F\u5E94\u65E9\u4E8E\u73B0\u5728");let s=new Date(r);for(s.setDate(s.getDate()+n);s31)throw new Error("\u6708\u91CD\u7F6E\u65E5\u5E94\u4E3A 1-31 \u4E4B\u95F4\u7684\u6574\u6570");let i=new Date,a=i.getDate(),s=i.getMonth(),u=i.getFullYear(),l;return t>a?l=0:l=new Date(u,s+1,0).getDate(),l-a+t}}catch(t){J.error(`getRmainingDays failed: ${t.message??t}`)}}function XA(e){try{let t=new Map;return e.split(";").map(r=>r.trim()).filter(Boolean).forEach(r=>{let n=r.indexOf("=");if(n===-1)return;let i=r.slice(0,n).trim(),a=r.slice(n+1).trim();if(!t.has(i))try{let s=decodeURIComponent(a);if(["upload","download","total","expire"].includes(i))try{s=Number(s).toFixed(0),["expire"].includes(i)&&s<=0&&(s="")}catch(u){J.error(`Failed to convert value for key "${i}=${a}": ${u.message??u}`)}t.set(i,s)}catch{t.set(i,a)}}),Array.from(t.entries()).map(([r,n])=>`${r}=${encodeURIComponent(n)}`).join("; ")}catch(t){return J.error(`normalizeFlowHeader failed: ${t.message??t}`),e}}var of=yn(Mb());function Vb(e,t,...r){try{return e(t,...r)}catch{return e(Kb(e(t.replace(/!\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function uf(e,...t){return Vb(of.default.safeLoad,JSON.parse(JSON.stringify(e)),...t)}function eP(e,...t){return Vb(of.default.load,JSON.parse(JSON.stringify(e)),...t)}function qb(e,...t){return of.default.safeDump(JSON.parse(JSON.stringify(e)),...t)}function Kb(e,...t){return of.default.dump(JSON.parse(JSON.stringify(e)),...t)}var qs={safeLoad:uf,load:eP,safeDump:qb,dump:Kb,parse:uf,stringify:qb};function tP(){return{name:"HTML",test:n=>/^/.test(n),parse:()=>""}}function rP(){let e="Base64 Pre-processor",t=["dm1lc3M","c3NyOi8v","c29ja3M6Ly","dHJvamFu","c3M6Ly","c3NkOi8v","c2hhZG93","aHR0c","dmxlc3M=","aHlzdGVyaWEy","aHkyOi8v","d2lyZWd1YXJkOi8v","d2c6Ly8=","dHVpYzovLw=="];return{name:e,test:function(i){return!/^\w+:\/\/\w+/im.test(i)&&t.some(a=>i.indexOf(a)!==-1)},parse:function(i){let a=yt.decode(i);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(a)?a:(J.error("Base64 Pre-processor error: decoded line does not start with protocol"),i)}}}function nP(){return{name:"Fallback Base64 Pre-processor",test:function(n){return!0},parse:function(n){let i=yt.decode(n);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(i)?i:(J.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),n)}}}function iP(){return{name:"Clash Pre-processor",test:function(n){if(!/proxies/.test(n))return!1;let i=uf(n);return i.proxies&&Array.isArray(i.proxies)},parse:function(n,i){let a=n.replace(/short-id:([ \t]*[^#\n,}]*)/g,(l,f)=>{let d=f.trim();return!d||d===""?'short-id: ""':/^(['"]).*\1$/.test(d)?`short-id: ${d}`:["null"].includes(d)?`short-id: ${d}`:`short-id: "${d}"`}),{proxies:s,"global-client-fingerprint":u}=uf(a);return(i?`proxies: `:"")+s.map(l=>(u&&!l["client-fingerprint"]&&(l["client-fingerprint"]=u),`${i?" - ":""}${JSON.stringify(l)} `)).join("")}}}function sP(){return{name:"SSD Pre-processor",test:function(n){return n.indexOf("ssd://")===0},parse:function(n){let i=[],a=JSON.parse(yt.decode(n.split("ssd://")[1])),s=a.port,u=a.encryption,l=a.password,f=a.servers;for(let d=0;d{let[a,s]=i;s.time||(delete this.resourceCache[a],J.delete(`#${a}`),n=!0),(new Date().getTime()-s.time>(r??this.expires)||t&&a.startsWith(t))&&(delete this.resourceCache[a],n=!0)}),n&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){J.write(JSON.stringify(this.resourceCache),mo)}get(t,r,n){let i=this.resourceCache[t]&&this.resourceCache[t].time;if(i){if(new Date().getTime()-i<=(r??this.expires))return this.resourceCache[t].data;n&&(delete this.resourceCache[t],this._persist())}return null}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()-r<=this.expires?this.resourceCache[t].time:null}set(t,r){this.resourceCache[t]={time:new Date().getTime(),data:r},this._persist()}};function $T(){J.read(h0)||J.write("1728e5",h0);let e=1728e5;if(J.env.isLoon){let t={"1\u5206\u949F":6e4,"5\u5206\u949F":3e5,"10\u5206\u949F":6e5,"30\u5206\u949F":18e5,"1\u5C0F\u65F6":36e5,"2\u5C0F\u65F6":72e5,"3\u5C0F\u65F6":108e5,"6\u5C0F\u65F6":216e5,"12\u5C0F\u65F6":432e5,"24\u5C0F\u65F6":864e5,"48\u5C0F\u65F6":1728e5,"72\u5C0F\u65F6":2592e5,\u53C2\u6570\u4F20\u5165:"readcachets"},r=J.read("#\u8282\u70B9\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=J.read(h0),e}var Og=new Tg;function ud(e,t){return[...Array(e).keys()].map(()=>t)}var kg={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["EXP","BAND"],"\u{1F1F8}\u{1F1F1}":["TEST","SOS"],"\u{1F1E6}\u{1F1E9}":["AD","AND"],"\u{1F1E6}\u{1F1EA}":["AE","ARE"],"\u{1F1E6}\u{1F1EB}":["AF","AFG"],"\u{1F1E6}\u{1F1F1}":["AL","ALB"],"\u{1F1E6}\u{1F1F2}":["AM","ARM"],"\u{1F1E6}\u{1F1F7}":["AR","ARG"],"\u{1F1E6}\u{1F1F9}":["AT","AUT"],"\u{1F1E6}\u{1F1FA}":["AU","AUS"],"\u{1F1E6}\u{1F1FF}":["AZ","AZE"],"\u{1F1E7}\u{1F1E6}":["BA","BIH"],"\u{1F1E7}\u{1F1E9}":["BD","BGD"],"\u{1F1E7}\u{1F1EA}":["BE","BEL"],"\u{1F1E7}\u{1F1EC}":["BG","BGR"],"\u{1F1E7}\u{1F1ED}":["BH","BHR"],"\u{1F1E7}\u{1F1F4}":["BO","BOL"],"\u{1F1E7}\u{1F1F3}":["BN","BRN"],"\u{1F1E7}\u{1F1F7}":["BR","BRA"],"\u{1F1E7}\u{1F1F9}":["BT","BTN"],"\u{1F1E7}\u{1F1FE}":["BY","BLR"],"\u{1F1E8}\u{1F1E6}":["CA","CAN"],"\u{1F1E8}\u{1F1ED}":["CH","CHE"],"\u{1F1E8}\u{1F1F1}":["CL","CHL"],"\u{1F1E8}\u{1F1F4}":["CO","COL"],"\u{1F1E8}\u{1F1F7}":["CR","CRI"],"\u{1F1E8}\u{1F1FE}":["CY","CYP"],"\u{1F1E8}\u{1F1FF}":["CZ","CZE"],"\u{1F1E9}\u{1F1EA}":["DE","DEU"],"\u{1F1E9}\u{1F1F0}":["DK","DNK"],"\u{1F1E9}\u{1F1FF}":["DZ","DZA"],"\u{1F1EA}\u{1F1E8}":["EC","ECU"],"\u{1F1EA}\u{1F1EA}":["EE","EST"],"\u{1F1EA}\u{1F1EC}":["EG","EGY"],"\u{1F1EA}\u{1F1F8}":["ES","ESP"],"\u{1F1EA}\u{1F1FA}":["EU"],"\u{1F1EB}\u{1F1EE}":["FI","FIN"],"\u{1F1EB}\u{1F1F7}":["FR","FRA"],"\u{1F1EC}\u{1F1E7}":["GB","GBR","UK"],"\u{1F1EC}\u{1F1EA}":["GE","GEO"],"\u{1F1EC}\u{1F1F7}":["GR","GRC"],"\u{1F1EC}\u{1F1F9}":["GT","GTM"],"\u{1F1EC}\u{1F1FA}":["GU","GUM"],"\u{1F1ED}\u{1F1F0}":["HK","HKG","HKT","HKBN","HGC","WTT","CMI"],"\u{1F1ED}\u{1F1F7}":["HR","HRV"],"\u{1F1ED}\u{1F1FA}":["HU","HUN"],"\u{1F1EE}\u{1F1F6}":["IQ","IRQ"],"\u{1F1EF}\u{1F1F4}":["JO","JOR"],"\u{1F1EF}\u{1F1F5}":["JP","JPN","TYO"],"\u{1F1F0}\u{1F1EA}":["KE","KEN"],"\u{1F1F0}\u{1F1EC}":["KG","KGZ"],"\u{1F1F0}\u{1F1ED}":["KH","KGZ"],"\u{1F1F0}\u{1F1F5}":["KP","PRK"],"\u{1F1F0}\u{1F1F7}":["KR","KOR","SEL"],"\u{1F1F0}\u{1F1FF}":["KZ","KAZ"],"\u{1F1EE}\u{1F1E9}":["ID","IDN"],"\u{1F1EE}\u{1F1EA}":["IE","IRL"],"\u{1F1EE}\u{1F1F1}":["IL","ISR"],"\u{1F1EE}\u{1F1F2}":["IM","IMN"],"\u{1F1EE}\u{1F1F3}":["IN","IND"],"\u{1F1EE}\u{1F1F7}":["IR","IRN"],"\u{1F1EE}\u{1F1F8}":["IS","ISL"],"\u{1F1EE}\u{1F1F9}":["IT","ITA"],"\u{1F1F1}\u{1F1E6}":["LA","LAO"],"\u{1F1F1}\u{1F1F0}":["LK","LKA"],"\u{1F1F1}\u{1F1F9}":["LT","LTU"],"\u{1F1F1}\u{1F1FA}":["LU","LUX"],"\u{1F1F1}\u{1F1FB}":["LV","LVA"],"\u{1F1F2}\u{1F1E6}":["MA","MAR"],"\u{1F1F2}\u{1F1E9}":["MD","MDA"],"\u{1F1F3}\u{1F1EC}":["NG","NGA"],"\u{1F1F2}\u{1F1F2}":["MM","MMR"],"\u{1F1F2}\u{1F1F0}":["MK","MKD"],"\u{1F1F2}\u{1F1F3}":["MN","MNG"],"\u{1F1F2}\u{1F1F4}":["MO","MAC","CTM"],"\u{1F1F2}\u{1F1F9}":["MT","MLT"],"\u{1F1F2}\u{1F1FD}":["MX","MEX"],"\u{1F1F2}\u{1F1FE}":["MY","MYS"],"\u{1F1F3}\u{1F1F1}":["NL","NLD","AMS"],"\u{1F1F3}\u{1F1F4}":["NO","NOR"],"\u{1F1F3}\u{1F1F5}":["NP","NPL"],"\u{1F1F3}\u{1F1FF}":["NZ","NZL"],"\u{1F1F5}\u{1F1E6}":["PA","PAN"],"\u{1F1F5}\u{1F1EA}":["PE","PER"],"\u{1F1F5}\u{1F1ED}":["PH","PHL"],"\u{1F1F5}\u{1F1F0}":["PK","PAK"],"\u{1F1F5}\u{1F1F1}":["PL","POL"],"\u{1F1F5}\u{1F1F7}":["PR","PRI"],"\u{1F1F5}\u{1F1F9}":["PT","PRT"],"\u{1F1F5}\u{1F1FE}":["PY","PRY"],"\u{1F1F5}\u{1F1EC}":["PG","PNG"],"\u{1F1F7}\u{1F1F4}":["RO","ROU"],"\u{1F1F7}\u{1F1F8}":["RS","SRB"],"\u{1F1F7}\u{1F1EA}":["RE","REU"],"\u{1F1F7}\u{1F1FA}":["RU","RUS"],"\u{1F1F8}\u{1F1E6}":["SA","SAU"],"\u{1F1F8}\u{1F1EA}":["SE","SWE"],"\u{1F1F8}\u{1F1EC}":["SG","SGP"],"\u{1F1F8}\u{1F1EE}":["SI","SVN"],"\u{1F1F8}\u{1F1F0}":["SK","SVK"],"\u{1F1F9}\u{1F1EC}":["TG","TGO"],"\u{1F1F9}\u{1F1ED}":["TH","THA"],"\u{1F1F9}\u{1F1F3}":["TN","TUN"],"\u{1F1F9}\u{1F1F7}":["TR","TUR"],"\u{1F1F9}\u{1F1FC}":["TW","TWN","CHT","HINET","ROC"],"\u{1F1FA}\u{1F1E6}":["UA","UKR"],"\u{1F1FA}\u{1F1F8}":["US","USA","LAX","SFO","SJC"],"\u{1F1FA}\u{1F1FE}":["UY","URY"],"\u{1F1FB}\u{1F1E6}":["VA","VAT"],"\u{1F1FB}\u{1F1EA}":["VE","VEN"],"\u{1F1FB}\u{1F1F3}":["VN","VNM"],"\u{1F1FF}\u{1F1E6}":["ZA","ZAF","JNB"],"\u{1F1E8}\u{1F1F3}":["CN","CHN","BACK"]};function Kl(e){let t={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["\u6D41\u91CF","\u65F6\u95F4","\u8FC7\u671F","Bandwidth","Expire"],"\u{1F1F8}\u{1F1F1}":["\u5E94\u6025","\u6D4B\u8BD5\u8282\u70B9"],"\u{1F1E6}\u{1F1E9}":["Andorra","\u5B89\u9053\u5C14"],"\u{1F1E6}\u{1F1EA}":["United Arab Emirates","\u963F\u8054\u914B","\u8FEA\u62DC","Dubai"],"\u{1F1E6}\u{1F1EB}":["Afghanistan","\u963F\u5BCC\u6C57"],"\u{1F1E6}\u{1F1F1}":["Albania","\u963F\u5C14\u5DF4\u5C3C\u4E9A","\u963F\u723E\u5DF4\u5C3C\u4E9E"],"\u{1F1E6}\u{1F1F2}":["Armenia","\u4E9A\u7F8E\u5C3C\u4E9A"],"\u{1F1E6}\u{1F1F7}":["Argentina","\u963F\u6839\u5EF7"],"\u{1F1E6}\u{1F1F9}":["Austria","\u5965\u5730\u5229","\u5967\u5730\u5229","\u7EF4\u4E5F\u7EB3"],"\u{1F1E6}\u{1F1FA}":["Australia","\u6FB3\u5927\u5229\u4E9A","\u6FB3\u6D32","\u58A8\u5C14\u672C","\u6089\u5C3C","\u571F\u6FB3","\u4EAC\u6FB3","\u5EE3\u6FB3","\u6EEC\u6FB3","\u6CAA\u6FB3","\u5E7F\u6FB3","Sydney"],"\u{1F1E6}\u{1F1FF}":["Azerbaijan","\u963F\u585E\u62DC\u7586"],"\u{1F1E7}\u{1F1E6}":["Bosnia and Herzegovina","\u6CE2\u9ED1\u5171\u548C\u56FD","\u6CE2\u9ED1"],"\u{1F1E7}\u{1F1E9}":["Bangladesh","\u5B5F\u52A0\u62C9\u56FD","\u5B5F\u52A0\u62C9"],"\u{1F1E7}\u{1F1EA}":["Belgium","\u6BD4\u5229\u65F6","\u6BD4\u5229\u6642"],"\u{1F1E7}\u{1F1EC}":["Bulgaria","\u4FDD\u52A0\u5229\u4E9A","\u4FDD\u52A0\u5229\u4E9E"],"\u{1F1E7}\u{1F1ED}":["Bahrain","\u5DF4\u6797"],"\u{1F1E7}\u{1F1F7}":["Brazil","\u5DF4\u897F","\u5723\u4FDD\u7F57"],"\u{1F1E7}\u{1F1F3}":["Brunei","\u6587\u83B1","\u6C76\u840A"],"\u{1F1E7}\u{1F1FE}":["Belarus","\u767D\u4FC4\u7F57\u65AF","\u767D\u4FC4"],"\u{1F1E7}\u{1F1F4}":["Bolivia","\u73BB\u5229\u7EF4\u4E9A"],"\u{1F1E7}\u{1F1F9}":["Bhutan","\u4E0D\u4E39","\u4E0D\u4E39\u738B\u56FD"],"\u{1F1E8}\u{1F1E6}":["Canada","\u52A0\u62FF\u5927","\u8499\u7279\u5229\u5C14","\u6E29\u54E5\u534E","\u6953\u8449","\u67AB\u53F6","\u6ED1\u94C1\u5362","\u591A\u4F26\u591A","Waterloo","Toronto"],"\u{1F1E8}\u{1F1ED}":["Switzerland","\u745E\u58EB","\u82CF\u9ECE\u4E16","Zurich"],"\u{1F1E8}\u{1F1F1}":["Chile","\u667A\u5229"],"\u{1F1E8}\u{1F1F4}":["Colombia","\u54E5\u4F26\u6BD4\u4E9A"],"\u{1F1E8}\u{1F1F7}":["Costa Rica","\u54E5\u65AF\u8FBE\u9ECE\u52A0"],"\u{1F1E8}\u{1F1FE}":["Cyprus","\u585E\u6D66\u8DEF\u65AF"],"\u{1F1E8}\u{1F1FF}":["Czechia","\u6377\u514B","Czech","Czech Republic"],"\u{1F1E9}\u{1F1EA}":["German","\u5FB7\u56FD","\u5FB7\u570B","\u4EAC\u5FB7","\u6EEC\u5FB7","\u5EE3\u5FB7","\u6CAA\u5FB7","\u5E7F\u5FB7","\u6CD5\u5170\u514B\u798F","Frankfurt","\u5FB7\u610F\u5FD7"],"\u{1F1E9}\u{1F1F0}":["Denmark","\u4E39\u9EA6","\u4E39\u9EA5"],"\u{1F1E9}\u{1F1FF}":["Algeria","\u963F\u5C14\u53CA\u5229\u4E9A","\u963F\u723E\u53CA\u5229\u4E9E"],"\u{1F1EA}\u{1F1E8}":["Ecuador","\u5384\u74DC\u591A\u5C14"],"\u{1F1EA}\u{1F1EA}":["Estonia","\u7231\u6C99\u5C3C\u4E9A"],"\u{1F1EA}\u{1F1EC}":["Egypt","\u57C3\u53CA"],"\u{1F1EA}\u{1F1F8}":["Spain","\u897F\u73ED\u7259"],"\u{1F1EA}\u{1F1FA}":["European Union","\u6B27\u76DF","\u6B27\u7F57\u5DF4"],"\u{1F1EB}\u{1F1EE}":["Finland","\u82AC\u5170","\u82AC\u862D","\u8D6B\u5C14\u8F9B\u57FA"],"\u{1F1EB}\u{1F1F7}":["France","\u6CD5\u56FD","\u6CD5\u570B","\u5DF4\u9ECE"],"\u{1F1EC}\u{1F1E7}":["Great Britain","\u82F1\u56FD","England","United Kingdom","\u4F26\u6566","\u82F1","London"],"\u{1F1EC}\u{1F1EA}":["Georgia","\u683C\u9C81\u5409\u4E9A","\u683C\u9B6F\u5409\u4E9E"],"\u{1F1EC}\u{1F1F7}":["Greece","\u5E0C\u814A","\u5E0C\u81D8"],"\u{1F1EC}\u{1F1FA}":["Guam","\u5173\u5C9B","\u95DC\u5CF6"],"\u{1F1EC}\u{1F1F9}":["Guatemala","\u5371\u5730\u9A6C\u62C9"],"\u{1F1ED}\u{1F1F0}":["Hongkong","\u9999\u6E2F","Hong Kong","HongKong","HONG KONG","\u6DF1\u6E2F","\u6CAA\u6E2F","\u547C\u6E2F","\u7A57\u6E2F","\u4EAC\u6E2F","\u6E2F"],"\u{1F1ED}\u{1F1F7}":["Croatia","\u514B\u7F57\u5730\u4E9A","\u514B\u7F85\u5730\u4E9E"],"\u{1F1ED}\u{1F1FA}":["Hungary","\u5308\u7259\u5229"],"\u{1F1EE}\u{1F1F6}":["Iraq","\u4F0A\u62C9\u514B","\u5DF4\u683C\u8FBE","Baghdad"],"\u{1F1EF}\u{1F1F4}":["Jordan","\u7EA6\u65E6"],"\u{1F1EF}\u{1F1F5}":["Japan","\u65E5\u672C","\u4E1C\u4EAC","\u5927\u962A","\u57FC\u7389","\u6CAA\u65E5","\u7A57\u65E5","\u5DDD\u65E5","\u4E2D\u65E5","\u6CC9\u65E5","\u676D\u65E5","\u6DF1\u65E5","\u8FBD\u65E5","\u5E7F\u65E5","\u5927\u5742","Osaka","Tokyo"],"\u{1F1F0}\u{1F1EA}":["Kenya","\u80AF\u5C3C\u4E9A"],"\u{1F1F0}\u{1F1EC}":["Kyrgyzstan","\u5409\u5C14\u5409\u65AF\u65AF\u5766"],"\u{1F1F0}\u{1F1ED}":["Cambodia","\u67EC\u57D4\u5BE8"],"\u{1F1F0}\u{1F1F5}":["North Korea","\u671D\u9C9C"],"\u{1F1F0}\u{1F1F7}":["Korea","\u97E9\u56FD","\u97D3\u570B","\u97E9","\u97D3","\u9996\u5C14","\u6625\u5DDD","Chuncheon","Seoul"],"\u{1F1F0}\u{1F1FF}":["Kazakhstan","\u54C8\u8428\u514B\u65AF\u5766","\u54C8\u8428\u514B"],"\u{1F1EE}\u{1F1E9}":["Indonesia","\u5370\u5C3C","\u5370\u5EA6\u5C3C\u897F\u4E9A","\u96C5\u52A0\u8FBE"],"\u{1F1EE}\u{1F1EA}":["Ireland","\u7231\u5C14\u5170","\u611B\u723E\u862D","\u90FD\u67CF\u6797"],"\u{1F1EE}\u{1F1F1}":["Israel","\u4EE5\u8272\u5217"],"\u{1F1EE}\u{1F1F2}":["Isle of Man","\u9A6C\u6069\u5C9B","\u99AC\u6069\u5CF6"],"\u{1F1EE}\u{1F1F3}":["India","\u5370\u5EA6","\u5B5F\u4E70","MFumbai","Mumbai"],"\u{1F1EE}\u{1F1F7}":["Iran","\u4F0A\u6717"],"\u{1F1EE}\u{1F1F8}":["Iceland","\u51B0\u5C9B","\u51B0\u5CF6"],"\u{1F1EE}\u{1F1F9}":["Italy","\u610F\u5927\u5229","\u7FA9\u5927\u5229","\u7C73\u5170","Nachash"],"\u{1F1F1}\u{1F1F0}":["Sri Lanka","\u65AF\u91CC\u5170\u5361","\u65AF\u91CC\u862D\u5361"],"\u{1F1F1}\u{1F1E6}":["Laos","\u8001\u631D","\u8001\u64BE"],"\u{1F1F1}\u{1F1F9}":["Lithuania","\u7ACB\u9676\u5B9B"],"\u{1F1F1}\u{1F1FA}":["Luxembourg","\u5362\u68EE\u5821"],"\u{1F1F1}\u{1F1FB}":["Latvia","\u62C9\u8131\u7EF4\u4E9A","Latvija"],"\u{1F1F2}\u{1F1E6}":["Morocco","\u6469\u6D1B\u54E5"],"\u{1F1F2}\u{1F1E9}":["Moldova","\u6469\u5C14\u591A\u74E6","\u6469\u723E\u591A\u74E6"],"\u{1F1F2}\u{1F1F2}":["Myanmar","\u7F05\u7538","\u7DEC\u7538"],"\u{1F1F3}\u{1F1EC}":["Nigeria","\u5C3C\u65E5\u5229\u4E9A","\u5C3C\u65E5\u5229\u4E9E"],"\u{1F1F2}\u{1F1F0}":["Macedonia","\u9A6C\u5176\u987F","\u99AC\u5176\u9813"],"\u{1F1F2}\u{1F1F3}":["Mongolia","\u8499\u53E4"],"\u{1F1F2}\u{1F1F4}":["Macao","\u6FB3\u95E8","\u6FB3\u9580","CTM"],"\u{1F1F2}\u{1F1F9}":["Malta","\u9A6C\u8033\u4ED6"],"\u{1F1F2}\u{1F1FD}":["Mexico","\u58A8\u897F\u54E5"],"\u{1F1F2}\u{1F1FE}":["Malaysia","\u9A6C\u6765","\u99AC\u4F86","\u5409\u9686\u5761","\u5927\u99AC"],"\u{1F1F3}\u{1F1F1}":["Netherlands","\u8377\u5170","\u8377\u862D","\u5C3C\u5FB7\u862D","\u963F\u59C6\u65AF\u7279\u4E39","Amsterdam"],"\u{1F1F3}\u{1F1F4}":["Norway","\u632A\u5A01"],"\u{1F1F3}\u{1F1F5}":["Nepal","\u5C3C\u6CCA\u5C14"],"\u{1F1F3}\u{1F1FF}":["New Zealand","\u65B0\u897F\u5170","\u65B0\u897F\u862D"],"\u{1F1F5}\u{1F1E6}":["Panama","\u5DF4\u62FF\u9A6C"],"\u{1F1F5}\u{1F1EA}":["Peru","\u79D8\u9C81","\u7955\u9B6F"],"\u{1F1F5}\u{1F1ED}":["Philippines","\u83F2\u5F8B\u5BBE","\u83F2\u5F8B\u8CD3"],"\u{1F1F5}\u{1F1F0}":["Pakistan","\u5DF4\u57FA\u65AF\u5766"],"\u{1F1F5}\u{1F1F1}":["Poland","\u6CE2\u5170","\u6CE2\u862D","\u534E\u6C99","Warsaw"],"\u{1F1F5}\u{1F1F7}":["Puerto Rico","\u6CE2\u591A\u9ECE\u5404"],"\u{1F1F5}\u{1F1F9}":["Portugal","\u8461\u8404\u7259"],"\u{1F1F5}\u{1F1EC}":["Papua New Guinea","\u5DF4\u5E03\u4E9A\u65B0\u51E0\u5185\u4E9A"],"\u{1F1F5}\u{1F1FE}":["Paraguay","\u5DF4\u62C9\u572D"],"\u{1F1F7}\u{1F1F4}":["Romania","\u7F57\u9A6C\u5C3C\u4E9A"],"\u{1F1F7}\u{1F1F8}":["Serbia","\u585E\u5C14\u7EF4\u4E9A"],"\u{1F1F7}\u{1F1EA}":["R\xE9union","\u7559\u5C3C\u6C6A","\u6CD5\u5C5E\u7559\u5C3C\u6C6A"],"\u{1F1F7}\u{1F1FA}":["Russia","\u4FC4\u7F57\u65AF","\u4FC4\u56FD","\u4FC4\u7F85\u65AF","\u4F2F\u529B","\u83AB\u65AF\u79D1","\u5723\u5F7C\u5F97\u5821","\u897F\u4F2F\u5229\u4E9A","\u4EAC\u4FC4","\u676D\u4FC4","\u5EE3\u4FC4","\u6EEC\u4FC4","\u5E7F\u4FC4","\u6CAA\u4FC4","Moscow"],"\u{1F1F8}\u{1F1E6}":["Saudi","\u6C99\u7279\u963F\u62C9\u4F2F","\u6C99\u7279","Riyadh","\u5229\u96C5\u5F97"],"\u{1F1F8}\u{1F1EA}":["Sweden","\u745E\u5178","\u65AF\u5FB7\u54E5\u5C14\u6469","Stockholm"],"\u{1F1F8}\u{1F1EC}":["Singapore","\u65B0\u52A0\u5761","\u72EE\u57CE","\u6CAA\u65B0","\u4EAC\u65B0","\u4E2D\u65B0","\u6CC9\u65B0","\u7A57\u65B0","\u6DF1\u65B0","\u676D\u65B0","\u5E7F\u65B0","\u5EE3\u65B0","\u6EEC\u65B0"],"\u{1F1F8}\u{1F1EE}":["Slovenia","\u65AF\u6D1B\u6587\u5C3C\u4E9A"],"\u{1F1F8}\u{1F1F0}":["Slovakia","\u65AF\u6D1B\u4F10\u514B"],"\u{1F1F9}\u{1F1EC}":["Togo","\u591A\u54E5","\u6D1B\u7F8E","Lom\xE9","Lome"],"\u{1F1F9}\u{1F1ED}":["Thailand","\u6CF0\u56FD","\u6CF0\u570B","\u66FC\u8C37"],"\u{1F1F9}\u{1F1F3}":["Tunisia","\u7A81\u5C3C\u65AF"],"\u{1F1F9}\u{1F1F7}":["Turkey","\u571F\u8033\u5176","\u4F0A\u65AF\u5766\u5E03\u5C14","Istanbul"],"\u{1F1F9}\u{1F1FC}":["Taiwan","\u53F0\u6E7E","\u81FA\u7063","\u53F0\u7063","\u4E2D\u83EF\u6C11\u570B","\u4E2D\u534E\u6C11\u56FD","\u53F0\u5317","\u53F0\u4E2D","\u65B0\u5317","\u5F70\u5316","\u53F0","\u81FA","Taipei","Tai Wan"],"\u{1F1FA}\u{1F1E6}":["Ukraine","\u4E4C\u514B\u5170","\u70CF\u514B\u862D"],"\u{1F1FA}\u{1F1F8}":["United States","\u7F8E\u56FD","America","\u7F8E","\u4EAC\u7F8E","\u6CE2\u7279\u5170","\u8FBE\u62C9\u65AF","\u4FC4\u52D2\u5188","Oregon","\u51E4\u51F0\u57CE","\u8D39\u5229\u8499","\u7845\u8C37","\u77FD\u8C37","\u62C9\u65AF\u7EF4\u52A0\u65AF","\u6D1B\u6749\u77F6","\u5723\u4F55\u585E","\u5723\u514B\u62C9\u62C9","\u897F\u96C5\u56FE","\u829D\u52A0\u54E5","\u6CAA\u7F8E","\u54E5\u4F26\u5E03","\u7EBD\u7EA6","New York","Los Angeles","San Jose","Sillicon Valley","Michigan","\u4FC4\u4EA5\u4FC4","Ohio","\u9A6C\u7EB3\u8428\u65AF","Manassas","\u5F17\u5409\u5C3C\u4E9A","Virginia"],"\u{1F1FA}\u{1F1FE}":["Uruguay","\u4E4C\u62C9\u572D"],"\u{1F1FB}\u{1F1E6}":["Vatican","Vatican City","Holy See","\u68B5\u8482\u5188","\u68B5\u8482\u5CA1"],"\u{1F1FB}\u{1F1EA}":["Venezuela","\u59D4\u5185\u745E\u62C9"],"\u{1F1FB}\u{1F1F3}":["Vietnam","\u8D8A\u5357","\u80E1\u5FD7\u660E"],"\u{1F1FF}\u{1F1E6}":["South Africa","\u5357\u975E"],"\u{1F1E8}\u{1F1F3}":["China","\u4E2D\u56FD","\u4E2D\u570B","\u56DE\u56FD","\u56DE\u570B","\u56FD\u5185","\u570B\u5167","\u534E\u4E1C","\u534E\u897F","\u534E\u5357","\u534E\u5317","\u534E\u4E2D","\u6C5F\u82CF","\u5317\u4EAC","\u4E0A\u6D77","\u5E7F\u5DDE","\u6DF1\u5733","\u676D\u5DDE","\u5F90\u5DDE","\u9752\u5C9B","\u5B81\u6CE2","\u9547\u6C5F"]},r=e.match(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/)?.[0]||"\u{1F3F4}\u200D\u2620\uFE0F";for(let n of Object.keys(t))if(t[n].some(a=>RegExp(`${a}`,"i").test(e)))return/内蒙古/.test(e)&&["\u{1F1F2}\u{1F1F3}"].includes(n)?r="\u{1F1E8}\u{1F1F3}":r=n;for(let n of Object.keys(kg))if(kg[n].some(a=>RegExp(`(^|[^a-zA-Z])${a}([^a-zA-Z]|$)`).test(e))&&!(n=="\u{1F1E8}\u{1F1F3}"&&RegExp("(^|[^a-zA-Z])CN2([^a-zA-Z]|$)").test(e)))return r=n;return r}function Ny(e){return kg[Kl(e)]?.[0]}function gf(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴‍☠️|🏳️‍🌈/g,"").trim()}var od=class{constructor({country,asn}={}){if(J.env.isNode){let Reader=eval('require("@maxmind/geoip2-node")').Reader,fs=eval("require('fs')"),countryFile=country||eval("process.env.SUB_STORE_MMDB_COUNTRY_PATH"),asnFile=asn||eval("process.env.SUB_STORE_MMDB_ASN_PATH");if(countryFile&&(this.countryReader=Reader.openBuffer(fs.readFileSync(countryFile))),asnFile){if(!fs.existsSync(asnFile))throw new Error("GeoLite2 ASN MMDB does not exist");this.asnReader=Reader.openBuffer(fs.readFileSync(asnFile))}}}geoip(e){return this.countryReader?.country(e)?.country?.isoCode}ipaso(e){return this.asnReader?.asn(e)?.autonomousSystemOrganization}ipasn(e){return this.asnReader?.asn(e)?.autonomousSystemNumber}};var fd=yn(Yy()),zg=yn(z0());async function Gl({url:e,domain:t,type:r="A",timeout:n,edns:i}){let a=fd.default.encode({type:"query",id:0,flags:fd.default.RECURSION_DESIRED,questions:[{type:r,name:t}],additionals:[{type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:i,sourcePrefixLength:Rr(i)?24:56,scopePrefixLength:0}]}]}),u=zg.Buffer.from(a).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),l=await J.http.get({url:`${e}?dns=${encodeURIComponent(u)}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:n});return fd.default.decode(zg.Buffer.from(J.env.isQX?l.bodyBytes:l.body))}var Wg=yn(Gg());var{isNode:Wy,isQX:jT,isLoon:HT,isSurge:MT,isStash:qT,isShadowRocket:VT,isLanceX:KT,isEgern:zT,isGUIforCores:GT}=ks(),ea="Node";Wy&&(ea="Node");jT&&(ea="QX");HT&&(ea="Loon");MT&&(ea="Surge");qT&&(ea="Stash");VT&&(ea="ShadowRocket");zT&&(ea="Egern");KT&&(ea="LanceX");GT&&(ea="GUI.for.Cores");var Po={},YT={};try{if(typeof $environment<"u"&&(Po.env=$environment),typeof $loon<"u"&&(Po.loon=$loon),typeof $script<"u"&&(Po.script=$script),typeof $Plugin<"u"&&(Po.plugin=$Plugin),Wy){Po.node={version:eval("process.version"),argv:eval("process.argv"),filename:eval("__filename"),dirname:eval("__dirname"),env:{}};let env=eval("process.env");for(let e in env)/^SUB_STORE_/.test(e)&&(Po.node.env[e]=env[e])}}catch(e){}var wf={backend:ea,version:o0,feature:YT,meta:Po};function WT(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Af(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function Zy(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(WT(r[n]))if(n.endsWith("!")){let i=Af(n.slice(0,-1));e[i]=r[n]}else{let i=Af(n);e[i]||Object.assign(e,{[i]:{}}),Zy(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=Af(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=Af(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=Af(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function XT({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>hd(e,r))}}function hd(e,t){if(!e.operator)switch(e.proposition){case"IN":return e.value.indexOf(t[e.attr])!==-1;case"CONTAINS":return typeof t[e.attr]!="string"?!1:t[e.attr].indexOf(e.value)!==-1;case"EQUALS":return t[e.attr]===e.value;case"EXISTS":return t[e.attr]!==null||typeof t[e.attr]<"u";default:throw new Error(`Unknown proposition: ${e.proposition}`)}switch(e.operator){case"AND":return e.child.every(r=>hd(r,t));case"OR":return e.child.some(r=>hd(r,t));case"NOT":return!hd(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function ZT(e){return{name:"Quick Setting Operator",func:r=>{if(t(e.useless)){let i=tC().func(r);r=r.filter((a,s)=>i[s]&&a.port>0&&a.port<=65535)}return r.map(n=>(n.udp=t(e.udp,n.udp),n.tfo=t(e.tfo,n.tfo),n["fast-open"]=t(e.tfo,n["fast-open"]),n["skip-cert-verify"]=t(e.scert,n["skip-cert-verify"]),n.type==="vmess"&&(n.aead=t(e["vmess aead"],n.aead)),n))}};function t(r,n){switch(r){case"ENABLED":return!0;case"DISABLED":return!1;default:return n}}}function JT({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=gf(n.name);else{let i=Kl(n.name);n.name=gf(n.name),n.name=i+" "+n.name,t=="ws"?n.name=n.name.replace(/🇹🇼/g,"\u{1F1FC}\u{1F1F8}"):t=="tw"||(n.name=n.name.replace(/🇹🇼/g,"\u{1F1E8}\u{1F1F3}"))}return n})}}function QT(e){let{action:t,template:r,link:n,position:i}={action:"rename",template:"0 1 2 3 4 5 6 7 8 9",link:"-",position:"back",...e};return{name:"Handle Duplicate Operator",func:a=>{if(t==="delete"){let s={};return a.filter(u=>s[u.name]?!1:(s[u.name]=!0,!0))}else if(t==="rename"){let s=r.split(" "),u={},l=0;a.forEach(d=>{typeof u[d.name]>"u"?u[d.name]=1:u[d.name]++,l=Math.max(u[d.name].toString().length,l)});let f={};return a.map(d=>{if(u[d.name]>1){typeof f[d.name]>"u"&&(f[d.name]=1);let m="",p=f[d.name]++,h=0;for(;p>0;)m=s[p%10]+m,p=parseInt(p/10),h++;for(;h++{switch(e){case"asc":case"desc":return t.sort((r,n)=>{let i=r.name>n.name?1:-1;return i*=e==="desc"?-1:1,i});case"random":return fO(t);default:throw new Error("Unknown sort option: "+e)}}}}function tO(e){let t=e.order||"asc",r=e.expressions;return Array.isArray(e)&&(r=e),Array.isArray(r)||(r=[]),{name:"Regex Sort Operator",func:n=>(r=r.map(i=>Xg(i)),n.sort((i,a)=>{let s=Xy(r,i.name),u=Xy(r,a.name);return s&&!u?-1:u&&!s?1:s&&u?st.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(Xg(n,"g"),i).trim();return r})}}function rO(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:Jy(t).func}}function nO(e,t,r,n,i){return{name:"Script Operator",func:async a=>{let s=a;if(s?.$file?.type==="mihomoProfile")try{let u=qs.safeLoad(e),l;if(s?.$content)try{l=qs.safeLoad(s?.$content)}catch(f){J.error(f.message??f)}if(typeof u!="object")throw new Error("patch is not an object");return s.$content=dr.yaml.safeDump(Zy(l||(s?.$file?.sourceType==="none"?{}:{proxies:await Qi({type:s?.$file?.sourceType||"collection",name:s?.$file?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0}})}),u)),s}catch{}return await async function(){s=dd("operator",e,r,i)(a,t,{source:n,...wf})}(),s},nodeFunc:async a=>{let s=a;return await async function(){s=dd("operator",`async function operator(input = []) { if (input && (input.$files || input.$content)) { let { $content, $files, $options, $file } = input if($file.type === 'mihomoProfile') { ${e} if(typeof main === 'function') { let config; if ($content) { try { config = ProxyUtils.yaml.safeLoad($content); } catch (e) { console.log(e.message ?? e); } } $content = ProxyUtils.yaml.safeDump(await main(config || ($file.sourceType === 'none' ? {} : { proxies: await produceArtifact({ type: $file.sourceType || 'collection', name: $file.sourceName, platform: 'mihomo', produceType: 'internal', produceOpts: { 'delete-underscore-fields': true } }), }))) } } else { ${e} } return { $content, $files, $options, $file } } else { let proxies = input let list = [] for await (let $server of proxies) { ${e} list.push($server) } return list } }`,r,i)(a,t,{source:n,...wf})}(),s}}}function iO(e){let t,r;try{let n=e.split(":");r=parseInt(n[2],16);let i=parseInt(n[3],16),a=parseInt(n[4],16),s=i>>8,u=i&255,l=a>>8,f=a&255;if(t=`${s}.${u}.${l}.${f}`,r<=0||r>65535)throw new Error(`Invalid port number: ${r}`);if(!Rr(t))throw new Error(`Invalid IP address: ${t}`)}catch(n){J.error(`IP4P \u89E3\u6790\u5931\u8D25: ${n}`)}return{server:t,port:r}}var Qy={Custom:async function(e,t,r,n,i,a){let s=hs(`CUSTOM:${a}:${e}:${t}`),u=Wr.get(s);if(!r&&u)return u;let l=t==="IPv6"?"AAAA":"A",f=await Gl({url:a,domain:e,type:l,timeout:n,edns:i}),{answers:d}=f;if(!Array.isArray(d)||d.length===0)throw new Error("No answers");let m=d.filter(p=>p?.type===l).map(p=>p?.data).filter(p=>p);if(m.length===0)throw new Error("No answers");return Wr.set(s,m),m},Google:async function(e,t,r,n,i){let a=hs(`GOOGLE:${e}:${t}`),s=Wr.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",l=await Gl({url:"https://8.8.4.4/dns-query",domain:e,type:u,timeout:n,edns:i}),{answers:f}=l;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let d=f.filter(m=>m?.type===u).map(m=>m?.data).filter(m=>m);if(d.length===0)throw new Error("No answers");return Wr.set(a,d),d},"IP-API":async function(e,t,r,n){if(["IPv6"].includes(t))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 IP-API \u4E0D\u652F\u6301 ${t}`);let i=hs(`IP-API:${e}`),a=Wr.get(i);if(!r&&a)return a;let s=await J.http.get({url:`http://ip-api.com/json/${encodeURIComponent(e)}?lang=zh-CN`,timeout:n}),u=JSON.parse(s.body);if(u.status!=="success")throw new Error(`Status is ${u.status}`);if(!u.query||u.query===0)throw new Error("No answers");let l=[u.query];if(l.length===0)throw new Error("No answers");return Wr.set(i,l),l},Cloudflare:async function(e,t,r,n,i){let a=hs(`CLOUDFLARE:${e}:${t}`),s=Wr.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",l=await Gl({url:"https://1.0.0.1/dns-query",domain:e,type:u,timeout:n,edns:i}),{answers:f}=l;if(!Array.isArray(f)||f.length===0)throw new Error("No answers");let d=f.filter(m=>m?.type===u).map(m=>m?.data).filter(m=>m);if(d.length===0)throw new Error("No answers");return Wr.set(a,d),d},Ali:async function(e,t,r,n,i){let a=hs(`ALI:${e}:${t}`),s=Wr.get(a);if(!r&&s)return s;let u=await J.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${i}/${Rr(i)?24:56}&name=${encodeURIComponent(e)}&type=${t==="IPv6"?"AAAA":"A"}&short=1`,headers:{accept:"application/dns-json"},timeout:n}),l=JSON.parse(u.body);if(!Array.isArray(l)||l.length===0)throw new Error("No answers");let f=l;if(f.length===0)throw new Error("No answers");return Wr.set(a,f),f},Tencent:async function(e,t,r,n,i){let a=hs(`TENCENT:${e}:${t}`),s=Wr.get(a);if(!r&&s)return s;let l=(await J.http.get({url:`http://119.28.28.28/d?ip=${i}&type=${t==="IPv6"?"AAAA":"A"}&dn=${encodeURIComponent(e)}`,headers:{accept:"application/dns-json"},timeout:n})).body.split(";").map(d=>d.split(",")[0]);if(l.length===0||String(l)==="0")throw new Error("No answers");let f=l;if(f.length===0)throw new Error("No answers");return Wr.set(a,f),f}};function eC({provider:e,type:t,filter:r,cache:n,url:i,timeout:a,edns:s}){if(["IPv6","IP4P"].includes(t)&&["IP-API"].includes(e))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 ${e} \u4E0D\u652F\u6301 ${t}`);let{defaultTimeout:u}=J.read(ui),l=a||u||8e3,f=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",d=Qy[e];if(!d)throw new Error(`\u627E\u4E0D\u5230\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9: ${e}`);let m=s||"223.6.6.6";if(!$o(m))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");return J.info(`Domain Resolver: [${t}] ${e} ${m||""} ${i||""}`),{name:"Resolve Domain Operator",func:async p=>{p.forEach((g,b)=>{!g["_no-resolve"]&&g["no-resolve"]&&(p[b]["_no-resolve"]=g["no-resolve"])});let h={},w=15,v=[...new Set(p.filter(g=>!$o(g.server)&&!g["_no-resolve"]).map(g=>g.server))],y=Math.ceil(v.length/w);for(let g=0;g{h[D]=_,J.info(`Successfully resolved domain: ${D} \u279F ${_}`)}).catch(_=>{J.error(`Failed to resolve domain: ${D} with resolver [${e}]: ${_}`)}));await Promise.all(b)}return p.forEach(g=>{if(!g["_no-resolve"])if(h[g.server]){g._resolved_ips=h[g.server];let b=Array.isArray(h[g.server])?h[g.server][Math.floor(Math.random()*h[g.server].length)]:h[g.server];if(f==="IPv6"&&Ur(b)){try{b=new F0.Address6(b).correctForm()}catch(D){J.error(`Failed to parse IPv6 address: ${b}: ${D}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(b)){g._IP4P=b;let{server:D,port:_}=iO(b);D&&_?(g._domain=g.server,g.server=D,g.port=_,g.resolved=!0,g._IPv4=g.server,$o(g._IP)||(g._IP=g.server)):g.resolved||(g.resolved=!1)}else g._domain=g.server,g.server=b,g.resolved=!0,g[`_${f}`]=g.server,$o(g._IP)||(g._IP=g.server)}else g._domain=g.server,g.server=b,g.resolved=!0,g[`_${f}`]=g.server,$o(g._IP)||(g._IP=g.server)}else g.resolved||(g.resolved=!1)}),p.filter(g=>r==="removeFailed"?$o(g.server)||g["_no-resolve"]||g.resolved:r==="IPOnly"?$o(g.server):r==="IPv4Only"?Rr(g.server):r==="IPv6Only"?Ur(g.server):!0)}}}function $o(e){return Rr(e)||Ur(e)}eC.resolver=Qy;function Yg(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function tC(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!Yg(t.cipher))return!1;if(t.password&&!Yg(t.password))return!1;if(t.network){let r=t[`${t.network}-opts`]?.headers?.Host||t[`${t.network}-opts`]?.headers?.host;if(r=Array.isArray(r)?r:[r],r.some(n=>n&&!Yg(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function sO(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0,n={HK:"\u{1F1ED}\u{1F1F0}",TW:"\u{1F1F9}\u{1F1FC}",US:"\u{1F1FA}\u{1F1F8}",SG:"\u{1F1F8}\u{1F1EC}",JP:"\u{1F1EF}\u{1F1F5}",UK:"\u{1F1EC}\u{1F1E7}",DE:"\u{1F1E9}\u{1F1EA}",KR:"\u{1F1F0}\u{1F1F7}"};return{name:"Region Filter",func:i=>i.map(a=>{let s=Kl(a.name),u=t.some(l=>n[l]===s);return r?u:!u})}}function aO({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(a=>Xg(a).test(n.name));return t?i:!i})}}function Xg(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function uO(e){let t=e?.value||e;Array.isArray(t)||(t=[]);let r=e?.keep??!0;return{name:"Type Filter",func:n=>n.map(i=>{let a=t.some(s=>i.type===s);return r?a:!a})}}function oO(e,t,r,n,i){return{name:"Script Filter",func:async a=>{let s=ud(a.length,!0);return await async function(){s=dd("filter",e,r,i)(a,t,{source:n,...wf})}(),s},nodeFunc:async a=>{let s=ud(a.length,!0);return await async function(){s=dd("filter",`async function filter(input = []) { let proxies = input let list = [] const fn = async ($server) => { ${e} } for await (let $server of proxies) { list.push(await fn($server)) } return list }`,r,i)(a,t,{source:n,...wf})}(),s}}}var pd={"Useless Filter":tC,"Region Filter":sO,"Regex Filter":aO,"Type Filter":uO,"Script Filter":oO,"Conditional Filter":XT,"Quick Setting Operator":ZT,"Flag Operator":JT,"Sort Operator":eO,"Regex Sort Operator":tO,"Regex Rename Operator":Jy,"Regex Delete Operator":rO,"Script Operator":nO,"Handle Duplicate Operator":QT,"Resolve Domain Operator":eC};async function lO(e,t){let r=ud(t.length,!0);try{r=await e.func(t)}catch(n){let i="",a=`${n.message??n}`;a.includes("$server is not defined")?i="":(J.error(`Cannot apply filter ${e.name}(function filter)! Reason: ${n}`),i=`\u6267\u884C function filter \u5931\u8D25 ${a}; `);try{r=await e.nodeFunc(t)}catch(s){J.error(`Cannot apply filter ${e.name}(shortcut script)! Reason: ${s}`);let u="",l=`${s.message??s}`;throw i&&l===a?(u="",i=`\u6267\u884C\u5931\u8D25 ${a}`):u=`\u6267\u884C\u5FEB\u6377\u8FC7\u6EE4\u811A\u672C \u5931\u8D25 ${l}`,new Error(`\u811A\u672C\u8FC7\u6EE4 ${i}${u}`)}}return t.filter((n,i)=>r[i])}async function cO(e,t){let r=hO(t);try{let n=await e.func(r);n&&(r=n)}catch(n){let i="",a=`${n.message??n}`;a.includes("$server is not defined")||a.includes("$content is not defined")||a.includes("$files is not defined")||r?.$files||r?.$content?i="":(J.error(`Cannot apply operator ${e.name}(function operator)! Reason: ${n}`),i=`\u6267\u884C function operator \u5931\u8D25 ${a}; `);try{let s=await e.nodeFunc(r);s&&(r=s)}catch(s){J.error(`Cannot apply operator ${e.name}(shortcut script)! Reason: ${s}`);let u="",l=`${s.message??s}`;throw i&&l===a?(u="",i=`\u6267\u884C\u5931\u8D25 ${a}`):u=`\u6267\u884C\u5FEB\u6377\u811A\u672C \u5931\u8D25 ${l}`,new Error(`\u811A\u672C\u64CD\u4F5C ${i}${u}`)}}return r}async function rC(e,t){if(e.name.indexOf("Filter")!==-1)return lO(e,t);if(e.name.indexOf("Operator")!==-1)return cO(e,t)}function fO(e){let t=e.length,r,n;for(;t!==0;)n=Math.floor(Math.random()*t),t-=1,r=e[t],e[t]=e[n],e[n]=r;return e}function hO(e){return JSON.parse(JSON.stringify(e))}function dd(name,script,$arguments,$options){let flowUtils={getFlowField:Fl,getFlowHeaders:I0,parseFlowHeaders:B0,flowTransfer:Qc,validCheck:x0,getRmainingDays:WA,normalizeFlowHeader:XA};return J.env.isLoon?new Function("$arguments","$options","$substore","lodash","$persistentStore","$httpClient","$notification","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script} return ${name}`)($arguments,$options,J,Wg.default,$persistentStore,$httpClient,$notification,dr,dr.yaml,dr.Buffer,dr.Base64.decode,dr.Base64.encode,Og,flowUtils,Qi,eval('typeof require !== "undefined"')?ho:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script} return ${name}`)($arguments,$options,J,Wg.default,dr,dr.yaml,dr.Buffer,dr.Base64.decode,dr.Base64.encode,Og,flowUtils,Qi,eval('typeof require !== "undefined"')?ho:void 0)}var nC=yn(Gg()),lt=class{constructor(t){this.proxy=t,this.output=[]}append(t){if(typeof t>"u")throw new Error("required field is missing");this.output.push(t)}appendIfPresent(t,r){ue(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}};function ue(e,t){let r=nC.default.get(e,t);return typeof r<"u"&&r!==null}var dO="Surge",es={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function Wl(){return{produce:(t,r,n={})=>{switch(t.name=t.name.replace(/=|,/g,""),t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return pO(t,n["include-unsupported-proxy"]);case"trojan":return gO(t);case"vmess":return mO(t,n["include-unsupported-proxy"]);case"http":return wO(t);case"direct":return AO(t);case"socks5":return EO(t);case"snell":return bO(t);case"tuic":return yO(t);case"wireguard-surge":return _O(t);case"hysteria2":return DO(t);case"ssh":return vO(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return CO(t);throw new Error(`Platform ${dO} does not support proxy type: ${t.type}`)}}}function pO(e){let t=new lt(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),e.cipher||(e.cipher="none"),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","none","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=es[e["ip-version"]]||e["ip-version"];if(t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),ue(e,"plugin")){if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else if(!["shadow-tls"].includes(e.plugin))throw new Error(`plugin ${e.plugin} is not supported`)}if(t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}return t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function gO(e){let t=new lt(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),iC(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function mO(e,t){let r=new lt(e);r.append(`${e.name}=${e.type},${e.server},${e.port}`),r.appendIfPresent(`,username=${e.uuid}`,"uuid");let n=es[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-version=${n}`,"ip-version"),r.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),iC(r,e,t),ue(e,"aead")?r.append(`,vmess-aead=${e.aead}`):r.append(`,vmess-aead=${e.alterId===0}`),r.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),r.appendIfPresent(`,tls=${e.tls}`,"tls"),r.appendIfPresent(`,sni=${e.sni}`,"sni"),r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),r.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),r.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),r.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),r.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),r.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),r.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),r.appendIfPresent(`,tos=${e.tos}`,"tos"),r.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),r.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(r.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),r.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),r.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),r.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),r.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),r.toString()}function vO(e){let t=new lt(e);t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,private-key=${e["keystore-private-key"]}`,"keystore-private-key"),t.appendIfPresent(`,idle-timeout=${e["idle-timeout"]}`,"idle-timeout"),t.appendIfPresent(`,server-fingerprint="${e["server-fingerprint"]}"`,"server-fingerprint");let r=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function wO(e){if(e.headers&&Object.keys(e.headers).length>0)throw new Error("headers is unsupported");let t=new lt(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password");let n=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function AO(e){let t=new lt(e);t.append(`${e.name}=direct`);let n=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function EO(e){let t=new lt(e),r=e.tls?"socks5-tls":"socks5";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password");let n=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e.tfo&&J.info("Option tfo is not supported by Surge, thus omitted"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function bO(e){let t=new lt(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk=${e.psk}`,"psk");let r=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,obfs=${e["obfs-opts"]?.mode}`,"obfs-opts.mode"),t.appendIfPresent(`,obfs-host=${e["obfs-opts"]?.host}`,"obfs-opts.host"),t.appendIfPresent(`,obfs-uri=${e["obfs-opts"]?.path}`,"obfs-opts.path"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),t.toString()}function yO(e){let t=new lt(e),r=e.type;(!e.token||e.token.length===0)&&(r="tuic-v5"),t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,token=${e.token}`,"token"),t.appendIfPresent(`,alpn=${Array.isArray(e.alpn)?e.alpn[0]:e.alpn}`,"alpn"),ue(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let n=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${n}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn"),t.toString()}function CO(e){Array.isArray(e.peers)&&e.peers.length>0&&(e.server=e.peers[0].server,e.port=e.peers[0].port,e.ip=e.peers[0].ip,e.ipv6=e.peers[0].ipv6,e["public-key"]=e.peers[0]["public-key"],e["preshared-key"]=e.peers[0]["pre-shared-key"],e["allowed-ips"]=e.peers[0]["allowed-ips"],e.reserved=e.peers[0].reserved);let t=new lt(e);t.append(`# > WireGuard Proxy ${e.name} # ${e.name}=wireguard`),e["section-name"]=Jt(e["section-name"],e.name),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert");let r=es[e["ip-version"]]||e["ip-version"];t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.append(` # > WireGuard Section ${e.name} [WireGuard ${e["section-name"]}] private-key = ${e["private-key"]}`),t.appendIfPresent(` self-ip = ${e.ip}`,"ip"),t.appendIfPresent(` self-ip-v6 = ${e.ipv6}`,"ipv6"),e.dns&&(Array.isArray(e.dns)&&(e.dns=e.dns.join(", ")),t.append(` dns-server = ${e.dns}`)),t.appendIfPresent(` mtu = ${e.mtu}`,"mtu"),r==="prefer-v6"&&t.append(` prefer-ipv6 = true`);let n=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],i=Array.isArray(e.reserved)?e.reserved.join("/"):e.reserved,a=e["preshared-key"]??e["pre-shared-key"],s={"public-key":e["public-key"],"allowed-ips":n?`"${n}"`:void 0,endpoint:`${e.server}:${e.port}`,keepalive:e["persistent-keepalive"]||e.keepalive,"client-id":i,"preshared-key":a};return t.append(` peer = (${Object.keys(s).filter(u=>s[u]!=null).map(u=>`${u} = ${s[u]}`).join(", ")})`),t.toString()}function _O(e){let t=new lt(e);t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert");let r=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.toString()}function DO(e){if(e.obfs||e["obfs-password"])throw new Error("obfs is unsupported");let t=new lt(e);t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),ue(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let r=es[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-version=${r}`,"ip-version"),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,server-cert-fingerprint-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,test-timeout=${e["test-timeout"]}`,"test-timeout"),t.appendIfPresent(`,test-udp=${e["test-udp"]}`,"test-udp"),t.appendIfPresent(`,hybrid=${e.hybrid}`,"hybrid"),t.appendIfPresent(`,tos=${e.tos}`,"tos"),t.appendIfPresent(`,allow-other-interface=${e["allow-other-interface"]}`,"allow-other-interface"),t.appendIfPresent(`,interface=${e["interface-name"]}`,"interface-name"),ue(e,"shadow-tls-password")&&(t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni")),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.appendIfPresent(`,underlying-proxy=${e["underlying-proxy"]}`,"underlying-proxy"),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn"),t.toString()}function iC(e,t,r){if(ue(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ue(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ue(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,i=Object.keys(n).map(a=>{let s=n[a];return s=`"${s}"`,`${a}:${s}`}).join("|");Hs(i)&&e.append(`,ws-headers=${i}`)}}else if(r&&["http"].includes(t.network))J.info(`Include Unsupported Proxy: nework ${t.network} -> tcp`);else throw new Error(`network ${t.network} is unsupported`)}var FO={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function Ri(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&s.version>=4||["juicity"].includes(s.type)||["ss"].includes(s.type)&&!["aes-128-ctr","aes-192-ctr","aes-256-ctr","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-ccm","aes-192-ccm","aes-256-ccm","aes-128-gcm-siv","aes-256-gcm-siv","chacha20-ietf","chacha20","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","chacha8-ietf-poly1305","xchacha8-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm","2022-blake3-chacha20-poly1305","lea-128-gcm","lea-192-gcm","lea-256-gcm","rabbit128-poly1305","aegis-128l","aegis-256","aez-384","deoxys-ii-256-128","rc4-md5","none"].includes(s.cipher)||["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"])?!1:!["xhttp"].includes(s.network)).map(s=>{if(s.type==="vmess"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5)):s.type==="hysteria"?(ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo)):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"?ue(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"&&ue(s,"shadow-tls-password")&&!ue(s,"plugin")&&(s.plugin="shadow-tls",s["plugin-opts"]={host:s["shadow-tls-sni"],password:s["shadow-tls-password"],version:s["shadow-tls-version"]},delete s["shadow-tls-password"],delete s["shadow-tls-sni"],delete s["shadow-tls-version"]),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let l=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",m=""]=l.exec(u);s[`${s.network}-opts`].path=d,m!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(m,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal"||i["delete-underscore-fields"])for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s["ip-version"]&&(s["ip-version"]=FO[s["ip-version"]]||s["ip-version"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var sC="SurgeMac",SO=Wl();function Zg(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return aC(t);default:try{return SO.produce(t,r,n)}catch{if(n.useMihomoExternal)return J.log(`${t.name} is not supported on ${sC}, try to use Mihomo(SurgeMac - External Proxy Program) instead`),IO(t,r,n);throw new Error("Surge for macOS \u53EF\u624B\u52A8\u6307\u5B9A\u94FE\u63A5\u53C2\u6570 target=SurgeMac \u6216\u5728 \u540C\u6B65\u914D\u7F6E \u4E2D\u6307\u5B9A SurgeMac \u6765\u542F\u7528 mihomo \u652F\u63F4 Surge \u672C\u8EAB\u4E0D\u652F\u6301\u7684\u534F\u8BAE")}}}}}function aC(e){let t=new lt(e);if(!e.exec||!e["local-port"])throw new Error(`${e.type}: exec and local-port are required`);return t.append(`${e.name}=external,exec="${e.exec}",local-port=${e["local-port"]}`),Array.isArray(e.args)&&e.args.map(r=>{t.append(`,args="${r}"`)}),Array.isArray(e.addresses)&&e.addresses.map(r=>{t.append(`,addresses=${r}`)}),t.appendIfPresent(`,no-error-alert=${e["no-error-alert"]}`,"no-error-alert"),ue(e,"tfo")?t.append(`,tfo=${e.tfo}`):ue(e,"fast-open")&&t.append(`,tfo=${e["fast-open"]}`),t.appendIfPresent(`,test-url=${e["test-url"]}`,"test-url"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function IO(e,t,r){let n=Ri().produce([e],"internal")?.[0];if(n){let i=r?.localPort||e._localPort||65535,a=!["ipv4","v4-only"].includes(e["ip-version"]),s={name:e.name,type:"external",exec:e._exec||"/usr/local/bin/mihomo","local-port":i,args:["-config",yt.encode(JSON.stringify({"mixed-port":i,ipv6:a,mode:"global",dns:{enable:!0,ipv6:a,"default-nameserver":r?.defaultNameserver||e._defaultNameserver||["180.76.76.76","52.80.52.52","119.28.28.28","223.6.6.6"],nameserver:r?.nameserver||e._nameserver||["https://doh.pub/dns-query","https://dns.alidns.com/dns-query","https://doh-pure.onedns.net/dns-query"]},proxies:[{...n,name:"proxy"}],"proxy-groups":[{name:"GLOBAL",type:"select",proxies:["proxy"]}]}))],addresses:[]};return BO(e.server)?s.addresses.push(e.server):J.log(`Platform ${sC}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),r.localPort=i-1,aC(s)}}function BO(e){return Rr(e)||Ur(e)}function Jg(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:!["ss","ssr","vmess","vless","socks5","http","snell","trojan","wireguard"].includes(s.type)||s.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305"].includes(s.cipher)||s.type==="snell"&&s.version>=4||s.type==="vless"&&(typeof s.flow<"u"||s["reality-opts"])?!1:s["underlying-proxy"]||s["dialer-proxy"]?(J.error(`Clash \u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${s.name}`),!1):!0).map(s=>{if(s.type==="vmess"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"&&ue(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let l=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",m=""]=l.exec(u);s[`${s.network}-opts`].path=d,m!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(m,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal")for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}function gd(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>!["ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","wireguard","hysteria","hysteria2","ssh","juicity"].includes(s.type)||s.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher)||s.type==="snell"&&s.version>=4||s.type==="vless"&&s["reality-opts"]&&!["xtls-rprx-vision"].includes(s.flow)?!1:s["underlying-proxy"]||s["dialer-proxy"]?(J.error(`Stash \u6682\u4E0D\u652F\u6301\u524D\u7F6E\u4EE3\u7406\u5B57\u6BB5. \u5DF2\u8FC7\u6EE4\u8282\u70B9 ${s.name}. \u8BF7\u4F7F\u7528 \u4EE3\u7406\u7684\u8F6C\u53D1\u94FE https://stash.wiki/proxy-protocols/proxy-groups#relay`),!1):!0).map(s=>{if(s.type==="vmess"?(ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ue(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5)):s.type==="hysteria"?(ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ue(s,"down")&&!ue(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ue(s,"up")&&!ue(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ue(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ue(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="hysteria2"?(ue(s,"password")&&!ue(s,"auth")&&(s.auth=s.password,delete s.password),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ue(s,"down")&&!ue(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ue(s,"up")&&!ue(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ue(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ue(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="wireguard"?(s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"]):s.type==="snell"&&s.version<3?delete s.udp:s.type==="vless"&&ue(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let l=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",m=""]=l.exec(u);s[`${s.network}-opts`].path=d,m!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(m,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s["server-cert-fingerprint"]=s["tls-fingerprint"]),delete s["tls-fingerprint"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,s["test-url"]&&(s["benchmark-url"]=s["test-url"],delete s["test-url"]),s["test-timeout"]&&(s["benchmark-timeout"]=s["test-timeout"],delete s["test-timeout"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal")for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var xO="Loon",Ja={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function Qg(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return PO(t);case"ssr":return $O(t);case"trojan":return RO(t);case"vmess":return TO(t,n["include-unsupported-proxy"]);case"vless":return OO(t,n["include-unsupported-proxy"]);case"http":return kO(t);case"socks5":return NO(t);case"wireguard":return LO(t);case"hysteria2":return UO(t)}throw new Error(`Platform ${xO} does not support proxy type: ${t.type}`)}}}function PO(e){let t=new lt(e);if(!["rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`${e.name}=shadowsocks,${e.server},${e.port},${e.cipher},"${e.password}"`),ue(e,"plugin")){if(e.plugin==="obfs"){if(e["plugin-opts"]?.mode&&e.cipher.startsWith("2022-"))throw new Error(`${e.cipher} ${e.plugin} is not supported`);t.append(`,obfs-name=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path")}else if(!["shadow-tls"].includes(e.plugin))throw new Error(`plugin ${e.plugin} is not supported`)}if(ue(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Ja[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function $O(e){let t=new lt(e);if(t.append(`${e.name}=shadowsocksr,${e.server},${e.port},${e.cipher},"${e.password}"`),t.append(`,protocol=${e.protocol}`),t.appendIfPresent(`,protocol-param=${e["protocol-param"]}`,"protocol-param"),t.appendIfPresent(`,obfs=${e.obfs}`,"obfs"),t.appendIfPresent(`,obfs-param=${e["obfs-param"]}`,"obfs-param"),ue(e,"shadow-tls-password"))t.append(`,shadow-tls-password=${e["shadow-tls-password"]}`),t.appendIfPresent(`,shadow-tls-version=${e["shadow-tls-version"]}`,"shadow-tls-version"),t.appendIfPresent(`,shadow-tls-sni=${e["shadow-tls-sni"]}`,"shadow-tls-sni"),t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port");else if(["shadow-tls"].includes(e.plugin)&&e["plugin-opts"]){let n=e["plugin-opts"].password,i=e["plugin-opts"].host,a=e["plugin-opts"].version;if(n){if(t.append(`,shadow-tls-password=${n}`),i&&t.append(`,shadow-tls-sni=${i}`),a){if(a<2)throw new Error(`shadow-tls version ${a} is not supported`);t.append(`,shadow-tls-version=${a}`)}t.appendIfPresent(`,udp-port=${e["udp-port"]}`,"udp-port")}}t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Ja[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function RO(e){let t=new lt(e);if(t.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,ue(e,"network"))if(e.network==="ws")t.append(",transport=ws"),t.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),t.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else throw new Error(`network ${e.network} is unsupported`);t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tls-name=${e.sni}`,"sni"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Ja[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function TO(e){let t=!!e["reality-opts"],r=new lt(e);if(r.append(`${e.name}=vmess,${e.server},${e.port},${e.cipher},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ue(e,"network"))if(e.network==="ws")r.append(",transport=ws"),r.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),r.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){r.append(",transport=http");let i=e["http-opts"]?.path,a=e["http-opts"]?.headers?.Host;r.appendIfPresent(`,path=${Array.isArray(i)?i[0]:i}`,"http-opts.path"),r.appendIfPresent(`,host=${Array.isArray(a)?a[0]:a}`,"http-opts.headers.Host")}else throw new Error(`network ${e.network} is unsupported`);else r.append(",transport=tcp");r.appendIfPresent(`,over-tls=${e.tls}`,"tls"),r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t?(r.appendIfPresent(`,sni=${e.sni}`,"sni"),r.appendIfPresent(`,public-key="${e["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),r.appendIfPresent(`,short-id=${e["reality-opts"]["short-id"]}`,"reality-opts.short-id")):(r.appendIfPresent(`,tls-name=${e.sni}`,"sni"),r.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),r.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),ue(e,"aead")?r.append(`,alterId=${e.aead?0:1}`):r.append(`,alterId=${e.alterId}`),r.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?r.append(",block-quic=true"):e["block-quic"]==="off"&&r.append(",block-quic=false"),e.udp&&r.append(",udp=true");let n=Ja[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${n}`,"ip-version"),r.toString()}function OO(e){let t=!1,r=!!e["reality-opts"];if(typeof e.flow<"u")if(["xtls-rprx-vision"].includes(e.flow))t=!0;else throw new Error(`VLESS flow(${e.flow}) is not supported`);let n=new lt(e);if(n.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ue(e,"network"))if(e.network==="ws")n.append(",transport=ws"),n.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),n.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){n.append(",transport=http");let a=e["http-opts"]?.path,s=e["http-opts"]?.headers?.Host;n.appendIfPresent(`,path=${Array.isArray(a)?a[0]:a}`,"http-opts.path"),n.appendIfPresent(`,host=${Array.isArray(s)?s[0]:s}`,"http-opts.headers.Host")}else throw new Error(`network ${e.network} is unsupported`);else n.append(",transport=tcp");n.appendIfPresent(`,over-tls=${e.tls}`,"tls"),n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t&&n.appendIfPresent(`,flow=${e.flow}`,"flow"),r?(n.appendIfPresent(`,sni=${e.sni}`,"sni"),n.appendIfPresent(`,public-key="${e["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),n.appendIfPresent(`,short-id=${e["reality-opts"]["short-id"]}`,"reality-opts.short-id")):(n.appendIfPresent(`,tls-name=${e.sni}`,"sni"),n.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),n.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?n.append(",block-quic=true"):e["block-quic"]==="off"&&n.append(",block-quic=false"),e.udp&&n.append(",udp=true");let i=Ja[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${i}`,"ip-version"),n.toString()}function kO(e){let t=new lt(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false");let n=Ja[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function NO(e){let t=new lt(e);t.append(`${e.name}=socks5,${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true");let r=Ja[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function LO(e){Array.isArray(e.peers)&&e.peers.length>0&&(e.server=e.peers[0].server,e.port=e.peers[0].port,e.ip=e.peers[0].ip,e.ipv6=e.peers[0].ipv6,e["public-key"]=e.peers[0]["public-key"],e["preshared-key"]=e.peers[0]["pre-shared-key"],e["allowed-ips"]=e.peers[0]["allowed-ips"],e.reserved=e.peers[0].reserved);let t=new lt(e);if(t.append(`${e.name}=wireguard`),t.appendIfPresent(`,interface-ip=${e.ip}`,"ip"),t.appendIfPresent(`,interface-ipv6=${e.ipv6}`,"ipv6"),t.appendIfPresent(`,private-key="${e["private-key"]}"`,"private-key"),t.appendIfPresent(`,mtu=${e.mtu}`,"mtu"),e.dns&&Array.isArray(e.dns)){e.dnsv6=e.dns.find(u=>Ur(u));let s=e.dns.find(u=>Rr(u));s||(s=e.dns.find(u=>!Rr(u)&&!Ur(u))),e.dns=s}t.appendIfPresent(`,dns=${e.dns}`,"dns"),t.appendIfPresent(`,dnsv6=${e.dnsv6}`,"dnsv6"),t.appendIfPresent(`,keepalive=${e["persistent-keepalive"]}`,"persistent-keepalive"),t.appendIfPresent(`,keepalive=${e.keepalive}`,"keepalive");let r=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],n=Array.isArray(e.reserved)?e.reserved.join(","):e.reserved;n&&(n=`,reserved=[${n}]`);let i=e["preshared-key"]??e["pre-shared-key"];i&&(i=`,preshared-key="${i}"`),t.append(`,peers=[{public-key="${e["public-key"]}",allowed-ips="${r??"0.0.0.0/0,::/0"}",endpoint=${e.server}:${e.port}${n??""}${i??""}}]`);let a=Ja[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${a}`,"ip-version"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),t.toString()}function UO(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new lt(e);t.append(`${e.name}=Hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,tls-name=${e.sni}`,"sni"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e["obfs-password"]&&e.obfs=="salamander"&&t.append(`,salamander-password=${e["obfs-password"]}`),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),e.udp&&t.append(",udp=true"),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),t.appendIfPresent(`,ecn=${e.ecn}`,"ecn");let r=Ja[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}var mG=yn(G4());function Y4(e){let t="none",r=e["reality-opts"],n="",i="",a="";if(r){t="reality";let _=e["reality-opts"]?.["public-key"];_&&(i=`&pbk=${encodeURIComponent(_)}`);let F=e["reality-opts"]?.["short-id"];F&&(n=`&sid=${encodeURIComponent(F)}`);let L=e["reality-opts"]?.["_spider-x"];L&&(a=`&spx=${encodeURIComponent(L)}`)}else e.tls&&(t="tls");let s="";e.alpn&&(s=`&alpn=${encodeURIComponent(Array.isArray(e.alpn)?e.alpn:e.alpn.join(","))}`);let u="";e["skip-cert-verify"]&&(u="&allowInsecure=1");let l="";e.sni&&(l=`&sni=${encodeURIComponent(e.sni)}`);let f="";e["client-fingerprint"]&&(f=`&fp=${encodeURIComponent(e["client-fingerprint"])}`);let d="";e.flow&&(d=`&flow=${encodeURIComponent(e.flow)}`);let m="";e._extra&&(m=`&extra=${encodeURIComponent(e._extra)}`);let p="";e._mode&&(p=`&mode=${encodeURIComponent(e._mode)}`);let h="";e._pqv&&(h=`&pqv=${encodeURIComponent(e._pqv)}`);let w="";e.encryption&&(w=`&encryption=${encodeURIComponent(e.encryption)}`);let v=e.network;e.network==="ws"&&e["ws-opts"]?.["v2ray-http-upgrade"]&&(v="httpupgrade");let y=`&type=${encodeURIComponent(v)}`;if(["grpc"].includes(e.network)){y+=`&mode=${encodeURIComponent(e[`${e.network}-opts`]?.["_grpc-type"]||"gun")}`;let _=e[`${e.network}-opts`]?.["_grpc-authority"];_&&(y+=`&authority=${encodeURIComponent(_)}`)}let g=e[`${e.network}-opts`]?.[`${e.network}-service-name`],b=e[`${e.network}-opts`]?.path,D=e[`${e.network}-opts`]?.headers?.Host;return b&&(y+=`&path=${encodeURIComponent(Array.isArray(b)?b[0]:b)}`),D&&(y+=`&host=${encodeURIComponent(Array.isArray(D)?D[0]:D)}`),g&&(y+=`&serviceName=${encodeURIComponent(g)}`),e.network==="kcp"&&(e.seed&&(y+=`&seed=${encodeURIComponent(e.seed)}`),e.headerType&&(y+=`&headerType=${encodeURIComponent(e.headerType)}`)),`vless://${e.uuid}@${e.server}:${e.port}?security=${encodeURIComponent(t)}${y}${s}${u}${l}${f}${d}${n}${a}${i}${p}${m}${h}${w}#${encodeURIComponent(e.name)}`}function bc(){return{type:"SINGLE",produce:r=>{let n="";delete r.subName,delete r.collectionName,delete r.id,delete r.resolved,delete r["no-resolve"];for(let i in r)r[i]==null&&delete r[i];switch(["trojan","tuic","hysteria","hysteria2","juicity"].includes(r.type)&&delete r.tls,!["vmess"].includes(r.type)&&r.server&&Ur(r.server)&&(r.server=`[${r.server}]`),r.type){case"socks5":n=`socks://${encodeURIComponent(yt.encode(`${r.username??""}:${r.password??""}`))}@${r.server}:${r.port}#${r.name}`;break;case"ss":let i=`${r.cipher}:${r.password}`;if(n=`ss://${r.cipher?.startsWith("2022-blake3-")?`${encodeURIComponent(r.cipher)}:${encodeURIComponent(r.password)}`:yt.encode(i)}@${r.server}:${r.port}${r.plugin?"/":""}`,r.plugin){n+="?plugin=";let P=r["plugin-opts"];switch(r.plugin){case"obfs":n+=encodeURIComponent(`simple-obfs;obfs=${P.mode}${P.host?";obfs-host="+P.host:""}`);break;case"v2ray-plugin":n+=encodeURIComponent(`v2ray-plugin;obfs=${P.mode}${P.host?";obfs-host"+P.host:""}${P.tls?";tls":""}`);break;case"shadow-tls":n+=encodeURIComponent(`shadow-tls;host=${P.host};password=${P.password};version=${P.version}`);break;default:throw new Error(`Unsupported plugin option: ${r.plugin}`)}}r["udp-over-tcp"]&&(n=`${n}${r.plugin?"&":"?"}uot=1`),r.tfo&&(n=`${n}${r.plugin||r["udp-over-tcp"]?"&":"?"}tfo=1`),n+=`#${encodeURIComponent(r.name)}`;break;case"ssr":n=`${r.server}:${r.port}:${r.protocol}:${r.cipher}:${r.obfs}:${yt.encode(r.password)}/`,n+=`?remarks=${yt.encode(r.name)}${r["obfs-param"]?"&obfsparam="+yt.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protocolparam="+yt.encode(r["protocol-param"]):""}`,n="ssr://"+yt.encode(n);break;case"vmess":let a="",s=r.network||"tcp";if(r.network==="http"?(s="tcp",a="http"):r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(s="httpupgrade"),n={v:"2",ps:r.name,add:r.server,port:`${r.port}`,id:r.uuid,aid:`${r.alterId||0}`,scy:r.cipher,net:s,type:a,tls:r.tls?"tls":"",alpn:Array.isArray(r.alpn)?r.alpn.join(","):r.alpn,fp:r["client-fingerprint"]},r.tls&&r.sni&&(n.sni=r.sni),r.network){let P=r[`${r.network}-opts`]?.path,U=r[`${r.network}-opts`]?.headers?.Host;["grpc"].includes(r.network)?(n.path=r[`${r.network}-opts`]?.["grpc-service-name"],n.type=r[`${r.network}-opts`]?.["_grpc-type"]||"gun",n.host=r[`${r.network}-opts`]?.["_grpc-authority"]):["kcp","quic"].includes(r.network)?(n.type=r[`${r.network}-opts`]?.[`_${r.network}-type`]||"none",n.host=r[`${r.network}-opts`]?.[`_${r.network}-host`],n.path=r[`${r.network}-opts`]?.[`_${r.network}-path`]):(P&&(n.path=Array.isArray(P)?P[0]:P),U&&(n.host=Array.isArray(U)?U[0]:U))}n="vmess://"+yt.encode(JSON.stringify(n));break;case"vless":n=Y4(r);break;case"trojan":let u="";if(r.network){let P=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(P="httpupgrade"),u=`&type=${encodeURIComponent(P)}`,["grpc"].includes(r.network)){let H=r[`${r.network}-opts`]?.[`${r.network}-service-name`],K=r[`${r.network}-opts`]?.["_grpc-authority"];H&&(u+=`&serviceName=${encodeURIComponent(H)}`),K&&(u+=`&authority=${encodeURIComponent(K)}`),u+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let U=r[`${r.network}-opts`]?.path,G=r[`${r.network}-opts`]?.headers?.Host;U&&(u+=`&path=${encodeURIComponent(Array.isArray(U)?U[0]:U)}`),G&&(u+=`&host=${encodeURIComponent(Array.isArray(G)?G[0]:G)}`)}let l="";r["client-fingerprint"]&&(l=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let f="";r.alpn&&(f=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let d=r["reality-opts"],m="",p="",h="",w="",v="",y="";if(d){w="&security=reality";let P=r["reality-opts"]?.["public-key"];P&&(p=`&pbk=${encodeURIComponent(P)}`);let U=r["reality-opts"]?.["short-id"];U&&(m=`&sid=${encodeURIComponent(U)}`);let G=r["reality-opts"]?.["_spider-x"];G&&(h=`&spx=${encodeURIComponent(G)}`),r._extra&&(y=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(v=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${r.password}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${u}${f}${l}${w}${m}${p}${h}${v}${y}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let g=[];r["hop-interval"]&&g.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&g.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&g.push("insecure=1"),r.obfs&&(g.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&g.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&g.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&g.push(`mport=${r.ports}`),r["tls-fingerprint"]&&g.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&g.push("fastopen=1"),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${g.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let b=[];Object.keys(r).forEach(P=>{if(!["name","type","server","port"].includes(P)){let U=P.replace(/-/,"_");["alpn"].includes(P)?r[P]&&b.push(`${U}=${encodeURIComponent(Array.isArray(r[P])?r[P][0]:r[P])}`):["skip-cert-verify"].includes(P)?r[P]&&b.push("insecure=1"):["tfo","fast-open"].includes(P)?r[P]&&!b.includes("fastopen=1")&&b.push("fastopen=1"):["ports"].includes(P)?b.push(`mport=${r[P]}`):["auth-str"].includes(P)?b.push(`auth=${r[P]}`):["up"].includes(P)?b.push(`upmbps=${r[P]}`):["down"].includes(P)?b.push(`downmbps=${r[P]}`):["_obfs"].includes(P)?b.push(`obfs=${r[P]}`):["obfs"].includes(P)?b.push(`obfsParam=${r[P]}`):["sni"].includes(P)?b.push(`peer=${r[P]}`):r[P]&&!/^_/i.test(P)&&b.push(`${U}=${encodeURIComponent(r[P])}`)}}),n=`hysteria://${r.server}:${r.port}?${b.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let P=[];Object.keys(r).forEach(U=>{if(!["name","type","uuid","password","server","port","tls"].includes(U)){let G=U.replace(/-/,"_");["alpn"].includes(U)?r[U]&&P.push(`${G}=${encodeURIComponent(Array.isArray(r[U])?r[U][0]:r[U])}`):["skip-cert-verify"].includes(U)?r[U]&&P.push("allow_insecure=1"):["tfo","fast-open"].includes(U)?r[U]&&!P.includes("fast_open=1")&&P.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(U)&&r[U]?P.push(`${G.replace(/-/g,"_")}=1`):["congestion-controller"].includes(U)?P.push(`congestion_control=${r[U]}`):r[U]&&!/^_/i.test(U)&&P.push(`${G.replace(/-/g,"_")}=${encodeURIComponent(r[U])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${P.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":n=Y4({...r,uuid:r.password,network:r.network||"tcp"}).replace("vless","anytls");let D=[];Object.keys(r).forEach(P=>{if(!["name","type","password","server","port","tls"].includes(P)){let U=P.replace(/-/,"_");["alpn"].includes(P)?r[P]&&D.push(`${U}=${encodeURIComponent(Array.isArray(r[P])?r[P][0]:r[P])}`):["skip-cert-verify"].includes(P)?r[P]&&D.push("insecure=1"):["udp"].includes(P)?r[P]&&D.push("udp=1"):r[P]&&!/^_|client-fingerprint/i.test(P)&&["number","string","boolean"].includes(typeof r[P])&&D.push(`${U.replace(/-/g,"_")}=${encodeURIComponent(r[P])}`)}});let _=n.split("?"),F=_[0],L={};_.length>1&&_[1].split("#")[0].split("&").forEach(G=>{let[H,K]=G.split("=");H&&(L[H]=K)}),D.forEach(P=>{let[U,G]=P.split("=");U&&(L[U]=G)});let N=Object.keys(L).map(P=>`${P}=${L[P]}`).join("&"),S=n.match(/#(.*)$/),B=S?`#${S[1]}`:"";n=`${F}?${N}${B}`;break;case"wireguard":let O=[];Object.keys(r).forEach(P=>{["name","type","server","port","ip","ipv6","private-key"].includes(P)||(["public-key"].includes(P)?O.push(`publickey=${r[P]}`):["udp"].includes(P)?r[P]&&O.push(`${P}=1`):r[P]&&!/^_/i.test(P)&&O.push(`${P}=${encodeURIComponent(r[P])}`))}),r.ip&&r.ipv6?O.push(`address=${r.ip}/32,${r.ipv6}/128`):r.ip?O.push(`address=${r.ip}/32`):r.ipv6&&O.push(`address=${r.ipv6}/128`),n=`wireguard://${encodeURIComponent(r["private-key"])}@${r.server}:${r.port}/?${O.join("&")}#${encodeURIComponent(r.name)}`;break}return n}}}var rH=bc();function sh(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(rH.produce(i))}catch(a){J.error(`Cannot produce proxy: ${JSON.stringify(i,null,2)} Reason: ${a}`)}}),yt.encode(n.join(` `))}}}var nH="QX";function ah(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return iH(t);case"ssr":return sH(t);case"trojan":return aH(t);case"vmess":return uH(t);case"http":return lH(t);case"socks5":return cH(t);case"vless":return oH(t)}throw new Error(`Platform ${nH} does not support proxy type: ${t.type}`)}}}function iH(e){let t=new lt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(e.cipher||(e.cipher="none"),!["none","rc4-md5","rc4-md5-6","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","cast5-cfb","des-cfb","rc2-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),ki(e)&&(e.tls=!0),ue(e,"plugin")){if(e.plugin==="obfs"){let i=e["plugin-opts"];r(`,obfs=${i.mode}`)}else if(e.plugin==="v2ray-plugin"&&e["plugin-opts"].mode==="websocket")e["plugin-opts"].tls?r(",obfs=wss"):r(",obfs=ws");else throw new Error("plugin is not supported");n(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),n(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path")}return ki(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),e._ssr_python_uot?r(",udp-over-tcp=true"):e["udp-over-tcp"]&&(!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?r(",udp-over-tcp=sp.v1"):e["udp-over-tcp-version"]===2&&r(",udp-over-tcp=sp.v2")),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function sH(e){let t=new lt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),r(`,ssr-protocol=${e.protocol}`),n(`,ssr-protocol-param=${e["protocol-param"]}`,"protocol-param"),n(`,obfs=${e.obfs}`,"obfs"),n(`,obfs-host=${e["obfs-param"]}`,"obfs-param"),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function aH(e){let t=new lt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),ue(e,"network"))if(e.network==="ws")ki(e)?r(",obfs=wss"):r(",obfs=ws"),n(`,obfs-uri=${e["ws-opts"]?.path}`,"ws-opts.path"),n(`,obfs-host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else throw new Error(`network ${e.network} is unsupported`);return e.network!=="ws"&&ki(e)&&r(",over-tls=true"),ki(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function uH(e){let t=new lt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);r(`vmess=${e.server}:${e.port}`);let i;if(e.cipher==="auto"?i="chacha20-ietf-poly1305":i=e.cipher,r(`,method=${i}`),r(`,password=${e.uuid}`),ki(e)&&(e.tls=!0),ue(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(",obfs=http");else throw new Error(`network ${e.network} is unsupported`);let a=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(a)?a[0]:a}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return ki(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),ue(e,"aead")?r(`,aead=${e.aead}`):r(`,aead=${e.alterId===0}`),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function oH(e){if(typeof e.flow<"u"||e["reality-opts"])throw new Error("VLESS XTLS/REALITY is not supported");let t=new lt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`vless=${e.server}:${e.port}`),r(",method=none"),r(`,password=${e.uuid}`),ki(e)&&(e.tls=!0),ue(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(",obfs=http");else if(["tcp"].includes(e.network))e.tls&&r(",obfs=over-tls");else if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`);let a=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(a)?a[0]:a}`,`${e.network}-opts.path`),n(`,obfs-host=${Array.isArray(s)?s[0]:s}`,`${e.network}-opts.headers.Host`)}else e.tls&&r(",obfs=over-tls");return ki(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function lH(e){let t=new lt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`http=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),ki(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),ki(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function cH(e){let t=new lt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`socks5=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),ki(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),ki(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),n(`,tls-alpn=${e["tls-alpn"]}`,"tls-alpn"),n(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),n(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),n(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),n(`,tls-verification=${!e["skip-cert-verify"]}`,"skip-cert-verify"),n(`,tls-host=${e.sni}`,"sni")),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function ki(e){return e.tls}function uh(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&s.version>=4?!1:!["mieru"].includes(s.type)).map(s=>{if(s.type==="vmess")ue(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ue(s,"sni")&&(s.servername=s.sni,delete s.sni),ue(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto");else if(s.type==="tuic")ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ue(s,"version")&&(s.version=5);else if(s.type==="hysteria")ue(s,"auth_str")&&!ue(s,"auth-str")&&(s["auth-str"]=s.auth_str),ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="hysteria2")ue(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ue(s,"tfo")&&!ue(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="wireguard")s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"];else if(s.type==="snell"&&s.version<3)delete s.udp;else if(s.type==="vless")ue(s,"sni")&&(s.servername=s.sni,delete s.sni);else if(s.type==="ss")ue(s,"shadow-tls-password")&&!ue(s,"plugin")&&(s.plugin="shadow-tls",s["plugin-opts"]={host:s["shadow-tls-sni"],password:s["shadow-tls-password"],version:s["shadow-tls-version"]},delete s["shadow-tls-password"],delete s["shadow-tls-sni"],delete s["shadow-tls-version"]);else{if(["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"]))return!1;if(["xhttp"].includes(s.network))return!1}if(["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ue(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ue(s,"http-opts.headers.Host")&&!Array.isArray(l)&&(s["http-opts"].headers.Host=[l])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let u=s["h2-opts"]?.path;ue(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ue(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(["ws"].includes(s.network)){let u=s[`${s.network}-opts`]?.path;if(u){let l=/^(.*?)(?:\?ed=(\d+))?$/,[f,d="",m=""]=l.exec(u);s[`${s.network}-opts`].path=d,m!==""&&(s["ws-opts"]["early-data-header-name"]="Sec-WebSocket-Protocol",s["ws-opts"]["max-early-data"]=parseInt(m,10))}else s[`${s.network}-opts`]=s[`${s.network}-opts`]||{},s[`${s.network}-opts`].path="/"}if(s["plugin-opts"]?.tls&&ue(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],ue(s,"tls")&&typeof s.tls!="boolean"&&delete s.tls,delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],n!=="internal")for(let u in s)(s[u]==null||/^_/i.test(u))&&delete s[u];return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}var fH="Surfboard";function ep(){return{produce:t=>{switch(t.name=t.name.replace(/=|,/g,""),t.type){case"ss":return hH(t);case"trojan":return dH(t);case"vmess":return pH(t);case"http":return gH(t);case"socks5":return mH(t);case"wireguard-surge":return vH(t)}throw new Error(`Platform ${fH} does not support proxy type: ${t.type}`)}}}function hH(e){let t=new lt(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password=${e.password}`,"password"),ue(e,"plugin"))if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else throw new Error(`plugin ${e.plugin} is not supported`);return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function dH(e){let t=new lt(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),W4(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function pH(e){let t=new lt(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),W4(t,e),ue(e,"aead")?t.append(`,vmess-aead=${e.aead}`):t.append(`,vmess-aead=${e.alterId===0}`),t.appendIfPresent(`,tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function gH(e){let t=new lt(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function mH(e){let t=new lt(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function vH(e){let t=new lt(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.toString()}function W4(e,t){if(ue(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ue(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ue(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,n=Object.keys(r).map(i=>{let a=r[i];return["Host"].includes(i)&&(a=`"${a}"`),`${i}:${a}`}).join("|");Hs(n)&&e.append(`,ws-headers=${n}`)}}else throw new Error(`network ${t.network} is unsupported`)}var wH={ipv4:"ipv4_only",ipv6:"ipv6_only","v4-only":"ipv4_only","v6-only":"ipv6_only","ipv4-prefer":"prefer_ipv4","ipv6-prefer":"prefer_ipv6","prefer-v4":"prefer_ipv4","prefer-v6":"prefer_ipv6"},vi=(e,t)=>{let r=wH[e["ip-version"]];e._dns_server&&r&&(t.domain_resolver={server:e._dns_server,strategy:r})},wi=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},ha=(e,t)=>{["tcp","udp"].includes(e._network)&&(t.network=e._network)},Ni=(e,t)=>{t.tcp_fast_open=!1,e.tfo&&(t.tcp_fast_open=!0),e.tcp_fast_open&&(t.tcp_fast_open=!0),e["tcp-fast-open"]&&(t.tcp_fast_open=!0),t.tcp_fast_open||delete t.tcp_fast_open},da=(e,t)=>{!e||!e.enabled||(t.multiplex={enabled:!0},t.multiplex.protocol=e.protocol,e["max-connections"]&&(t.multiplex.max_connections=parseInt(`${e["max-connections"]}`,10)),e["max-streams"]&&(t.multiplex.max_streams=parseInt(`${e["max-streams"]}`,10)),e["min-streams"]&&(t.multiplex.min_streams=parseInt(`${e["min-streams"]}`,10)),e.padding&&(t.multiplex.padding=!0),(e["brutal-opts"]?.up||e["brutal-opts"]?.down)&&(t.multiplex.brutal={enabled:!0},e["brutal-opts"]?.up&&(t.multiplex.brutal.up_mbps=parseInt(`${e["brutal-opts"]?.up}`,10)),e["brutal-opts"]?.down&&(t.multiplex.brutal.down_mbps=parseInt(`${e["brutal-opts"]?.down}`,10))))},K2=(e,t)=>{let r={type:"ws",headers:{}};if(e["ws-opts"]){let{path:n="",headers:i={},"max-early-data":a,"early-data-header-name":s}=e["ws-opts"];if(r.early_data_header_name=s,r.max_early_data=a?parseInt(a,10):void 0,n!==""&&(r.path=`${n}`),Object.keys(i).length>0){let u={};for(let f of Object.keys(i)){let d=i[f];d!==""&&(Array.isArray(d)||(d=[`${d}`]),d.length>0&&(u[f]=d))}let{Host:l}=u;if(l.length===1)for(let f of`Host:${l[0]}`.split(` `)){let[d,m]=f.split(":");m.trim()!==""&&(u[d.trim()]=m.trim().split(","))}r.headers=u}}if(e["ws-headers"]){let n={};for(let a of Object.keys(e["ws-headers"])){let s=e["ws-headers"][a];s!==""&&(Array.isArray(s)||(s=[`${s}`]),s.length>0&&(n[a]=s))}let{Host:i}=n;if(i.length===1)for(let a of`Host:${i[0]}`.split(` `)){let[s,u]=a.split(":");u.trim()!==""&&(n[s.trim()]=u.trim().split(","))}for(let a of Object.keys(n))r.headers[a]=n[a]}if(e["ws-path"]&&e["ws-path"]!==""&&(r.path=`${e["ws-path"]}`),r.path){let n=/^(.*?)(?:\?ed=(\d+))?$/,[i,a="",s=""]=n.exec(r.path);r.path=a,s!==""&&(r.early_data_header_name="Sec-WebSocket-Protocol",r.max_early_data=parseInt(s,10))}t.tls.insecure&&(t.tls.server_name=r.headers.Host[0]),e["ws-opts"]&&e["ws-opts"]["v2ray-http-upgrade"]&&(r.type="httpupgrade",r.headers.Host&&(r.host=r.headers.Host[0],delete r.headers.Host),r.max_early_data&&delete r.max_early_data,r.early_data_header_name&&delete r.early_data_header_name);for(let n of Object.keys(r.headers)){let i=r.headers[n];i.length===1&&(r.headers[n]=i[0])}t.transport=r},X4=(e,t)=>{let r={type:"http",headers:{}};if(e["http-opts"]){let{method:n="",path:i="",headers:a={}}=e["http-opts"];n!==""&&(r.method=n),Array.isArray(i)?r.path=`${i[0]}`:i!==""&&(r.path=`${i}`);for(let s of Object.keys(a)){let u=a[s];if(u!==""){if(s.toLowerCase()==="host"){let l=u;Array.isArray(l)||(l=`${l}`.split(",").map(f=>f.trim())),l.length>0&&(r.host=l);continue}Array.isArray(u)||(u=`${u}`.split(",").map(l=>l.trim())),u.length>0&&(r.headers[s]=u)}}}if(e["http-host"]&&e["http-host"]!==""){let n=e["http-host"];Array.isArray(n)||(n=`${n}`.split(",").map(i=>i.trim())),n.length>0&&(r.host=n)}if(e["http-path"]&&e["http-path"]!==""){let n=e["http-path"];Array.isArray(n)?r.path=`${n[0]}`:n!==""&&(r.path=`${n}`)}t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host?.length===1&&(r.host=r.host[0]);for(let n of Object.keys(r.headers)){let i=r.headers[n];i.length===1&&(r.headers[n]=i[0])}t.transport=r},Z4=(e,t)=>{let r={type:"http"};if(e["h2-opts"]){let{host:n="",path:i=""}=e["h2-opts"];i!==""&&(r.path=`${i}`),n!==""&&(Array.isArray(n)||(n=`${n}`.split(",").map(a=>a.trim())),n.length>0&&(r.host=n))}if(e["h2-host"]&&e["h2-host"]!==""){let n=e["h2-host"];Array.isArray(n)||(n=`${n}`.split(",").map(i=>i.trim())),n.length>0&&(r.host=n)}e["h2-path"]&&e["h2-path"]!==""&&(r.path=`${e["h2-path"]}`),t.tls.enabled=!0,t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host.length===1&&(r.host=r.host[0]),t.transport=r},z2=(e,t)=>{let r={type:"grpc"};if(e["grpc-opts"]){let n=e["grpc-opts"]["grpc-service-name"];n!=null&&n!==""&&(r.service_name=`${n}`)}t.transport=r},Hu=(e,t)=>{e.tls&&(t.tls.enabled=!0),e.servername&&e.servername!==""&&(t.tls.server_name=e.servername),e.peer&&e.peer!==""&&(t.tls.server_name=e.peer),e.sni&&e.sni!==""&&(t.tls.server_name=e.sni),e["skip-cert-verify"]&&(t.tls.insecure=!0),e.insecure&&(t.tls.insecure=!0),e["disable-sni"]&&(t.tls.disable_sni=!0),typeof e.alpn=="string"?t.tls.alpn=[e.alpn]:Array.isArray(e.alpn)&&(t.tls.alpn=e.alpn),e.ca&&(t.tls.certificate_path=`${e.ca}`),e.ca_str&&(t.tls.certificate=[e.ca_str]),e["ca-str"]&&(t.tls.certificate=[e["ca-str"]]),e["reality-opts"]&&(t.tls.reality={enabled:!0},e["reality-opts"]["public-key"]&&(t.tls.reality.public_key=e["reality-opts"]["public-key"]),e["reality-opts"]["short-id"]&&(t.tls.reality.short_id=e["reality-opts"]["short-id"]),t.tls.utls={enabled:!0}),!["hysteria","hysteria2","tuic"].includes(e.type)&&e["client-fingerprint"]&&e["client-fingerprint"]!==""&&(t.tls.utls={enabled:!0,fingerprint:e["client-fingerprint"]}),e._fragment&&(t.tls.fragment=!!e._fragment),e._fragment_fallback_delay&&(t.tls.fragment_fallback_delay=e._fragment_fallback_delay),e._record_fragment&&(t.tls.record_fragment=!!e._record_fragment),t.tls.enabled||delete t.tls},AH=(e={})=>{let t={tag:e.name,type:"ssh",server:e.server,server_port:parseInt(`${e.port}`,10)};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e.username&&(t.user=e.username),e.password&&(t.password=e.password),e.privateKey&&(t.private_key_path=e.privateKey),e["private-key"]&&(t.private_key_path=e["private-key"]),e["private-key-passphrase"]&&(t.private_key_passphrase=e["private-key-passphrase"]),e["server-fingerprint"]&&(t.host_key=[e["server-fingerprint"]],t.host_key_algorithms=[e["server-fingerprint"].split(" ")[0]]),e["host-key"]&&(t.host_key=e["host-key"]),e["host-key-algorithms"]&&(t.host_key_algorithms=e["host-key-algorithms"]),e["fast-open"]&&(t.udp_fragment=!0),Ni(e,t),wi(e,t),vi(e,t),t},EH=(e={})=>{let t={tag:e.name,type:"http",server:e.server,server_port:parseInt(`${e.port}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.headers){t.headers={};for(let r of Object.keys(e.headers))t.headers[r]=`${e.headers[r]}`;Object.keys(t.headers).length===0&&delete t.headers}return e["fast-open"]&&(t.udp_fragment=!0),Ni(e,t),wi(e,t),Hu(e,t),vi(e,t),t},bH=(e={})=>{let t={tag:e.name,type:"socks",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,version:"5"};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e.username&&(t.username=e.username),e.password&&(t.password=e.password),e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp=!0),e["fast-open"]&&(t.udp_fragment=!0),ha(e,t),Ni(e,t),wi(e,t),vi(e,t),t},yH=(e={})=>{let t={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:`${e.name}_shadowtls`};e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2});let r={tag:`${e.name}_shadowtls`,type:"shadowtls",server:e.server,server_port:parseInt(`${e.port}`,10),version:e["plugin-opts"].version,password:e["plugin-opts"].password,tls:{enabled:!0,server_name:e["plugin-opts"].host,utls:{enabled:!0,fingerprint:e["client-fingerprint"]}}};if(r.server_port<0||r.server_port>65535)throw"\u7AEF\u53E3\u503C\u975E\u6CD5";return e["fast-open"]===!0&&(r.udp_fragment=!0),Ni(e,r),wi(e,r),da(e.smux,t),vi(e,r),{type:"ss-with-st",ssPart:t,stPart:r}},CH=(e={})=>{let t={tag:e.name,type:"shadowsocks",server:e.server,server_port:parseInt(`${e.port}`,10),method:e.cipher,password:e.password};if(t.server_port<0||t.server_port>65535)throw"invalid port";if(e.uot&&(t.udp_over_tcp=!0),e["udp-over-tcp"]&&(t.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),e["fast-open"]&&(t.udp_fragment=!0),ha(e,t),Ni(e,t),wi(e,t),da(e.smux,t),vi(e,t),e.plugin){let r=[];e.plugin==="obfs"&&(t.plugin="obfs-local",t.plugin_opts="",e["obfs-host"]&&(e["plugin-opts"].host=e["obfs-host"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"mode":r.push(`obfs=${e["plugin-opts"].mode}`);break;case"host":r.push(`obfs-host=${e["plugin-opts"].host}`);break;default:r.push(`${n}=${e["plugin-opts"][n]}`);break}})),e.plugin==="v2ray-plugin"&&(t.plugin="v2ray-plugin",e["ws-host"]&&(e["plugin-opts"].host=e["ws-host"]),e["ws-path"]&&(e["plugin-opts"].path=e["ws-path"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"tls":e["plugin-opts"].tls&&r.push("tls");break;case"host":r.push(`host=${e["plugin-opts"].host}`);break;case"path":r.push(`path=${e["plugin-opts"].path}`);break;case"headers":r.push(`headers=${JSON.stringify(e["plugin-opts"].headers)}`);break;case"mux":e["plugin-opts"].mux&&(t.multiplex={enabled:!0});break;default:r.push(`${n}=${e["plugin-opts"][n]}`)}})),t.plugin_opts=r.join(";")}return t},_H=(e={})=>{let t={tag:e.name,type:"shadowsocksr",server:e.server,server_port:parseInt(`${e.port}`,10),method:e.cipher,password:e.password,obfs:e.obfs,protocol:e.protocol};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["obfs-param"]&&(t.obfs_param=e["obfs-param"]),e["protocol-param"]&&e["protocol-param"]!==""&&(t.protocol_param=e["protocol-param"]),e["fast-open"]&&(t.udp_fragment=!0),Ni(e,t),wi(e,t),da(e.smux,t),vi(e,t),t},DH=(e={})=>{let t={tag:e.name,type:"vmess",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,security:e.cipher,alter_id:parseInt(`${e.alterId}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(["auto","none","zero","aes-128-gcm","chacha20-poly1305","aes-128-ctr"].indexOf(t.security)===-1&&(t.security="auto"),t.server_port<0||t.server_port>65535)throw"invalid port";return e.xudp&&(t.packet_encoding="xudp"),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&K2(e,t),e.network==="h2"&&Z4(e,t),e.network==="http"&&X4(e,t),e.network==="grpc"&&z2(e,t),ha(e,t),Ni(e,t),wi(e,t),Hu(e,t),da(e.smux,t),vi(e,t),t},FH=(e={})=>{let t={tag:e.name,type:"vless",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e.xudp&&(t.packet_encoding="xudp"),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&K2(e,t),e.network==="h2"&&Z4(e,t),e.network==="http"&&X4(e,t),e.network==="grpc"&&z2(e,t),ha(e,t),Ni(e,t),wi(e,t),da(e.smux,t),Hu(e,t),vi(e,t),t},SH=(e={})=>{let t={tag:e.name,type:"trojan",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["fast-open"]&&(t.udp_fragment=!0),e.network==="grpc"&&z2(e,t),e.network==="ws"&&K2(e,t),ha(e,t),Ni(e,t),wi(e,t),Hu(e,t),da(e.smux,t),vi(e,t),t},IH=(e={})=>{let t={tag:e.name,type:"hysteria",server:e.server,server_port:parseInt(`${e.port}`,10),disable_mtu_discovery:!1,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(n=>{let i=n.replace(/\s*-\s*/g,":");return i.includes(":")?i:`${i}:${i}`})),e.auth_str&&(t.auth_str=`${e.auth_str}`),e["auth-str"]&&(t.auth_str=`${e["auth-str"]}`),e["fast-open"]&&(t.udp_fragment=!0);let r=new RegExp("^[0-9]+[ ]*[KMGT]*[Bb]ps$");return r.test(`${e.up}`)&&!`${e.up}`.endsWith("Mbps")?t.up=`${e.up}`:t.up_mbps=parseInt(`${e.up}`,10),r.test(`${e.down}`)&&!`${e.down}`.endsWith("Mbps")?t.down=`${e.down}`:t.down_mbps=parseInt(`${e.down}`,10),e.obfs&&(t.obfs=e.obfs),e.recv_window_conn&&(t.recv_window_conn=e.recv_window_conn),e["recv-window-conn"]&&(t.recv_window_conn=e["recv-window-conn"]),e.recv_window&&(t.recv_window=e.recv_window),e["recv-window"]&&(t.recv_window=e["recv-window"]),e.disable_mtu_discovery&&(typeof e.disable_mtu_discovery=="boolean"?t.disable_mtu_discovery=e.disable_mtu_discovery:e.disable_mtu_discovery===1&&(t.disable_mtu_discovery=!0)),ha(e,t),Hu(e,t),wi(e,t),Ni(e,t),da(e.smux,t),vi(e,t),t},BH=(e={})=>{let t={tag:e.name,type:"hysteria2",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,obfs:{},tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(r=>{let n=r.replace(/\s*-\s*/g,":");return n.includes(":")?n:`${n}:${n}`})),e.up&&(t.up_mbps=parseInt(`${e.up}`,10)),e.down&&(t.down_mbps=parseInt(`${e.down}`,10)),e.obfs==="salamander"&&(t.obfs.type="salamander"),e["obfs-password"]&&(t.obfs.password=e["obfs-password"]),t.obfs.type||delete t.obfs,ha(e,t),Hu(e,t),Ni(e,t),wi(e,t),da(e.smux,t),vi(e,t),t},xH=(e={})=>{let t={tag:e.name,type:"tuic",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return e["fast-open"]&&(t.udp_fragment=!0),e["congestion-controller"]&&e["congestion-controller"]!=="cubic"&&(t.congestion_control=e["congestion-controller"]),e["udp-relay-mode"]&&e["udp-relay-mode"]!=="native"&&(t.udp_relay_mode=e["udp-relay-mode"]),e["reduce-rtt"]&&(t.zero_rtt_handshake=!0),e["udp-over-stream"]&&(t.udp_over_stream=!0),e["heartbeat-interval"]&&(t.heartbeat=`${e["heartbeat-interval"]}ms`),ha(e,t),Ni(e,t),wi(e,t),Hu(e,t),da(e.smux,t),vi(e,t),t},PH=(e={})=>{let t={tag:e.name,type:"anytls",server:e.server,server_port:parseInt(`${e.port}`,10),password:e.password,tls:{enabled:!0,server_name:e.server,insecure:!1}};return/^\d+$/.test(e["idle-session-check-interval"])&&(t.idle_session_check_interval=`${e["idle-session-check-interval"]}s`),/^\d+$/.test(e["idle-session-timeout"])&&(t.idle_session_timeout=`${e["idle-session-timeout"]}s`),/^\d+$/.test(e["min-idle-session"])&&(t.min_idle_session=parseInt(`${e["min-idle-session"]}`,10)),ha(e,t),wi(e,t),Hu(e,t),vi(e,t),t},$H=(e={})=>{let t=["ip","ipv6"].map(n=>e[n]).map(n=>{if(Rr(n))return`${n}/32`;if(Ur(n))return`${n}/128`}).filter(n=>n),r={tag:e.name,type:"wireguard",server:e.server,server_port:parseInt(`${e.port}`,10),local_address:t,private_key:e["private-key"],peer_public_key:e["public-key"],pre_shared_key:e["pre-shared-key"],reserved:[]};if(r.server_port<0||r.server_port>65535)throw"invalid port";if(e["fast-open"]&&(r.udp_fragment=!0),typeof e.reserved=="string")r.reserved=e.reserved;else if(Array.isArray(e.reserved))for(let n of e.reserved)r.reserved.push(n);else delete r.reserved;if(e.peers&&e.peers.length>0){r.peers=[];for(let n of e.peers){let i={server:n.server,server_port:parseInt(`${n.port}`,10),public_key:n["public-key"],allowed_ips:n["allowed-ips"]||n.allowed_ips,reserved:[]};if(typeof n.reserved=="string")i.reserved.push(n.reserved);else if(Array.isArray(n.reserved))for(let a of n.reserved)i.reserved.push(a);else delete i.reserved;n["pre-shared-key"]&&(i.pre_shared_key=n["pre-shared-key"]),r.peers.push(i)}}return ha(e,r),Ni(e,r),wi(e,r),da(e.smux,r),vi(e,r),r};function tp(){return{type:"ALL",produce:(r,n,i={})=>{let a=[];return Ri().produce(r,"internal",{"include-unsupported-proxy":!0}).map(s=>{try{switch(s.type){case"ssh":a.push(AH(s));break;case"http":a.push(EH(s));break;case"socks5":if(s.tls)throw new Error(`Platform sing-box does not support proxy type: ${s.type} with tls`);a.push(bH(s));break;case"ss":if(s.plugin==="shadow-tls"){let{ssPart:u,stPart:l}=yH(s);a.push(u),a.push(l)}else a.push(CH(s));break;case"ssr":if(i["include-unsupported-proxy"])a.push(_H(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type}`);break;case"vmess":if(!s.network||["ws","grpc","h2","http"].includes(s.network))a.push(DH(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with network ${s.network}`);break;case"vless":if(!s.flow||["xtls-rprx-vision"].includes(s.flow))a.push(FH(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"trojan":if(!s.flow)a.push(SH(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"hysteria":a.push(IH(s));break;case"hysteria2":a.push(BH(s,i["include-unsupported-proxy"]));break;case"tuic":if(!s.token||s.token.length===0)a.push(xH(s));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":a.push($H(s));break;case"anytls":a.push(PH(s));break;default:throw new Error(`Platform sing-box does not support proxy type: ${s.type}`)}}catch(u){J.error(u.message??u)}}),n==="internal"?a:JSON.stringify({outbounds:a},null,2)}}}function rp(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>!(!["http","socks5","ss","trojan","hysteria2","vless","vmess","tuic"].includes(s.type)||s.type==="ss"&&(s.plugin==="obfs"&&!["http","tls"].includes(s["plugin-opts"]?.mode)||!["chacha20-ietf-poly1305","chacha20-poly1305","aes-256-gcm","aes-128-gcm","none","tbale","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher))||s.type==="vmess"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="trojan"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="vless"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="tuic"&&s.token&&s.token.length!==0)).map(s=>{let u={...s},l;s.tls&&!s.sni&&(s.sni=s.server);let f=s.prev_hop||s["underlying-proxy"]||s["dialer-proxy"]||s.detour;if(s.type==="http")s={type:"http",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:s.tfo||s["fast-open"],next_hop:s.next_hop};else if(s.type==="socks5")s={type:"socks5",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop};else if(s.type==="ss")s={type:"shadowsocks",name:s.name,method:s.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":s.cipher,server:s.server,port:s.port,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop},u.plugin==="obfs"&&(s.obfs=u["plugin-opts"].mode,s.obfs_host=u["plugin-opts"].host,s.obfs_uri=u["plugin-opts"].path);else if(s.type==="hysteria2")s={type:"hysteria2",name:s.name,server:s.server,port:s.port,auth:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,sni:s.sni,skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]},u["obfs-password"]&&u.obfs=="salamander"&&(s.obfs="salamander",s.obfs_password=u["obfs-password"]);else if(s.type==="tuic")s={type:"tuic",name:s.name,server:s.server,port:s.port,uuid:s.uuid,password:s.password,next_hop:s.next_hop,sni:s.sni,alpn:Array.isArray(s.alpn)?s.alpn:[s.alpn||"h3"],skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]};else if(s.type==="trojan")s.network==="ws"&&(s.websocket={path:s["ws-opts"]?.path,host:s["ws-opts"]?.headers?.Host}),s={type:"trojan",name:s.name,server:s.server,port:s.port,password:s.password,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,sni:s.sni,skip_tls_verify:s["skip-cert-verify"],websocket:s.websocket};else if(s.type==="vmess"){let d=s.cipher;d&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(d)&&(d="auto"),s.network==="ws"?s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}}:s.network==="http"?s.transport={http1:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:s.network==="h2"?s.transport={http2:{method:s["h2-opts"]?.method,path:Array.isArray(s["h2-opts"]?.path)?s["h2-opts"]?.path[0]:s["h2-opts"]?.path,headers:{Host:Array.isArray(s["h2-opts"]?.headers?.Host)?s["h2-opts"]?.headers?.Host[0]:s["h2-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:(s.network==="tcp"||!s.network)&&s.tls&&(s.transport={tls:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}});let m;(ue(s,"aead")&&!s.aead||s.alterId!==0)&&(m=!0),s={type:"vmess",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:d,tfo:s.tfo||s["fast-open"],legacy:m,udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,transport:s.transport}}else if(s.type==="vless"){if(s.network==="ws")s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}};else if(s.network==="http")s.transport={http:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}};else if(s.network==="tcp"||!s.network){let d;if((s["reality-opts"]?.["short-id"]||s["reality-opts"]?.["public-key"])&&(d={short_id:s["reality-opts"]["short-id"],public_key:s["reality-opts"]["public-key"]}),s.transport={[s.tls?"tls":"tcp"]:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0,reality:d}},typeof s.flow<"u"&&!["xtls-rprx-vision"].includes(s.flow))throw new Error(`VLESS flow(${s.flow}) is not supported`);l=s.flow}s={type:"vless",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:s.cipher,tfo:s.tfo||s["fast-open"],udp_relay:s.udp||s.udp_relay||s.udp_relay,next_hop:s.next_hop,transport:s.transport,flow:l}}if(["http","socks5","ss","trojan","vless","vmess"].includes(u.type)){if(ue(u,"shadow-tls-password")){if(u["shadow-tls-version"]!=3)throw new Error(`shadow-tls version ${u["shadow-tls-version"]} is not supported`);s.shadow_tls={password:u["shadow-tls-password"],sni:u["shadow-tls-sni"]}}else if(["shadow-tls"].includes(u.plugin)&&u["plugin-opts"]){if(u["plugin-opts"].version!=3)throw new Error(`shadow-tls version ${u["plugin-opts"].version} is not supported`);s.shadow_tls={password:u["plugin-opts"].password,sni:u["plugin-opts"].host}}}if(["ss"].includes(u.type)&&s.shadow_tls&&u["udp-port"]>0&&u["udp-port"]<=65535&&(s.udp_port=u["udp-port"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],s.transport){for(let d in s.transport)(Object.keys(s.transport[d]).length===0||Object.values(s.transport[d]).every(m=>m==null))&&delete s.transport[d];Object.keys(s.transport).length===0&&delete s.transport}if(n!=="internal")for(let d in s)(s[d]==null||/^_/i.test(d))&&delete s[d];return{[s.type]:{...s,type:void 0,prev_hop:f}}});return n==="internal"?a:`proxies: `+a.map(s=>" - "+JSON.stringify(s)+` `).join("")}}}function J4(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var Q4={qx:ah(),QX:ah(),QuantumultX:ah(),surge:Wl(),Surge:Wl(),SurgeMac:Zg(),Loon:Qg(),Clash:Jg(),meta:Ri(),clashmeta:Ri(),"clash.meta":Ri(),"Clash.Meta":Ri(),ClashMeta:Ri(),mihomo:Ri(),Mihomo:Ri(),uri:bc(),URI:bc(),v2:sh(),v2ray:sh(),V2Ray:sh(),json:J4(),JSON:J4(),stash:gd(),Stash:gd(),shadowrocket:uh(),Shadowrocket:uh(),ShadowRocket:uh(),surfboard:ep(),Surfboard:ep(),singbox:tp(),"sing-box":tp(),egern:rp(),Egern:rp()};var sD=yn(ph()),HM=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } }} // per-parser initializer { const proxy = {}; const obfs = {}; const $ = {}; function handleWebsocket() { if (obfs.type === "ws") { proxy.network = "ws"; $set(proxy, "ws-opts.path", obfs.path); $set(proxy, "ws-opts.headers", obfs['ws-headers']); if (proxy['ws-opts'] && proxy['ws-opts']['headers'] && proxy['ws-opts']['headers'].Host) { proxy['ws-opts']['headers'].Host = proxy['ws-opts']['headers'].Host.replace(/^"(.*)"$/, '$1') } } } function handleShadowTLS() { if (proxy['shadow-tls-password'] && !proxy['shadow-tls-version']) { proxy['shadow-tls-version'] = 2; } } } start = (shadowsocks/vmess/trojan/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/direct) { return proxy; } shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/udp_port/others)* { proxy.type = "ss"; // handle obfs if (obfs.type == "http" || obfs.type === "tls") { proxy.plugin = "obfs"; $set(proxy, "plugin-opts.mode", obfs.type); $set(proxy, "plugin-opts.host", obfs.host); $set(proxy, "plugin-opts.path", obfs.path); } handleShadowTLS(); } vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_path/ws_headers/method/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls/sni/tls_fingerprint/tls_verification/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "vmess"; proxy.cipher = proxy.cipher || "none"; // Surfboard 与 Surge 默认不一致, 不管 Surfboard https://getsurfboard.com/docs/profile-format/proxy/external-proxy/vmess if (proxy.aead) { proxy.alterId = 0; } else { proxy.alterId = 1; } handleWebsocket(); handleShadowTLS(); } trojan = tag equals "trojan" address (passwordk/ws/ws_path/ws_headers/tls/sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "trojan"; handleWebsocket(); handleShadowTLS(); } https = tag equals "https" address (username password)? (usernamek passwordk)? (sni/tls_fingerprint/tls_verification/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "http"; proxy.tls = true; handleShadowTLS(); } http = tag equals "http" address (username password)? (usernamek passwordk)? (ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "http"; handleShadowTLS(); } ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "ssh"; handleShadowTLS(); } snell = tag equals "snell" address (snell_version/snell_psk/obfs/obfs_host/obfs_uri/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/udp_relay/reuse/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "snell"; // handle obfs if (obfs.type == "http" || obfs.type === "tls") { $set(proxy, "obfs-opts.mode", obfs.type); $set(proxy, "obfs-opts.host", obfs.host); $set(proxy, "obfs-opts.path", obfs.path); } handleShadowTLS(); } tuic = tag equals "tuic" address (alpn/token/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* { proxy.type = "tuic"; handleShadowTLS(); } tuic_v5 = tag equals "tuic-v5" address (alpn/passwordk/uuidk/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/tls_fingerprint/tls_verification/sni/fast_open/tfo/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* { proxy.type = "tuic"; proxy.version = 5; handleShadowTLS(); } wireguard = tag equals "wireguard" (section_name/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "wireguard-surge"; handleShadowTLS(); } hysteria2 = tag equals "hysteria2" address (no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_verification/passwordk/tls_fingerprint/download_bandwidth/ecn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/port_hopping_interval/others)* { proxy.type = "hysteria2"; handleShadowTLS(); } socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "socks5"; handleShadowTLS(); } socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/no_error_alert/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/sni/tls_fingerprint/tls_verification/fast_open/tfo/shadow_tls_version/shadow_tls_sni/shadow_tls_password/block_quic/others)* { proxy.type = "socks5"; proxy.tls = true; handleShadowTLS(); } direct = tag equals "direct" (udp_relay/ip_version/underlying_proxy/tos/allow_other_interface/interface/test_url/test_udp/test_timeout/hybrid/no_error_alert/fast_open/tfo/block_quic/others)* { proxy.type = "direct"; } address = comma server:server comma port:port { proxy.server = server; proxy.port = port; } server = ip/domain ip = & { const start = peg$currPos; let j = start; while (j < input.length) { if (input[j] === ",") break; j++; } peg$currPos = j; $.ip = input.substring(start, j).trim(); return true; } { return $.ip; } domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } } port_hopping_interval = comma "port-hopping-interval" equals match:$[0-9]+ { proxy["hop-interval"] = parseInt(match.trim()); } username = & { let j = peg$currPos; let start, end; let first = true; while (j < input.length) { if (input[j] === ',') { if (first) { start = j + 1; first = false; } else { end = j; break; } } j++; } const match = input.substring(start, end); if (match.indexOf("=") === -1) { $.username = match; peg$currPos = end; return true; } } { proxy.username = $.username.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } password = comma match:[^,]+ { proxy.password = match.join("").replace(/^"(.*)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } tls = comma "tls" equals flag:bool { proxy.tls = flag; } sni = comma "sni" equals sni:("off"/domain) { if (sni === "off") { proxy["disable-sni"] = true; } else { proxy.sni = sni; } } tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; } tls_fingerprint = comma "server-cert-fingerprint-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); } snell_psk = comma "psk" equals match:[^,]+ { proxy.psk = match.join(""); } snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); } usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } vmess_uuid = comma "username" equals match:[^,]+ { proxy.uuid = match.join(""); } vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; } method = comma "encrypt-method" equals cipher:cipher { proxy.cipher = cipher; } cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"idea-cfb"/"none"/"rc2-cfb"/"rc4-md5"/"rc4"/"salsa20"/"seed-cfb"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm"); ws = comma "ws" equals flag:bool { obfs.type = "ws"; } ws_headers = comma "ws-headers" equals headers:$[^,]+ { const pairs = headers.split("|"); const result = {}; pairs.forEach(pair => { const [key, value] = pair.trim().split(":"); result[key.trim()] = value.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }) obfs["ws-headers"] = result; } ws_path = comma "ws-path" equals path:uri { obfs.path = path.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; } obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; }; obfs_uri = comma "obfs-uri" equals path:uri { obfs.path = path } uri = $[^,]+ udp_relay = comma "udp-relay" equals flag:bool { proxy.udp = flag; } fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; } reuse = comma "reuse" equals flag:bool { proxy.reuse = flag; } ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; } tfo = comma "tfo" equals flag:bool { proxy.tfo = flag; } ip_version = comma "ip-version" equals match:[^,]+ { proxy["ip-version"] = match.join(""); } section_name = comma "section-name" equals match:[^,]+ { proxy["section-name"] = match.join(""); } no_error_alert = comma "no-error-alert" equals match:[^,]+ { proxy["no-error-alert"] = match.join(""); } underlying_proxy = comma "underlying-proxy" equals match:[^,]+ { proxy["underlying-proxy"] = match.join(""); } download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); } test_url = comma "test-url" equals match:[^,]+ { proxy["test-url"] = match.join(""); } test_udp = comma "test-udp" equals match:[^,]+ { proxy["test-udp"] = match.join(""); } test_timeout = comma "test-timeout" equals match:$[0-9]+ { proxy["test-timeout"] = parseInt(match.trim()); } tos = comma "tos" equals match:$[0-9]+ { proxy.tos = parseInt(match.trim()); } interface = comma "interface" equals match:[^,]+ { proxy.interface = match.join(""); } allow_other_interface = comma "allow-other-interface" equals flag:bool { proxy["allow-other-interface"] = flag; } hybrid = comma "hybrid" equals flag:bool { proxy.hybrid = flag; } idle_timeout = comma "idle-timeout" equals match:$[0-9]+ { proxy["idle-timeout"] = parseInt(match.trim()); } private_key = comma "private-key" equals match:[^,]+ { proxy["keystore-private-key"] = match.join("").replace(/^"(.*)"$/, '$1'); } server_fingerprint = comma "server-fingerprint" equals match:[^,]+ { proxy["server-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); } block_quic = comma "block-quic" equals match:[^,]+ { proxy["block-quic"] = match.join(""); } udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); } shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); } shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); } shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } token = comma "token" equals match:[^,]+ { proxy.token = match.join(""); } alpn = comma "alpn" equals match:[^,]+ { proxy.alpn = match.join(""); } uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); } tag = match:[^=,]* { proxy.name = match.join("").trim(); } comma = _ "," _ equals = _ "=" _ _ = [ \r\t]* bool = b:("true"/"false") { return b === "true" } others = comma [^=,]+ equals [^=,]+ `,hv;function Ui(){return hv||(hv=sD.generate(HM)),hv}var aD=yn(ph()),MM=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } }} // per-parser initializer { const proxy = {}; const obfs = {}; const transport = {}; const $ = {}; function handleTransport() { if (transport.type === "tcp") { /* do nothing */ } else if (transport.type === "ws") { proxy.network = "ws"; $set(proxy, "ws-opts.path", transport.path); $set(proxy, "ws-opts.headers.Host", transport.host); } else if (transport.type === "http") { proxy.network = "http"; $set(proxy, "http-opts.path", transport.path); $set(proxy, "http-opts.headers.Host", transport.host); } } } start = (shadowsocksr/shadowsocks/vmess/vless/trojan/https/http/socks5/hysteria2) { return proxy; } shadowsocksr = tag equals "shadowsocksr"i address method password (ssr_protocol/ssr_protocol_param/obfs_ssr/obfs_ssr_param/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)*{ proxy.type = "ssr"; // handle ssr obfs proxy.obfs = obfs.type; } shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs_hostv)? (obfs_ss/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)* { proxy.type = "ss"; // handle ss obfs if (obfs.type == "http" || obfs.type === "tls") { proxy.plugin = "obfs"; $set(proxy, "plugin-opts.mode", obfs.type); $set(proxy, "plugin-opts.host", obfs.host); $set(proxy, "plugin-opts.path", obfs.path); } } vmess = tag equals "vmess"i address method uuid (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/vmess_alterId/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* { proxy.type = "vmess"; proxy.cipher = proxy.cipher || "none"; proxy.alterId = proxy.alterId || 0; handleTransport(); } vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/flow/public_key/short_id/block_quic/others)* { proxy.type = "vless"; handleTransport(); } trojan = tag equals "trojan"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "trojan"; handleTransport(); } hysteria2 = tag equals "hysteria2"i address password (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/udp_relay/fast_open/download_bandwidth/salamander_password/ecn/ip_mode/block_quic/others)* { proxy.type = "hysteria2"; } https = tag equals "https"i address (username password)? (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "http"; proxy.tls = true; } http = tag equals "http"i address (username password)? (fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "http"; } socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/block_quic/others)* { proxy.type = "socks5"; } address = comma server:server comma port:port { proxy.server = server; proxy.port = port; } server = ip/domain ip = & { const start = peg$currPos; let j = start; while (j < input.length) { if (input[j] === ",") break; j++; } peg$currPos = j; $.ip = input.substring(start, j).trim(); return true; } { return $.ip; } domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } throw new Error("Invalid domain: " + domain); } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } throw new Error("Invalid port number: " + port); } method = comma cipher:cipher { proxy.cipher = cipher; } cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"auto"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none"/"rc4-md5"/"rc4"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm"); username = & { let j = peg$currPos; let start, end; let first = true; while (j < input.length) { if (input[j] === ',') { if (first) { start = j + 1; first = false; } else { end = j; break; } } j++; } const match = input.substring(start, end); if (match.indexOf("=") === -1) { $.username = match; peg$currPos = end; return true; } } { proxy.username = $.username; } password = comma '"' match:[^"]* '"' { proxy.password = match.join(""); } uuid = comma '"' match:[^"]+ '"' { proxy.uuid = match.join(""); } obfs_typev = comma type:("http"/"tls") { obfs.type = type; } obfs_hostv = comma match:[^,]+ { obfs.host = match.join(""); } obfs_ss = comma "obfs-name" equals type:("http"/"tls") { obfs.type = type; } obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { obfs.type = type; } obfs_ssr_param = comma "obfs-param" equals match:$[^,]+ { proxy["obfs-param"] = match; } obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; } obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; } uri = $[^,]+ transport = comma "transport" equals type:("tcp"/"ws"/"http") { transport.type = type; } transport_host = comma "host" equals host:domain { transport.host = host; } transport_path = comma "path" equals path:uri { transport.path = path; } ssr_protocol = comma "protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; } ssr_protocol_param = comma "protocol-param" equals param:$[^=,]+ { proxy["protocol-param"] = param; } vmess_alterId = comma "alterId" equals alterId:$[0-9]+ { proxy.alterId = parseInt(alterId); } udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); } shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { proxy["shadow-tls-version"] = parseInt(match.trim()); } shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { proxy["shadow-tls-sni"] = match.join(""); } shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { proxy["shadow-tls-password"] = match.join(""); } over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; } tls_name = comma sni:("tls-name") equals host:domain { proxy.sni = host; } sni = comma sni:("sni") equals host:domain { proxy.sni = host; } tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; } tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); } tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); } flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); } public_key = comma "public-key" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["public-key"] = match.join("").replace(/^"(.*)"$/, '$1'); } short_id = comma "short-id" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = match.join("").replace(/^"(.*)"$/, '$1'); } fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; } udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; } ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); } ecn = comma "ecn" equals flag:bool { proxy.ecn = flag; } download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); } salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join(""); proxy.obfs = 'salamander'; } block_quic = comma "block-quic" equals flag:bool { if(flag) proxy["block-quic"] = "on"; else proxy["block-quic"] = "off"; } tag = match:[^=,]* { proxy.name = match.join("").trim(); } comma = _ "," _ equals = _ "=" _ _ = [ \r\t]* bool = b:("true"/"false") { return b === "true" } others = comma [^=,]+ equals [^=,]+ `,dv;function pa(){return dv||(dv=aD.generate(MM)),dv}var uD=yn(ph()),qM=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } }} // per-parse initializer { const proxy = {}; const obfs = {}; const $ = {}; function handleObfs() { if (obfs.type === "ws" || obfs.type === "wss") { proxy.network = "ws"; if (obfs.type === 'wss') { proxy.tls = true; } $set(proxy, "ws-opts.path", obfs.path); $set(proxy, "ws-opts.headers.Host", obfs.host); } else if (obfs.type === "over-tls") { proxy.tls = true; } else if (obfs.type === "http") { proxy.network = "http"; $set(proxy, "http-opts.path", obfs.path); $set(proxy, "http-opts.headers.Host", obfs.host); } } } start = (trojan/shadowsocks/vmess/vless/http/socks5) { return proxy } trojan = "trojan" equals address (password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/obfs/obfs_host/obfs_uri/tag/udp_relay/udp_over_tcp/fast_open/server_check_url/others)* { proxy.type = "trojan"; handleObfs(); } shadowsocks = "shadowsocks" equals address (password/method/obfs_ssr/obfs_ss/obfs_host/obfs_uri/ssr_protocol/ssr_protocol_param/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/udp_relay/udp_over_tcp_new/fast_open/tag/server_check_url/others)* { if (proxy.protocol || proxy.type === "ssr") { proxy.type = "ssr"; if (!proxy.protocol) { proxy.protocol = "origin"; } // handle ssr obfs if (obfs.host) proxy["obfs-param"] = obfs.host; if (obfs.type) proxy.obfs = obfs.type; } else { proxy.type = "ss"; // handle ss obfs if (obfs.type == "http" || obfs.type === "tls") { proxy.plugin = "obfs"; $set(proxy, "plugin-opts", { mode: obfs.type }); } else if (obfs.type === "ws" || obfs.type === "wss") { proxy.plugin = "v2ray-plugin"; $set(proxy, "plugin-opts.mode", "websocket"); if (obfs.type === "wss") { $set(proxy, "plugin-opts.tls", true); } } else if (obfs.type === 'over-tls') { throw new Error('ss over-tls is not supported'); } if (obfs.type) { $set(proxy, "plugin-opts.host", obfs.host); $set(proxy, "plugin-opts.path", obfs.path); } } } vmess = "vmess" equals address (uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/others)* { proxy.type = "vmess"; proxy.cipher = proxy.cipher || "none"; if (proxy.aead === false) { proxy.alterId = 1; } else { proxy.alterId = 0; } handleObfs(); } vless = "vless" equals address (uuid/method/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/obfs/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/others)* { proxy.type = "vless"; proxy.cipher = proxy.cipher || "none"; handleObfs(); } http = "http" equals address (username/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/others)*{ proxy.type = "http"; } socks5 = "socks5" equals address (username/password/password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/fast_open/udp_relay/udp_over_tcp/server_check_url/others)* { proxy.type = "socks5"; } address = server:server ":" port:port { proxy.server = server; proxy.port = port; } server = ip/domain domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } } ip = & { const start = peg$currPos; let end; let j = start; while (j < input.length) { if (input[j] === ",") break; if (input[j] === ":") end = j; j++; } peg$currPos = end || j; $.ip = input.substring(start, end).trim(); return true; } { return $.ip; } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } } username = comma "username" equals username:[^,]+ { proxy.username = username.join("").trim(); } password = comma "password" equals password:[^,]+ { proxy.password = password.join("").trim(); } uuid = comma "password" equals uuid:[^,]+ { proxy.uuid = uuid.join("").trim(); } method = comma "method" equals cipher:cipher { proxy.cipher = cipher; }; cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"none"/"rc2-cfb"/"rc4-md5-6"/"rc4-md5"/"salsa20"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm"); aead = comma "aead" equals flag:bool { proxy.aead = flag; } udp_relay = comma "udp-relay" equals flag:bool { proxy.udp = flag; } udp_over_tcp = comma "udp-over-tcp" equals flag:bool { throw new Error("UDP over TCP is not supported"); } udp_over_tcp_new = comma "udp-over-tcp" equals param:$[^=,]+ { if (param === "sp.v1") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 1; } else if (param === "sp.v2") { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 2; } else if (param === "true") { proxy["_ssr_python_uot"] = true; } else { throw new Error("Invalid value for udp-over-tcp"); } } fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; } over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; } tls_host = comma "tls-host" equals sni:domain { proxy.sni = sni; } tls_verification = comma "tls-verification" equals flag:bool { proxy["skip-cert-verify"] = !flag; } tls_fingerprint = comma "tls-cert-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); } tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals param:$[^=,]+ { proxy["tls-pubkey-sha256"] = param; } tls_alpn = comma "tls-alpn" equals param:$[^=,]+ { proxy["tls-alpn"] = param; } tls_no_session_ticket = comma "tls-no-session-ticket" equals flag:bool { proxy["tls-no-session-ticket"] = flag; } tls_no_session_reuse = comma "tls-no-session-reuse" equals flag:bool { proxy["tls-no-session-reuse"] = flag; } obfs_ss = comma "obfs" equals type:("http"/"tls"/"wss"/"ws"/"over-tls") { obfs.type = type; return type; } obfs_ssr = comma "obfs" equals type:("plain"/"http_simple"/"http_post"/"random_head"/"tls1.2_ticket_auth"/"tls1.2_ticket_fastauth") { proxy.type = "ssr"; obfs.type = type; return type; } obfs = comma "obfs" equals type:("wss"/"ws"/"over-tls"/"http") { obfs.type = type; return type; }; obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; } obfs_uri = comma "obfs-uri" equals uri:uri { obfs.path = uri; } ssr_protocol = comma "ssr-protocol" equals protocol:("origin"/"auth_sha1_v4"/"auth_aes128_md5"/"auth_aes128_sha1"/"auth_chain_a"/"auth_chain_b") { proxy.protocol = protocol; return protocol; } ssr_protocol_param = comma "ssr-protocol-param" equals param:$[^=,]+ { proxy["protocol-param"] = param; } server_check_url = comma "server_check_url" equals param:$[^=,]+ { proxy["test-url"] = param; } uri = $[^,]+ tag = comma "tag" equals tag:[^=,]+ { proxy.name = tag.join(""); } others = comma [^=,]+ equals [^=,]+ comma = _ "," _ equals = _ "=" _ _ = [ \r\t]* bool = b:("true"/"false") { return b === "true" } `,pv;function uu(){return pv||(pv=uD.generate(qM)),pv}var oD=yn(ph()),VM=String.raw` // global initializer {{ function $set(obj, path, value) { if (Object(obj) !== obj) return obj; if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []; path .slice(0, -1) .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ path[path.length - 1] ] = value; return obj; } function toBool(str) { if (typeof str === 'undefined' || str === null) return undefined; return /(TRUE)|1/i.test(str); } }} { const proxy = {}; const obfs = {}; const $ = {}; const params = {}; } start = (trojan) { return proxy } trojan = "trojan://" password:password "@" server:server ":" port:port "/"? params? name:name?{ proxy.type = "trojan"; proxy.password = password; proxy.server = server; proxy.port = port; proxy.name = name; // name may be empty if (!proxy.name) { proxy.name = server + ":" + port; } }; password = match:$[^@]+ { return decodeURIComponent(match); }; server = ip/domain; domain = match:[0-9a-zA-z-_.]+ { const domain = match.join(""); if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) { return domain; } } ip = & { const start = peg$currPos; let end; let j = start; while (j < input.length) { if (input[j] === ",") break; if (input[j] === ":") end = j; j++; } peg$currPos = end || j; $.ip = input.substring(start, end).trim(); return true; } { return $.ip; } port = digits:[0-9]+ { const port = parseInt(digits.join(""), 10); if (port >= 0 && port <= 65535) { return port; } else { throw new Error("Invalid port: " + port); } } params = "?" head:param tail:("&"@param)* { for (const [key, value] of Object.entries(params)) { params[key] = decodeURIComponent(value); } proxy["skip-cert-verify"] = toBool(params["allowInsecure"]); proxy.sni = params["sni"] || params["peer"]; proxy['client-fingerprint'] = params.fp; proxy.alpn = params.alpn ? decodeURIComponent(params.alpn).split(',') : undefined; if (toBool(params["ws"])) { proxy.network = "ws"; $set(proxy, "ws-opts.path", params["wspath"]); } if (params["type"]) { let httpupgrade proxy.network = params["type"] if(proxy.network === 'httpupgrade') { proxy.network = 'ws' httpupgrade = true } if (['grpc'].includes(proxy.network)) { proxy[proxy.network + '-opts'] = { 'grpc-service-name': params["serviceName"], '_grpc-type': params["mode"], '_grpc-authority': params["authority"], }; } else { if (params["path"]) { $set(proxy, proxy.network+"-opts.path", decodeURIComponent(params["path"])); } if (params["host"]) { $set(proxy, proxy.network+"-opts.headers.Host", decodeURIComponent(params["host"])); } if (httpupgrade) { $set(proxy, proxy.network+"-opts.v2ray-http-upgrade", true); $set(proxy, proxy.network+"-opts.v2ray-http-upgrade-fast-open", true); } } if (['reality'].includes(params.security)) { const opts = {}; if (params.pbk) { opts['public-key'] = params.pbk; } if (params.sid) { opts['short-id'] = params.sid; } if (params.spx) { opts['_spider-x'] = params.spx; } if (params.mode) { proxy._mode = params.mode; } if (params.extra) { proxy._extra = params.extra; } if (Object.keys(opts).length > 0) { $set(proxy, params.security+"-opts", opts); } } } proxy.udp = toBool(params["udp"]); proxy.tfo = toBool(params["tfo"]); } param = kv/single; kv = key:$[a-z]i+ "=" value:$[^&#]i* { params[key] = value; } single = key:$[a-z]i+ { params[key] = true; }; name = "#" + match:$.* { return decodeURIComponent(match); } `,gv;function mv(){return gv||(gv=oD.generate(VM)),gv}var Ev=yn(Av());function lD(e){let[t,r]=e.match(/,\s*?port-hopping\s*?=\s*?["']?\s*?((\d+(-\d+)?)([,;]\d+(-\d+)?)*)\s*?["']?\s*?/)||[];return{port_hopping:r?r.replace(/;/g,","):void 0,line:t?e.replace(t,""):e}}function KM(){return{name:"URI PROXY Parser",test:n=>/^(socks5\+tls|socks5|http|https):\/\//.test(n),parse:n=>{let[i,a,s,u,l,f,d,m,p]=n.match(/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?\/?(\?.*?)?(?:#(.*?))?$/);if(d)d=parseInt(d,10);else{if(s)d=443;else if(a==="http")d=80;else throw J.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);J.info(`port is not present in line: ${n}, set to ${d}`)}return{name:p!=null?decodeURIComponent(p):`${a} ${f}:${d}`,type:a,tls:!!s,server:f,port:d,username:u!=null?decodeURIComponent(u):void 0,password:l!=null?decodeURIComponent(l):void 0}}}}function zM(){return{name:"URI SOCKS Parser",test:n=>/^socks:\/\//.test(n),parse:n=>{let[i,a,s,u,l,f,d]=n.match(/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(l)l=parseInt(l,10);else throw J.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);let m,p;if(s){let w=yt.decode(decodeURIComponent(s)).split(":");m=w[0],p=w[1]}return{name:d!=null?decodeURIComponent(d):`${a} ${u}:${l}`,type:"socks5",server:u,port:l,username:m,password:p}}}}function GM(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let i=n.split("ss://")[1],a=n.split("#")[1],s={type:"ss"};i=i.split("#")[0];let u=i.match(/@([^/?]*)(\/|\?|$)/),l=decodeURIComponent(i.split("@")[0]),f;l?.startsWith("2022-blake3-")?f=l:f=yt.decode(l);let d="";if(u)i.includes("?")&&(d=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let y=i.match(/^(.*)(\?.*)$/);i=y[1],d=y[2]}if(i=yt.decode(i),d){if(/(&|\?)v2ray-plugin=/.test(d)){let g=d.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];g&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(yt.decode(g)))}i=`${i}${d}`}f=i.match(/(^.*)@/)?.[1],u=i.match(/@([^/@]*)(\/|$)/)}let m=u[1],p=m.lastIndexOf(":");s.server=m.substring(0,p),s.port=`${m.substring(p+1)}`.match(/\d+/)?.[0];let h=f.match(/(^.*?):(.*$)/);s.cipher=h?.[1],s.password=h?.[2];let w=i.match(/[?&]plugin=([^&]+)/),v=i.match(/[?&]shadow-tls=([^&]+)/);if(w){let y=("plugin="+decodeURIComponent(w[1])).split(";"),g={};for(let b of y){let[D,_]=b.split("=");D&&(g[D]=_||!0)}switch(g.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:g.obfs,host:Jt(g["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:"websocket",host:Jt(g["obfs-host"]),path:Jt(g.path),tls:Dl(g.tls)};break;case"shadow-tls":{s.plugin="shadow-tls";let b=Jt(g.version);s["plugin-opts"]={host:Jt(g.host),password:Jt(g.password),version:b?parseInt(b,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${g.plugin}`)}}if(v){let y=JSON.parse(yt.decode(v[1])),g=Jt(y.version),b=Jt(y.address),D=Jt(y.port);s.plugin="shadow-tls",s["plugin-opts"]={host:Jt(y.host),password:Jt(y.password),version:g?parseInt(g,10):void 0},b&&(s.server=b),D&&(s.port=parseInt(D,10))}return/(&|\?)uot=(1|true)/i.test(d)&&(s["udp-over-tcp"]=!0),/(&|\?)tfo=(1|true)/i.test(d)&&(s.tfo=!0),a!=null&&(a=decodeURIComponent(a)),s.name=a??`SS ${s.server}:${s.port}`,s}}}function YM(){return{name:"URI SSR Parser",test:n=>/^ssr:\/\//.test(n),parse:n=>{n=yt.decode(n.split("ssr://")[1]);let i=n.indexOf(":origin");i===-1&&(i=n.indexOf(":auth_"));let a=n.substring(0,i),s=a.substring(0,a.lastIndexOf(":")),u=a.substring(a.lastIndexOf(":")+1),l=n.substring(i+1).split("/?")[0].split(":"),f={type:"ssr",server:s,port:u,protocol:l[0],cipher:l[1],obfs:l[2],password:yt.decode(l[3])},d={};if(n=n.split("/?")[1].split("&"),n.length>1)for(let m of n){let[p,h]=m.split("=");h=h.trim(),h.length>0&&h!=="(null)"&&(d[p]=h)}return f={...f,name:d.remarks?yt.decode(d.remarks):f.server,"protocol-param":Jt(yt.decode(d.protoparam||"").replace(/\s/g,"")),"obfs-param":Jt(yt.decode(d.obfsparam||"").replace(/\s/g,""))},f}}}function WM(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{n=n.split("vmess://")[1];let i=yt.decode(n.replace(/\?.*?$/,""));if(/=\s*vmess/.test(i)){let a=i.split(",").map(l=>l.trim()),s={};for(let l of a)if(l.indexOf("=")!==-1){let[f,d]=l.split("=");s[f.trim()]=d.trim()}let u={name:a[0].split("=")[0].trim(),type:"vmess",server:a[1],port:a[2],cipher:Jt(a[3],"auto"),uuid:a[4].match(/^"(.*)"$/)[1],tls:s.obfs==="wss",udp:Dl(s["udp-relay"]),tfo:Dl(s["fast-open"]),"skip-cert-verify":_l(s["tls-verification"])?!s["tls-verification"]:void 0};if(_l(s.obfs))if(s.obfs==="ws"||s.obfs==="wss"){u.network="ws",u["ws-opts"].path=(Jt(s["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let l=s["obfs-header"];l&&l.indexOf("Host")!==-1&&(l=l.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),Hs(l)&&(u["ws-opts"].headers={Host:l})}else throw new Error(`Unsupported obfs: ${s.obfs}`);return u}else{let a={};try{a=JSON.parse(i)}catch{let[m,p,h]=/(^[^?]+?)\/?\?(.*)$/.exec(n);i=yt.decode(p);for(let D of h.split("&")){let[_,F]=D.split("="),L=F;L=decodeURIComponent(F),L.indexOf(",")===-1?a[_]=L:a[_]=L.split(",")}let[w,v,y,g,b]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(i);a.scy=v,a.id=y,a.port=b,a.add=g}let s=a.add,u=parseInt(Dl(a.port),10),l={name:a.ps??a.remarks??a.remark??`VMess ${s}:${u}`,type:"vmess",server:s,port:u,cipher:["auto","aes-128-gcm","chacha20-poly1305","none"].includes(a.scy)?a.scy:"auto",uuid:a.id,alterId:parseInt(Dl(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":_l(a.verify_cert)?!a.verify_cert:void 0};!l["skip-cert-verify"]&&_l(a.allowInsecure)&&(l["skip-cert-verify"]=/(TRUE)|1/i.test(a.allowInsecure)),l.tls&&(a.sni&&a.sni!==""?l.sni=a.sni:a.peer&&a.peer!==""&&(l.sni=a.peer));let f=!1;if(a.net==="ws"||a.obfs==="websocket"?l.network="ws":["http"].includes(a.net)||["http"].includes(a.obfs)||["http"].includes(a.type)?l.network="http":["grpc","kcp","quic"].includes(a.net)?l.network=a.net:a.net==="httpupgrade"||l.network==="httpupgrade"?(l.network="ws",f=!0):(a.net==="h2"||l.network==="h2")&&(l.network="h2"),l.network){let d=a.host??a.obfsParam;try{let h=JSON.parse(d)?.Host;h&&(d=h)}catch{}let m=a.path;if(["ws"].includes(l.network)&&(m=m||"/"),l.network==="http"&&(d&&(d=d.split(",").map(p=>p.trim()),d=Array.isArray(d)?d[0]:d),m?m=Array.isArray(m)?m[0]:m:m="/"),m||d||["kcp","quic"].includes(l.network))if(["grpc"].includes(l.network))l[`${l.network}-opts`]={"grpc-service-name":Jt(m),"_grpc-type":Jt(a.type),"_grpc-authority":Jt(a.authority)};else if(["kcp","quic"].includes(l.network))l[`${l.network}-opts`]={[`_${l.network}-type`]:Jt(a.type),[`_${l.network}-host`]:Jt(Jt(d)),[`_${l.network}-path`]:Jt(m)};else{let p={path:Jt(m),headers:{Host:Jt(d)}};f&&(p["v2ray-http-upgrade"]=!0,p["v2ray-http-upgrade-fast-open"]=!0),l[`${l.network}-opts`]=p}else delete l.network}return l["client-fingerprint"]=a.fp,l.alpn=a.alpn?a.alpn.split(","):void 0,l}}}}function cD(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:n=>{n=n.split("vless://")[1];let i,a=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!a){let[y,g,b]=/^(.*?)(\?.*?$)/.exec(n);n=`${yt.decode(g)}${b}`,a=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),i=!0}let[s,u,l,f,d,m="",p]=a;i&&(u=u.replace(/^.*?:/g,"")),f=parseInt(`${f}`,10),u=decodeURIComponent(u),p!=null&&(p=decodeURIComponent(p));let h={type:"vless",name:p,server:l,port:f,uuid:u},w={};for(let y of m.split("&"))if(y){let[g,b]=y.split("="),D=b;D=decodeURIComponent(b),w[g]=D}if(h.name=p??w.remarks??w.remark??`VLESS ${l}:${f}`,h.tls=w.security&&w.security!=="none",i&&/TRUE|1/i.test(w.tls)&&(h.tls=!0,w.security=w.security??"reality"),h.sni=w.sni||w.peer,h.flow=w.flow,!h.flow&&i&&w.xtls){let y=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][w.xtls];y&&(h.flow=y)}if(h["client-fingerprint"]=w.fp,h.alpn=w.alpn?w.alpn.split(","):void 0,h["skip-cert-verify"]=/(TRUE)|1/i.test(w.allowInsecure),["reality"].includes(w.security)){let y={};w.pbk&&(y["public-key"]=w.pbk),w.sid&&(y["short-id"]=w.sid),w.spx&&(y["_spider-x"]=w.spx),Object.keys(y).length>0&&(h[`${w.security}-opts`]=y)}let v=!1;if(h.network=w.type,h.network==="tcp"&&w.headerType==="http"?h.network="http":h.network==="httpupgrade"&&(h.network="ws",v=!0),!h.network&&i&&w.obfs&&(h.network=w.obfs,["none"].includes(h.network)&&(h.network="tcp")),["websocket"].includes(h.network)&&(h.network="ws"),h.network&&!["tcp","none"].includes(h.network)){let y={},g=w.host??w.obfsParam;if(g)if(w.obfsParam)try{let b=JSON.parse(g);y.headers=b}catch{y.headers={Host:g}}else y.headers={Host:g};w.serviceName?(y[`${h.network}-service-name`]=w.serviceName,["grpc"].includes(h.network)&&w.authority&&(y["_grpc-authority"]=w.authority)):i&&w.path&&(["ws","http","h2"].includes(h.network)||(y[`${h.network}-service-name`]=w.path,delete w.path)),w.path&&(y.path=w.path),["grpc"].includes(h.network)&&(y["_grpc-type"]=w.mode||"gun"),v&&(y["v2ray-http-upgrade"]=!0,y["v2ray-http-upgrade-fast-open"]=!0),Object.keys(y).length>0&&(h[`${h.network}-opts`]=y),h.network==="kcp"&&(w.seed&&(h.seed=w.seed),h.headerType=w.headerType||"none"),w.mode&&(h._mode=w.mode),w.extra&&(h._extra=w.extra)}return w.encryption&&(h.encryption=w.encryption),w.pqv&&(h._pqv=w.pqv),h}}}function XM(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{let i=cD().parse(n.replace("anytls","vless"));n=n.split(/anytls:\/\//)[1];let[a,s,u,l,f="",d]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);s=decodeURIComponent(s),l=parseInt(`${l}`,10),isNaN(l)&&(l=443),s=decodeURIComponent(s),d!=null&&(d=decodeURIComponent(d)),d=d??`AnyTLS ${u}:${l}`;let m={...i,uuid:void 0,type:"anytls",name:d,server:u,port:l,password:s};for(let p of f.split("&"))if(p){let[h,w]=p.split("=");h=h.replace(/_/g,"-"),w=decodeURIComponent(w),["alpn"].includes(h)?m[h]=w?w.split(","):void 0:["insecure"].includes(h)?m["skip-cert-verify"]=/(TRUE)|1/i.test(w):["udp"].includes(h)?m[h]=/(TRUE)|1/i.test(w):Object.keys(m).includes(h)||(m[h]=w)}return["tcp"].includes(m.network)&&!m["reality-opts"]&&(delete m.network,delete m.security),m}}}function ZM(){return{name:"URI Hysteria2 Parser",test:n=>/^(hysteria2|hy2):\/\//.test(n),parse:n=>{n=n.split(/(hysteria2|hy2):\/\//)[2];let i,[a,s,u,l,f,d,m,p,h,w,v="",y]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);/^\d+$/.test(f)?(f=parseInt(`${f}`,10),isNaN(f)&&(f=443)):f?(i=f,f=Zc(i)):f=443,s=decodeURIComponent(s),y!=null&&(y=decodeURIComponent(y)),y=y??`Hysteria2 ${u}:${f}`;let g={type:"hysteria2",name:y,server:u,port:f,ports:i,password:s},b={};for(let F of v.split("&"))if(F){let[L,N]=F.split("="),S=N;S=decodeURIComponent(N),b[L]=S}g.sni=b.sni,!g.sni&&b.peer&&(g.sni=b.peer),b.obfs&&b.obfs!=="none"&&(g.obfs=b.obfs),b.mport&&(g.ports=b.mport),g["obfs-password"]=b["obfs-password"],g["skip-cert-verify"]=/(TRUE)|1/i.test(b.insecure),g.tfo=/(TRUE)|1/i.test(b.fastopen),g["tls-fingerprint"]=b.pinSHA256;let D=b["hop-interval"]||b.hop_interval;/^\d+$/.test(D)&&(g["hop-interval"]=parseInt(`${D}`,10));let _=b.keepalive;return/^\d+$/.test(_)&&(g.keepalive=parseInt(`${_}`,10)),g}}}function JM(){return{name:"URI Hysteria Parser",test:n=>/^(hysteria|hy):\/\//.test(n),parse:n=>{n=n.split(/(hysteria|hy):\/\//)[2];let[i,a,s,u,l,f="",d]=/^(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);u=parseInt(`${u}`,10),isNaN(u)&&(u=443),d!=null&&(d=decodeURIComponent(d)),d=d??`Hysteria ${a}:${u}`;let m={type:"hysteria",name:d,server:a,port:u},p={};for(let h of f.split("&"))if(h){let[w,v]=h.split("=");w=w.replace(/_/,"-"),v=decodeURIComponent(v),["alpn"].includes(w)?m[w]=v?v.split(","):void 0:["insecure"].includes(w)?m["skip-cert-verify"]=/(TRUE)|1/i.test(v):["auth"].includes(w)?m["auth-str"]=v:["mport"].includes(w)?m.ports=v:["obfsParam"].includes(w)?m.obfs=v:["upmbps"].includes(w)?m.up=v:["downmbps"].includes(w)?m.down=v:["obfs"].includes(w)?m._obfs=v||"":["fast-open","peer"].includes(w)?p[w]=v:Object.keys(m).includes(w)||(m[w]=v)}return!m.sni&&p.peer&&(m.sni=p.peer),!m["fast-open"]&&p.fastopen&&(m["fast-open"]=!0),m.protocol||(m.protocol="udp"),m}}}function QM(){return{name:"URI TUIC Parser",test:n=>/^tuic:\/\//.test(n),parse:n=>{n=n.split(/tuic:\/\//)[1];let[i,a,s,u,l="",f]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);a=decodeURIComponent(a);let[d,...m]=a.split(":"),p=m.join(":");u=parseInt(`${u}`,10),isNaN(u)&&(u=443),p=decodeURIComponent(p),f!=null&&(f=decodeURIComponent(f)),f=f??`TUIC ${s}:${u}`;let h={type:"tuic",name:f,server:s,port:u,password:p,uuid:d};for(let w of l.split("&"))if(w){let[v,y]=w.split("=");v=v.replace(/_/g,"-"),y=decodeURIComponent(y),["alpn"].includes(v)?h[v]=y?y.split(","):void 0:["allow-insecure","insecure"].includes(v)?h["skip-cert-verify"]=/(TRUE)|1/i.test(y):["fast-open"].includes(v)?h.tfo=!0:["disable-sni","reduce-rtt"].includes(v)?h[v]=/(TRUE)|1/i.test(y):v==="congestion-control"?(h["congestion-controller"]=y,delete h[v]):Object.keys(h).includes(v)||(h[v]=y)}return h}}}function eq(){return{name:"URI WireGuard Parser",test:n=>/^(wireguard|wg):\/\//.test(n),parse:n=>{n=n.split(/(wireguard|wg):\/\//)[2];let[i,a,s,u,l,f,d,m="",p]=/^((.*?)@)?(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);f=parseInt(`${f}`,10),isNaN(f)&&(f=51820),s=decodeURIComponent(s),p!=null&&(p=decodeURIComponent(p)),p=p??`WireGuard ${u}:${f}`;let h={type:"wireguard",name:p,server:u,port:f,"private-key":s,udp:!0};for(let w of m.split("&"))if(w){let[v,y]=w.split("=");if(v=v.replace(/_/,"-"),y=decodeURIComponent(y),["reserved"].includes(v)){let g=y.split(",").map(b=>parseInt(b.trim(),10)).filter(b=>Number.isInteger(b));g.length===3&&(h[v]=g)}else if(["address","ip"].includes(v))y.split(",").map(g=>{let b=g.trim().replace(/\/\d+$/,"").replace(/^\[/,"").replace(/\]$/,"");Rr(b)?h.ip=b:Ur(b)&&(h.ipv6=b)});else if(["mtu"].includes(v)){let g=parseInt(y.trim(),10);Number.isInteger(g)&&(h[v]=g)}else/publickey/i.test(v)?h["public-key"]=y:/privatekey/i.test(v)?h["private-key"]=y:["udp"].includes(v)?h[v]=/(TRUE)|1/i.test(y):[...Object.keys(h),"flag"].includes(v)||(h[v]=y)}return h}}}function tq(){return{name:"URI Trojan Parser",test:n=>/^trojan:\/\//.test(n),parse:n=>{let i=/^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(n);i?.[2]||(n=n.replace(i[1],`${i[1]}:443`));let[s,u]=n.split(/#(.+)/,2),f=mv().parse(s);if(Hs(u))try{f.name=decodeURIComponent(u)}catch(d){console.log(d)}return f}}}function rq(){return{name:"Clash Parser",test:n=>{let i;try{i=Ev.default.parse(n)}catch{i=qs.parse(n)}return!!i?.type},parse:n=>{let i;try{i=Ev.default.parse(n)}catch{i=qs.parse(n)}if(!["anytls","mieru","juicity","ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","hysteria","hysteria2","wireguard","ssh","direct"].includes(i.type))throw new Error(`Clash does not support proxy with type: ${i.type}`);return["vmess","vless"].includes(i.type)&&(i.sni=i.servername,delete i.servername),i["server-cert-fingerprint"]&&(i["tls-fingerprint"]=i["server-cert-fingerprint"]),i.fingerprint&&(i["tls-fingerprint"]=i.fingerprint),i["dialer-proxy"]&&(i["underlying-proxy"]=i["dialer-proxy"]),i["benchmark-url"]&&(i["test-url"]=i["benchmark-url"]),i["benchmark-timeout"]&&(i["test-timeout"]=i["benchmark-timeout"]),i}}}function nq(){return{name:"QX SS Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")===-1,parse:n=>uu().parse(n)}}function iq(){return{name:"QX SSR Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")!==-1,parse:n=>uu().parse(n)}}function sq(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>uu().parse(n)}}function aq(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>uu().parse(n)}}function uq(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>uu().parse(n)}}function oq(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>uu().parse(n)}}function lq(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>uu().parse(n)}}function cq(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>pa().parse(n)}}function fq(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>pa().parse(n)}}function hq(){return{name:"Loon VMess Parser",test:n=>/^.*=\s*vmess/i.test(n.split(",")[0])&&n.indexOf("username")===-1,parse:n=>pa().parse(n)}}function dq(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>pa().parse(n)}}function pq(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>pa().parse(n)}}function gq(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>pa().parse(n)}}function mq(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>pa().parse(n)}}function vq(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>pa().parse(n)}}function wq(){return{name:"Loon WireGuard Parser",test:n=>/^.*=\s*wireguard/i.test(n.split(",")[0]),parse:n=>{let i=n.match(/(^.*?)\s*?=\s*?wireguard\s*?,.+?\s*?=\s*?.+?/i)?.[1];n=n.replace(i,"").replace(/^\s*?=\s*?wireguard\s*/i,"");let a=n.match(/,\s*?peers\s*?=\s*?\[\s*?\{\s*?(.+?)\s*?\}\s*?\]/i)?.[1],s=a.match(/(,|^)\s*?endpoint\s*?=\s*?"?(.+?):(\d+)"?\s*?(,|$)/i),u=s?.[2],l=parseInt(s?.[3],10),f=n.match(/(,|^)\s*?mtu\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];f&&(f=parseInt(f,10));let d=n.match(/(,|^)\s*?keepalive\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];d&&(d=parseInt(d,10));let m=a.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];m&&(m=JSON.parse(m));let p,h=n.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],w=n.match(/(,|^)\s*?dnsv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2];(h||w)&&(p=[],h&&p.push(h),w&&p.push(w));let v=a.match(/(,|^)\s*?allowed-ips\s*?=\s*?"(.+?)"\s*?(,|$)/i)?.[2]?.split(",").map(F=>F.trim()),y=a.match(/(,|^)\s*?preshared-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],g=n.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],b=n.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],D=a.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],_={type:"wireguard",name:i,server:u,port:l,ip:g,ipv6:b,"private-key":n.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":D,mtu:f,keepalive:d,reserved:m,"allowed-ips":v,"preshared-key":y,dns:p,udp:!0,peers:[{server:u,port:l,ip:g,ipv6:b,"public-key":D,"pre-shared-key":y,"allowed-ips":v,reserved:m}]};return Array.isArray(_.dns)&&_.dns.length>0&&(_["remote-dns-resolve"]=!0),_}}}function Aq(){return{name:"Surge Direct Parser",test:n=>/^.*=\s*direct/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function Eq(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function bq(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function yq(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1,parse:n=>Ui().parse(n)}}function Cq(){return{name:"Surge Trojan Parser",test:n=>/^.*=\s*trojan/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function _q(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function Dq(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function Fq(){return{name:"Surge External Parser",test:n=>/^.*=\s*external/.test(n.split(",")[0]),parse:n=>{let i=/^\s*(.*?)\s*?=\s*?external\s*?,\s*(.*?)\s*$/.exec(n),[a,s,u]=i;n=u;let l=/(,|^)\s*?exec\s*?=\s*"(.*?)"\s*?(,|$)/.exec(n)?.[2];l||(l=/(,|^)\s*?exec\s*?=\s*(.*?)\s*?(,|$)/.exec(n)?.[2]);let f=/(,|^)\s*?local-port\s*?=\s*"(.*?)"\s*?(,|$)/.exec(n)?.[2];f||(f=/(,|^)\s*?local-port\s*?=\s*(.*?)\s*?(,|$)/.exec(n)?.[2]);let d=/(,|^)\s*?args\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,m,p=[];for(;(m=d.exec(n))!==null;)m[3]!=null?p.push(m[3]):m[4]!=null&&p.push(m[4]);let h=/(,|^)\s*?addresses\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,w,v=[];for(;(w=h.exec(n))!==null;){let g;w[3]!=null?g=w[3]:w[4]!=null&&(g=w[4]),g!=null&&(g=`${g}`.trim().replace(/^\[/,"").replace(/\]$/,"")),Pq(g)&&v.push(g)}return{type:"external",name:s,exec:l,"local-port":f,args:p,addresses:v}}}}function Sq(){return{name:"Surge Snell Parser",test:n=>/^.*=\s*snell/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function Iq(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=lD(n),s=Ui().parse(a);return s.ports=i,s}}}function Bq(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>Ui().parse(n)}}function xq(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=lD(n),s=Ui().parse(a);return s.ports=i,s}}}function Pq(e){return Rr(e)||Ur(e)}var fD=[KM(),zM(),GM(),YM(),WM(),cD(),QM(),eq(),JM(),ZM(),tq(),XM(),rq(),Aq(),Eq(),bq(),yq(),Cq(),_q(),Sq(),Iq(),Bq(),xq(),Dq(),Fq(),cq(),fq(),hq(),dq(),gq(),pq(),mq(),vq(),wq(),nq(),iq(),sq(),aq(),uq(),oq(),lq()];var zo=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=ks(),{defaultProxy,defaultTimeout:timeout,githubProxy}=J.read(ui),proxy=defaultProxy;J.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY")),syncPlatform==="gitlab"?(this.headers={"PRIVATE-TOKEN":`${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=Ta({baseURL:"https://gitlab.com/api/v4",headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ka(proxy):{},timeout:timeout||8e3,events:{onResponse:e=>{if(/^[45]/.test(String(e.statusCode))){let t=JSON.parse(e.body);return Promise.reject(`ERROR: ${t.message?.error??t.message}`)}else return e}}})):(this.headers={Authorization:`token ${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=Ta({baseURL:`${githubProxy?`${githubProxy}/`:""}https://api.github.com`,headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ka(proxy):{},timeout:timeout||8e3,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(`ERROR: ${JSON.parse(e.body).message}`):e}})),this.key=key,this.syncPlatform=syncPlatform}async locate(){return this.syncPlatform==="gitlab"?this.http.get("/snippets").then(e=>{let t=JSON.parse(e.body);for(let r of t)if(r.title===this.key)return r}):this.http.get("/gists?per_page=100&page=1").then(e=>{let t=JSON.parse(e.body);J.info(`\u83B7\u53D6\u5230\u5F53\u524D GitHub \u7528\u6237\u7684 gist: ${t.length} \u4E2A`);for(let r of t)if(r.description===this.key)return r})}async upload(e){if(Object.keys(e).length===0)return Promise.reject("\u672A\u63D0\u4F9B\u9700\u4E0A\u4F20\u7684\u6587\u4EF6");let t=await this.locate(),r=e;if(t?.id){this.syncPlatform==="gitlab"&&(t.files=t.files.reduce((a,s)=>(a[s.path]=s,a),{}));let n=[],i={...t.files};return Object.keys(r).map(a=>{i[a]?r[a].content==null||r[a].content===""?(delete i[a],n.push({action:"delete",file_path:a})):(i[a]=r[a],n.push({action:"update",file_path:a,content:r[a].content})):r[a].content==null||r[a].content===""?(delete i[a],delete r[a]):(i[a]=r[a],n.push({action:"create",file_path:a,content:r[a].content}))}),this.syncPlatform==="gitlab"?Object.keys(i).length===0?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u66F4\u65B0 snippet"):Object.keys(i).length>10?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4 snippet \u7684\u6587\u4EF6\u6570\u8D85\u8FC7 10, \u65E0\u6CD5\u66F4\u65B0 snippet"):(r=n,this.http.put({headers:{...this.headers,"Content-Type":"application/json"},url:`/snippets/${t.id}`,body:JSON.stringify({files:r})})):Object.keys(i).length===0?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u66F4\u65B0 gist"):this.http.patch({url:`/gists/${t.id}`,body:JSON.stringify({files:r})})}else return r=Object.entries(r).reduce((n,[i,a])=>(a.content!==null&&a.content!==""&&(n[i]=a),n),{}),this.syncPlatform==="gitlab"?Object.keys(r).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA snippet"):(r=Object.keys(r).map(n=>({file_path:n,content:r[n].content})),this.http.post({headers:{...this.headers,"Content-Type":"application/json"},url:"/snippets",body:JSON.stringify({title:this.key,visibility:"private",files:r})})):Object.keys(r).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA gist"):this.http.post({url:"/gists",body:JSON.stringify({description:this.key,public:!1,files:r})})}async download(e){let t=await this.locate();if(t?.id)try{let{files:r}=await this.http.get(`/gists/${t.id}`).then(i=>JSON.parse(i.body)),n=r[e].raw_url;return await this.http.get(n).then(i=>i.body)}catch(r){return Promise.reject(r)}else return Promise.reject(`\u627E\u4E0D\u5230 Sub-Store Gist (${this.key})`)}};var gD=yn(Av());function $q(e){for(let t of M0)try{if(t.test(e))return J.info(`Pre-processor [${t.name}] activated`),t.parse(e)}catch(r){J.error(`Parser [${t.name}] failed Reason: ${r}`)}return e}function Rq(e){e=$q(e);let t=e.split(` `),r=[],n;for(let i of t){if(i=i.trim(),i.length===0)continue;let a=!1;if(n){let[s,u]=hD(n,i);u||(r.push(pD(s)),a=!0)}if(!a)for(let s of fD){let[u,l]=hD(s,i);if(!l){r.push(pD(u)),n=s,a=!0,J.info(`${s.name} is activated`);break}}a||J.error(`Failed to parse line: ${i}`)}return r.filter(i=>(["vless","vmess"].includes(i.type)&&(S0(i.uuid)||J.error(`UUID may be invalid: ${i.name} ${i.uuid}`)),!0))}async function Tq(proxies,operators=[],targetPlatform,source,$options){for(let item of operators){if(item.disabled){J.log(`Skipping disabled operator: "${item.type}" with arguments: >>> ${JSON.stringify(item.args,null,2)||"None"}`);continue}let script,$arguments={};if(item.type.indexOf("Script")!==-1){let{mode,content}=item.args;if(mode==="link"){let url=content||"",rawArgs=url.split("#");if(rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}url=`${url.split("#")[0]}${rawArgs[2]?`#${rawArgs[2]}`:$arguments?.noCache!=null||$arguments?.insecure!=null?`#${rawArgs[1]}`:""}`;let downloadUrlMatch=url.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(downloadUrlMatch){let e="";try{e=downloadUrlMatch?.[1];let t=downloadUrlMatch?.[2];if(t==null)throw new Error(`\u672C\u5730 ${e} URL \u65E0\u6548: ${url}`);t=decodeURIComponent(t);let r=e==="module"?c0:vl,n=Mn(J.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);e==="module"?script=n.content:script=await Qi({type:"file",name:t})}catch(t){throw J.error(`Error when loading ${e}: ${item.args.content}. Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let fs=eval('require("fs")');script=fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw J.error(`Error when reading local script: ${item.args.content}. Reason: ${e}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u811A\u672C\u6587\u4EF6: ${url}`)}else try{script=await ji(url)}catch(e){throw J.error(`Error when downloading remote script: ${item.args.content}. Reason: ${e}`),new Error(`\u65E0\u6CD5\u4E0B\u8F7D\u811A\u672C: ${url}`)}}else script=content,$arguments=item.args.arguments||{}}if(!pd[item.type]){J.error(`Unknown operator: "${item.type}"`);continue}J.log(`Applying "${item.type}" with arguments: >>> ${JSON.stringify(item.args,null,2)||"None"}`);let processor;item.type.indexOf("Script")!==-1?processor=pd[item.type](script,targetPlatform,$arguments,source,$options):processor=pd[item.type](item.args||{}),proxies=await rC(processor,proxies)}return proxies}function Oq(e,t,r,n={}){let i=Q4[t];if(!i)throw new Error(`Target platform: ${t} is not supported!`);let a=/Surge|SurgeMac|Shadowrocket/i.test(t);if(e=e.filter(s=>s.supported&&s.supported[t]===!1?!1:(["vless","vmess"].includes(s.type)&&(S0(s.uuid)||J.error(`UUID may be invalid: ${s.name} ${s.uuid}`)),!0)),e=e.map(s=>(s._resolved=s.resolved,Hs(s.name)||(s.name=`${s.type} ${s.server}:${s.port}`),s["disable-sni"]&&(a?s.sni="off":["tuic"].includes(s.type)||(J.error(`Target platform ${t} does not support sni off. Proxy's fields (sni, tls-fingerprint and skip-cert-verify) will be modified.`),s.sni="",s["skip-cert-verify"]=!0,delete s["tls-fingerprint"])),s.ports&&(s.ports=String(s.ports),["ClashMeta"].includes(t)||(s.ports=s.ports.replace(/\//g,",")),s.port||(s.port=Zc(s.ports))),s)),J.log(`Producing proxies for target: ${t}`),typeof i.type>"u"||i.type==="SINGLE"){let s=e.map(u=>{try{return i.produce(u,r,n)}catch(l){return J.error(`Cannot produce proxy: ${JSON.stringify(u,null,2)} Reason: ${l}`),""}}).filter(u=>u.length>0);return s=r==="internal"?s:s.join(` `),t.startsWith("Surge")&&e.length>0&&e.every(u=>u.type==="wireguard")&&(s=`#!name=${e[0]?._subName} #!desc=${e[0]?._desc??""} #!category=${e[0]?._category??""} ${s}`),s}else if(i.type==="ALL")return i.produce(e,r,n)}var dr={parse:Rq,process:Tq,produce:Oq,ipAddress:F0,getRandomPort:Zc,isIPv4:Rr,isIPv6:Ur,isIP:bv,yaml:qs,getFlag:Kl,removeFlag:gf,getISO:Ny,MMDB:od,Gist:zo,download:ji,downloadFile:mD,isValidUUID:S0,doh:Gl,Buffer:fp.Buffer,Base64:yt,JSON5:gD.default};function hD(e,t){if(!kq(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function kq(e,t){try{return e.test(t)}catch{return!1}}function dD(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function pD(e){typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=YA(e.password)),["ss"].includes(e.type)&&e.cipher==="none"&&!e.password&&(e.password=""),e.interface&&(e["interface-name"]=e.interface,delete e.interface),GA(e.port)&&(e.port=parseInt(e.port,10)),e.server&&(e.server=`${e.server}`.trim().replace(/^\[/,"").replace(/\]$/,"")),e.network==="ws"&&(!e["ws-opts"]&&(e["ws-path"]||e["ws-headers"])&&(e["ws-opts"]={},e["ws-path"]&&(e["ws-opts"].path=e["ws-path"]),e["ws-headers"]&&(e["ws-opts"].headers=e["ws-headers"])),delete e["ws-path"],delete e["ws-headers"]);let t=e[`${e.network}-opts`]?.path;if(Array.isArray(t)?e[`${e.network}-opts`].path=t.map(n=>dD(n)):t!=null&&(e[`${e.network}-opts`].path=dD(t)),e.type==="trojan"&&e.network==="tcp"&&delete e.network,["vless"].includes(e.type)&&(e.network||(e.network="tcp")),["trojan","tuic","hysteria","hysteria2","juicity","anytls"].includes(e.type)&&(e.tls=!0),e.network){let n=e[`${e.network}-opts`]?.headers?.Host,i=e[`${e.network}-opts`]?.headers?.host;e.network==="h2"?!i&&n&&(e[`${e.network}-opts`].headers.host=n,delete e[`${e.network}-opts`].headers.Host):i&&!n&&(e[`${e.network}-opts`].headers.Host=i,delete e[`${e.network}-opts`].headers.host)}if(e.network==="h2"){let n=e["h2-opts"]?.headers?.host,i=e["h2-opts"]?.path;n&&!Array.isArray(n)&&(e["h2-opts"].headers.host=[n]),Array.isArray(i)&&(e["h2-opts"].path=i[0])}if(!e.tls&&["ws","http"].includes(e.network)&&!e[`${e.network}-opts`]?.headers?.Host&&!bv(e.server)&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].headers=e[`${e.network}-opts`].headers||{},e[`${e.network}-opts`].headers.Host=["vmess","vless"].includes(e.type)&&e.network==="http"?[e.server]:e.server),["vmess","vless"].includes(e.type)&&e.network==="http"){let n=e[`${e.network}-opts`]?.path,i=e[`${e.network}-opts`]?.headers?.Host;i&&!Array.isArray(i)&&(e[`${e.network}-opts`].headers.Host=[i]),n&&!Array.isArray(n)&&(e[`${e.network}-opts`].path=[n])}if(e.tls&&!e.sni&&(bv(e.server)||(e.sni=e.server),!e.sni&&e.network)){let n=e[`${e.network}-opts`]?.headers?.Host;n=Array.isArray(n)?n[0]:n,n&&(e.sni=n)}if(e.ports?e.ports=String(e.ports).replace(/\//g,","):delete e.ports,["hysteria2"].includes(e.type)&&e.obfs&&!["salamander"].includes(e.obfs)&&!e["obfs-password"]&&(e["obfs-password"]=e.obfs,e.obfs="salamander"),["hysteria2"].includes(e.type)&&!e["obfs-password"]&&e.obfs_password&&(e["obfs-password"]=e.obfs_password,delete e.obfs_password),["vless"].includes(e.type)&&(e["reality-opts"]&&Object.keys(e["reality-opts"]).length===0&&delete e["reality-opts"],e["grpc-opts"]&&Object.keys(e["grpc-opts"]).length===0&&delete e["grpc-opts"],!e["reality-opts"]&&!e.flow&&delete e.flow,["http"].includes(e.network)&&(e[`${e.network}-opts`]?.path||(e[`${e.network}-opts`]||(e[`${e.network}-opts`]={}),e[`${e.network}-opts`].path=["/"]))),typeof e.name!="string")if(/^\d+$/.test(e.name))e.name=`${e.name}`;else try{e.name?.data?e.name=fp.Buffer.from(e.name.data).toString("utf8"):e.name=fp.Buffer.from(e.name).toString("utf8")}catch(n){J.error(`proxy.name decode failed Reason: ${n}`),e.name=`${e.type} ${e.server}:${e.port}`}["ws","http","h2"].includes(e.network)&&(["ws","h2"].includes(e.network)&&!e[`${e.network}-opts`]?.path?(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path="/"):e.network==="http"&&(!Array.isArray(e[`${e.network}-opts`]?.path)||e[`${e.network}-opts`]?.path.every(n=>!n))&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path=["/"])),["","off"].includes(e.sni)&&(e["disable-sni"]=!0);let r=e.ca_str;e["ca-str"]?r=e["ca-str"]:r&&(delete e.ca_str,e["ca-str"]=r);try{J.env.isNode&&!r&&e._ca&&(r=J.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(n){J.error(`Read ca file failed Reason: ${n}`)}return!e["tls-fingerprint"]&&r&&(e["tls-fingerprint"]=ky.generateFingerprint(r)),["ss"].includes(e.type)&&ue(e,"shadow-tls-password")&&(e.plugin="shadow-tls",e["plugin-opts"]={host:e["shadow-tls-sni"],password:e["shadow-tls-password"],version:e["shadow-tls-version"]},delete e["shadow-tls-sni"],delete e["shadow-tls-password"],delete e["shadow-tls-version"]),e}function bv(e){return Rr(e)||Ur(e)}var vD=M0.find(e=>e.name==="Clash Pre-processor"),yv=new Map;async function ji(rawUrl="",ua,timeout,customProxy,skipCustomCache,awaitCustomCache,noCache,preprocess){let $arguments={},url=rawUrl.replace(/#noFlow$/,""),rawArgs=url.split("#");if(url=url.split("#")[0],rawArgs.length>1)try{$arguments=JSON.parse(decodeURIComponent(rawArgs[1]))}catch{for(let t of rawArgs[1].split("&")){let r=t.split("=")[0],n=t.split("=")[1];$arguments[r]=n==null||n===""?!0:decodeURIComponent(n)}}let{isNode,isStash,isLoon,isShadowRocket,isQX}=ks(),{defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=J.read(ui),cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;J.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultUserAgent||"clash.meta",requestTimeout=timeout||defaultTimeout||8e3,id=hs(userAgent+url);$arguments?.cacheKey===!0&&(J.error("\u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58\u65F6 cacheKey \u7684\u503C\u4E0D\u80FD\u4E3A\u7A7A"),$arguments.cacheKey=void 0);let customCacheKey=$arguments?.cacheKey?`#sub-store-cached-custom-${$arguments?.cacheKey}`:void 0;if(customCacheKey&&!skipCustomCache){let e=J.read(customCacheKey),t=Wr.get(id);if(!noCache&&!$arguments?.noCache&&t)return J.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u5B58\u5728\u6709\u6548\u7684\u5E38\u89C4\u7F13\u5B58 \u4F7F\u7528\u5E38\u89C4\u7F13\u5B58\u4EE5\u907F\u514D\u91CD\u590D\u8BF7\u6C42`),t;if(e){if(awaitCustomCache){J.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await ji(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess)}catch(r){J.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`),J.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),Wr.set(id,e)}}else J.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u672C\u6B21\u8FD4\u56DE\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey} \u5E76\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u5F02\u6B65\u66F4\u65B0\u7F13\u5B58`),ji(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess).catch(r=>{J.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u5F02\u6B65\u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`)});return e}}let downloadUrlMatch=url.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(downloadUrlMatch){let e="";try{e=downloadUrlMatch?.[1];let t=downloadUrlMatch?.[2];if(t==null)throw new Error(`\u672C\u5730 ${e} URL \u65E0\u6548: ${url}`);t=decodeURIComponent(t);let r=e==="module"?c0:vl,n=Mn(J.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return e==="module"?n.content:await Qi({type:"file",name:t})}catch(t){throw J.error(`Error when loading ${e}: ${url.split("#")[0]}. Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let fs=eval('require("fs")');return fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw J.error(`Error when reading local file: ${url.split("#")[0]}. Reason: ${e}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u6587\u672C\u5185\u5BB9: ${url}`)}if(!isNode&&yv.has(id))return yv.get(id);let http=Ta({headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,cached=Wr.get(id);if(!noCache&&!$arguments?.noCache&&cached)J.info(`\u4F7F\u7528\u7F13\u5B58: ${url}, ${userAgent}`),result=cached,customCacheKey&&(J.info(`URL ${url} \u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),J.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;J.info(`Downloading... User-Agent: ${userAgent} Timeout: ${requestTimeout} Proxy: ${proxy} Insecure: ${!!e} Preprocess: ${preprocess} URL: ${url}`);try{let{body:t,headers:r,statusCode:n}=await http.get({url,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ka(proxy):{},...e||{}});if(J.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let a=Fl(r);a&&Jc.set(id,a)}if(t.replace(/\s/g,"").length===0)throw new Error(new Error("\u8FDC\u7A0B\u8D44\u6E90\u5185\u5BB9\u4E3A\u7A7A"));if(preprocess)try{vD.test(t)&&(t=vD.parse(t,!0))}catch(a){J.error(`Clash Pre-processor error: ${a}`)}let i=!0;if(cacheThreshold){let a=t.length/1024;a>cacheThreshold&&(J.info(`\u8D44\u6E90\u5927\u5C0F ${a.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),i=!1)}if(preprocess)try{let a=dr.parse(t);(!Array.isArray(a)||a.length===0)&&(J.error(`URL ${url} \u4E0D\u5305\u542B\u6709\u6548\u8282\u70B9, \u4E0D\u7F13\u5B58`),i=!1)}catch(a){J.error(`URL ${url} \u5C1D\u8BD5\u89E3\u6790\u8282\u70B9\u5931\u8D25 ${a.message??a}, \u4E0D\u7F13\u5B58`),i=!1}i&&(Wr.set(id,t),customCacheKey&&(J.info(`URL ${url} \u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),J.write(t,customCacheKey))),result=t}catch(t){if(customCacheKey){let r=J.read(customCacheKey);if(r)return J.info(`\u65E0\u6CD5\u4E0B\u8F7D URL ${url}: ${t.message??t} \u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),r}throw new Error(`\u65E0\u6CD5\u4E0B\u8F7D URL ${url}: ${t.message??t}`)}}return $arguments?.validCheck&&await x0(B0(await I0(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl))),isNode||yv.set(id,result),result}async function mD(url,file){let undici=eval("require('undici')"),fs=eval("require('fs')"),{pipeline}=eval("require('stream/promises')"),{Agent,interceptors,request}=undici;J.info(`Downloading file... URL: ${url} File: ${file}`);let{body,statusCode}=await request(url,{dispatcher:new Agent().compose(interceptors.redirect({maxRedirections:3,throwOnRedirect:!0}))});if(statusCode!==200)throw new Error(`Failed to download file from ${url}`);let fileStream=fs.createWriteStream(file);return await pipeline(body,fileStream),J.info(`File downloaded from ${url} to ${file}`),file}function Nq(){return{name:"HTML",test:n=>/^/.test(n),parse:()=>""}}function Lq(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var wD=[Nq(),Lq()];function Uq(){return{type:"SINGLE",func:r=>["URL-REGEX","DEST-PORT","SRC-IP","IN-PORT","PROTOCOL","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:`${{"DOMAIN-KEYWORD":"HOST-KEYWORD","DOMAIN-SUFFIX":"HOST-SUFFIX",DOMAIN:"HOST","IP-CIDR6":"IP6-CIDR"}[r.type]||r.type},${r.content},SUB-STORE`}}function AD(){return{type:"SINGLE",func:r=>{if(["GEOSITE","GEOIP"].indexOf(r.type)!==-1)return null;let i=`${r.type},${r.content}`;return["IP-CIDR","IP-CIDR6"].includes(r.type)&&(i+=r.options?.length>0?`,${r.options.join(",")}`:""),i}}}function jq(){return{type:"SINGLE",func:r=>["SRC-IP","GEOSITE","GEOIP"].indexOf(r.type)!==-1?null:(["IP-CIDR","IP-CIDR6"].includes(r.type)&&r.options&&(r.options=r.options.filter(i=>["no-resolve"].includes(i))),AD().func(r))}}function Hq(){return{type:"ALL",func:r=>{let n={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},i={payload:r.map(a=>{let s=`${n[a.type]||a.type},${a.content}`;return["IP-CIDR","IP-CIDR6","GEOIP"].includes(a.type)&&(a.options&&(a.options=a.options.filter(u=>["no-resolve"].includes(u))),s+=a.options?.length>0?`,${a.options.join(",")}`:""),s})};return qs.dump(i)}}}var ED={QX:Uq(),Surge:AD(),Loon:jq(),Clash:Hq()};var Mq=[[/^(DOMAIN|host|HOST)$/,"DOMAIN"],[/^(DOMAIN-KEYWORD|host-keyword|HOST-KEYWORD)$/,"DOMAIN-KEYWORD"],[/^(DOMAIN-SUFFIX|host-suffix|HOST-SUFFIX)$/,"DOMAIN-SUFFIX"],[/^USER-AGENT$/i,"USER-AGENT"],[/^PROCESS-NAME$/,"PROCESS-NAME"],[/^(DEST-PORT|DST-PORT)$/,"DST-PORT"],[/^SRC-IP(-CIDR)?$/,"SRC-IP"],[/^(IN|SRC)-PORT$/,"IN-PORT"],[/^PROTOCOL$/,"PROTOCOL"],[/^IP-CIDR$/i,"IP-CIDR"],[/^(IP-CIDR6|ip6-cidr|IP6-CIDR)$/,"IP-CIDR6"],[/^GEOIP$/i,"GEOIP"],[/^GEOSITE$/i,"GEOSITE"]];function qq(){return{name:"Universal Rule Parser",test:()=>!0,parse:n=>{let i=n.split(` `),a=[];for(let s of i)if(s=s.trim(),s.length!==0&&!/\s*#/.test(s))try{let u=s.split(",").map(d=>d.trim()),l=u[0],f=!1;for(let d of Mq)if(d[0].test(l)){f=!0;let p={type:d[1],content:u[1]};["IP-CIDR","IP-CIDR6","GEOIP"].includes(p.type)&&(p.options=u.slice(2)),a.push(p)}if(!f)throw new Error("Invalid rule type: "+l)}catch(u){console.log(`Failed to parse line: ${s} Reason: ${u}`)}return a}}}var bD=[qq()];var hp=function(){function e(n){for(let i of wD)try{if(i.test(n))return J.info(`Pre-processor [${i.name}] activated`),i.parse(n)}catch(a){J.error(`Parser [${i.name}] failed Reason: ${a}`)}return n}function t(n){n=e(n);for(let i of bD){let a;try{a=i.test(n)}catch{a=!1}if(a)return J.info(`Rule parser [${i.name}] is activated!`),i.parse(n)}}function r(n,i){let a=ED[i];if(!a)throw new Error(`Target platform: ${i} is not supported!`);if(typeof a.type>"u"||a.type==="SINGLE")return n.map(s=>{try{return a.func(s)}catch(u){return console.log(`ERROR: cannot produce rule: ${JSON.stringify(s)} Reason: ${u}`),""}}).filter(s=>s.length>0).join(` `);if(a.type==="ALL")return a.func(n)}return{parse:t,produce:r}}();async function Cv(e){let{gistToken:t,syncPlatform:r}=J.read(ui);if(!t)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let i=await new zo({token:t,key:fA,syncPlatform:r}).upload(e),a={};try{a=JSON.parse(i.body)}catch{}let s=a?.html_url??a?.web_url,u=J.read(ui);return s?(J.log(`\u540C\u6B65 Gist \u540E, \u627E\u5230 Sub-Store Gist: ${s}`),u.artifactStore=s,u.artifactStoreStatus="VALID"):(J.error("\u540C\u6B65 Gist \u540E, \u627E\u4E0D\u5230 Sub-Store Gist"),u.artifactStoreStatus="NOT FOUND"),J.write(u,ui),i}async function Qi({type:e,name:t,platform:r,url:n,ua:i,content:a,mergeSources:s,ignoreFailedRemoteSub:u,ignoreFailedRemoteFile:l,produceType:f,produceOpts:d={},subscription:m,awaitCustomCache:p,$options:h,proxy:w,noCache:v,all:y}){if(r=r||"JSON",["subscription","sub"].includes(e)){let g;if(t){let F=J.read(Gc);if(g=Mn(F,t),!g)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(m)g=m;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let b;if(a&&!["localFirst","remoteFirst"].includes(s))b=a;else if(n){let F={};b=await Promise.all(n.split(/[\r\n]+/).map(N=>N.trim()).filter(N=>N.length).map(async N=>{try{return await ji(N,i||g.ua,void 0,w||g.proxy,void 0,p,v||g.noCache,!0)}catch(S){return F[N]=S,J.error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${N} \u53D1\u751F\u9519\u8BEF: ${S}`),""}}));let L=g.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(L=u),Object.keys(F).length>0)if(L)L==="enabled"&&J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${g.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?b.unshift(a):s==="remoteFirst"&&b.push(a)}else if(g.source==="local"&&!["localFirst","remoteFirst"].includes(g.mergeSources))b=g.content;else{let F={};b=await Promise.all(g.url.split(/[\r\n]+/).map(N=>N.trim()).filter(N=>N.length).map(async N=>{try{return await ji(N,i||g.ua,void 0,w||g.proxy,void 0,p,v||g.noCache,!0)}catch(S){return F[N]=S,J.error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${N} \u53D1\u751F\u9519\u8BEF: ${S}`),""}}));let L=g.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(L=u),Object.keys(F).length>0)if(L)L==="enabled"&&J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${g.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${g.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(F).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);g.mergeSources==="localFirst"?b.unshift(g.content):g.mergeSources==="remoteFirst"&&b.push(g.content)}if(f==="raw")return JSON.stringify((Array.isArray(b)?b:[b]).flat());let D=(Array.isArray(b)?b:[b]).map(F=>dr.parse(F)).flat();if(D.forEach(F=>{F._subName=g.name,F._subDisplayName=g.displayName}),D=await dr.process(D,g.process||[],r,{[g.name]:g},h),D.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let _={};for(let F of D){if(_[F.name]){J.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${F.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}_[F.name]=!0}return dr.produce(D,r,f,d)}else if(["collection","col"].includes(e)){let g=J.read(Gc),b=J.read(l0),D=Mn(b,t);if(!D)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let _=[...D.subscriptions],F=D.subscriptionTags;Array.isArray(F)&&F.length>0&&g.forEach(U=>{Array.isArray(U.tag)&&U.tag.length>0&&!_.includes(U.name)&&U.tag.some(G=>F.includes(G))&&_.push(U.name)});let L={},N={},S=0;await Promise.all(_.map(async U=>{let G=Mn(g,U),H=G.passThroughUA,K=G.ua;H&&(J.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${i}`),K=i);try{J.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${G.name}...`);let Y;if(G.source==="local"&&!["localFirst","remoteFirst"].includes(G.mergeSources))Y=G.content;else{let _e={};if(Y=await await Promise.all(G.url.split(/[\r\n]+/).map(Fe=>Fe.trim()).filter(Fe=>Fe.length).map(async Fe=>{try{return await ji(Fe,K,void 0,w||G.proxy||D.proxy,void 0,void 0,v||G.noCache,!0)}catch($e){return _e[Fe]=$e,J.error(`\u8BA2\u9605 ${G.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Fe} \u53D1\u751F\u9519\u8BEF: ${$e}`),""}})),Object.keys(_e).length>0)if(G.ignoreFailedRemoteSub)G.ignoreFailedRemoteSub==="enabled"&&J.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${G.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(_e).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${G.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(_e).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);G.mergeSources==="localFirst"?Y.unshift(G.content):G.mergeSources==="remoteFirst"&&Y.push(G.content)}let ie=(Array.isArray(Y)?Y:[Y]).map(_e=>dr.parse(_e)).flat();ie.forEach(_e=>{_e._subName=G.name,_e._subDisplayName=G.displayName,_e._collectionName=D.name,_e._collectionDisplayName=D.displayName}),ie=await dr.process(ie,G.process||[],r,{[G.name]:G,_collection:D,$options:h}),L[U]=ie,S++,J.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${G.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(S/_.length).toFixed(1)}% `)}catch(Y){S++,N[U]=Y,J.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${G.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${Y}\uFF01\u8FDB\u5EA6--${100*(S/_.length).toFixed(1)}%`)}}));let B=D.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(B=u),Object.keys(N).length>0)if(B)B==="enabled"&&J.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${D.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${D.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let O=Array.prototype.concat.apply([],_.map(U=>L[U]||[]));if(O.forEach(U=>{U._collectionName=D.name,U._collectionDisplayName=D.displayName}),O=await dr.process(O,D.process||[],r,{_collection:D},h),O.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let P={};for(let U of O){if(P[U.name]){J.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${U.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}P[U.name]=!0}return dr.produce(O,r,f,d)}else if(e==="rule"){let g=J.read(cA),b=Mn(g,t);if(!b)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let D=[];for(let _=0;_B.trim()).filter(B=>B.length).map(async B=>{try{return await ji(B,i||b.ua,void 0,b.proxy||w,void 0,void 0,v)}catch(O){return N[B]=O,J.error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${B} \u53D1\u751F\u9519\u8BEF: ${O}`),""}}));let S=b.ignoreFailedRemoteFile;if(l!=null&&l!==""&&(S=l),!S&&Object.keys(N).length>0)throw new Error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?D.unshift(a):s==="remoteFirst"&&D.push(a)}else if(b.source==="local"&&!["localFirst","remoteFirst"].includes(b.mergeSources))D=b.content;else{let N={};D=await Promise.all(b.url.split(/[\r\n]+/).map(B=>B.trim()).filter(B=>B.length).map(async B=>{try{return await ji(B,i||b.ua,void 0,b.proxy||w,void 0,void 0,v)}catch(O){return N[B]=O,J.error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${B} \u53D1\u751F\u9519\u8BEF: ${O}`),""}}));let S=b.ignoreFailedRemoteFile;if(l!=null&&l!==""&&(S=l),Object.keys(N).length>0)if(S)S==="enabled"&&J.notify("\u{1F30D} Sub-Store \u5904\u7406\u6587\u4EF6\u5931\u8D25",`\u274C ${b.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${b.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(N).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);b.mergeSources==="localFirst"?D.unshift(b.content):b.mergeSources==="remoteFirst"&&D.push(b.content)}if(f==="raw")return JSON.stringify((Array.isArray(D)?D:[D]).flat());let _=(Array.isArray(D)?D:[D]).flat(),F=_.filter(N=>N!=null&&N!=="").join(` `),L=Array.isArray(b.process)&&b.process.length>0?await dr.process({$files:_,$content:F,$options:h,$file:b},b.process):{$content:F,$files:_,$options:h};return(y?L:L?.$content)??""}}(async function(){let e;typeof $argument<"u"?e=Object.fromEntries($argument.split("&").map(n=>n.split("="))):e={};let t=(e?.subscription??e?.sub??"").split(/,|,/g).map(n=>n.trim()).filter(n=>n.length>0).map(n=>decodeURIComponent(n)),r=(e?.collection??e?.col??"").split(/,|,/g).map(n=>n.trim()).filter(n=>n.length>0).map(n=>decodeURIComponent(n));if(t.length>0||r.length>0)t.length>0&&await yD(t,"subscription"),r.length>0&&await yD(r,"collection");else{let n=J.read(ui);if(!n.githubUser||!n.gistToken)return;let i=J.read(wl);if(!i||i.length===0)return;i.some(s=>s.sync)&&await Yq()}})().finally(()=>J.done());async function yD(e,t){try{e.length>0&&(J.info(`produceArtifacts ${t} \u5F00\u59CB: ${e.join(", ")}`),await Promise.all(e.map(async r=>{try{await Qi({type:t,name:r})}catch(n){J.error(`${t} ${r} error: ${n.message??n}`)}})),J.info(`produceArtifacts ${t} \u5B8C\u6210: ${e.join(", ")}`))}catch(r){J.error(`produceArtifacts error: ${r.message??r}`)}}async function Yq(){console.log(` \u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505 Sub-Store Sync -- v${o0} \u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505 `),J.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");let e=J.read(wl),t={};try{let r=[],n=[],i=J.read(Gc),a=J.read(l0),s=[],u=0;if(e.map(d=>{if(d.sync&&d.source){if(u++,d.type==="subscription"){let m=d.source,p=Mn(i,m);p&&p.url&&!s.includes(m)&&s.push(m)}else if(d.type==="collection"){let m=Mn(a,d.source);m&&Array.isArray(m.subscriptions)&&m.subscriptions.map(p=>{let h=Mn(i,p);h&&h.url&&!s.includes(p)&&s.push(p)})}}}),u===0){J.info(`\u9700\u540C\u6B65\u7684\u914D\u7F6E: ${u}, \u603B\u6570: ${e.length}`);return}if(s.length>0&&await Promise.all(s.map(async d=>{try{await Qi({type:"subscription",name:d,awaitCustomCache:!0})}catch{}})),await Promise.all(e.map(async d=>{try{if(d.sync&&d.source){J.info(`\u6B63\u5728\u540C\u6B65\u4E91\u914D\u7F6E\uFF1A${d.name}...`);let m=d.platform==="SurgeMac";m&&J.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External");let p=await Qi({type:d.type,name:d.source,platform:d.platform,produceOpts:{"include-unsupported-proxy":d.includeUnsupportedProxy,useMihomoExternal:m}});t[encodeURIComponent(d.name)]={content:p},r.push(d.name)}}catch(m){J.error(`\u751F\u6210\u540C\u6B65\u914D\u7F6E ${d.name} \u53D1\u751F\u9519\u8BEF: ${m.message??m}`),n.push(d.name)}})),J.info(`${r.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u6210\u529F: ${r.join(", ")}`),J.info(`${n.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u5931\u8D25: ${n.join(", ")}`),r.length===0)throw new Error(`\u540C\u6B65\u914D\u7F6E ${n.join(", ")} \u751F\u6210\u5931\u8D25 \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`);let l=await Cv(t),f=JSON.parse(l.body);delete f.history,delete f.forks,delete f.owner,Object.values(f.files).forEach(d=>{delete d.content}),J.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),J.info(JSON.stringify(f,null,2));for(let d of e)if(d.sync&&d.source&&r.includes(d.name)){d.updated=new Date().getTime();let m=f.files,p;Array.isArray(m)&&(p=!0,m=Object.fromEntries(m.map(v=>[v.path,v])));let h=m[encodeURIComponent(d.name)]?.raw_url,w=p?h:h?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");J.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210 \u6587\u4EF6\u5217\u8868: ${Object.keys(m).join(", ")} \u5F53\u524D\u6587\u4EF6: ${encodeURIComponent(d.name)} \u54CD\u5E94\u8FD4\u56DE\u7684\u539F\u59CB\u94FE\u63A5: ${h} \u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${w}`),d.url=w}J.write(e,wl),J.info("\u4E0A\u4F20\u914D\u7F6E\u6210\u529F"),n.length>0?J.notify("\u{1F30D} Sub-Store",`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${r.length} \u4E2A, \u5931\u8D25 ${n.length} \u4E2A, \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`):J.notify("\u{1F30D} Sub-Store","\u540C\u6B65\u914D\u7F6E\u5B8C\u6210")}catch(r){J.notify("\u{1F30D} Sub-Store","\u540C\u6B65\u914D\u7F6E\u5931\u8D25",`\u539F\u56E0\uFF1A${r.message??r}`),J.error(`\u65E0\u6CD5\u540C\u6B65\u914D\u7F6E\u5230 Gist\uFF0C\u539F\u56E0\uFF1A${r}`)}}})(); /*! Bundled license information: ieee754/index.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) buffer/index.js: (*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT *) jsrsasign/lib/jsrsasign.js: (*! CryptoJS v3.1.2 core-fix.js * code.google.com/p/crypto-js * (c) 2009-2013 by Jeff Mott. All rights reserved. * code.google.com/p/crypto-js/wiki/License * THIS IS FIX of 'core.js' to fix Hmac issue. * https://code.google.com/p/crypto-js/issues/detail?id=84 * https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js *) (*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ *) (*! (c) Tom Wu, Kenji Urushima | http://www-cs-students.stanford.edu/~tjw/jsbn/ *) (*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib *) (*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval *) lodash/lodash.js: (** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) */