Sub-Store/sub-store.no-bundle.js
github-actions[bot] 29f99a0d10 release: 2.19.60
2025-06-02 16:11:11 +00:00

1173 lines
934 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{var YC=Object.create;var am=Object.defineProperty;var WC=Object.getOwnPropertyDescriptor;var XC=Object.getOwnPropertyNames;var JC=Object.getPrototypeOf,ZC=Object.prototype.hasOwnProperty;var za=(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 ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var QC=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of XC(t))!ZC.call(e,i)&&i!==r&&am(e,i,{get:()=>t[i],enumerable:!(n=WC(t,i))||n.enumerable});return e};var Cn=(e,t,r)=>(r=e!=null?YC(JC(e)):{},QC(t||!e||!e.__esModule?am(r,"default",{value:e,enumerable:!0}):r,e));var td=ye(nu=>{"use strict";Object.defineProperty(nu,"__esModule",{value:!0});nu.isCorrect=nu.isInSubnet=void 0;function m_(e){return this.subnetMask<e.subnetMask?!1:this.mask(e.subnetMask)===e.mask()}nu.isInSubnet=m_;function v_(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}nu.isCorrect=v_});var rd=ye(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});Ni.RE_SUBNET_STRING=Ni.RE_ADDRESS=Ni.GROUPS=Ni.BITS=void 0;Ni.BITS=32;Ni.GROUPS=4;Ni.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;Ni.RE_SUBNET_STRING=/\/\d{1,2}$/});var gf=ye(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.AddressError=void 0;var nd=class extends Error{constructor(t,r){super(t),this.name="AddressError",r!==null&&(this.parseMessage=r)}};df.AddressError=nd});var sd=ye((mf,hm)=>{(function(){var e,t=0xdeadbeefcafe,r=(t&16777215)==15715070;function n(T,x,H){T!=null&&(typeof T=="number"?this.fromNumber(T,x,H):x==null&&typeof T!="string"?this.fromString(T,256):this.fromString(T,x))}function i(){return new n(null)}function a(T,x,H,Q,de,ve){for(;--ve>=0;){var Fe=x*this[T++]+H[Q]+de;de=Math.floor(Fe/67108864),H[Q++]=Fe&67108863}return de}function s(T,x,H,Q,de,ve){for(var Fe=x&32767,Re=x>>15;--ve>=0;){var Pt=this[T]&32767,Qt=this[T++]>>15,Or=Re*Pt+Qt*Fe;Pt=Fe*Pt+((Or&32767)<<15)+H[Q]+(de&1073741823),de=(Pt>>>30)+(Or>>>15)+Re*Qt+(de>>>30),H[Q++]=Pt&1073741823}return de}function u(T,x,H,Q,de,ve){for(var Fe=x&16383,Re=x>>14;--ve>=0;){var Pt=this[T]&16383,Qt=this[T++]>>14,Or=Re*Pt+Qt*Fe;Pt=Fe*Pt+((Or&16383)<<14)+H[Q]+de,de=(Pt>>28)+(Or>>14)+Re*Qt,H[Q++]=Pt&268435455}return de}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<<e)-1,n.prototype.DV=1<<e;var f=52;n.prototype.FV=Math.pow(2,f),n.prototype.F1=f-e,n.prototype.F2=2*e-f;var d="0123456789abcdefghijklmnopqrstuvwxyz",E=new Array,p,h;for(p=48,h=0;h<=9;++h)E[p++]=h;for(p=97,h=10;h<36;++h)E[p++]=h;for(p=65,h=10;h<36;++h)E[p++]=h;function A(T){return d.charAt(T)}function m(T,x){var H=E[T.charCodeAt(x)];return H??-1}function S(T){for(var x=this.t-1;x>=0;--x)T[x]=this[x];T.t=this.t,T.s=this.s}function w(T){this.t=1,this.s=T<0?-1:0,T>0?this[0]=T:T<-1?this[0]=T+this.DV:this.t=0}function y(T){var x=i();return x.fromInt(T),x}function _(T,x){var H;if(x==16)H=4;else if(x==8)H=3;else if(x==256)H=8;else if(x==2)H=1;else if(x==32)H=5;else if(x==4)H=2;else{this.fromRadix(T,x);return}this.t=0,this.s=0;for(var Q=T.length,de=!1,ve=0;--Q>=0;){var Fe=H==8?T[Q]&255:m(T,Q);if(Fe<0){T.charAt(Q)=="-"&&(de=!0);continue}de=!1,ve==0?this[this.t++]=Fe:ve+H>this.DB?(this[this.t-1]|=(Fe&(1<<this.DB-ve)-1)<<ve,this[this.t++]=Fe>>this.DB-ve):this[this.t-1]|=Fe<<ve,ve+=H,ve>=this.DB&&(ve-=this.DB)}H==8&&T[0]&128&&(this.s=-1,ve>0&&(this[this.t-1]|=(1<<this.DB-ve)-1<<ve)),this.clamp(),de&&n.ZERO.subTo(this,this)}function B(){for(var T=this.s&this.DM;this.t>0&&this[this.t-1]==T;)--this.t}function D(T){if(this.s<0)return"-"+this.negate().toString(T);var x;if(T==16)x=4;else if(T==8)x=3;else if(T==2)x=1;else if(T==32)x=5;else if(T==4)x=2;else return this.toRadix(T);var H=(1<<x)-1,Q,de=!1,ve="",Fe=this.t,Re=this.DB-Fe*this.DB%x;if(Fe-- >0)for(Re<this.DB&&(Q=this[Fe]>>Re)>0&&(de=!0,ve=A(Q));Fe>=0;)Re<x?(Q=(this[Fe]&(1<<Re)-1)<<x-Re,Q|=this[--Fe]>>(Re+=this.DB-x)):(Q=this[Fe]>>(Re-=x)&H,Re<=0&&(Re+=this.DB,--Fe)),Q>0&&(de=!0),de&&(ve+=A(Q));return de?ve:"0"}function j(){var T=i();return n.ZERO.subTo(this,T),T}function q(){return this.s<0?this.negate():this}function F(T){var x=this.s-T.s;if(x!=0)return x;var H=this.t;if(x=H-T.t,x!=0)return this.s<0?-x:x;for(;--H>=0;)if((x=this[H]-T[H])!=0)return x;return 0}function P(T){var x=1,H;return(H=T>>>16)!=0&&(T=H,x+=16),(H=T>>8)!=0&&(T=H,x+=8),(H=T>>4)!=0&&(T=H,x+=4),(H=T>>2)!=0&&(T=H,x+=2),(H=T>>1)!=0&&(T=H,x+=1),x}function L(){return this.t<=0?0:this.DB*(this.t-1)+P(this[this.t-1]^this.s&this.DM)}function M(T,x){var H;for(H=this.t-1;H>=0;--H)x[H+T]=this[H];for(H=T-1;H>=0;--H)x[H]=0;x.t=this.t+T,x.s=this.s}function V(T,x){for(var H=T;H<this.t;++H)x[H-T]=this[H];x.t=Math.max(this.t-T,0),x.s=this.s}function W(T,x){var H=T%this.DB,Q=this.DB-H,de=(1<<Q)-1,ve=Math.floor(T/this.DB),Fe=this.s<<H&this.DM,Re;for(Re=this.t-1;Re>=0;--Re)x[Re+ve+1]=this[Re]>>Q|Fe,Fe=(this[Re]&de)<<H;for(Re=ve-1;Re>=0;--Re)x[Re]=0;x[ve]=Fe,x.t=this.t+ve+1,x.s=this.s,x.clamp()}function G(T,x){x.s=this.s;var H=Math.floor(T/this.DB);if(H>=this.t){x.t=0;return}var Q=T%this.DB,de=this.DB-Q,ve=(1<<Q)-1;x[0]=this[H]>>Q;for(var Fe=H+1;Fe<this.t;++Fe)x[Fe-H-1]|=(this[Fe]&ve)<<de,x[Fe-H]=this[Fe]>>Q;Q>0&&(x[this.t-H-1]|=(this.s&ve)<<de),x.t=this.t-H,x.clamp()}function z(T,x){for(var H=0,Q=0,de=Math.min(T.t,this.t);H<de;)Q+=this[H]-T[H],x[H++]=Q&this.DM,Q>>=this.DB;if(T.t<this.t){for(Q-=T.s;H<this.t;)Q+=this[H],x[H++]=Q&this.DM,Q>>=this.DB;Q+=this.s}else{for(Q+=this.s;H<T.t;)Q-=T[H],x[H++]=Q&this.DM,Q>>=this.DB;Q-=T.s}x.s=Q<0?-1:0,Q<-1?x[H++]=this.DV+Q:Q>0&&(x[H++]=Q),x.t=H,x.clamp()}function X(T,x){var H=this.abs(),Q=T.abs(),de=H.t;for(x.t=de+Q.t;--de>=0;)x[de]=0;for(de=0;de<Q.t;++de)x[de+H.t]=H.am(0,Q[de],x,de,0,H.t);x.s=0,x.clamp(),this.s!=T.s&&n.ZERO.subTo(x,x)}function ie(T){for(var x=this.abs(),H=T.t=2*x.t;--H>=0;)T[H]=0;for(H=0;H<x.t-1;++H){var Q=x.am(H,x[H],T,2*H,0,1);(T[H+x.t]+=x.am(H+1,2*x[H],T,2*H+1,Q,x.t-H-1))>=x.DV&&(T[H+x.t]-=x.DV,T[H+x.t+1]=1)}T.t>0&&(T[T.t-1]+=x.am(H,x[H],T,2*H,0,1)),T.s=0,T.clamp()}function Se(T,x,H){var Q=T.abs();if(!(Q.t<=0)){var de=this.abs();if(de.t<Q.t){x?.fromInt(0),H!=null&&this.copyTo(H);return}H==null&&(H=i());var ve=i(),Fe=this.s,Re=T.s,Pt=this.DB-P(Q[Q.t-1]);Pt>0?(Q.lShiftTo(Pt,ve),de.lShiftTo(Pt,H)):(Q.copyTo(ve),de.copyTo(H));var Qt=ve.t,Or=ve[Qt-1];if(Or!=0){var xr=Or*(1<<this.F1)+(Qt>1?ve[Qt-2]>>this.F2:0),Tn=this.FV/xr,Ws=(1<<this.F1)/xr,nn=1<<this.F2,Nr=H.t,Xs=Nr-Qt,Qn=x??i();for(ve.dlShiftTo(Xs,Qn),H.compareTo(Qn)>=0&&(H[H.t++]=1,H.subTo(Qn,H)),n.ONE.dlShiftTo(Qt,Qn),Qn.subTo(ve,ve);ve.t<Qt;)ve[ve.t++]=0;for(;--Xs>=0;){var Na=H[--Nr]==Or?this.DM:Math.floor(H[Nr]*Tn+(H[Nr-1]+nn)*Ws);if((H[Nr]+=ve.am(0,Na,H,Xs,0,Qt))<Na)for(ve.dlShiftTo(Xs,Qn),H.subTo(Qn,H);H[Nr]<--Na;)H.subTo(Qn,H)}x!=null&&(H.drShiftTo(Qt,x),Fe!=Re&&n.ZERO.subTo(x,x)),H.t=Qt,H.clamp(),Pt>0&&H.rShiftTo(Pt,H),Fe<0&&n.ZERO.subTo(H,H)}}}function we(T){var x=i();return this.abs().divRemTo(T,null,x),this.s<0&&x.compareTo(n.ZERO)>0&&T.subTo(x,x),x}function Ie(T){this.m=T}function Ve(T){return T.s<0||T.compareTo(this.m)>=0?T.mod(this.m):T}function ue(T){return T}function _e(T){T.divRemTo(this.m,null,T)}function He(T,x,H){T.multiplyTo(x,H),this.reduce(H)}function Sr(T,x){T.squareTo(x),this.reduce(x)}Ie.prototype.convert=Ve,Ie.prototype.revert=ue,Ie.prototype.reduce=_e,Ie.prototype.mulTo=He,Ie.prototype.sqrTo=Sr;function Ht(){if(this.t<1)return 0;var T=this[0];if(!(T&1))return 0;var x=T&3;return x=x*(2-(T&15)*x)&15,x=x*(2-(T&255)*x)&255,x=x*(2-((T&65535)*x&65535))&65535,x=x*(2-T*x%this.DV)%this.DV,x>0?this.DV-x:-x}function wt(T){this.m=T,this.mp=T.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<T.DB-15)-1,this.mt2=2*T.t}function ir(T){var x=i();return T.abs().dlShiftTo(this.m.t,x),x.divRemTo(this.m,null,x),T.s<0&&x.compareTo(n.ZERO)>0&&this.m.subTo(x,x),x}function Gt(T){var x=i();return T.copyTo(x),this.reduce(x),x}function at(T){for(;T.t<=this.mt2;)T[T.t++]=0;for(var x=0;x<this.m.t;++x){var H=T[x]&32767,Q=H*this.mpl+((H*this.mph+(T[x]>>15)*this.mpl&this.um)<<15)&T.DM;for(H=x+this.m.t,T[H]+=this.m.am(0,Q,T,x,0,this.m.t);T[H]>=T.DV;)T[H]-=T.DV,T[++H]++}T.clamp(),T.drShiftTo(this.m.t,T),T.compareTo(this.m)>=0&&T.subTo(this.m,T)}function kt(T,x){T.squareTo(x),this.reduce(x)}function it(T,x,H){T.multiplyTo(x,H),this.reduce(H)}wt.prototype.convert=ir,wt.prototype.revert=Gt,wt.prototype.reduce=at,wt.prototype.mulTo=it,wt.prototype.sqrTo=kt;function bt(){return(this.t>0?this[0]&1:this.s)==0}function sr(T,x){if(T>4294967295||T<1)return n.ONE;var H=i(),Q=i(),de=x.convert(this),ve=P(T)-1;for(de.copyTo(H);--ve>=0;)if(x.sqrTo(H,Q),(T&1<<ve)>0)x.mulTo(Q,de,H);else{var Fe=H;H=Q,Q=Fe}return x.revert(H)}function et(T,x){var H;return T<256||x.isEven()?H=new Ie(x):H=new wt(x),this.exp(T,H)}n.prototype.copyTo=S,n.prototype.fromInt=w,n.prototype.fromString=_,n.prototype.clamp=B,n.prototype.dlShiftTo=M,n.prototype.drShiftTo=V,n.prototype.lShiftTo=W,n.prototype.rShiftTo=G,n.prototype.subTo=z,n.prototype.multiplyTo=X,n.prototype.squareTo=ie,n.prototype.divRemTo=Se,n.prototype.invDigit=Ht,n.prototype.isEven=bt,n.prototype.exp=sr,n.prototype.toString=D,n.prototype.negate=j,n.prototype.abs=q,n.prototype.compareTo=F,n.prototype.bitLength=L,n.prototype.mod=we,n.prototype.modPowInt=et,n.ZERO=y(0),n.ONE=y(1);function Jt(){var T=i();return this.copyTo(T),T}function Zn(){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)<<this.DB|this[0]}function br(){return this.t==0?this.s:this[0]<<24>>24}function Tr(){return this.t==0?this.s:this[0]<<16>>16}function cr(T){return Math.floor(Math.LN2*this.DB/Math.log(T))}function Mr(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Sa(T){if(T==null&&(T=10),this.signum()==0||T<2||T>36)return"0";var x=this.chunkSize(T),H=Math.pow(T,x),Q=y(H),de=i(),ve=i(),Fe="";for(this.divRemTo(Q,de,ve);de.signum()>0;)Fe=(H+ve.intValue()).toString(T).substr(1)+Fe,de.divRemTo(Q,de,ve);return ve.intValue().toString(T)+Fe}function tn(T,x){this.fromInt(0),x==null&&(x=10);for(var H=this.chunkSize(x),Q=Math.pow(x,H),de=!1,ve=0,Fe=0,Re=0;Re<T.length;++Re){var Pt=m(T,Re);if(Pt<0){T.charAt(Re)=="-"&&this.signum()==0&&(de=!0);continue}Fe=x*Fe+Pt,++ve>=H&&(this.dMultiply(Q),this.dAddOffset(Fe,0),ve=0,Fe=0)}ve>0&&(this.dMultiply(Math.pow(x,ve)),this.dAddOffset(Fe,0)),de&&n.ZERO.subTo(this,this)}function Ct(T,x,H){if(typeof x=="number")if(T<2)this.fromInt(1);else for(this.fromNumber(T,H),this.testBit(T-1)||this.bitwiseTo(n.ONE.shiftLeft(T-1),rs,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(x);)this.dAddOffset(2,0),this.bitLength()>T&&this.subTo(n.ONE.shiftLeft(T-1),this);else{var Q=new Array,de=T&7;Q.length=(T>>3)+1,x.nextBytes(Q),de>0?Q[0]&=(1<<de)-1:Q[0]=0,this.fromString(Q,256)}}function lr(){var T=this.t,x=new Array;x[0]=this.s;var H=this.DB-T*this.DB%8,Q,de=0;if(T-- >0)for(H<this.DB&&(Q=this[T]>>H)!=(this.s&this.DM)>>H&&(x[de++]=Q|this.s<<this.DB-H);T>=0;)H<8?(Q=(this[T]&(1<<H)-1)<<8-H,Q|=this[--T]>>(H+=this.DB-8)):(Q=this[T]>>(H-=8)&255,H<=0&&(H+=this.DB,--T)),Q&128&&(Q|=-256),de==0&&(this.s&128)!=(Q&128)&&++de,(de>0||Q!=this.s)&&(x[de++]=Q);return x}function tt(T){return this.compareTo(T)==0}function jr(T){return this.compareTo(T)<0?this:T}function ba(T){return this.compareTo(T)>0?this:T}function Ca(T,x,H){var Q,de,ve=Math.min(T.t,this.t);for(Q=0;Q<ve;++Q)H[Q]=x(this[Q],T[Q]);if(T.t<this.t){for(de=T.s&this.DM,Q=ve;Q<this.t;++Q)H[Q]=x(this[Q],de);H.t=this.t}else{for(de=this.s&this.DM,Q=ve;Q<T.t;++Q)H[Q]=x(de,T[Q]);H.t=T.t}H.s=x(this.s,T.s),H.clamp()}function _a(T,x){return T&x}function Fa(T){var x=i();return this.bitwiseTo(T,_a,x),x}function rs(T,x){return T|x}function Ia(T){var x=i();return this.bitwiseTo(T,rs,x),x}function Vs(T,x){return T^x}function Fi(T){var x=i();return this.bitwiseTo(T,Vs,x),x}function ns(T,x){return T&~x}function Ao(T){var x=i();return this.bitwiseTo(T,ns,x),x}function yo(){for(var T=i(),x=0;x<this.t;++x)T[x]=this.DM&~this[x];return T.t=this.t,T.s=~this.s,T}function So(T){var x=i();return T<0?this.rShiftTo(-T,x):this.lShiftTo(T,x),x}function bo(T){var x=i();return T<0?this.lShiftTo(-T,x):this.rShiftTo(T,x),x}function Co(T){if(T==0)return-1;var x=0;return T&65535||(T>>=16,x+=16),T&255||(T>>=8,x+=8),T&15||(T>>=4,x+=4),T&3||(T>>=2,x+=2),T&1||++x,x}function _o(){for(var T=0;T<this.t;++T)if(this[T]!=0)return T*this.DB+Co(this[T]);return this.s<0?this.t*this.DB:-1}function Fo(T){for(var x=0;T!=0;)T&=T-1,++x;return x}function ju(){for(var T=0,x=this.s&this.DM,H=0;H<this.t;++H)T+=Fo(this[H]^x);return T}function Io(T){var x=Math.floor(T/this.DB);return x>=this.t?this.s!=0:(this[x]&1<<T%this.DB)!=0}function qu(T,x){var H=n.ONE.shiftLeft(T);return this.bitwiseTo(H,x,H),H}function Ku(T){return this.changeBit(T,rs)}function Vu(T){return this.changeBit(T,ns)}function Gs(T){return this.changeBit(T,Vs)}function Gu(T,x){for(var H=0,Q=0,de=Math.min(T.t,this.t);H<de;)Q+=this[H]+T[H],x[H++]=Q&this.DM,Q>>=this.DB;if(T.t<this.t){for(Q+=T.s;H<this.t;)Q+=this[H],x[H++]=Q&this.DM,Q>>=this.DB;Q+=this.s}else{for(Q+=this.s;H<T.t;)Q+=T[H],x[H++]=Q&this.DM,Q>>=this.DB;Q+=T.s}x.s=Q<0?-1:0,Q>0?x[H++]=Q:Q<-1&&(x[H++]=this.DV+Q),x.t=H,x.clamp()}function $a(T){var x=i();return this.addTo(T,x),x}function zu(T){var x=i();return this.subTo(T,x),x}function Yu(T){var x=i();return this.multiplyTo(T,x),x}function Wu(){var T=i();return this.squareTo(T),T}function Xu(T){var x=i();return this.divRemTo(T,x,null),x}function Ju(T){var x=i();return this.divRemTo(T,null,x),x}function Zu(T){var x=i(),H=i();return this.divRemTo(T,x,H),new Array(x,H)}function Qu(T){this[this.t]=this.am(0,T-1,this,0,0,this.t),++this.t,this.clamp()}function ec(T,x){if(T!=0){for(;this.t<=x;)this[this.t++]=0;for(this[x]+=T;this[x]>=this.DV;)this[x]-=this.DV,++x>=this.t&&(this[this.t++]=0),++this[x]}}function Ii(){}function $o(T){return T}function tc(T,x,H){T.multiplyTo(x,H)}function rc(T,x){T.squareTo(x)}Ii.prototype.convert=$o,Ii.prototype.revert=$o,Ii.prototype.mulTo=tc,Ii.prototype.sqrTo=rc;function nc(T){return this.exp(T,new Ii)}function Do(T,x,H){var Q=Math.min(this.t+T.t,x);for(H.s=0,H.t=Q;Q>0;)H[--Q]=0;var de;for(de=H.t-this.t;Q<de;++Q)H[Q+this.t]=this.am(0,T[Q],H,Q,0,this.t);for(de=Math.min(T.t,x);Q<de;++Q)this.am(0,T[Q],H,Q,0,x-Q);H.clamp()}function $i(T,x,H){--x;var Q=H.t=this.t+T.t-x;for(H.s=0;--Q>=0;)H[Q]=0;for(Q=Math.max(x-this.t,0);Q<T.t;++Q)H[this.t+Q-x]=this.am(x-Q,T[Q],H,0,0,this.t+Q-x);H.clamp(),H.drShiftTo(1,H)}function gn(T){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*T.t,this.r2),this.mu=this.r2.divide(T),this.m=T}function ic(T){if(T.s<0||T.t>2*this.m.t)return T.mod(this.m);if(T.compareTo(this.m)<0)return T;var x=i();return T.copyTo(x),this.reduce(x),x}function zs(T){return T}function Pn(T){for(T.drShiftTo(this.m.t-1,this.r2),T.t>this.m.t+1&&(T.t=this.m.t+1,T.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);T.compareTo(this.r2)<0;)T.dAddOffset(1,this.m.t+1);for(T.subTo(this.r2,T);T.compareTo(this.m)>=0;)T.subTo(this.m,T)}function sc(T,x){T.squareTo(x),this.reduce(x)}function ac(T,x,H){T.multiplyTo(x,H),this.reduce(H)}gn.prototype.convert=ic,gn.prototype.revert=zs,gn.prototype.reduce=Pn,gn.prototype.mulTo=ac,gn.prototype.sqrTo=sc;function Bo(T,x){var H=T.bitLength(),Q,de=y(1),ve;if(H<=0)return de;H<18?Q=1:H<48?Q=3:H<144?Q=4:H<768?Q=5:Q=6,H<8?ve=new Ie(x):x.isEven()?ve=new gn(x):ve=new wt(x);var Fe=new Array,Re=3,Pt=Q-1,Qt=(1<<Q)-1;if(Fe[1]=ve.convert(this),Q>1){var Or=i();for(ve.sqrTo(Fe[1],Or);Re<=Qt;)Fe[Re]=i(),ve.mulTo(Or,Fe[Re-2],Fe[Re]),Re+=2}var xr=T.t-1,Tn,Ws=!0,nn=i(),Nr;for(H=P(T[xr])-1;xr>=0;){for(H>=Pt?Tn=T[xr]>>H-Pt&Qt:(Tn=(T[xr]&(1<<H+1)-1)<<Pt-H,xr>0&&(Tn|=T[xr-1]>>this.DB+H-Pt)),Re=Q;!(Tn&1);)Tn>>=1,--Re;if((H-=Re)<0&&(H+=this.DB,--xr),Ws)Fe[Tn].copyTo(de),Ws=!1;else{for(;Re>1;)ve.sqrTo(de,nn),ve.sqrTo(nn,de),Re-=2;Re>0?ve.sqrTo(de,nn):(Nr=de,de=nn,nn=Nr),ve.mulTo(nn,Fe[Tn],de)}for(;xr>=0&&!(T[xr]&1<<H);)ve.sqrTo(de,nn),Nr=de,de=nn,nn=Nr,--H<0&&(H=this.DB-1,--xr)}return ve.revert(de)}function Da(T){var x=this.s<0?this.negate():this.clone(),H=T.s<0?T.negate():T.clone();if(x.compareTo(H)<0){var Q=x;x=H,H=Q}var de=x.getLowestSetBit(),ve=H.getLowestSetBit();if(ve<0)return x;for(de<ve&&(ve=de),ve>0&&(x.rShiftTo(ve,x),H.rShiftTo(ve,H));x.signum()>0;)(de=x.getLowestSetBit())>0&&x.rShiftTo(de,x),(de=H.getLowestSetBit())>0&&H.rShiftTo(de,H),x.compareTo(H)>=0?(x.subTo(H,x),x.rShiftTo(1,x)):(H.subTo(x,H),H.rShiftTo(1,H));return ve>0&&H.lShiftTo(ve,H),H}function Ro(T){if(T<=0)return 0;var x=this.DV%T,H=this.s<0?T-1:0;if(this.t>0)if(x==0)H=this[0]%T;else for(var Q=this.t-1;Q>=0;--Q)H=(x*H+this[Q])%T;return H}function Ys(T){var x=T.isEven();if(this.isEven()&&x||T.signum()==0)return n.ZERO;for(var H=T.clone(),Q=this.clone(),de=y(1),ve=y(0),Fe=y(0),Re=y(1);H.signum()!=0;){for(;H.isEven();)H.rShiftTo(1,H),x?((!de.isEven()||!ve.isEven())&&(de.addTo(this,de),ve.subTo(T,ve)),de.rShiftTo(1,de)):ve.isEven()||ve.subTo(T,ve),ve.rShiftTo(1,ve);for(;Q.isEven();)Q.rShiftTo(1,Q),x?((!Fe.isEven()||!Re.isEven())&&(Fe.addTo(this,Fe),Re.subTo(T,Re)),Fe.rShiftTo(1,Fe)):Re.isEven()||Re.subTo(T,Re),Re.rShiftTo(1,Re);H.compareTo(Q)>=0?(H.subTo(Q,H),x&&de.subTo(Fe,de),ve.subTo(Re,ve)):(Q.subTo(H,Q),x&&Fe.subTo(de,Fe),Re.subTo(ve,Re))}if(Q.compareTo(n.ONE)!=0)return n.ZERO;if(Re.compareTo(T)>=0)return Re.subtract(T);if(Re.signum()<0)Re.addTo(T,Re);else return Re;return Re.signum()<0?Re.add(T):Re}var Zt=[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],oc=(1<<26)/Zt[Zt.length-1];function uc(T){var x,H=this.abs();if(H.t==1&&H[0]<=Zt[Zt.length-1]){for(x=0;x<Zt.length;++x)if(H[0]==Zt[x])return!0;return!1}if(H.isEven())return!1;for(x=1;x<Zt.length;){for(var Q=Zt[x],de=x+1;de<Zt.length&&Q<oc;)Q*=Zt[de++];for(Q=H.modInt(Q);x<de;)if(Q%Zt[x++]==0)return!1}return H.millerRabin(T)}function Po(T){var x=this.subtract(n.ONE),H=x.getLowestSetBit();if(H<=0)return!1;var Q=x.shiftRight(H);T=T+1>>1,T>Zt.length&&(T=Zt.length);for(var de=i(),ve=0;ve<T;++ve){de.fromInt(Zt[Math.floor(Math.random()*Zt.length)]);var Fe=de.modPow(Q,this);if(Fe.compareTo(n.ONE)!=0&&Fe.compareTo(x)!=0){for(var Re=1;Re++<H&&Fe.compareTo(x)!=0;)if(Fe=Fe.modPowInt(2,this),Fe.compareTo(n.ONE)==0)return!1;if(Fe.compareTo(x)!=0)return!1}}return!0}n.prototype.chunkSize=cr,n.prototype.toRadix=Sa,n.prototype.fromRadix=tn,n.prototype.fromNumber=Ct,n.prototype.bitwiseTo=Ca,n.prototype.changeBit=qu,n.prototype.addTo=Gu,n.prototype.dMultiply=Qu,n.prototype.dAddOffset=ec,n.prototype.multiplyLowerTo=Do,n.prototype.multiplyUpperTo=$i,n.prototype.modInt=Ro,n.prototype.millerRabin=Po,n.prototype.clone=Jt,n.prototype.intValue=Zn,n.prototype.byteValue=br,n.prototype.shortValue=Tr,n.prototype.signum=Mr,n.prototype.toByteArray=lr,n.prototype.equals=tt,n.prototype.min=jr,n.prototype.max=ba,n.prototype.and=Fa,n.prototype.or=Ia,n.prototype.xor=Fi,n.prototype.andNot=Ao,n.prototype.not=yo,n.prototype.shiftLeft=So,n.prototype.shiftRight=bo,n.prototype.getLowestSetBit=_o,n.prototype.bitCount=ju,n.prototype.testBit=Io,n.prototype.setBit=Ku,n.prototype.clearBit=Vu,n.prototype.flipBit=Gs,n.prototype.add=$a,n.prototype.subtract=zu,n.prototype.multiply=Yu,n.prototype.divide=Xu,n.prototype.remainder=Ju,n.prototype.divideAndRemainder=Zu,n.prototype.modPow=Bo,n.prototype.modInverse=Ys,n.prototype.pow=nc,n.prototype.gcd=Da,n.prototype.isProbablePrime=uc,n.prototype.square=Wu,n.prototype.Barrett=gn;var Di,Cr,Kt;function cc(T){Cr[Kt++]^=T&255,Cr[Kt++]^=T>>8&255,Cr[Kt++]^=T>>16&255,Cr[Kt++]^=T>>24&255,Kt>=rn&&(Kt-=rn)}function Ba(){cc(new Date().getTime())}if(Cr==null){Cr=new Array,Kt=0;var _r;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var Ra=new Uint8Array(32);for(window.crypto.getRandomValues(Ra),_r=0;_r<32;++_r)Cr[Kt++]=Ra[_r]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var To=window.crypto.random(32);for(_r=0;_r<To.length;++_r)Cr[Kt++]=To.charCodeAt(_r)&255}}for(;Kt<rn;)_r=Math.floor(65536*Math.random()),Cr[Kt++]=_r>>>8,Cr[Kt++]=_r&255;Kt=0,Ba()}function Oo(){if(Di==null){for(Ba(),Di=xa(),Di.init(Cr),Kt=0;Kt<Cr.length;++Kt)Cr[Kt]=0;Kt=0}return Di.next()}function Pa(T){var x;for(x=0;x<T.length;++x)T[x]=Oo()}function Bi(){}Bi.prototype.nextBytes=Pa;function Ta(){this.i=0,this.j=0,this.S=new Array}function xo(T){var x,H,Q;for(x=0;x<256;++x)this.S[x]=x;for(H=0,x=0;x<256;++x)H=H+this.S[x]+T[x%T.length]&255,Q=this.S[x],this.S[x]=this.S[H],this.S[H]=Q;this.i=0,this.j=0}function Oa(){var T;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,T=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=T,this.S[T+this.S[this.i]&255]}Ta.prototype.init=xo,Ta.prototype.next=Oa;function xa(){return new Ta}var rn=256;typeof mf<"u"?mf=hm.exports={default:n,BigInteger:n,SecureRandom:Bi}:this.jsbn={BigInteger:n,SecureRandom:Bi}}).call(mf)});var Tc=ye(vf=>{(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,E="",p,h,A,m,S,w,y,_;for(p=0;p<f;p++)if(typeof s[p]=="string")E+=s[p];else if(typeof s[p]=="object"){if(A=s[p],A.keys)for(d=u[l],h=0;h<A.keys.length;h++){if(d==null)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',A.keys[h],A.keys[h-1]));d=d[A.keys[h]]}else A.param_no?d=u[A.param_no]:d=u[l++];if(e.not_type.test(A.type)&&e.not_primitive.test(A.type)&&d instanceof Function&&(d=d()),e.numeric_arg.test(A.type)&&typeof d!="number"&&isNaN(d))throw new TypeError(t("[sprintf] expecting number but found %T",d));switch(e.number.test(A.type)&&(y=d>=0),A.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,A.width?parseInt(A.width):0);break;case"e":d=A.precision?parseFloat(d).toExponential(A.precision):parseFloat(d).toExponential();break;case"f":d=A.precision?parseFloat(d).toFixed(A.precision):parseFloat(d);break;case"g":d=A.precision?String(Number(d.toPrecision(A.precision))):parseFloat(d);break;case"o":d=(parseInt(d,10)>>>0).toString(8);break;case"s":d=String(d),d=A.precision?d.substring(0,A.precision):d;break;case"t":d=String(!!d),d=A.precision?d.substring(0,A.precision):d;break;case"T":d=Object.prototype.toString.call(d).slice(8,-1).toLowerCase(),d=A.precision?d.substring(0,A.precision):d;break;case"u":d=parseInt(d,10)>>>0;break;case"v":d=d.valueOf(),d=A.precision?d.substring(0,A.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(A.type)?E+=d:(e.number.test(A.type)&&(!y||A.sign)?(_=y?"+":"-",d=d.toString().replace(e.sign,"")):_="",S=A.pad_char?A.pad_char==="0"?"0":A.pad_char.charAt(1):" ",w=A.width-(_+d).length,m=A.width&&w>0?S.repeat(w):"",E+=A.align?_+d+m:S==="0"?_+m+d:m+_+d)}return E}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 E=[],p=l[2],h=[];if((h=e.key.exec(p))!==null)for(E.push(h[1]);(p=p.substring(h[0].length))!=="";)if((h=e.key_access.exec(p))!==null)E.push(h[1]);else if((h=e.index_access.exec(p))!==null)E.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]=E}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 vf<"u"&&(vf.sprintf=t,vf.vsprintf=r),typeof window<"u"&&(window.sprintf=t,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:t,vsprintf:r}}))})()});var od=ye(ki=>{"use strict";var E_=ki&&ki.__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]}),w_=ki&&ki.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gm=ki&&ki.__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)&&E_(t,e,r);return w_(t,e),t};Object.defineProperty(ki,"__esModule",{value:!0});ki.Address4=void 0;var pm=gm(td()),Ai=gm(rd()),dm=gf(),Oc=sd(),iu=Tc(),ad=class e{constructor(t){this.groups=Ai.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=pm.isCorrect(Ai.BITS),this.isInSubnet=pm.isInSubnet,this.address=t;let r=Ai.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>Ai.BITS)throw new dm.AddressError("Invalid subnet mask.");t=t.replace(Ai.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(Ai.RE_ADDRESS))throw new dm.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,iu.sprintf)("%02x",parseInt(t,10))).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r<Ai.GROUPS;r+=2){let n=(0,iu.sprintf)("%02x%02x",parseInt(this.parsedAddress[r],10),parseInt(this.parsedAddress[r+1],10));t.push((0,iu.sprintf)("%x",parseInt(n,16)))}return t.join(":")}bigInteger(){return new Oc.BigInteger(this.parsedAddress.map(t=>(0,iu.sprintf)("%02x",parseInt(t,10))).join(""),16)}_startAddress(){return new Oc.BigInteger(this.mask()+"0".repeat(Ai.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new Oc.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new Oc.BigInteger(this.mask()+"1".repeat(Ai.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new Oc.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,iu.sprintf)("%s.in-addr.arpa.",r)}isMulticast(){return this.isInSubnet(new e("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(Ai.BITS,"0")}groupForV6(){let t=this.parsedAddress;return this.address.replace(Ai.RE_ADDRESS,(0,iu.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))}};ki.Address4=ad});var ud=ye(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.RE_URL_WITH_PORT=rr.RE_URL=rr.RE_ZONE_STRING=rr.RE_SUBNET_STRING=rr.RE_BAD_ADDRESS=rr.RE_BAD_CHARACTERS=rr.TYPES=rr.SCOPES=rr.GROUPS=rr.BITS=void 0;rr.BITS=128;rr.GROUPS=8;rr.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};rr.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"};rr.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;rr.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;rr.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;rr.RE_ZONE_STRING=/%.*$/;rr.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/);rr.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)});var cd=ye(Li=>{"use strict";Object.defineProperty(Li,"__esModule",{value:!0});Li.simpleGroup=Li.spanLeadingZeroes=Li.spanAll=Li.spanAllZeroes=void 0;var mm=Tc();function vm(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')}Li.spanAllZeroes=vm;function A_(e,t=0){return e.split("").map((n,i)=>(0,mm.sprintf)('<span class="digit value-%s position-%d">%s</span>',n,i+t,vm(n))).join("")}Li.spanAll=A_;function Em(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}function y_(e){return e.split(":").map(r=>Em(r)).join(":")}Li.spanLeadingZeroes=y_;function S_(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:(0,mm.sprintf)('<span class="hover-group group-%d">%s</span>',i+t,Em(n)))}Li.simpleGroup=S_});var wm=ye($r=>{"use strict";var b_=$r&&$r.__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]}),C_=$r&&$r.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__=$r&&$r.__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)&&b_(t,e,r);return C_(t,e),t};Object.defineProperty($r,"__esModule",{value:!0});$r.possibleElisions=$r.simpleRegularExpression=$r.ADDRESS_BOUNDARY=$r.padGroup=$r.groupPossibilities=void 0;var F_=__(ud()),su=Tc();function wf(e){return(0,su.sprintf)("(%s)",e.join("|"))}$r.groupPossibilities=wf;function Ef(e){return e.length<4?(0,su.sprintf)("0{0,%d}%s",4-e.length,e):e}$r.padGroup=Ef;$r.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function I_(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===F_.GROUPS-1?":":"";return wf([Ef(i),s])}return Ef(i)}).join(":"));return r.push(e.map(Ef).join(":")),wf(r)}$r.simpleRegularExpression=I_;function $_(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,su.sprintf)("%s(:0{1,4}){1,%d}",n,e-1)),a.push((0,su.sprintf)("(0{1,4}:){1,%d}%s",e-1,i)),a.push((0,su.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let s=1;s<e-1;s++)for(let u=1;u<e-s;u++)a.push((0,su.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",u,e-u-s-1));return wf(a)}$r.possibleElisions=$_});var bm=ye(Ui=>{"use strict";var D_=Ui&&Ui.__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]}),B_=Ui&&Ui.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yf=Ui&&Ui.__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)&&D_(t,e,r);return B_(t,e),t};Object.defineProperty(Ui,"__esModule",{value:!0});Ui.Address6=void 0;var Am=yf(td()),ld=yf(rd()),Mt=yf(ud()),fd=yf(cd()),Za=od(),Qa=wm(),bs=gf(),fn=sd(),hn=Tc();function Af(e){if(!e)throw new Error("Assertion failed.")}function R_(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function P_(e){return e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),e=e.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2'),e}function T_(e,t){let r=[],n=[],i;for(i=0;i<e.length;i++)i<t[0]?r.push(e[i]):i>t[1]&&n.push(e[i]);return r.concat(["compact"]).concat(n)}function ym(e){return(0,hn.sprintf)("%04x",parseInt(e,16))}function Sm(e){return e&255}var hd=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=Am.isInSubnet,this.isCorrect=Am.isCorrect(Mt.BITS),r===void 0?this.groups=Mt.GROUPS:this.groups=r,this.address=t;let n=Mt.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>Mt.BITS)throw new bs.AddressError("Invalid subnet mask.");t=t.replace(Mt.RE_SUBNET_STRING,"")}else if(/\//.test(t))throw new bs.AddressError("Invalid subnet mask.");let i=Mt.RE_ZONE_STRING.exec(t);i&&(this.zone=i[0],t=t.replace(Mt.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;i<Mt.GROUPS;i++)n.push(r.slice(i*4,(i+1)*4));return new e(n.join(":"))}static fromURL(t){let r,n=null,i;if(t.indexOf("[")!==-1&&t.indexOf("]:")!==-1){if(i=Mt.RE_URL_WITH_PORT.exec(t),i===null)return{error:"failed to parse address with port",address:null,port:null};r=i[1],n=i[2]}else if(t.indexOf("/")!==-1){if(t=t.replace(/^[a-z0-9]+:\/\//,""),i=Mt.RE_URL.exec(t),i===null)return{error:"failed to parse address from URL",address:null,port:null};r=i[1]}else r=t;return n?(n=parseInt(n,10),(n<0||n>65536)&&(n=null)):n=null,{address:new e(r),port:n}}static fromAddress4(t){let r=new Za.Address4(t),n=Mt.BITS-(ld.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 bs.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,hn.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=Mt.BITS-this.subnetMask,n=Math.abs(t-Mt.BITS),i=r-n;return i<0?"0":R_(new fn.BigInteger("2",10).pow(i).toString(10))}_startAddress(){return new fn.BigInteger(this.mask()+"0".repeat(Mt.BITS-this.subnetMask),2)}startAddress(){return e.fromBigInteger(this._startAddress())}startAddressExclusive(){let t=new fn.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))}_endAddress(){return new fn.BigInteger(this.mask()+"1".repeat(Mt.BITS-this.subnetMask),2)}endAddress(){return e.fromBigInteger(this._endAddress())}endAddressExclusive(){let t=new fn.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))}getScope(){let t=Mt.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(Mt.TYPES))if(this.isInSubnet(new e(t)))return Mt.TYPES[t];return"Global unicast"}getBits(t,r){return new fn.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,Mt.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,hn.sprintf)("%s.ip6.arpa.",n):t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let u=parseInt(this.parsedAddress[t],16);u===0&&n++,u!==0&&n>0&&(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=T_(this.parsedAddress,i[u])}else r=this.parsedAddress;for(t=0;t<r.length;t++)r[t]!=="compact"&&(r[t]=parseInt(r[t],16).toString(16));let s=r.join(":");return s=s.replace(/^compact$/,"::"),s=s.replace(/^compact|compact$/,":"),s=s.replace(/compact/,""),s}binaryZeroPad(){return this.bigInteger().toString(2).padStart(Mt.BITS,"0")}parse4in6(t){let r=t.split(":"),i=r.slice(-1)[0].match(ld.RE_ADDRESS);if(i){this.parsedAddress4=i[0],this.address4=new Za.Address4(this.parsedAddress4);for(let a=0;a<this.address4.groups;a++)if(/^0[0-9]+/.test(this.address4.parsedAddress[a]))throw new bs.AddressError("IPv4 addresses can't have leading zeroes.",t.replace(ld.RE_ADDRESS,this.address4.parsedAddress.map(P_).join(".")));this.v4=!0,r[r.length-1]=this.address4.toGroup6(),t=r.join(":")}return t}parse(t){t=this.parse4in6(t);let r=t.match(Mt.RE_BAD_CHARACTERS);if(r)throw new bs.AddressError((0,hn.sprintf)("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),t.replace(Mt.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let n=t.match(Mt.RE_BAD_ADDRESS);if(n)throw new bs.AddressError((0,hn.sprintf)("Address failed regex: %s",n.join("")),t.replace(Mt.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));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 bs.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<l;f++)i.push("0");i=i.concat(u)}else if(a.length===1)i=t.split(":"),this.elidedGroups=0;else throw new bs.AddressError("Too many :: groups found");if(i=i.map(s=>(0,hn.sprintf)("%x",parseInt(s,16))),i.length!==this.groups)throw new bs.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(ym).join(":")}decimal(){return this.parsedAddress.map(t=>(0,hn.sprintf)("%05d",parseInt(t,16))).join(":")}bigInteger(){return new fn.BigInteger(this.parsedAddress.map(ym).join(""),16)}to4(){let t=this.binaryZeroPad().split("");return Za.Address4.fromHex(new fn.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 fn.BigInteger("ffff",16)).toString(),n=Za.Address4.fromHex(this.getBitsBase16(32,64)),i=Za.Address4.fromHex(this.getBits(96,128).xor(new fn.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),E=new fn.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:(0,hn.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:E},udpPort:r}}inspect6to4(){let t=this.getBitsBase16(0,16),r=Za.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:(0,hn.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(Sm)}static fromByteArray(t){return this.fromUnsignedByteArray(t.map(Sm))}static fromUnsignedByteArray(t){let r=new fn.BigInteger("256",10),n=new fn.BigInteger("0",10),i=new fn.BigInteger("1",10);for(let a=t.length-1;a>=0;a--)n=n.add(i.multiply(new fn.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,hn.sprintf)(":%s",t),(0,hn.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,hn.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',t.prefix,r.call(this),t.className):(0,hn.sprintf)('<a href="%1$s%2$s">%2$s</a>',t.prefix,r.call(this))}group(){if(this.elidedGroups===0)return fd.simpleGroup(this.address).join(":");Af(typeof this.elidedGroups=="number"),Af(typeof this.elisionBegin=="number");let t=[],[r,n]=this.address.split("::");r.length?t.push(...fd.simpleGroup(r)):t.push("");let i=["hover-group"];for(let a=this.elisionBegin;a<this.elisionBegin+this.elidedGroups;a++)i.push((0,hn.sprintf)("group-%d",a));return t.push((0,hn.sprintf)('<span class="%s"></span>',i.join(" "))),n.length?t.push(...fd.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(Af(this.address4 instanceof Za.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,Qa.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===Mt.GROUPS)r.push((0,Qa.possibleElisions)(Mt.GROUPS));else{let i=n.address.split("::");i[0].length&&r.push((0,Qa.simpleRegularExpression)(i[0].split(":"))),Af(typeof n.elidedGroups=="number"),r.push((0,Qa.possibleElisions)(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push((0,Qa.simpleRegularExpression)(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Qa.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Qa.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};Ui.Address6=hd});var Cm=ye(Jr=>{"use strict";var O_=Jr&&Jr.__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]}),x_=Jr&&Jr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),N_=Jr&&Jr.__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)&&O_(t,e,r);return x_(t,e),t};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.v6=Jr.AddressError=Jr.Address6=Jr.Address4=void 0;var k_=od();Object.defineProperty(Jr,"Address4",{enumerable:!0,get:function(){return k_.Address4}});var L_=bm();Object.defineProperty(Jr,"Address6",{enumerable:!0,get:function(){return L_.Address6}});var U_=gf();Object.defineProperty(Jr,"AddressError",{enumerable:!0,get:function(){return U_.AddressError}});var H_=N_(cd());Jr.v6={helpers:H_}});var Ym=ye($f=>{"use strict";$f.byteLength=n5;$f.toByteArray=s5;$f.fromByteArray=u5;var Mi=[],ui=[],r5=typeof Uint8Array<"u"?Uint8Array:Array,wd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ro=0,Gm=wd.length;ro<Gm;++ro)Mi[ro]=wd[ro],ui[wd.charCodeAt(ro)]=ro;var ro,Gm;ui[45]=62;ui[95]=63;function zm(e){var t=e.length;if(t%4>0)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 n5(e){var t=zm(e),r=t[0],n=t[1];return(r+n)*3/4-n}function i5(e,t,r){return(t+r)*3/4-r}function s5(e){var t,r=zm(e),n=r[0],i=r[1],a=new r5(i5(e,n,i)),s=0,u=i>0?n-4:n,l;for(l=0;l<u;l+=4)t=ui[e.charCodeAt(l)]<<18|ui[e.charCodeAt(l+1)]<<12|ui[e.charCodeAt(l+2)]<<6|ui[e.charCodeAt(l+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=ui[e.charCodeAt(l)]<<2|ui[e.charCodeAt(l+1)]>>4,a[s++]=t&255),i===1&&(t=ui[e.charCodeAt(l)]<<10|ui[e.charCodeAt(l+1)]<<4|ui[e.charCodeAt(l+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function a5(e){return Mi[e>>18&63]+Mi[e>>12&63]+Mi[e>>6&63]+Mi[e&63]}function o5(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(a5(n));return i.join("")}function u5(e){for(var t,r=e.length,n=r%3,i=[],a=16383,s=0,u=r-n;s<u;s+=a)i.push(o5(e,s,s+a>u?u:s+a));return n===1?(t=e[r-1],i.push(Mi[t>>2]+Mi[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Mi[t>>10]+Mi[t>>4&63]+Mi[t<<2&63]+"=")),i.join("")}});var Wm=ye(Ad=>{Ad.read=function(e,t,r,n,i){var a,s,u=i*8-n-1,l=(1<<u)-1,f=l>>1,d=-7,E=r?i-1:0,p=r?-1:1,h=e[t+E];for(E+=p,a=h&(1<<-d)-1,h>>=-d,d+=u;d>0;a=a*256+e[t+E],E+=p,d-=8);for(s=a&(1<<-d)-1,a>>=-d,d+=n;d>0;s=s*256+e[t+E],E+=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)};Ad.write=function(e,t,r,n,i,a){var s,u,l,f=a*8-i-1,d=(1<<f)-1,E=d>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,A=n?1:-1,m=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+E>=1?t+=p/l:t+=p*Math.pow(2,1-E),t*l>=2&&(s++,l/=2),s+E>=d?(u=0,s=d):s+E>=1?(u=(t*l-1)*Math.pow(2,i),s=s+E):(u=t*Math.pow(2,E-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=u&255,h+=A,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;e[r+h]=s&255,h+=A,s/=256,f-=8);e[r+h-A]|=m*128}});var Rf=ye(mu=>{"use strict";var yd=Ym(),du=Wm(),Xm=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;mu.Buffer=fe;mu.SlowBuffer=d5;mu.INSPECT_MAX_BYTES=50;var Df=2147483647;mu.kMaxLength=Df;fe.TYPED_ARRAY_SUPPORT=c5();!fe.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 c5(){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(fe.prototype,"parent",{enumerable:!0,get:function(){if(fe.isBuffer(this))return this.buffer}});Object.defineProperty(fe.prototype,"offset",{enumerable:!0,get:function(){if(fe.isBuffer(this))return this.byteOffset}});function _s(e){if(e>Df)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,fe.prototype),t}function fe(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 _d(e)}return ev(e,t,r)}fe.poolSize=8192;function ev(e,t,r){if(typeof e=="string")return f5(e,t);if(ArrayBuffer.isView(e))return h5(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(ji(e,ArrayBuffer)||e&&ji(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ji(e,SharedArrayBuffer)||e&&ji(e.buffer,SharedArrayBuffer)))return bd(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 fe.from(n,t,r);let i=p5(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return fe.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)}fe.from=function(e,t,r){return ev(e,t,r)};Object.setPrototypeOf(fe.prototype,Uint8Array.prototype);Object.setPrototypeOf(fe,Uint8Array);function tv(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 l5(e,t,r){return tv(e),e<=0?_s(e):t!==void 0?typeof r=="string"?_s(e).fill(t,r):_s(e).fill(t):_s(e)}fe.alloc=function(e,t,r){return l5(e,t,r)};function _d(e){return tv(e),_s(e<0?0:Fd(e)|0)}fe.allocUnsafe=function(e){return _d(e)};fe.allocUnsafeSlow=function(e){return _d(e)};function f5(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!fe.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=rv(e,t)|0,n=_s(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function Sd(e){let t=e.length<0?0:Fd(e.length)|0,r=_s(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function h5(e){if(ji(e,Uint8Array)){let t=new Uint8Array(e);return bd(t.buffer,t.byteOffset,t.byteLength)}return Sd(e)}function bd(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,fe.prototype),n}function p5(e){if(fe.isBuffer(e)){let t=Fd(e.length)|0,r=_s(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||$d(e.length)?_s(0):Sd(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Sd(e.data)}function Fd(e){if(e>=Df)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Df.toString(16)+" bytes");return e|0}function d5(e){return+e!=e&&(e=0),fe.alloc(+e)}fe.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==fe.prototype};fe.compare=function(t,r){if(ji(t,Uint8Array)&&(t=fe.from(t,t.offset,t.byteLength)),ji(r,Uint8Array)&&(r=fe.from(r,r.offset,r.byteLength)),!fe.isBuffer(t)||!fe.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);a<s;++a)if(t[a]!==r[a]){n=t[a],i=r[a];break}return n<i?-1:i<n?1:0};fe.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};fe.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return fe.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let i=fe.allocUnsafe(r),a=0;for(n=0;n<t.length;++n){let s=t[n];if(ji(s,Uint8Array))a+s.length>i.length?(fe.isBuffer(s)||(s=fe.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(fe.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function rv(e,t){if(fe.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ji(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 Cd(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fv(e).length;default:if(i)return n?-1:Cd(e).length;t=(""+t).toLowerCase(),i=!0}}fe.byteLength=rv;function g5(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 _5(this,t,r);case"utf8":case"utf-8":return iv(this,t,r);case"ascii":return b5(this,t,r);case"latin1":case"binary":return C5(this,t,r);case"base64":return y5(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F5(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}fe.prototype._isBuffer=!0;function no(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}fe.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;r<t;r+=2)no(this,r,r+1);return this};fe.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)no(this,r,r+3),no(this,r+1,r+2);return this};fe.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)no(this,r,r+7),no(this,r+1,r+6),no(this,r+2,r+5),no(this,r+3,r+4);return this};fe.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?iv(this,0,t):g5.apply(this,arguments)};fe.prototype.toLocaleString=fe.prototype.toString;fe.prototype.equals=function(t){if(!fe.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:fe.compare(this,t)===0};fe.prototype.inspect=function(){let t="",r=mu.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Xm&&(fe.prototype[Xm]=fe.prototype.inspect);fe.prototype.compare=function(t,r,n,i,a){if(ji(t,Uint8Array)&&(t=fe.from(t,t.offset,t.byteLength)),!fe.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 E=0;E<l;++E)if(f[E]!==d[E]){s=f[E],u=d[E];break}return s<u?-1:u<s?1:0};function nv(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,$d(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=fe.from(t,n)),fe.isBuffer(t))return t.length===0?-1:Jm(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):Jm(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Jm(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,E){return a===1?d[E]:d.readUInt16BE(E*a)}let f;if(i){let d=-1;for(f=r;f<s;f++)if(l(e,f)===l(t,d===-1?0:f-d)){if(d===-1&&(d=f),f-d+1===u)return d*a}else d!==-1&&(f-=f-d),d=-1}else for(r+u>s&&(r=s-u),f=r;f>=0;f--){let d=!0;for(let E=0;E<u;E++)if(l(e,f+E)!==l(t,E)){d=!1;break}if(d)return f}return-1}fe.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};fe.prototype.indexOf=function(t,r,n){return nv(this,t,r,n,!0)};fe.prototype.lastIndexOf=function(t,r,n){return nv(this,t,r,n,!1)};function m5(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let a=t.length;n>a/2&&(n=a/2);let s;for(s=0;s<n;++s){let u=parseInt(t.substr(s*2,2),16);if($d(u))return s;e[r+s]=u}return s}function v5(e,t,r,n){return Bf(Cd(t,e.length-r),e,r,n)}function E5(e,t,r,n){return Bf(B5(t),e,r,n)}function w5(e,t,r,n){return Bf(fv(t),e,r,n)}function A5(e,t,r,n){return Bf(R5(t,e.length-r),e,r,n)}fe.prototype.write=function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>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 m5(this,t,r,n);case"utf8":case"utf-8":return v5(this,t,r,n);case"ascii":case"latin1":case"binary":return E5(this,t,r,n);case"base64":return w5(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A5(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};fe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function y5(e,t,r){return t===0&&r===e.length?yd.fromByteArray(e):yd.fromByteArray(e.slice(t,r))}function iv(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let a=e[i],s=null,u=a>239?4:a>223?3:a>191?2:1;if(i+u<=r){let l,f,d,E;switch(u){case 1:a<128&&(s=a);break;case 2:l=e[i+1],(l&192)===128&&(E=(a&31)<<6|l&63,E>127&&(s=E));break;case 3:l=e[i+1],f=e[i+2],(l&192)===128&&(f&192)===128&&(E=(a&15)<<12|(l&63)<<6|f&63,E>2047&&(E<55296||E>57343)&&(s=E));break;case 4:l=e[i+1],f=e[i+2],d=e[i+3],(l&192)===128&&(f&192)===128&&(d&192)===128&&(E=(a&15)<<18|(l&63)<<12|(f&63)<<6|d&63,E>65535&&E<1114112&&(s=E))}}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 S5(n)}var Zm=4096;function S5(e){let t=e.length;if(t<=Zm)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Zm));return r}function b5(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}function C5(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function _5(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let a=t;a<r;++a)i+=P5[e[a]];return i}function F5(e,t,r){let n=e.slice(t,r),i="";for(let a=0;a<n.length-1;a+=2)i+=String.fromCharCode(n[a]+n[a+1]*256);return i}fe.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let i=this.subarray(t,r);return Object.setPrototypeOf(i,fe.prototype),i};function Dr(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}fe.prototype.readUintLE=fe.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Dr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s<r&&(a*=256);)i+=this[t+s]*a;return i};fe.prototype.readUintBE=fe.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Dr(t,r,this.length);let i=this[t+--r],a=1;for(;r>0&&(a*=256);)i+=this[t+--r]*a;return i};fe.prototype.readUint8=fe.prototype.readUInt8=function(t,r){return t=t>>>0,r||Dr(t,1,this.length),this[t]};fe.prototype.readUint16LE=fe.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Dr(t,2,this.length),this[t]|this[t+1]<<8};fe.prototype.readUint16BE=fe.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Dr(t,2,this.length),this[t]<<8|this[t+1]};fe.prototype.readUint32LE=fe.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Dr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};fe.prototype.readUint32BE=fe.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Dr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};fe.prototype.readBigUInt64LE=fa(function(t){t=t>>>0,gu(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lc(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)<<BigInt(32))});fe.prototype.readBigUInt64BE=fa(function(t){t=t>>>0,gu(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lc(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)<<BigInt(32))+BigInt(a)});fe.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Dr(t,r,this.length);let i=this[t],a=1,s=0;for(;++s<r&&(a*=256);)i+=this[t+s]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*r)),i};fe.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Dr(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};fe.prototype.readInt8=function(t,r){return t=t>>>0,r||Dr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};fe.prototype.readInt16LE=function(t,r){t=t>>>0,r||Dr(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};fe.prototype.readInt16BE=function(t,r){t=t>>>0,r||Dr(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};fe.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Dr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};fe.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Dr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};fe.prototype.readBigInt64LE=fa(function(t){t=t>>>0,gu(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lc(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});fe.prototype.readBigInt64BE=fa(function(t){t=t>>>0,gu(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Lc(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});fe.prototype.readFloatLE=function(t,r){return t=t>>>0,r||Dr(t,4,this.length),du.read(this,t,!0,23,4)};fe.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Dr(t,4,this.length),du.read(this,t,!1,23,4)};fe.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Dr(t,8,this.length),du.read(this,t,!0,52,8)};fe.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Dr(t,8,this.length),du.read(this,t,!1,52,8)};function _n(e,t,r,n,i,a){if(!fe.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}fe.prototype.writeUintLE=fe.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;_n(this,t,r,n,u,0)}let a=1,s=0;for(this[r]=t&255;++s<n&&(a*=256);)this[r+s]=t/a&255;return r+n};fe.prototype.writeUintBE=fe.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;_n(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};fe.prototype.writeUint8=fe.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||_n(this,t,r,1,255,0),this[r]=t&255,r+1};fe.prototype.writeUint16LE=fe.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||_n(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};fe.prototype.writeUint16BE=fe.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||_n(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};fe.prototype.writeUint32LE=fe.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||_n(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};fe.prototype.writeUint32BE=fe.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||_n(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 sv(e,t,r,n,i){lv(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 av(e,t,r,n,i){lv(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}fe.prototype.writeBigUInt64LE=fa(function(t,r=0){return sv(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeBigUInt64BE=fa(function(t,r=0){return av(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});fe.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);_n(this,t,r,n,l-1,-l)}let a=0,s=1,u=0;for(this[r]=t&255;++a<n&&(s*=256);)t<0&&u===0&&this[r+a-1]!==0&&(u=1),this[r+a]=(t/s>>0)-u&255;return r+n};fe.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let l=Math.pow(2,8*n-1);_n(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};fe.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||_n(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};fe.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||_n(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};fe.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||_n(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};fe.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||_n(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};fe.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||_n(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};fe.prototype.writeBigInt64LE=fa(function(t,r=0){return sv(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});fe.prototype.writeBigInt64BE=fa(function(t,r=0){return av(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ov(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 uv(e,t,r,n,i){return t=+t,r=r>>>0,i||ov(e,t,r,4,34028234663852886e22,-34028234663852886e22),du.write(e,t,r,n,23,4),r+4}fe.prototype.writeFloatLE=function(t,r,n){return uv(this,t,r,!0,n)};fe.prototype.writeFloatBE=function(t,r,n){return uv(this,t,r,!1,n)};function cv(e,t,r,n,i){return t=+t,r=r>>>0,i||ov(e,t,r,8,17976931348623157e292,-17976931348623157e292),du.write(e,t,r,n,52,8),r+8}fe.prototype.writeDoubleLE=function(t,r,n){return cv(this,t,r,!0,n)};fe.prototype.writeDoubleBE=function(t,r,n){return cv(this,t,r,!1,n)};fe.prototype.copy=function(t,r,n,i){if(!fe.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<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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<i-n&&(i=t.length-r+n);let a=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),a};fe.prototype.fill=function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!fe.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let a;if(typeof t=="number")for(a=r;a<n;++a)this[a]=t;else{let s=fe.isBuffer(t)?t:fe.from(t,i),u=s.length;if(u===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=s[a%u]}return this};var pu={};function Id(e,t,r){pu[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}Id("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Id("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);Id("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Qm(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Qm(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function Qm(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 I5(e,t,r){gu(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Lc(t,e.length-(r+1))}function lv(e,t,r,n,i,a){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",u;throw a>3?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 pu.ERR_OUT_OF_RANGE("value",u,e)}I5(n,i,a)}function gu(e,t){if(typeof e!="number")throw new pu.ERR_INVALID_ARG_TYPE(t,"number",e)}function Lc(e,t,r){throw Math.floor(e)!==e?(gu(e,r),new pu.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new pu.ERR_BUFFER_OUT_OF_BOUNDS:new pu.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var $5=/[^+/0-9A-Za-z-_]/g;function D5(e){if(e=e.split("=")[0],e=e.trim().replace($5,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Cd(e,t){t=t||1/0;let r,n=e.length,i=null,a=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&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 B5(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function R5(e,t){let r,n,i,a=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function fv(e){return yd.toByteArray(D5(e))}function Bf(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function ji(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function $d(e){return e!==e}var P5=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 fa(e){return typeof BigInt>"u"?T5:e}function T5(){throw new Error("BigInt not supported")}});var xv=ye(be=>{var Uc={};Uc.userAgent=!1;var vu={},O5="11.1.0",x5="jsrsasign(all) 11.1.0 (2024-02-01) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var Ce=Ce||function(e,t){var r={},n=r.lib={},i=n.Base=function(){function h(){}return{extend:function(A){h.prototype=this;var m=new h;return A&&m.mixIn(A),m.hasOwnProperty("init")||(m.init=function(){m.$super.init.apply(this,arguments)}),m.init.prototype=m,m.$super=this,m},create:function(){var A=this.extend();return A.init.apply(A,arguments),A},init:function(){},mixIn:function(A){for(var m in A)A.hasOwnProperty(m)&&(this[m]=A[m]);A.hasOwnProperty("toString")&&(this.toString=A.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),a=n.WordArray=i.extend({init:function(h,A){h=this.words=h||[],A!=t?this.sigBytes=A:this.sigBytes=h.length*4},toString:function(h){return(h||u).stringify(this)},concat:function(h){var A=this.words,m=h.words,S=this.sigBytes,w=h.sigBytes;if(this.clamp(),S%4)for(var y=0;y<w;y++){var _=m[y>>>2]>>>24-y%4*8&255;A[S+y>>>2]|=_<<24-(S+y)%4*8}else for(var y=0;y<w;y+=4)A[S+y>>>2]=m[y>>>2];return this.sigBytes+=w,this},clamp:function(){var h=this.words,A=this.sigBytes;h[A>>>2]&=4294967295<<32-A%4*8,h.length=e.ceil(A/4)},clone:function(){var h=i.clone.call(this);return h.words=this.words.slice(0),h},random:function(h){for(var A=[],m=0;m<h;m+=4)A.push(e.random()*4294967296|0);return new a.init(A,h)}}),s=r.enc={},u=s.Hex={stringify:function(h){for(var A=h.words,m=h.sigBytes,S=[],w=0;w<m;w++){var y=A[w>>>2]>>>24-w%4*8&255;S.push((y>>>4).toString(16)),S.push((y&15).toString(16))}return S.join("")},parse:function(h){for(var A=h.length,m=[],S=0;S<A;S+=2)m[S>>>3]|=parseInt(h.substr(S,2),16)<<24-S%8*4;return new a.init(m,A/2)}},l=s.Latin1={stringify:function(h){for(var A=h.words,m=h.sigBytes,S=[],w=0;w<m;w++){var y=A[w>>>2]>>>24-w%4*8&255;S.push(String.fromCharCode(y))}return S.join("")},parse:function(h){for(var A=h.length,m=[],S=0;S<A;S++)m[S>>>2]|=(h.charCodeAt(S)&255)<<24-S%4*8;return new a.init(m,A)}},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 A=this._data,m=A.words,S=A.sigBytes,w=this.blockSize,y=w*4,_=S/y;h?_=e.ceil(_):_=e.max((_|0)-this._minBufferSize,0);var B=_*w,D=e.min(B*4,S);if(B){for(var j=0;j<B;j+=w)this._doProcessBlock(m,j);var q=m.splice(0,B);A.sigBytes-=D}return new a.init(q,D)},clone:function(){var h=i.clone.call(this);return h._data=this._data.clone(),h},_minBufferSize:0}),E=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 A=this._doFinalize();return A},blockSize:512/32,_createHelper:function(h){return function(A,m){return new h.init(m).finalize(A)}},_createHmacHelper:function(h){return function(A,m){return new p.HMAC.init(h,m).finalize(A)}}}),p=r.algo={};return r}(Math);(function(e){var i=Ce,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<s;l++){var f=a[l];u.push(f.high),u.push(f.low)}return n.create(u,this.sigBytes)},clone:function(){for(var a=r.clone.call(this),s=a.words=this.words.slice(0),u=s.length,l=0;l<u;l++)s[l]=s[l].clone();return a}})})();Ce.lib.Cipher||function(e){var h=Ce,t=h.lib,r=t.Base,n=t.WordArray,i=t.BufferedBlockAlgorithm,a=h.enc.Base64,s=h.algo.EvpKDF,u=t.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(m,S){return this.create(this._ENC_XFORM_MODE,m,S)},createDecryptor:function(m,S){return this.create(this._DEC_XFORM_MODE,m,S)},init:function(m,S,w){this.cfg=this.cfg.extend(w),this._xformMode=m,this._key=S,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(m){return this._append(m),this._process()},finalize:function(m){return m&&this._append(m),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(m){return{encrypt:function(S,w,y){return(typeof w=="string"?A:p).encrypt(m,S,w,y)},decrypt:function(S,w,y){return(typeof w=="string"?A:p).decrypt(m,S,w,y)}}}});t.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var E=h.mode={},l=function(m,S,w){var y=this._iv;y?this._iv=e:y=this._prevBlock;for(var _=0;_<w;_++)m[S+_]^=y[_]},f=(t.BlockCipherMode=r.extend({createEncryptor:function(m,S){return this.Encryptor.create(m,S)},createDecryptor:function(m,S){return this.Decryptor.create(m,S)},init:function(m,S){this._cipher=m,this._iv=S}})).extend();f.Encryptor=f.extend({processBlock:function(m,S){var w=this._cipher,y=w.blockSize;l.call(this,m,S,y),w.encryptBlock(m,S),this._prevBlock=m.slice(S,S+y)}}),f.Decryptor=f.extend({processBlock:function(m,S){var w=this._cipher,y=w.blockSize,_=m.slice(S,S+y);w.decryptBlock(m,S),l.call(this,m,S,y),this._prevBlock=_}}),E=E.CBC=f,f=(h.pad={}).Pkcs7={pad:function(m,S){for(var w=4*S,w=w-m.sigBytes%w,y=w<<24|w<<16|w<<8|w,_=[],B=0;B<w;B+=4)_.push(y);w=n.create(_,w),m.concat(w)},unpad:function(m){m.sigBytes-=m.words[m.sigBytes-1>>>2]&255}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:E,padding:f}),reset:function(){u.reset.call(this);var S=this.cfg,m=S.iv,S=S.mode;if(this._xformMode==this._ENC_XFORM_MODE)var w=S.createEncryptor;else w=S.createDecryptor,this._minBufferSize=1;this._mode=w.call(S,this,m&&m.words)},_doProcessBlock:function(m,S){this._mode.processBlock(m,S)},_doFinalize:function(){var m=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){m.pad(this._data,this.blockSize);var S=this._process(!0)}else S=this._process(!0),m.unpad(S);return S},blockSize:4});var d=t.CipherParams=r.extend({init:function(m){this.mixIn(m)},toString:function(m){return(m||this.formatter).stringify(this)}}),E=(h.format={}).OpenSSL={stringify:function(m){var S=m.ciphertext;return m=m.salt,(m?n.create([1398893684,1701076831]).concat(m).concat(S):S).toString(a)},parse:function(m){m=a.parse(m);var S=m.words;if(S[0]==1398893684&&S[1]==1701076831){var w=n.create(S.slice(2,4));S.splice(0,4),m.sigBytes-=16}return d.create({ciphertext:m,salt:w})}},p=t.SerializableCipher=r.extend({cfg:r.extend({format:E}),encrypt:function(m,S,w,y){y=this.cfg.extend(y);var _=m.createEncryptor(w,y);return S=_.finalize(S),_=_.cfg,d.create({ciphertext:S,key:w,iv:_.iv,algorithm:m,mode:_.mode,padding:_.padding,blockSize:m.blockSize,formatter:y.format})},decrypt:function(m,S,w,y){return y=this.cfg.extend(y),S=this._parse(S,y.format),m.createDecryptor(w,y).finalize(S.ciphertext)},_parse:function(m,S){return typeof m=="string"?S.parse(m,this):m}}),h=(h.kdf={}).OpenSSL={execute:function(m,S,w,y){return y||(y=n.random(8)),m=s.create({keySize:S+w}).compute(m,y),w=n.create(m.words.slice(S),4*w),m.sigBytes=4*S,d.create({key:m,iv:w,salt:y})}},A=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),encrypt:function(m,S,w,y){return y=this.cfg.extend(y),w=y.kdf.execute(w,m.keySize,m.ivSize),y.iv=w.iv,m=p.encrypt.call(this,m,S,w.key,y),m.mixIn(w),m},decrypt:function(m,S,w,y){return y=this.cfg.extend(y),S=this._parse(S,y.format),w=y.kdf.execute(w,m.keySize,m.ivSize,S.salt),y.iv=w.iv,p.decrypt.call(this,m,S,w.key,y)}})}();(function(){for(var e=Ce,t=e.lib.BlockCipher,j=e.algo,r=[],n=[],i=[],a=[],s=[],u=[],l=[],f=[],d=[],E=[],p=[],h=0;256>h;h++)p[h]=128>h?h<<1:h<<1^283;for(var A=0,m=0,h=0;256>h;h++){var S=m^m<<1^m<<2^m<<3^m<<4,S=S>>>8^S&255^99;r[A]=S,n[S]=A;var w=p[A],y=p[w],_=p[y],B=257*p[S]^16843008*S;i[A]=B<<24|B>>>8,a[A]=B<<16|B>>>16,s[A]=B<<8|B>>>24,u[A]=B,B=16843009*_^65537*y^257*w^16843008*A,l[S]=B<<24|B>>>8,f[S]=B<<16|B>>>16,d[S]=B<<8|B>>>24,E[S]=B,A?(A=w^p[p[p[_^w]]],m^=p[p[m]]):A=m=1}var D=[0,1,2,4,8,16,32,64,128,27,54],j=j.AES=t.extend({_doReset:function(){for(var P=this._key,q=P.words,F=P.sigBytes/4,P=4*((this._nRounds=F+6)+1),L=this._keySchedule=[],M=0;M<P;M++)if(M<F)L[M]=q[M];else{var V=L[M-1];M%F?6<F&&M%F==4&&(V=r[V>>>24]<<24|r[V>>>16&255]<<16|r[V>>>8&255]<<8|r[V&255]):(V=V<<8|V>>>24,V=r[V>>>24]<<24|r[V>>>16&255]<<16|r[V>>>8&255]<<8|r[V&255],V^=D[M/F|0]<<24),L[M]=L[M-F]^V}for(q=this._invKeySchedule=[],F=0;F<P;F++)M=P-F,V=F%4?L[M]:L[M-4],q[F]=4>F||4>=M?V:l[r[V>>>24]]^f[r[V>>>16&255]]^d[r[V>>>8&255]]^E[r[V&255]]},encryptBlock:function(q,F){this._doCryptBlock(q,F,this._keySchedule,i,a,s,u,r)},decryptBlock:function(q,F){var P=q[F+1];q[F+1]=q[F+3],q[F+3]=P,this._doCryptBlock(q,F,this._invKeySchedule,l,f,d,E,n),P=q[F+1],q[F+1]=q[F+3],q[F+3]=P},_doCryptBlock:function(q,F,P,L,M,V,W,G){for(var z=this._nRounds,ue=q[F]^P[0],_e=q[F+1]^P[1],He=q[F+2]^P[2],Ve=q[F+3]^P[3],X=4,ie=1;ie<z;ie++)var Se=L[ue>>>24]^M[_e>>>16&255]^V[He>>>8&255]^W[Ve&255]^P[X++],we=L[_e>>>24]^M[He>>>16&255]^V[Ve>>>8&255]^W[ue&255]^P[X++],Ie=L[He>>>24]^M[Ve>>>16&255]^V[ue>>>8&255]^W[_e&255]^P[X++],Ve=L[Ve>>>24]^M[ue>>>16&255]^V[_e>>>8&255]^W[He&255]^P[X++],ue=Se,_e=we,He=Ie;Se=(G[ue>>>24]<<24|G[_e>>>16&255]<<16|G[He>>>8&255]<<8|G[Ve&255])^P[X++],we=(G[_e>>>24]<<24|G[He>>>16&255]<<16|G[Ve>>>8&255]<<8|G[ue&255])^P[X++],Ie=(G[He>>>24]<<24|G[Ve>>>16&255]<<16|G[ue>>>8&255]<<8|G[_e&255])^P[X++],Ve=(G[Ve>>>24]<<24|G[ue>>>16&255]<<16|G[_e>>>8&255]<<8|G[He&255])^P[X++],q[F]=Se,q[F+1]=we,q[F+2]=Ie,q[F+3]=Ve},keySize:8});e.AES=t._createHelper(j)})();(function(){function e(p,h){var A=(this._lBlock>>>p^this._rBlock)&h;this._rBlock^=A,this._lBlock^=A<<p}function t(p,h){var A=(this._rBlock>>>p^this._lBlock)&h;this._lBlock^=A,this._rBlock^=A<<p}var r=Ce,i=r.lib,n=i.WordArray,i=i.BlockCipher,a=r.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],f=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],E=a.DES=i.extend({_doReset:function(){for(var p=this._key.words,h=[],A=0;56>A;A++){var m=s[A]-1;h[A]=p[m>>>5]>>>31-m%32&1}for(p=this._subKeys=[],m=0;16>m;m++){for(var S=p[m]=[],w=l[m],A=0;24>A;A++)S[A/6|0]|=h[(u[A]-1+w)%28]<<31-A%6,S[4+(A/6|0)]|=h[28+(u[A+24]-1+w)%28]<<31-A%6;for(S[0]=S[0]<<1|S[0]>>>31,A=1;7>A;A++)S[A]>>>=4*(A-1)+3;S[7]=S[7]<<5|S[7]>>>27}for(h=this._invSubKeys=[],A=0;16>A;A++)h[A]=p[15-A]},encryptBlock:function(p,h){this._doCryptBlock(p,h,this._subKeys)},decryptBlock:function(p,h){this._doCryptBlock(p,h,this._invSubKeys)},_doCryptBlock:function(p,h,A){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 m=0;16>m;m++){for(var S=A[m],w=this._lBlock,y=this._rBlock,_=0,B=0;8>B;B++)_|=f[B][((y^S[B])&d[B])>>>0];this._lBlock=y,this._rBlock=w^_}A=this._lBlock,this._lBlock=this._rBlock,this._rBlock=A,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(E),a=a.TripleDES=i.extend({_doReset:function(){var p=this._key.words;this._des1=E.createEncryptor(n.create(p.slice(0,2))),this._des2=E.createEncryptor(n.create(p.slice(2,4))),this._des3=E.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=Ce,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<i;s+=3)for(var u=(n[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<i;l++)r.push(a.charAt(u>>>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<n;u++)if(u%4){var l=i.indexOf(r.charAt(u-1))<<2*(u%4),f=i.indexOf(r.charAt(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(E,p,h,A,m,S,w){return E=E+(p&h|~p&A)+m+w,(E<<S|E>>>32-S)+p}function r(E,p,h,A,m,S,w){return E=E+(p&A|h&~A)+m+w,(E<<S|E>>>32-S)+p}function n(E,p,h,A,m,S,w){return E=E+(p^h^A)+m+w,(E<<S|E>>>32-S)+p}function i(E,p,h,A,m,S,w){return E=E+(h^(p|~A))+m+w,(E<<S|E>>>32-S)+p}for(var a=Ce,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(E,p){for(var h=0;16>h;h++){var A=p+h,m=E[A];E[A]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}var h=this._hash.words,A=E[p+0],m=E[p+1],S=E[p+2],w=E[p+3],y=E[p+4],_=E[p+5],B=E[p+6],D=E[p+7],j=E[p+8],q=E[p+9],F=E[p+10],P=E[p+11],L=E[p+12],M=E[p+13],V=E[p+14],W=E[p+15],G=h[0],ie=h[1],X=h[2],z=h[3],G=t(G,ie,X,z,A,7,f[0]),z=t(z,G,ie,X,m,12,f[1]),X=t(X,z,G,ie,S,17,f[2]),ie=t(ie,X,z,G,w,22,f[3]),G=t(G,ie,X,z,y,7,f[4]),z=t(z,G,ie,X,_,12,f[5]),X=t(X,z,G,ie,B,17,f[6]),ie=t(ie,X,z,G,D,22,f[7]),G=t(G,ie,X,z,j,7,f[8]),z=t(z,G,ie,X,q,12,f[9]),X=t(X,z,G,ie,F,17,f[10]),ie=t(ie,X,z,G,P,22,f[11]),G=t(G,ie,X,z,L,7,f[12]),z=t(z,G,ie,X,M,12,f[13]),X=t(X,z,G,ie,V,17,f[14]),ie=t(ie,X,z,G,W,22,f[15]),G=r(G,ie,X,z,m,5,f[16]),z=r(z,G,ie,X,B,9,f[17]),X=r(X,z,G,ie,P,14,f[18]),ie=r(ie,X,z,G,A,20,f[19]),G=r(G,ie,X,z,_,5,f[20]),z=r(z,G,ie,X,F,9,f[21]),X=r(X,z,G,ie,W,14,f[22]),ie=r(ie,X,z,G,y,20,f[23]),G=r(G,ie,X,z,q,5,f[24]),z=r(z,G,ie,X,V,9,f[25]),X=r(X,z,G,ie,w,14,f[26]),ie=r(ie,X,z,G,j,20,f[27]),G=r(G,ie,X,z,M,5,f[28]),z=r(z,G,ie,X,S,9,f[29]),X=r(X,z,G,ie,D,14,f[30]),ie=r(ie,X,z,G,L,20,f[31]),G=n(G,ie,X,z,_,4,f[32]),z=n(z,G,ie,X,j,11,f[33]),X=n(X,z,G,ie,P,16,f[34]),ie=n(ie,X,z,G,V,23,f[35]),G=n(G,ie,X,z,m,4,f[36]),z=n(z,G,ie,X,y,11,f[37]),X=n(X,z,G,ie,D,16,f[38]),ie=n(ie,X,z,G,F,23,f[39]),G=n(G,ie,X,z,M,4,f[40]),z=n(z,G,ie,X,A,11,f[41]),X=n(X,z,G,ie,w,16,f[42]),ie=n(ie,X,z,G,B,23,f[43]),G=n(G,ie,X,z,q,4,f[44]),z=n(z,G,ie,X,L,11,f[45]),X=n(X,z,G,ie,W,16,f[46]),ie=n(ie,X,z,G,S,23,f[47]),G=i(G,ie,X,z,A,6,f[48]),z=i(z,G,ie,X,D,10,f[49]),X=i(X,z,G,ie,V,15,f[50]),ie=i(ie,X,z,G,_,21,f[51]),G=i(G,ie,X,z,L,6,f[52]),z=i(z,G,ie,X,w,10,f[53]),X=i(X,z,G,ie,F,15,f[54]),ie=i(ie,X,z,G,m,21,f[55]),G=i(G,ie,X,z,j,6,f[56]),z=i(z,G,ie,X,W,10,f[57]),X=i(X,z,G,ie,B,15,f[58]),ie=i(ie,X,z,G,M,21,f[59]),G=i(G,ie,X,z,y,6,f[60]),z=i(z,G,ie,X,P,10,f[61]),X=i(X,z,G,ie,S,15,f[62]),ie=i(ie,X,z,G,q,21,f[63]);h[0]=h[0]+G|0,h[1]=h[1]+ie|0,h[2]=h[2]+X|0,h[3]=h[3]+z|0},_doFinalize:function(){var E=this._data,p=E.words,h=8*this._nDataBytes,A=8*E.sigBytes;p[A>>>5]|=128<<24-A%32;var m=e.floor(h/4294967296);for(p[(A+64>>>9<<4)+15]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,p[(A+64>>>9<<4)+14]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,E.sigBytes=4*(p.length+1),this._process(),E=this._hash,p=E.words,h=0;4>h;h++)A=p[h],p[h]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360;return E},clone:function(){var E=u.clone.call(this);return E._hash=this._hash.clone(),E}}),a.MD5=u._createHelper(l),a.HmacMD5=u._createHmacHelper(l)})(Math);(function(){var e=Ce,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],E=u[3],p=u[4],h=0;80>h;h++){if(16>h)n[h]=a[s+h]|0;else{var A=n[h-3]^n[h-8]^n[h-14]^n[h-16];n[h]=A<<1|A>>>31}A=(l<<5|l>>>27)+p+n[h],A=20>h?A+((f&d|~f&E)+1518500249):40>h?A+((f^d^E)+1859775393):60>h?A+((f&d|f&E|d&E)-1894007588):A+((f^d^E)-899497514),p=E,E=d,d=f<<30|f>>>2,f=l,l=A}u[0]=u[0]+l|0,u[1]=u[1]+f|0,u[2]=u[2]+d|0,u[3]=u[3]+E|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=Ce,h=t.lib,r=h.WordArray,n=h.Hasher,h=t.algo,i=[],a=[],s=function(m){return 4294967296*(m-(m|0))|0},u=2,l=0;64>l;){var f;e:{f=u;for(var d=e.sqrt(f),E=2;E<=d;E++)if(!(f%E)){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(A,m){for(var S=this._hash.words,w=S[0],y=S[1],_=S[2],B=S[3],D=S[4],j=S[5],q=S[6],F=S[7],P=0;64>P;P++){if(16>P)p[P]=A[m+P]|0;else{var L=p[P-15],M=p[P-2];p[P]=((L<<25|L>>>7)^(L<<14|L>>>18)^L>>>3)+p[P-7]+((M<<15|M>>>17)^(M<<13|M>>>19)^M>>>10)+p[P-16]}L=F+((D<<26|D>>>6)^(D<<21|D>>>11)^(D<<7|D>>>25))+(D&j^~D&q)+a[P]+p[P],M=((w<<30|w>>>2)^(w<<19|w>>>13)^(w<<10|w>>>22))+(w&y^w&_^y&_),F=q,q=j,j=D,D=B+L|0,B=_,_=y,y=w,w=L+M|0}S[0]=S[0]+w|0,S[1]=S[1]+y|0,S[2]=S[2]+_|0,S[3]=S[3]+B|0,S[4]=S[4]+D|0,S[5]=S[5]+j|0,S[6]=S[6]+q|0,S[7]=S[7]+F|0},_doFinalize:function(){var A=this._data,m=A.words,S=8*this._nDataBytes,w=8*A.sigBytes;return m[w>>>5]|=128<<24-w%32,m[(w+64>>>9<<4)+14]=e.floor(S/4294967296),m[(w+64>>>9<<4)+15]=S,A.sigBytes=4*m.length,this._process(),this._hash},clone:function(){var A=n.clone.call(this);return A._hash=this._hash.clone(),A}});t.SHA256=n._createHelper(h),t.HmacSHA256=n._createHmacHelper(h)})(Math);(function(){var e=Ce,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=Ce,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 y=this._hash.words,E=y[0],p=y[1],h=y[2],A=y[3],m=y[4],S=y[5],w=y[6],y=y[7],_=E.high,B=E.low,D=p.high,j=p.low,q=h.high,F=h.low,P=A.high,L=A.low,M=m.high,V=m.low,W=S.high,G=S.low,z=w.high,X=w.low,ie=y.high,Se=y.low,we=_,Ie=B,Ve=D,ue=j,_e=q,He=F,Sr=P,Ht=L,wt=M,ir=V,Gt=W,at=G,kt=z,it=X,bt=ie,sr=Se,et=0;80>et;et++){var jr=u[et];if(16>et)var Jt=jr.high=f[d+2*et]|0,tt=jr.low=f[d+2*et+1]|0;else{var Jt=u[et-15],tt=Jt.high,cr=Jt.low,Jt=(tt>>>1|cr<<31)^(tt>>>8|cr<<24)^tt>>>7,cr=(cr>>>1|tt<<31)^(cr>>>8|tt<<24)^(cr>>>7|tt<<25),Mr=u[et-2],tt=Mr.high,Ct=Mr.low,Mr=(tt>>>19|Ct<<13)^(tt<<3|Ct>>>29)^tt>>>6,Ct=(Ct>>>19|tt<<13)^(Ct<<3|tt>>>29)^(Ct>>>6|tt<<26),tt=u[et-7],Zn=tt.high,br=u[et-16],lr=br.high,br=br.low,tt=cr+tt.low,Jt=Jt+Zn+(tt>>>0<cr>>>0?1:0),tt=tt+Ct,Jt=Jt+Mr+(tt>>>0<Ct>>>0?1:0),tt=tt+br,Jt=Jt+lr+(tt>>>0<br>>>0?1:0);jr.high=Jt,jr.low=tt}var Zn=wt&Gt^~wt&kt,br=ir&at^~ir&it,jr=we&Ve^we&_e^Ve&_e,Tr=Ie&ue^Ie&He^ue&He,cr=(we>>>28|Ie<<4)^(we<<30|Ie>>>2)^(we<<25|Ie>>>7),Mr=(Ie>>>28|we<<4)^(Ie<<30|we>>>2)^(Ie<<25|we>>>7),Ct=s[et],Sa=Ct.high,tn=Ct.low,Ct=sr+((ir>>>14|wt<<18)^(ir>>>18|wt<<14)^(ir<<23|wt>>>9)),lr=bt+((wt>>>14|ir<<18)^(wt>>>18|ir<<14)^(wt<<23|ir>>>9))+(Ct>>>0<sr>>>0?1:0),Ct=Ct+br,lr=lr+Zn+(Ct>>>0<br>>>0?1:0),Ct=Ct+tn,lr=lr+Sa+(Ct>>>0<tn>>>0?1:0),Ct=Ct+tt,lr=lr+Jt+(Ct>>>0<tt>>>0?1:0),tt=Mr+Tr,jr=cr+jr+(tt>>>0<Mr>>>0?1:0),bt=kt,sr=it,kt=Gt,it=at,Gt=wt,at=ir,ir=Ht+Ct|0,wt=Sr+lr+(ir>>>0<Ht>>>0?1:0)|0,Sr=_e,Ht=He,_e=Ve,He=ue,Ve=we,ue=Ie,Ie=Ct+tt|0,we=lr+jr+(Ie>>>0<Ct>>>0?1:0)|0}B=E.low=B+Ie,E.high=_+we+(B>>>0<Ie>>>0?1:0),j=p.low=j+ue,p.high=D+Ve+(j>>>0<ue>>>0?1:0),F=h.low=F+He,h.high=q+_e+(F>>>0<He>>>0?1:0),L=A.low=L+Ht,A.high=P+Sr+(L>>>0<Ht>>>0?1:0),V=m.low=V+ir,m.high=M+wt+(V>>>0<ir>>>0?1:0),G=S.low=G+at,S.high=W+Gt+(G>>>0<at>>>0?1:0),X=w.low=X+it,w.high=z+kt+(X>>>0<it>>>0?1:0),Se=y.low=Se+sr,y.high=ie+bt+(Se>>>0<sr>>>0?1:0)},_doFinalize:function(){var f=this._data,d=f.words,E=8*this._nDataBytes,p=8*f.sigBytes;return d[p>>>5]|=128<<24-p%32,d[(p+128>>>10<<5)+30]=Math.floor(E/4294967296),d[(p+128>>>10<<5)+31]=E,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=Ce,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=Ce,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,E){for(var p=0;16>p;p++){var h=E+p,A=d[h];d[h]=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360}var h=this._hash.words,A=u.words,m=l.words,S=n.words,w=i.words,y=a.words,_=s.words,B,D,j,q,F,P,L,M,V,W;P=B=h[0],L=D=h[1],M=j=h[2],V=q=h[3],W=F=h[4];for(var G,p=0;80>p;p+=1)G=B+d[E+S[p]]|0,G=16>p?G+((D^j^q)+A[0]):32>p?G+((D&j|~D&q)+A[1]):48>p?G+(((D|~j)^q)+A[2]):64>p?G+((D&q|j&~q)+A[3]):G+((D^(j|~q))+A[4]),G|=0,G=G<<y[p]|G>>>32-y[p],G=G+F|0,B=F,F=q,q=j<<10|j>>>22,j=D,D=G,G=P+d[E+w[p]]|0,G=16>p?G+((L^(M|~V))+m[0]):32>p?G+((L&V|M&~V)+m[1]):48>p?G+(((L|~M)^V)+m[2]):64>p?G+((L&M|~L&V)+m[3]):G+((L^M^V)+m[4]),G|=0,G=G<<_[p]|G>>>32-_[p],G=G+W|0,P=W,W=V,V=M<<10|M>>>22,M=L,L=G;G=h[1]+j+V|0,h[1]=h[2]+q+W|0,h[2]=h[3]+F+P|0,h[3]=h[4]+B+L|0,h[4]=h[0]+D+M|0,h[0]=G},_doFinalize:function(){var d=this._data,E=d.words,p=8*this._nDataBytes,h=8*d.sigBytes;for(E[h>>>5]|=128<<24-h%32,E[(h+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,d.sigBytes=4*(E.length+1),this._process(),d=this._hash,E=d.words,p=0;5>p;p++)h=E[p],E[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=Ce,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<i;d++)l[d]^=1549556828,f[d]^=909522486;s.sigBytes=u.sigBytes=a,this.reset()},reset:function(){var r=this._hasher;r.reset(),r.update(this._iKey)},update:function(r){return this._hasher.update(r),this},finalize:function(r){var n=this._hasher;return r=n.finalize(r),n.reset(),n.finalize(this._oKey.clone().concat(r))}})})();(function(){var e=Ce,n=e.lib,t=n.Base,r=n.WordArray,n=e.algo,i=n.HMAC,a=n.PBKDF2=t.extend({cfg:t.extend({keySize:4,hasher:n.SHA1,iterations:1}),init:function(s){this.cfg=this.cfg.extend(s)},compute:function(s,u){for(var A=this.cfg,l=i.create(A.hasher,s),f=r.create(),d=r.create([1]),E=f.words,p=d.words,h=A.keySize,A=A.iterations;E.length<h;){var m=l.update(u).finalize(d);l.reset();for(var S=m.words,w=S.length,y=m,_=1;_<A;_++){y=l.finalize(y),l.reset();for(var B=y.words,D=0;D<w;D++)S[D]^=B[D]}f.concat(m),p[0]++}return f.sigBytes=4*h,f}});e.PBKDF2=function(s,u,l){return a.create(l).compute(s,u)}})();var Eu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pd="=";function Is(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=Eu.charAt(r>>6)+Eu.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Eu.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Eu.charAt(r>>2)+Eu.charAt((r&3)<<4)),Pd)for(;(n.length&3)>0;)n+=Pd;return n}function Au(e){var t="",r,n=0,i,a;for(r=0;r<e.length&&e.charAt(r)!=Pd;++r)a=Eu.indexOf(e.charAt(r)),!(a<0)&&(n==0?(t+=Fs(a>>2),i=a&3,n=1):n==1?(t+=Fs(i<<2|a>>4),i=a&15,n=2):n==2?(t+=Fs(i),t+=Fs(a>>2),i=a&3,n=3):(t+=Fs(i<<2|a>>4),t+=Fs(a&15),n=0));return n==1&&(t+=Fs(i<<2)),t}function gv(e){var t=Au(e),r,n=new Array;for(r=0;2*r<t.length;++r)n[r]=parseInt(t.substring(2*r,2*r+2),16);return n}var pa,N5=0xdeadbeefcafe,hv=(N5&16777215)==15715070;function ee(e,t,r){e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}function gt(){return new ee(null)}function k5(e,t,r,n,i,a){for(;--a>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=s&67108863}return i}function L5(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 U5(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}hv&&Uc.appName=="Microsoft Internet Explorer"?(ee.prototype.am=L5,pa=30):hv&&Uc.appName!="Netscape"?(ee.prototype.am=k5,pa=26):(ee.prototype.am=U5,pa=28);ee.prototype.DB=pa;ee.prototype.DM=(1<<pa)-1;ee.prototype.DV=1<<pa;var kd=52;ee.prototype.FV=Math.pow(2,kd);ee.prototype.F1=kd-pa;ee.prototype.F2=2*pa-kd;var H5="0123456789abcdefghijklmnopqrstuvwxyz",Nf=new Array,yu,li;yu=48;for(li=0;li<=9;++li)Nf[yu++]=li;yu=97;for(li=10;li<36;++li)Nf[yu++]=li;yu=65;for(li=10;li<36;++li)Nf[yu++]=li;function Fs(e){return H5.charAt(e)}function mv(e,t){var r=Nf[e.charCodeAt(t)];return r??-1}function M5(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function j5(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 ha(e){var t=gt();return t.fromInt(e),t}function q5(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:mv(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)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,a+=r,a>=this.DB&&(a-=this.DB)}r==8&&e[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&ee.ZERO.subTo(this,this)}function K5(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function V5(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<<t)-1,n,i=!1,a="",s=this.t,u=this.DB-s*this.DB%t;if(s-- >0)for(u<this.DB&&(n=this[s]>>u)>0&&(i=!0,a=Fs(n));s>=0;)u<t?(n=(this[s]&(1<<u)-1)<<t-u,n|=this[--s]>>(u+=this.DB-t)):(n=this[s]>>(u-=t)&r,u<=0&&(u+=this.DB,--s)),n>0&&(i=!0),i&&(a+=Fs(n));return i?a:"0"}function G5(){var e=gt();return ee.ZERO.subTo(this,e),e}function z5(){return this.s<0?this.negate():this}function Y5(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 kf(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 W5(){return this.t<=0?0:this.DB*(this.t-1)+kf(this[this.t-1]^this.s&this.DM)}function X5(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 J5(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}function Z5(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,a=Math.floor(e/this.DB),s=this.s<<r&this.DM,u;for(u=this.t-1;u>=0;--u)t[u+a+1]=this[u]>>n|s,s=(this[u]&i)<<r;for(u=a-1;u>=0;--u)t[u]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function Q5(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)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&a)<<i,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&a)<<i),t.t=this.t-r,t.clamp()}function e3(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=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 t3(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<n.t;++i)t[i+r.t]=r.am(0,n[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&ee.ZERO.subTo(t,t)}function r3(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=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 n3(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=gt());var a=gt(),s=this.s,u=e.s,l=this.DB-kf(n[n.t-1]);l>0?(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 E=d*(1<<this.F1)+(f>1?a[f-2]>>this.F2:0),p=this.FV/E,h=(1<<this.F1)/E,A=1<<this.F2,m=r.t,S=m-f,w=t??gt();for(a.dlShiftTo(S,w),r.compareTo(w)>=0&&(r[r.t++]=1,r.subTo(w,r)),ee.ONE.dlShiftTo(f,w),w.subTo(a,a);a.t<f;)a[a.t++]=0;for(;--S>=0;){var y=r[--m]==d?this.DM:Math.floor(r[m]*p+(r[m-1]+A)*h);if((r[m]+=a.am(0,y,r,S,0,f))<y)for(a.dlShiftTo(S,w),r.subTo(w,r);r[m]<--y;)r.subTo(w,r)}t!=null&&(r.drShiftTo(f,t),s!=u&&ee.ZERO.subTo(t,t)),r.t=f,r.clamp(),l>0&&r.rShiftTo(l,r),s<0&&ee.ZERO.subTo(r,r)}}}function i3(e){var t=gt();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 s3(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function a3(e){return e}function o3(e){e.divRemTo(this.m,null,e)}function u3(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function c3(e,t){e.squareTo(t),this.reduce(t)}io.prototype.convert=s3;io.prototype.revert=a3;io.prototype.reduce=o3;io.prototype.mulTo=u3;io.prototype.sqrTo=c3;function l3(){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 so(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function f3(e){var t=gt();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(ee.ZERO)>0&&this.m.subTo(t,t),t}function h3(e){var t=gt();return e.copyTo(t),this.reduce(t),t}function p3(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e[t]&32767,n=r*this.mpl+((r*this.mph+(e[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 d3(e,t){e.squareTo(t),this.reduce(t)}function g3(e,t,r){e.multiplyTo(t,r),this.reduce(r)}so.prototype.convert=f3;so.prototype.revert=h3;so.prototype.reduce=p3;so.prototype.mulTo=g3;so.prototype.sqrTo=d3;function m3(){return(this.t>0?this[0]&1:this.s)==0}function v3(e,t){if(e>4294967295||e<1)return ee.ONE;var r=gt(),n=gt(),i=t.convert(this),a=kf(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function E3(e,t){var r;return e<256||t.isEven()?r=new io(t):r=new so(t),this.exp(e,r)}ee.prototype.copyTo=M5;ee.prototype.fromInt=j5;ee.prototype.fromString=q5;ee.prototype.clamp=K5;ee.prototype.dlShiftTo=X5;ee.prototype.drShiftTo=J5;ee.prototype.lShiftTo=Z5;ee.prototype.rShiftTo=Q5;ee.prototype.subTo=e3;ee.prototype.multiplyTo=t3;ee.prototype.squareTo=r3;ee.prototype.divRemTo=n3;ee.prototype.invDigit=l3;ee.prototype.isEven=m3;ee.prototype.exp=v3;ee.prototype.toString=V5;ee.prototype.negate=G5;ee.prototype.abs=z5;ee.prototype.compareTo=Y5;ee.prototype.bitLength=W5;ee.prototype.mod=i3;ee.prototype.modPowInt=E3;ee.ZERO=ha(0);ee.ONE=ha(1);function w3(){var e=gt();return this.copyTo(e),e}function A3(){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)<<this.DB|this[0]}function y3(){return this.t==0?this.s:this[0]<<24>>24}function S3(){return this.t==0?this.s:this[0]<<16>>16}function b3(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function C3(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function _3(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=ha(r),i=gt(),a=gt(),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 F3(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<e.length;++u){var l=mv(e,u);if(l<0){e.charAt(u)=="-"&&this.signum()==0&&(i=!0);continue}s=t*s+l,++a>=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 I3(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),Ld,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<<i)-1:n[0]=0,this.fromString(n,256)}}function $3(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,n,i=0;if(e-- >0)for(r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<<this.DB-r);e>=0;)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(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 D3(e){return this.compareTo(e)==0}function B3(e){return this.compareTo(e)<0?this:e}function R3(e){return this.compareTo(e)>0?this:e}function P3(e,t,r){var n,i,a=Math.min(e.t,this.t);for(n=0;n<a;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=a;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=a;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function T3(e,t){return e&t}function O3(e){var t=gt();return this.bitwiseTo(e,T3,t),t}function Ld(e,t){return e|t}function x3(e){var t=gt();return this.bitwiseTo(e,Ld,t),t}function vv(e,t){return e^t}function N3(e){var t=gt();return this.bitwiseTo(e,vv,t),t}function Ev(e,t){return e&~t}function k3(e){var t=gt();return this.bitwiseTo(e,Ev,t),t}function L3(){for(var e=gt(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function U3(e){var t=gt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function H3(e){var t=gt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function M3(e){if(e==0)return-1;var t=0;return e&65535||(e>>=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 j3(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+M3(this[e]);return this.s<0?this.t*this.DB:-1}function q3(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function K3(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=q3(this[r]^t);return e}function V3(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function G3(e,t){var r=ee.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function z3(e){return this.changeBit(e,Ld)}function Y3(e){return this.changeBit(e,Ev)}function W3(e){return this.changeBit(e,vv)}function X3(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=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 J3(e){var t=gt();return this.addTo(e,t),t}function Z3(e){var t=gt();return this.subTo(e,t),t}function Q3(e){var t=gt();return this.multiplyTo(e,t),t}function eF(){var e=gt();return this.squareTo(e),e}function tF(e){var t=gt();return this.divRemTo(e,t,null),t}function rF(e){var t=gt();return this.divRemTo(e,null,t),t}function nF(e){var t=gt(),r=gt();return this.divRemTo(e,t,r),new Array(t,r)}function iF(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function sF(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 Mc(){}function wv(e){return e}function aF(e,t,r){e.multiplyTo(t,r)}function oF(e,t){e.squareTo(t)}Mc.prototype.convert=wv;Mc.prototype.revert=wv;Mc.prototype.mulTo=aF;Mc.prototype.sqrTo=oF;function uF(e){return this.exp(e,new Mc)}function cF(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<i;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(i=Math.min(e.t,t);n<i;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}function lF(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function Su(e){this.r2=gt(),this.q3=gt(),ee.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function fF(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=gt();return e.copyTo(t),this.reduce(t),t}function hF(e){return e}function pF(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 dF(e,t){e.squareTo(t),this.reduce(t)}function gF(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Su.prototype.convert=fF;Su.prototype.revert=hF;Su.prototype.reduce=pF;Su.prototype.mulTo=gF;Su.prototype.sqrTo=dF;function mF(e,t){var r=e.bitLength(),n,i=ha(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 Su(t):a=new so(t);var s=new Array,u=3,l=n-1,f=(1<<n)-1;if(s[1]=a.convert(this),n>1){var d=gt();for(a.sqrTo(s[1],d);u<=f;)s[u]=gt(),a.mulTo(d,s[u-2],s[u]),u+=2}var E=e.t-1,p,h=!0,A=gt(),m;for(r=kf(e[E])-1;E>=0;){for(r>=l?p=e[E]>>r-l&f:(p=(e[E]&(1<<r+1)-1)<<l-r,E>0&&(p|=e[E-1]>>this.DB+r-l)),u=n;!(p&1);)p>>=1,--u;if((r-=u)<0&&(r+=this.DB,--E),h)s[p].copyTo(i),h=!1;else{for(;u>1;)a.sqrTo(i,A),a.sqrTo(A,i),u-=2;u>0?a.sqrTo(i,A):(m=i,i=A,A=m),a.mulTo(A,s[p],i)}for(;E>=0&&!(e[E]&1<<r);)a.sqrTo(i,A),m=i,i=A,A=m,--r<0&&(r=this.DB-1,--E)}return a.revert(i)}function vF(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),a=r.getLowestSetBit();if(a<0)return t;for(i<a&&(a=i),a>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 EF(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 wF(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return ee.ZERO;for(var r=e.clone(),n=this.clone(),i=ha(1),a=ha(0),s=ha(0),u=ha(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 pn=[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],AF=(1<<26)/pn[pn.length-1];function yF(e){var t,r=this.abs();if(r.t==1&&r[0]<=pn[pn.length-1]){for(t=0;t<pn.length;++t)if(r[0]==pn[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<pn.length;){for(var n=pn[t],i=t+1;i<pn.length&&n<AF;)n*=pn[i++];for(n=r.modInt(n);t<i;)if(n%pn[t++]==0)return!1}return r.millerRabin(e)}function SF(e){var t=this.subtract(ee.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>pn.length&&(e=pn.length);for(var i=gt(),a=0;a<e;++a){i.fromInt(pn[Math.floor(Math.random()*pn.length)]);var s=i.modPow(n,this);if(s.compareTo(ee.ONE)!=0&&s.compareTo(t)!=0){for(var u=1;u++<r&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(ee.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}ee.prototype.chunkSize=b3;ee.prototype.toRadix=_3;ee.prototype.fromRadix=F3;ee.prototype.fromNumber=I3;ee.prototype.bitwiseTo=P3;ee.prototype.changeBit=G3;ee.prototype.addTo=X3;ee.prototype.dMultiply=iF;ee.prototype.dAddOffset=sF;ee.prototype.multiplyLowerTo=cF;ee.prototype.multiplyUpperTo=lF;ee.prototype.modInt=EF;ee.prototype.millerRabin=SF;ee.prototype.clone=w3;ee.prototype.intValue=A3;ee.prototype.byteValue=y3;ee.prototype.shortValue=S3;ee.prototype.signum=C3;ee.prototype.toByteArray=$3;ee.prototype.equals=D3;ee.prototype.min=B3;ee.prototype.max=R3;ee.prototype.and=O3;ee.prototype.or=x3;ee.prototype.xor=N3;ee.prototype.andNot=k3;ee.prototype.not=L3;ee.prototype.shiftLeft=U3;ee.prototype.shiftRight=H3;ee.prototype.getLowestSetBit=j3;ee.prototype.bitCount=K3;ee.prototype.testBit=V3;ee.prototype.setBit=z3;ee.prototype.clearBit=Y3;ee.prototype.flipBit=W3;ee.prototype.add=J3;ee.prototype.subtract=Z3;ee.prototype.multiply=Q3;ee.prototype.divide=tF;ee.prototype.remainder=rF;ee.prototype.divideAndRemainder=nF;ee.prototype.modPow=mF;ee.prototype.modInverse=wF;ee.prototype.pow=uF;ee.prototype.gcd=vF;ee.prototype.isProbablePrime=yF;ee.prototype.square=eF;function Ud(){this.i=0,this.j=0,this.S=new Array}function bF(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function CF(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}Ud.prototype.init=bF;Ud.prototype.next=CF;function _F(){return new Ud}var Td=256;var Pf,qn,Br;function FF(e){qn[Br++]^=e&255,qn[Br++]^=e>>8&255,qn[Br++]^=e>>16&255,qn[Br++]^=e>>24&255,Br>=Td&&(Br-=Td)}function Hd(){FF(new Date().getTime())}if(qn==null){if(qn=new Array,Br=0,vu!==void 0&&(vu.crypto!==void 0||vu.msCrypto!==void 0)){if(Dd=vu.crypto||vu.msCrypto,Dd.getRandomValues)for(Bd=new Uint8Array(32),Dd.getRandomValues(Bd),ci=0;ci<32;++ci)qn[Br++]=Bd[ci];else if(Uc.appName=="Netscape"&&Uc.appVersion<"5")for(Rd=vu.crypto.random(32),ci=0;ci<Rd.length;++ci)qn[Br++]=Rd.charCodeAt(ci)&255}for(;Br<Td;)ci=Math.floor(65536*Math.random()),qn[Br++]=ci>>>8,qn[Br++]=ci&255;Br=0,Hd()}var ci,Dd,Bd,Rd;function IF(){if(Pf==null){for(Hd(),Pf=_F(),Pf.init(qn),Br=0;Br<qn.length;++Br)qn[Br]=0;Br=0}return Pf.next()}function $F(e){var t;for(t=0;t<e.length;++t)e[t]=IF()}function bu(){}bu.prototype.nextBytes=$F;function Fn(e,t){return new ee(e,t)}function We(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function DF(e,t){if(this.isPublic=!0,this.isPrivate=!1,typeof e!="string")this.n=e,this.e=t;else if(e!=null&&t!=null&&e.length>0&&t.length>0)this.n=Fn(e,16),this.e=parseInt(t,16);else throw"Invalid RSA public key"}function BF(e){return e.modPowInt(this.e,this.n)}We.prototype.doPublic=BF;We.prototype.setPublic=DF;We.prototype.type="RSA";function RF(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=Fn(e,16),this.e=parseInt(t,16),this.d=Fn(r,16);else throw"Invalid RSA private key"}function PF(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=Fn(e,16),this.e=parseInt(t,16),this.d=Fn(r,16),this.p=Fn(n,16),this.q=Fn(i,16),this.dmp1=Fn(a,16),this.dmq1=Fn(s,16),this.coeff=Fn(u,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function TF(e,t){var r=new bu,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()<a||l.compareTo(s)<=0)){var f=this.p.subtract(ee.ONE),d=this.q.subtract(ee.ONE),E=f.multiply(d);if(E.gcd(i).compareTo(ee.ONE)==0&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=i.modInverse(E),this.dmp1=this.d.mod(f),this.dmq1=this.d.mod(d),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0}function OF(e){if(this.p==null||this.q==null)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}We.prototype.doPrivate=OF;We.prototype.setPrivate=RF;We.prototype.setPrivateEx=PF;We.prototype.generate=TF;function wr(e,t){this.x=t,this.q=e}function xF(e){return e==this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function NF(){return this.x}function kF(){return new wr(this.q,this.x.negate().mod(this.q))}function LF(e){return new wr(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function UF(e){return new wr(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function HF(e){return new wr(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function MF(){return new wr(this.q,this.x.square().mod(this.q))}function jF(e){return new wr(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}wr.prototype.equals=xF;wr.prototype.toBigInteger=NF;wr.prototype.negate=kF;wr.prototype.add=LF;wr.prototype.subtract=UF;wr.prototype.multiply=HF;wr.prototype.square=MF;wr.prototype.divide=jF;wr.prototype.sqrt=function(){return new wr(this.q,this.x.sqrt().mod(this.q))};function St(e,t,r,n){this.curve=e,this.x=t,this.y=r,n==null?this.z=ee.ONE:this.z=n,this.zinv=null}function qF(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function KF(){return this.zinv==null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function VF(e){if(e==this)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return this.isInfinity();var t,r;return t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),t.equals(ee.ZERO)?(r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q),r.equals(ee.ZERO)):!1}function GF(){return this.x==null&&this.y==null?!0:this.z.equals(ee.ZERO)&&!this.y.toBigInteger().equals(ee.ZERO)}function zF(){return new St(this.curve,this.x,this.y.negate(),this.z)}function YF(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(ee.ZERO.equals(r))return ee.ZERO.equals(t)?this.twice():this.curve.getInfinity();var n=new ee("3"),i=this.x.toBigInteger(),a=this.y.toBigInteger(),s=e.x.toBigInteger(),u=e.y.toBigInteger(),l=r.square(),f=l.multiply(r),d=i.multiply(l),E=t.square().multiply(this.z),p=E.subtract(d.shiftLeft(1)).multiply(e.z).subtract(f).multiply(r).mod(this.curve.q),h=d.multiply(n).multiply(t).subtract(a.multiply(f)).subtract(E.multiply(t)).multiply(e.z).add(t.multiply(f)).mod(this.curve.q),A=f.multiply(this.z).multiply(e.z).mod(this.curve.q);return new St(this.curve,this.curve.fromBigInteger(p),this.curve.fromBigInteger(h),A)}function WF(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=new ee("3"),t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),a=this.curve.a.toBigInteger(),s=t.square().multiply(e);ee.ZERO.equals(a)||(s=s.add(this.z.square().multiply(a))),s=s.mod(this.curve.q);var u=s.square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),l=s.multiply(e).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),f=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new St(this.curve,this.curve.fromBigInteger(u),this.curve.fromBigInteger(l),f)}function XF(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=this.curve.q.subtract(e),s=a.multiply(new ee("3")),u=new St(this.curve,this.x,this.y),l=u.negate(),f;for(f=r.bitLength()-2;f>0;--f){i=i.twice();var d=r.testBit(f),E=t.testBit(f);d!=E&&(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 JF(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}St.prototype.getX=qF;St.prototype.getY=KF;St.prototype.equals=VF;St.prototype.isInfinity=GF;St.prototype.negate=zF;St.prototype.add=YF;St.prototype.twice=WF;St.prototype.multiply=XF;St.prototype.multiplyTwo=JF;function $s(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new St(this,null,null)}function ZF(){return this.q}function QF(){return this.a}function e8(){return this.b}function t8(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function r8(){return this.infinity}function n8(e){return new wr(this.q,e)}function i8(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 St(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 St(this,this.fromBigInteger(new ee(f,16)),this.fromBigInteger(new ee(d,16)));default:return null}}$s.prototype.getQ=ZF;$s.prototype.getA=QF;$s.prototype.getB=e8;$s.prototype.equals=t8;$s.prototype.getInfinity=r8;$s.prototype.fromBigInteger=n8;$s.prototype.decodePointHex=i8;wr.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};St.prototype.getEncoded=function(e){var t=function(a,s){var u=a.toByteArrayUnsigned();if(s<u.length)u=u.slice(u.length-s);else for(;s>u.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};St.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 St(e,e.fromBigInteger(s),e.fromBigInteger(u))};St.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 St(e,e.fromBigInteger(s),e.fromBigInteger(u))};St.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 St(this.curve,i,a)};St.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 St(this.curve,n,i)};St.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};St.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)};St.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};St.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 Av=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(E,p,h){return p?a[p]:String.fromCharCode(parseInt(h,16))}var u=new String(""),l="\\",f={"{":Object,"[":Array},d=Object.hasOwnProperty;return function(E,p){var h=E.match(n),A,m=h[0],S=!1;m==="{"?A={}:m==="["?A=[]:(A=[],S=!0);for(var w,y=[A],_=1-S,B=h.length;_<B;++_){m=h[_];var D;switch(m.charCodeAt(0)){default:D=y[0],D[w||D.length]=+m,w=void 0;break;case 34:if(m=m.substring(1,m.length-1),m.indexOf(l)!==-1&&(m=m.replace(i,s)),D=y[0],!w)if(D instanceof Array)w=D.length;else{w=m||u;break}D[w]=m,w=void 0;break;case 91:D=y[0],y.unshift(D[w||D.length]=[]),w=void 0;break;case 93:y.shift();break;case 102:D=y[0],D[w||D.length]=!1,w=void 0;break;case 110:D=y[0],D[w||D.length]=null,w=void 0;break;case 116:D=y[0],D[w||D.length]=!0,w=void 0;break;case 123:D=y[0],y.unshift(D[w||D.length]={}),w=void 0;break;case 125:y.shift();break}}if(S){if(y.length!==1)throw new Error;A=A[0]}else if(y.length)throw new Error;if(p){var j=function(q,F){var P=q[F];if(P&&typeof P=="object"){var L=null;for(var M in P)if(d.call(P,M)&&P!==q){var V=j(P,M);V!==void 0?P[M]=V:(L||(L=[]),L.push(M))}if(L)for(var W=L.length;--W>=0;)delete P[L[W]]}return p.call(q,F,P)};A=j({"":A},"")}return A}}();(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});g.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 qc(e)},this.getPEMStringFromHex=function(e,t){return Qr(e,t)},this.newObject=function(e){var t=g,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,E=r.DERUTF8String,p=r.DERNumericString,h=r.DERPrintableString,A=r.DERTeletexString,m=r.DERIA5String,S=r.DERUTCTime,w=r.DERGeneralizedTime,y=r.DERVisibleString,_=r.DERBMPString,B=r.DERSequence,D=r.DERSet,j=r.DERTaggedObject,q=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var F=Object.keys(e);if(F.length!=1)throw new Error("key of param shall be only one.");var P=F[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+P+":")==-1)throw new Error("undefined key: "+P);if(P=="bool")return new i(e[P]);if(P=="int")return new a(e[P]);if(P=="bitstr")return new s(e[P]);if(P=="octstr")return new u(e[P]);if(P=="null")return new l(e[P]);if(P=="oid")return new f(e[P]);if(P=="enum")return new d(e[P]);if(P=="utf8str")return new E(e[P]);if(P=="numstr")return new p(e[P]);if(P=="prnstr")return new h(e[P]);if(P=="telstr")return new A(e[P]);if(P=="ia5str")return new m(e[P]);if(P=="utctime")return new S(e[P]);if(P=="gentime")return new w(e[P]);if(P=="visstr")return new y(e[P]);if(P=="bmpstr")return new _(e[P]);if(P=="asn1")return new n(e[P]);if(P=="seq"){for(var L=e[P],M=[],V=0;V<L.length;V++){var W=q(L[V]);M.push(W)}return new B({array:M})}if(P=="set"){for(var L=e[P],M=[],V=0;V<L.length;V++){var W=q(L[V]);M.push(W)}return new D({array:M})}if(P=="tag"){var G=e[P];if(Object.prototype.toString.call(G)==="[object Array]"&&G.length==3){var z=q(G[2]);return new j({tag:G[0],explicit:G[1],obj:z})}else return new j(G)}},this.jsonToASN1HEX=function(e){var t=this.newObject(e);return t.tohex()}};g.asn1.ASN1Util.oidHexToInt=function(e){for(var i="",t=parseInt(e.substr(0,2),16),r=Math.floor(t/40),n=t%40,i=r+"."+n,a="",s=2;s<e.length;s+=2){var u=parseInt(e.substr(s,2),16),l=("00000000"+u.toString(2)).slice(-8);if(a=a+l.substr(1,7),l.substr(0,1)=="0"){var f=new ee(a,2);i=i+"."+f.toString(10),a=""}}return i};g.asn1.ASN1Util.oidIntToHex=function(e){var t=function(u){var l=u.toString(16);return l.length==1&&(l="0"+l),l},r=function(u){var l="",f=new ee(u,10),d=f.toString(2),E=7-d.length%7;E==7&&(E=0);for(var p="",h=0;h<E;h++)p+="0";d=p+d;for(var h=0;h<d.length-1;h+=7){var A=d.substr(h,7);h!=d.length-7&&(A="1"+A),l+=t(parseInt(A,2))}return l};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),a=parseInt(i[0])*40+parseInt(i[1]);n+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n};g.asn1.ASN1Object=function(e){var t=!0,r=null,n="00",i="00",a="";this.params=null,this.getLengthHexFromValue=function(){if(typeof this.hV>"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)};g.asn1.DERAbstractString=function(e){g.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=Uf(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))};he(g.asn1.DERAbstractString,g.asn1.ASN1Object);g.asn1.DERAbstractTime=function(e){g.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),E=s(String(u.getHours()),2),p=s(String(u.getMinutes()),2),h=s(String(u.getSeconds()),2),A=l+f+d+E+p+h;if(a===!0){var m=u.getMilliseconds();if(m!=0){var S=s(String(m),3);S=S.replace(/[0]+$/,""),A=A+"."+S}}return A+"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}};he(g.asn1.DERAbstractTime,g.asn1.ASN1Object);g.asn1.DERAbstractStructured=function(e){g.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)};he(g.asn1.DERAbstractStructured,g.asn1.ASN1Object);g.asn1.DERBoolean=function(e){g.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",e==!1?this.hTLV="010100":this.hTLV="0101ff"};he(g.asn1.DERBoolean,g.asn1.ASN1Object);g.asn1.DERInteger=function(e){g.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=qc;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)};he(g.asn1.DERInteger,g.asn1.ASN1Object);g.asn1.DERBitString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=g.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}g.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<r)throw"unused bits shall be from 0 to 7: u = "+r;var i="0"+r;this.hTLV=null,this.isModified=!0,this.hV=i+n},this.setByBinaryString=function(r){r=r.replace(/0+$/,"");var n=8-r.length%8;n==8&&(n=0),r+="0000000".substr(0,n);for(var i="",a=0;a<r.length-1;a+=8){var s=r.substr(a,8),u=parseInt(s,2).toString(16);u.length==1&&(u="0"+u),i+=u}this.hTLV=null,this.isModified=!0,this.hV="0"+n+i},this.setByBooleanArray=function(r){for(var n="",i=0;i<r.length;i++)r[i]==!0?n+="1":n+="0";this.setByBinaryString(n)},this.newFalseArray=function(r){for(var n=new Array(r),i=0;i<r;i++)n[i]=!1;return n},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e=="string"&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):typeof e.hex<"u"?this.setHexValueIncludingUnusedBits(e.hex):typeof e.bin<"u"?this.setByBinaryString(e.bin):typeof e.array<"u"&&this.setByBooleanArray(e.array))};he(g.asn1.DERBitString,g.asn1.ASN1Object);g.asn1.DEROctetString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=g.asn1.ASN1Util.newObject(e.obj);e.hex=t.tohex()}g.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"};he(g.asn1.DEROctetString,g.asn1.DERAbstractString);g.asn1.DERNull=function(){g.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};he(g.asn1.DERNull,g.asn1.ASN1Object);g.asn1.DERObjectIdentifier=function(e){g.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var r=Iv(t);if(r==null)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var r=g.asn1.x509.OID.name2oid(t);if(r!=="")this.setValueOidString(r);else throw new Error("DERObjectIdentifier oidName undefined: "+t)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){typeof t=="string"?this.setValueNameOrOid(t):t.oid!==void 0?this.setValueNameOrOid(t.oid):t.name!==void 0?this.setValueNameOrOid(t.name):t.hex!==void 0&&this.setValueHex(t.hex)},e!==void 0&&this.setByParam(e)};he(g.asn1.DERObjectIdentifier,g.asn1.ASN1Object);g.asn1.DEREnumerated=function(e){g.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=qc(t)},this.setByInteger=function(t){var r=new ee(String(t),10);this.setByBigInteger(r)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},typeof e<"u"&&(typeof e.int<"u"?this.setByInteger(e.int):typeof e=="number"?this.setByInteger(e):typeof e.hex<"u"&&this.setValueHex(e.hex))};he(g.asn1.DEREnumerated,g.asn1.ASN1Object);g.asn1.DERUTF8String=function(e){g.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"};he(g.asn1.DERUTF8String,g.asn1.DERAbstractString);g.asn1.DERNumericString=function(e){g.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"};he(g.asn1.DERNumericString,g.asn1.DERAbstractString);g.asn1.DERPrintableString=function(e){g.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"};he(g.asn1.DERPrintableString,g.asn1.DERAbstractString);g.asn1.DERTeletexString=function(e){g.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"};he(g.asn1.DERTeletexString,g.asn1.DERAbstractString);g.asn1.DERIA5String=function(e){g.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"};he(g.asn1.DERIA5String,g.asn1.DERAbstractString);g.asn1.DERVisibleString=function(e){g.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"};he(g.asn1.DERVisibleString,g.asn1.DERAbstractString);g.asn1.DERBMPString=function(e){g.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"};he(g.asn1.DERBMPString,g.asn1.DERAbstractString);g.asn1.DERUTCTime=function(e){g.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var t=this.params;if(this.params==null&&(t={date:new Date}),typeof t=="string")if(t.match(/^[0-9]{12}Z$/)||t.match(/^[0-9]{12}\.[0-9]+Z$/))this.hV=In(t);else throw new Error("malformed string for UTCTime: "+t);else if(t.str!=null)this.hV=In(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=In(this.formatDate(r,"utc",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=In(this.formatDate(t.date,"utc",n))}else t instanceof Date&&(this.hV=In(this.formatDate(t,"utc")));if(this.hV==null)throw new Error("parameter not specified properly for UTCTime");return this.hV},e!=null&&this.setByParam(e)};he(g.asn1.DERUTCTime,g.asn1.DERAbstractTime);g.asn1.DERGeneralizedTime=function(e){g.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.params=e,this.getFreshValueHex=function(){var t=this.params;if(this.params==null&&(t={date:new Date}),typeof t=="string")if(t.match(/^[0-9]{14}Z$/)||t.match(/^[0-9]{14}\.[0-9]+Z$/))this.hV=In(t);else throw new Error("malformed string for GeneralizedTime: "+t);else if(t.str!=null)this.hV=In(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=In(this.formatDate(r,"gen",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=In(this.formatDate(t.date,"gen",n))}else t instanceof Date&&(this.hV=In(this.formatDate(t,"gen")));if(this.hV==null)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},e!=null&&this.setByParam(e)};he(g.asn1.DERGeneralizedTime,g.asn1.DERAbstractTime);g.asn1.DERSequence=function(e){g.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var t="",r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];t+=n.tohex()}return this.hV=t,this.hV}};he(g.asn1.DERSequence,g.asn1.DERAbstractStructured);g.asn1.DERSet=function(e){g.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,r=0;r<this.asn1Array.length;r++){var n=this.asn1Array[r];t.push(n.tohex())}return this.sortFlag==!0&&t.sort(),this.hV=t.join(""),this.hV},typeof e<"u"&&typeof e.sortflag<"u"&&e.sortflag==!1&&(this.sortFlag=!1)};he(g.asn1.DERSet,g.asn1.DERAbstractStructured);g.asn1.DERTaggedObject=function(e){g.asn1.DERTaggedObject.superclass.constructor.call(this);var t=g.asn1,r=Ae,n=r.getV,i=r.isASN1HEX,a=t.ASN1Util.newObject;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(s,u,l){this.params={tag:u,explicit:s,obj:l}},this.getFreshValueHex=function(){var s=this.params;if(s.explicit==null&&(s.explicit=!0),s.tage!=null&&(s.tag=s.tage,s.explicit=!0),s.tagi!=null&&(s.tag=s.tagi,s.explicit=!1),s.str!=null)this.hV=Uf(s.str);else if(s.hex!=null)this.hV=s.hex;else if(s.obj!=null){var u;s.obj instanceof t.ASN1Object?u=s.obj.tohex():typeof s.obj=="object"&&(u=a(s.obj).tohex()),s.explicit?this.hV=u:this.hV=n(u,0)}else throw new Error("str, hex nor obj not specified");return s.tag==null&&(s.tag="a0"),this.hT=s.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(s){this.params=s},e!==void 0&&this.setByParam(e)};he(g.asn1.DERTaggedObject,g.asn1.ASN1Object);var Ae=new function(){};Ae.getLblen=function(e,t){if(e.substr(t+2,1)!="8")return 1;var r=parseInt(e.substr(t+3,1));return r==0?-1:0<r&&r<10?r+1:-2};Ae.getL=function(e,t){var r=Ae.getLblen(e,t);return r<1?"":e.substr(t+2,r*2)};Ae.getVblen=function(e,t){var r,n;return r=Ae.getL(e,t),r==""?-1:(r.substr(0,1)==="8"?n=new ee(r.substr(2),16):n=new ee(r,16),n.intValue())};Ae.getVidx=function(e,t){var r=Ae.getLblen(e,t);return r<0?r:t+(r+1)*2};Ae.getV=function(e,t){var r=Ae.getVidx(e,t),n=Ae.getVblen(e,t);return e.substr(r,n*2)};Ae.getTLV=function(e,t){return e.substr(t,2)+Ae.getL(e,t)+Ae.getV(e,t)};Ae.getTLVblen=function(e,t){return 2+Ae.getLblen(e,t)*2+Ae.getVblen(e,t)*2};Ae.getNextSiblingIdx=function(e,t){var r=Ae.getVidx(e,t),n=Ae.getVblen(e,t);return r+n*2};Ae.getChildIdx=function(e,t){var r=Ae,n=[],i,a,s;i=r.getVidx(e,t),a=r.getVblen(e,t)*2,e.substr(t,2)=="03"&&(i+=2,a-=2),s=0;for(var u=i;s<=a;){var l=r.getTLVblen(e,u);if(s+=l,s<=a&&n.push(u),u+=l,s>=a)break}return n};Ae.getNthChildIdx=function(e,t,r){var n=Ae.getChildIdx(e,t);return n[r]};Ae.getIdxbyList=function(e,t,r,n){var i=Ae,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))};Ae.getIdxbyListEx=function(e,t,r,n){var i=Ae,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<s.length;l++){var f=e.substr(s[l],2);if(typeof a=="number"&&!i.isContextTag(f)&&u==a||typeof a=="string"&&i.isContextTag(f,a))return i.getIdxbyListEx(e,s[l],r,n);i.isContextTag(f)||u++}return-1};Ae.getTLVbyList=function(e,t,r,n){var i=Ae,a=i.getIdxbyList(e,t,r,n);return a==-1||a>=e.length?null:i.getTLV(e,a)};Ae.getTLVbyListEx=function(e,t,r,n){var i=Ae,a=i.getIdxbyListEx(e,t,r,n);return a==-1?null:i.getTLV(e,a)};Ae.getVbyList=function(e,t,r,n,i){var a=Ae,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)};Ae.getVbyListEx=function(e,t,r,n,i){var a=Ae,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)};Ae.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=Ae.getV(e,t);return n=="02"?parseInt(i,16):Dv(i)}catch{return r}};Ae.getOID=function(e,t,r){r==null&&(r=null);try{if(e.substr(t,2)!="06")return r;var n=Ae.getV(e,t);return Kf(n)}catch{return r}};Ae.getOIDName=function(e,t,r){r==null&&(r=null);try{var n=Ae.getOID(e,t,r);if(n==r)return r;var i=g.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};Ae.getString=function(e,t,r){r==null&&(r=null);try{var n=Ae.getV(e,t);return $n(n)}catch{return r}};Ae.hextooidstr=function(e){var t=function(E,p){return E.length>=p?E:new Array(p-E.length+1).join("0")+E},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;u<a.length/2;u++)s.push(parseInt(a.substr(u*2,2),16));for(var l=[],f="",u=0;u<s.length;u++)s[u]&128?f=f+t((s[u]&127).toString(2),7):(f=f+t((s[u]&127).toString(2),7),l.push(new String(parseInt(f,2))),f="");var d=r.join(".");return l.length>0&&(d=d+"."+l.join(".")),d};Ae.dump=function(e,t,r,n){var i=Ae,a=i.getV,s=i.dump,u=i.getChildIdx,l=e;e instanceof g.asn1.ASN1Object&&(l=e.tohex());var f=function(q,F){if(q.length<=F*2)return q;var P=q.substr(0,F)+"..(total "+q.length/2+"bytes).."+q.substr(q.length-F,F);return P};t===void 0&&(t={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var d=t.ommit_long_octet,D=l.substr(r,2);if(D=="01"){var E=a(l,r);return E=="00"?n+`BOOLEAN FALSE
`:n+`BOOLEAN TRUE
`}if(D=="02"){var E=a(l,r);return n+"INTEGER "+f(E,d)+`
`}if(D=="03"){var E=a(l,r);if(i.isASN1HEX(E.substr(2))){var p=n+`BITSTRING, encapsulates
`;return p=p+s(E.substr(2),t,0,n+" "),p}else return n+"BITSTRING "+f(E,d)+`
`}if(D=="04"){var E=a(l,r);if(i.isASN1HEX(E)){var p=n+`OCTETSTRING, encapsulates
`;return p=p+s(E,t,0,n+" "),p}else return n+"OCTETSTRING "+f(E,d)+`
`}if(D=="05")return n+`NULL
`;if(D=="06"){var h=a(l,r),A=g.asn1.ASN1Util.oidHexToInt(h),m=g.asn1.x509.OID.oid2name(A),S=A.replace(/\./g," ");return m!=""?n+"ObjectIdentifier "+m+" ("+S+`)
`:n+"ObjectIdentifier ("+S+`)
`}if(D=="0a")return n+"ENUMERATED "+parseInt(a(l,r))+`
`;if(D=="0c")return n+"UTF8String '"+Rt(a(l,r))+`'
`;if(D=="13")return n+"PrintableString '"+Rt(a(l,r))+`'
`;if(D=="14")return n+"TeletexString '"+Rt(a(l,r))+`'
`;if(D=="16")return n+"IA5String '"+Rt(a(l,r))+`'
`;if(D=="17")return n+"UTCTime "+Rt(a(l,r))+`
`;if(D=="18")return n+"GeneralizedTime "+Rt(a(l,r))+`
`;if(D=="1a")return n+"VisualString '"+Rt(a(l,r))+`'
`;if(D=="1e")return n+"BMPString '"+Kd(a(l,r))+`'
`;if(D=="30"){if(l.substr(r,4)=="3000")return n+`SEQUENCE {}
`;var p=n+`SEQUENCE
`,w=u(l,r),y=t;if((w.length==2||w.length==3)&&l.substr(w[0],2)=="06"&&l.substr(w[w.length-1],2)=="04"){var m=i.oidname(a(l,w[0])),_=JSON.parse(JSON.stringify(t));_.x509ExtName=m,y=_}for(var B=0;B<w.length;B++)p=p+s(l,y,w[B],n+" ");return p}if(D=="31"){for(var p=n+`SET
`,w=u(l,r),B=0;B<w.length;B++)p=p+s(l,t,w[B],n+" ");return p}var D=parseInt(D,16);if(D&128){var j=D&31;if(D&32){for(var p=n+"["+j+`]
`,w=u(l,r),B=0;B<w.length;B++)p=p+s(l,t,w[B],n+" ");return p}else{var E=a(l,r);if(Ae.isASN1HEX(E)){var p=n+"["+j+`]
`;return p=p+s(E,t,0,n+" "),p}else(E.substr(0,8)=="68747470"||t.x509ExtName==="subjectAltName"&&j==2)&&(E=Rt(E));var p=n+"["+j+"] "+E+`
`;return p}}return n+"UNKNOWN("+D+") "+a(l,r)+`
`};Ae.parse=function(e){var t=Ae,r=t.parse,n=t.isASN1HEX,i=t.getV,a=t.getTLV,s=t.getChildIdx,u=g.asn1,l=u.ASN1Util.oidHexToInt,f=u.x509.OID.oid2name,d=Rt,E=Kd,p=l8,h={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},A=function(P){for(var L=[],M=s(P,0),V=0;V<M.length;V++){var W=M[V],G=a(P,W),z=r(G);L.push(z)}return L},m=e.substr(0,2),S={},w=i(e,0);if(m=="01")return e=="0101ff"?{bool:!0}:{bool:!1};if(m=="02")return{int:{hex:w}};if(m=="03")try{if(w.substr(0,2)!="00")throw"not encap";var y=w.substr(2);if(!n(y))throw"not encap";return{bitstr:{obj:r(y)}}}catch{var _=null;return w.length<=10&&(_=Rv(w)),_==null?{bitstr:{hex:w}}:{bitstr:{bin:_}}}else if(m=="04")try{if(!n(w))throw"not encap";return{octstr:{obj:r(w)}}}catch{return{octstr:{hex:w}}}else{if(m=="05")return{null:""};if(m=="06"){var B=l(w),D=f(B);return D==""?{oid:B}:{oid:D}}else{if(m=="0a")return w.length>4?{enum:{hex:w}}:{enum:parseInt(w,16)};if(m=="30"||m=="31")return S[h[m]]=A(e),S;if(m=="14"){var j=p(w);return S[h[m]]={str:j},S}else if(m=="1e"){var j=E(w);return S[h[m]]={str:j},S}else if(":0c:12:13:16:17:18:1a:".indexOf(m)!=-1){var j=d(w);return S[h[m]]={str:j},S}else if(m.match(/^8[0-9]$/)){var j=d(w);return j==null|j==""?{tag:{tag:m,explicit:!1,hex:w}}:j.match(/[\x00-\x1F\x7F-\x9F]/)!=null||j.match(/[\u0000-\u001F\u0080\u009F]/)!=null?{tag:{tag:m,explicit:!1,hex:w}}:{tag:{tag:m,explicit:!1,str:j}}}else if(m.match(/^a[0-9]$/))try{if(!n(w))throw new Error("not encap");return{tag:{tag:m,explicit:!0,obj:r(w)}}}catch{return{tag:{tag:m,explicit:!0,hex:w}}}else{var q=new g.asn1.ASN1Object;q.hV=w;var F=q.getLengthHexFromValue();return{asn1:{tlv:m+F+w}}}}}};Ae.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}};Ae.isASN1HEX=function(e){var t=Ae;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};Ae.checkStrictDER=function(e,t,r,n,i){var a=Ae;if(r===void 0){if(typeof e!="string")throw new Error("not hex string");if(e=e.toLowerCase(),!g.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 E=a.getVidx(e,t);if(e.substr(E,2)=="00"&&e.charCodeAt(E+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,A=a.getChildIdx(e,t),m=0;m<A.length;m++){var S=a.getTLV(e,A[m]);h+=S.length,a.checkStrictDER(e,A[m],r,n,i)}if(p*2!=h)throw new Error("sum of children's TLV length and L unmatch: "+p*2+"!="+h)}};Ae.oidname=function(e){var t=g.asn1;g.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var r=t.x509.OID.oid2name(e);return r===""&&(r=e),r};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.x509>"u"||!g.asn1.x509)&&(g.asn1.x509={});g.asn1.x509.Certificate=function(e){g.asn1.x509.Certificate.superclass.constructor.call(this);var t=g,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(),E=new g.crypto.Signature({alg:f});E.init(l.cakey),E.updateHex(d),l.sighex=E.sign()},this.getPEM=function(){return Qr(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)};he(g.asn1.x509.Certificate,g.asn1.ASN1Object);g.asn1.x509.TBSCertificate=function(e){g.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=g,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,E=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 A=2;h.version!=null&&(A=h.version-1);var m=new i({obj:new a({int:A})});p.push(m)}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 E(ct.getKey(h.sbjpubkey))),h.ext!==void 0&&h.ext.length>0&&p.push(new i({tag:"a3",obj:new d(h.ext)}));var S=new g.asn1.DERSequence({array:p});return S.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.TBSCertificate,g.asn1.ASN1Object);g.asn1.x509.Extensions=function(e){g.asn1.x509.Extensions.superclass.constructor.call(this);var t=g,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<this.aParam.length;s++){var u=this.aParam[s],l=u.extname,f=null;if(u.extn!=null)f=new i.PrivateExtension(u);else if(l=="subjectKeyIdentifier")f=new i.SubjectKeyIdentifier(u);else if(l=="keyUsage")f=new i.KeyUsage(u);else if(l=="subjectAltName")f=new i.SubjectAltName(u);else if(l=="issuerAltName")f=new i.IssuerAltName(u);else if(l=="basicConstraints")f=new i.BasicConstraints(u);else if(l=="nameConstraints")f=new i.NameConstraints(u);else if(l=="cRLDistributionPoints")f=new i.CRLDistributionPoints(u);else if(l=="certificatePolicies")f=new i.CertificatePolicies(u);else if(l=="policyMappings")f=new i.PolicyMappings(u);else if(l=="policyConstraints")f=new i.PolicyConstraints(u);else if(l=="inhibitAnyPolicy")f=new i.InhibitAnyPolicy(u);else if(l=="authorityKeyIdentifier")f=new i.AuthorityKeyIdentifier(u);else if(l=="extKeyUsage")f=new i.ExtKeyUsage(u);else if(l=="authorityInfoAccess")f=new i.AuthorityInfoAccess(u);else if(l=="cRLNumber")f=new i.CRLNumber(u);else if(l=="cRLReason")f=new i.CRLReason(u);else if(l=="ocspNonce")f=new i.OCSPNonce(u);else if(l=="ocspNoCheck")f=new i.OCSPNoCheck(u);else if(l=="adobeTimeStamp")f=new i.AdobeTimeStamp(u);else if(l=="subjectDirectoryAttributes")f=new i.SubjectDirectoryAttributes(u);else throw new Error("extension not supported:"+JSON.stringify(u));f!=null&&a.push(f)}var d=new n({array:a});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.x509.Extensions,g.asn1.ASN1Object);g.asn1.x509.Extension=function(e){g.asn1.x509.Extension.superclass.constructor.call(this);var t=null,r=g,n=r.asn1,i=n.DERObjectIdentifier,a=n.DEROctetString,s=n.DERBitString,u=n.DERBoolean,l=n.DERSequence;this.tohex=function(){var f=new i({oid:this.oid}),d=new a({hex:this.getExtnValueHex()}),E=new Array;E.push(f),this.critical&&E.push(new u),E.push(d);var p=new l({array:E});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,e!==void 0&&e.critical!==void 0&&(this.critical=e.critical)};he(g.asn1.x509.Extension,g.asn1.ASN1Object);g.asn1.x509.KeyUsage=function(e){g.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Error,r={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var n=this.getBinValue();return this.asn1ExtnValue=new g.asn1.DERBitString({bin:n}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var n=this.params;if(typeof n!="object"||typeof n.names!="object"&&typeof n.bin!="string")throw new t("parameter not yet set");if(n.names!=null)return xf(n.names,r);if(n.bin!=null)return n.bin;throw new t("parameter not set properly")},this.oid="2.5.29.15",e!==void 0&&(this.params=e)};he(g.asn1.x509.KeyUsage,g.asn1.x509.Extension);g.asn1.x509.BasicConstraints=function(e){g.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=g.asn1,r=t.DERBoolean,n=t.DERInteger,i=t.DERSequence,a=!1,s=-1;this.getExtnValueHex=function(){var u=new Array;this.cA&&u.push(new r),this.pathLen>-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))};he(g.asn1.x509.BasicConstraints,g.asn1.x509.Extension);g.asn1.x509.CRLDistributionPoints=function(e){g.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var a=[],s=0;s<i.length;s++)if(i[s]instanceof g.asn1.ASN1Object)a.push(i[s]);else{var u=new n.DistributionPoint(i[s]);a.push(u)}this.asn1ExtnValue=new r.DERSequence({array:a})},this.setByOneURI=function(i){var a=new n.DistributionPoint({fulluri:i});this.setByDPArray([a])},this.oid="2.5.29.31",e!==void 0&&(e.array!==void 0?this.setByDPArray(e.array):e.uri!==void 0&&this.setByOneURI(e.uri))};he(g.asn1.x509.CRLDistributionPoints,g.asn1.x509.Extension);g.asn1.x509.DistributionPoint=function(e){g.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=null,r=g,n=r.asn1,i=n.x509.DistributionPointName;this.tohex=function(){var a=new n.DERSequence;if(this.asn1DP!=null){var s=new n.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});a.appendASN1Object(s)}return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(e.dpobj!==void 0?this.asn1DP=e.dpobj:e.dpname!==void 0?this.asn1DP=new i(e.dpname):e.fulluri!==void 0&&(this.asn1DP=new i({full:[{uri:e.fulluri}]})))};he(g.asn1.x509.DistributionPoint,g.asn1.ASN1Object);g.asn1.x509.DistributionPointName=function(e){g.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=null,r=null,n=null,i=null,a=g,s=a.asn1,u=s.DERTaggedObject;if(this.tohex=function(){if(this.type!="full")throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new u({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0)if(s.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else if(e.full!==void 0)this.type="full",this.tag="a0",this.asn1V=new s.x509.GeneralNames(e.full);else throw new Error("This class supports GeneralNames only as argument")};he(g.asn1.x509.DistributionPointName,g.asn1.ASN1Object);g.asn1.x509.CertificatePolicies=function(e){g.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.DERSequence,a=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var s=[],u=0;u<this.params.array.length;u++)s.push(new a(this.params.array[u]));var l=new i({array:s});return this.asn1ExtnValue=l,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",e!==void 0&&(this.params=e)};he(g.asn1.x509.CertificatePolicies,g.asn1.x509.Extension);g.asn1.x509.PolicyInformation=function(e){g.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=g.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,i=t.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(this.params.policyoid===void 0&&this.params.array===void 0)throw new Error("parameter oid and array missing");var a=[new n(this.params.policyoid)];if(this.params.array!==void 0){for(var s=[],u=0;u<this.params.array.length;u++)s.push(new i(this.params.array[u]));s.length>0&&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)};he(g.asn1.x509.PolicyInformation,g.asn1.ASN1Object);g.asn1.x509.PolicyQualifierInfo=function(e){g.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=g.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)};he(g.asn1.x509.PolicyQualifierInfo,g.asn1.ASN1Object);g.asn1.x509.UserNotice=function(e){g.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=g.asn1.DERSequence,r=g.asn1.DERInteger,n=g.asn1.x509.DisplayText,i=g.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)};he(g.asn1.x509.UserNotice,g.asn1.ASN1Object);g.asn1.x509.NoticeReference=function(e){g.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=g.asn1.DERSequence,r=g.asn1.DERInteger,n=g.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;u<s.length;u++)a.push(new r(s[u]));i.push(new t({array:a}))}if(i.length==0)throw new Error("parameter is empty");var l=new t({array:i});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};he(g.asn1.x509.NoticeReference,g.asn1.ASN1Object);g.asn1.x509.DisplayText=function(e){g.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",e!==void 0&&(e.type==="ia5"?this.hT="16":e.type==="vis"?this.hT="1a":e.type==="bmp"&&(this.hT="1e"))};he(g.asn1.x509.DisplayText,g.asn1.DERAbstractString);g.asn1.x509.PolicyMappings=function(e){g.asn1.x509.PolicyMappings.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){for(var a=this.params,s=[],u=0;u<a.array.length;u++){var l=a.array[u];s.push({seq:[{oid:l[0]},{oid:l[1]}]})}return this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",e!==void 0&&(this.params=e)};he(g.asn1.x509.PolicyMappings,g.asn1.x509.Extension);g.asn1.x509.PolicyConstraints=function(e){g.asn1.x509.PolicyConstraints.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){var a=this.params,s=[];return a.reqexp!=null&&s.push({tag:{tagi:"80",obj:{int:a.reqexp}}}),a.inhibit!=null&&s.push({tag:{tagi:"81",obj:{int:a.inhibit}}}),this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",e!==void 0&&(this.params=e)};he(g.asn1.x509.PolicyConstraints,g.asn1.x509.Extension);g.asn1.x509.InhibitAnyPolicy=function(e){g.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=i({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",e!==void 0&&(this.params=e)};he(g.asn1.x509.InhibitAnyPolicy,g.asn1.x509.Extension);g.asn1.x509.NameConstraints=function(e){g.asn1.x509.NameConstraints.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject,a=n.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var s=this.params,u=[];if(s.permit!=null&&s.permit.length!=null){for(var l=[],f=0;f<s.permit.length;f++)l.push(new a(s.permit[f]));u.push({tag:{tagi:"a0",obj:{seq:l}}})}if(s.exclude!=null&&s.exclude.length!=null){for(var d=[],f=0;f<s.exclude.length;f++)d.push(new a(s.exclude[f]));u.push({tag:{tagi:"a1",obj:{seq:d}}})}return this.asn1ExtnValue=i({seq:u}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",e!==void 0&&(this.params=e)};he(g.asn1.x509.NameConstraints,g.asn1.x509.Extension);g.asn1.x509.GeneralSubtree=function(e){g.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var t=g.asn1,r=t.x509,n=r.GeneralName,i=t.ASN1Util.newObject;this.params=null,this.setByParam=function(a){this.params=a},this.tohex=function(){var a=this.params,s=[new n(a)];a.min!=null&&s.push({tag:{tagi:"80",obj:{int:a.min}}}),a.max!=null&&s.push({tag:{tagi:"81",obj:{int:a.max}}});var u=i({seq:s});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.GeneralSubtree,g.asn1.ASN1Object);g.asn1.x509.ExtKeyUsage=function(e){g.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=g,r=t.asn1;this.setPurposeArray=function(n){this.asn1ExtnValue=new r.DERSequence;for(var i=0;i<n.length;i++){var a=new r.DERObjectIdentifier(n[i]);this.asn1ExtnValue.appendASN1Object(a)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",e!==void 0&&e.array!==void 0&&this.setPurposeArray(e.array)};he(g.asn1.x509.ExtKeyUsage,g.asn1.x509.Extension);g.asn1.x509.AuthorityKeyIdentifier=function(e){g.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.DERTaggedObject,i=r.x509.GeneralNames,a=t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var s=new Array;this.asn1KID&&s.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&s.push(new n({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&s.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var u=new r.DERSequence({array:s});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(s){if(s.str!==void 0||s.hex!==void 0)this.asn1KID=new g.asn1.DEROctetString(s);else if(typeof s=="object"&&g.crypto.Util.isKey(s)||typeof s=="string"&&s.indexOf("BEGIN ")!=-1){var u=s;typeof s=="string"&&(u=ct.getKey(s));var l=ct.getKeyID(u);this.asn1KID=new g.asn1.DEROctetString({hex:l})}},this.setCertIssuerByParam=function(s){s.str!==void 0||s.ldapstr!==void 0||s.hex!==void 0||s.certsubject!==void 0||s.certissuer!==void 0?this.asn1CertIssuer=new g.asn1.x509.X500Name(s):typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")!=-1&&(this.asn1CertIssuer=new g.asn1.x509.X500Name({certissuer:s}))},this.setCertSNByParam=function(s){if(s.str!==void 0||s.bigint!==void 0||s.hex!==void 0)this.asn1CertSN=new g.asn1.DERInteger(s);else if(typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")){var u=new je;u.readCertPEM(s);var l=u.getSerialNumberHex();this.asn1CertSN=new g.asn1.DERInteger({hex:l})}},this.oid="2.5.29.35",e!==void 0&&(e.kid!==void 0&&this.setKIDByParam(e.kid),e.issuer!==void 0&&this.setCertIssuerByParam(e.issuer),e.sn!==void 0&&this.setCertSNByParam(e.sn),e.issuersn!==void 0&&typeof e.issuersn=="string"&&e.issuersn.indexOf("BEGIN ")!=-1&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))};he(g.asn1.x509.AuthorityKeyIdentifier,g.asn1.x509.Extension);g.asn1.x509.SubjectKeyIdentifier=function(e){g.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(i){if(i.str!==void 0||i.hex!==void 0)this.asn1KID=new n(i);else if(typeof i=="object"&&g.crypto.Util.isKey(i)||typeof i=="string"&&i.indexOf("BEGIN")!=-1){var a=i;typeof i=="string"&&(a=ct.getKey(i));var s=ct.getKeyID(a);this.asn1KID=new g.asn1.DEROctetString({hex:s})}},this.oid="2.5.29.14",e!==void 0&&e.kid!==void 0&&this.setKIDByParam(e.kid)};he(g.asn1.x509.SubjectKeyIdentifier,g.asn1.x509.Extension);g.asn1.x509.AuthorityInfoAccess=function(e){g.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(t){for(var r=new Array,n=g,i=n.asn1,a=i.DERSequence,s=i.DERObjectIdentifier,u=i.x509.GeneralName,l=0;l<t.length;l++){var f,d=t[l];if(d.ocsp!==void 0)f=new a({array:[new s({oid:"1.3.6.1.5.5.7.48.1"}),new u({uri:d.ocsp})]});else if(d.caissuer!==void 0)f=new a({array:[new s({oid:"1.3.6.1.5.5.7.48.2"}),new u({uri:d.caissuer})]});else throw new Error("unknown AccessMethod parameter: "+JSON.stringify(d));r.push(f)}this.asn1ExtnValue=new a({array:r})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",e!==void 0&&e.array!==void 0&&this.setAccessDescriptionArray(e.array)};he(g.asn1.x509.AuthorityInfoAccess,g.asn1.x509.Extension);g.asn1.x509.SubjectAltName=function(e){g.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new g.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",e!==void 0&&e.array!==void 0&&this.setNameArray(e.array)};he(g.asn1.x509.SubjectAltName,g.asn1.x509.Extension);g.asn1.x509.IssuerAltName=function(e){g.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new g.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",e!==void 0&&e.array!==void 0&&this.setNameArray(e.array)};he(g.asn1.x509.IssuerAltName,g.asn1.x509.Extension);g.asn1.x509.SubjectDirectoryAttributes=function(e){g.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=g.asn1,r=t.DERSequence,n=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var a=[],s=0;s<this.params.array.length;s++){var u=this.params.array[s];if(u.attr!=null&&u.array!=null){var l={seq:[{oid:u.attr},{set:u.array}]};a.push(n(l));continue}var f={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if(u.attr=="dateOfBirth")f.seq[0].oid=i(u.attr),f.seq[1].set[0]={gentime:u.str};else if(u.attr=="placeOfBirth")f.seq[0].oid=i(u.attr),f.seq[1].set[0]={utf8str:u.str};else if(u.attr=="gender")f.seq[0].oid=i(u.attr),f.seq[1].set[0]={prnstr:u.str};else if(u.attr=="countryOfCitizenship")f.seq[0].oid=i(u.attr),f.seq[1].set[0]={prnstr:u.str};else if(u.attr=="countryOfResidence")f.seq[0].oid=i(u.attr),f.seq[1].set[0]={prnstr:u.str};else throw new Error("unsupported attribute: "+u.attr);a.push(new n(f))}var d=new r({array:a});return this.asn1ExtnValue=d,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",e!==void 0&&(this.params=e)};he(g.asn1.x509.SubjectDirectoryAttributes,g.asn1.x509.Extension);g.asn1.x509.PrivateExtension=function(e){g.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=g,r=t.lang.String.isHex,n=t.asn1,i=n.x509.OID.name2oid,a=n.ASN1Util.newObject;this.params=null,this.setByParam=function(s){this.oid=i(s.extname),this.params=s},this.getExtnValueHex=function(){if(this.params.extname==null||this.params.extn==null)throw new Error("extname or extnhex not specified");var s=this.params.extn;if(typeof s=="string"&&r(s))return s;if(typeof s=="object")try{return a(s).tohex()}catch{}throw new Error("unsupported extn value")},e!=null&&this.setByParam(e)};he(g.asn1.x509.PrivateExtension,g.asn1.x509.Extension);g.asn1.x509.CRL=function(e){g.asn1.x509.CRL.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.DERSequence,i=r.DERBitString,a=r.x509,s=a.AlgorithmIdentifier,u=a.TBSCertList;this.params=void 0,this.setByParam=function(l){this.params=l},this.sign=function(){var l=new u(this.params).tohex(),f=new g.crypto.Signature({alg:this.params.sigalg});f.init(this.params.cakey),f.updateHex(l);var d=f.sign();this.params.sighex=d},this.getPEM=function(){return Qr(this.tohex(),"X509 CRL")},this.tohex=function(){var l=this.params;if(l.tbsobj==null&&(l.tbsobj=new u(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 s({name:l.sigalg})),f.push(new i({hex:"00"+l.sighex}));var d=new n({array:f});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};he(g.asn1.x509.CRL,g.asn1.ASN1Object);g.asn1.x509.TBSCertList=function(e){g.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,a=r.DERTaggedObject,s=r.DERObjectIdentifier,u=r.x509,l=u.AlgorithmIdentifier,f=u.Time,d=u.Extensions,E=u.X500Name;this.params=null,this.setByParam=function(p){this.params=p},this.getRevCertSequence=function(){for(var p=[],h=this.params.revcert,A=0;A<h.length;A++){var m=[new n(h[A].sn),new f(h[A].date)];h[A].ext!=null&&m.push(new d(h[A].ext)),p.push(new i({array:m}))}return new i({array:p})},this.tohex=function(){var p=[],h=this.params;if(h.version!=null){var A=h.version-1,m=new n({int:A});p.push(m)}if(p.push(new l({name:h.sigalg})),p.push(new E(h.issuer)),p.push(new f(h.thisupdate)),h.nextupdate!=null&&p.push(new f(h.nextupdate)),h.revcert!=null&&p.push(this.getRevCertSequence()),h.ext!=null){var S=new d(h.ext);p.push(new a({tag:"a0",explicit:!0,obj:S}))}var w=new i({array:p});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.TBSCertList,g.asn1.ASN1Object);g.asn1.x509.CRLEntry=function(e){g.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1;this.setCertSerial=function(a){this.sn=new i.DERInteger(a)},this.setRevocationDate=function(a){this.time=new i.x509.Time(a)},this.tohex=function(){var a=new i.DERSequence({array:[this.sn,this.time]});return this.TLV=a.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(e.time!==void 0&&this.setRevocationDate(e.time),e.sn!==void 0&&this.setCertSerial(e.sn))};he(g.asn1.x509.CRLEntry,g.asn1.ASN1Object);g.asn1.x509.CRLNumber=function(e){g.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",e!=null&&(this.params=e)};he(g.asn1.x509.CRLNumber,g.asn1.x509.Extension);g.asn1.x509.CRLReason=function(e){g.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",e!=null&&(this.params=e)};he(g.asn1.x509.CRLReason,g.asn1.x509.Extension);g.asn1.x509.OCSPNonce=function(e){g.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",e!=null&&(this.params=e)};he(g.asn1.x509.OCSPNonce,g.asn1.x509.Extension);g.asn1.x509.OCSPNoCheck=function(e){g.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new g.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",e!=null&&(this.params=e)};he(g.asn1.x509.OCSPNoCheck,g.asn1.x509.Extension);g.asn1.x509.AdobeTimeStamp=function(e){g.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=g,r=t.asn1,n=r.DERInteger,i=r.DERBoolean,a=r.DERSequence,s=r.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var u=this.params,l=[new n(1)];return l.push(new s({uri:u.uri})),u.reqauth!=null&&l.push(new i(u.reqauth)),this.asn1ExtnValue=new a({array:l}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",e!==void 0&&this.setByParam(e)};he(g.asn1.x509.AdobeTimeStamp,g.asn1.x509.Extension);g.asn1.x509.X500Name=function(e){g.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=g,r=t.asn1,n=r.x509,i=n.RDN,a=Xt;this.setByString=function(s,u){u!==void 0&&(this.sRule=u);var l=s.split("/");l.shift();for(var f=[],d=0;d<l.length;d++)if(l[d].match(/^[^=]+=.+$/))f.push(l[d]);else{var E=f.length-1;f[E]=f[E]+"/"+l[d]}for(var d=0;d<f.length;d++)this.asn1Array.push(new i({str:f[d],rule:this.sRule}))},this.setByLdapString=function(s,u){u!==void 0&&(this.sRule=u);var l=n.X500Name.ldapToCompat(s);this.setByString(l,u)},this.setByObject=function(s,u){u!==void 0&&(this.sRule=u);for(var l in s)if(s.hasOwnProperty(l)){var f=new i({str:l+"="+s[l],rule:this.sRule});this.asn1Array?this.asn1Array.push(f):this.asn1Array=[f]}},this.setByParam=function(s){if(s.rule!==void 0&&(this.sRule=s.rule),s.array!==void 0)this.paramArray=s.array;else if(s.str!==void 0)this.setByString(s.str);else if(s.ldapstr!==void 0)this.setByLdapString(s.ldapstr);else if(s.hex!==void 0)this.hTLV=s.hex;else if(s.certissuer!==void 0){var u=new je;u.readCertPEM(s.certissuer),this.hTLV=u.getIssuerHex()}else if(s.certsubject!==void 0){var u=new je;u.readCertPEM(s.certsubject),this.hTLV=u.getSubjectHex()}else typeof s=="object"&&s.certsubject===void 0&&s.certissuer===void 0&&this.setByObject(s)},this.tohex=function(){if(typeof this.hTLV=="string")return this.hTLV;if(this.asn1Array.length==0&&this.paramArray.length>0)for(var s=0;s<this.paramArray.length;s++){var u={array:this.paramArray[s]};this.sRule!="utf8"&&(u.rule=this.sRule);var l=new i(u);this.asn1Array.push(l)}var f=new r.DERSequence({array:this.asn1Array});return this.hTLV=f.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.X500Name,g.asn1.ASN1Object);g.asn1.x509.X500Name.compatToLDAP=function(e){if(e.substr(0,1)!=="/")throw"malformed input";var t="";e=e.substr(1);var r=e.split("/");return r.reverse(),r=r.map(function(n){return n.replace(/,/,"\\,")}),r.join(",")};g.asn1.x509.X500Name.onelineToLDAP=function(e){return g.asn1.x509.X500Name.compatToLDAP(e)};g.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),r=!1,n=[],i=0;t.length>0;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("/")};g.asn1.x509.X500Name.ldapToOneline=function(e){return g.asn1.x509.X500Name.ldapToCompat(e)};g.asn1.x509.RDN=function(e){g.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=g.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 g.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=g.asn1.x509.RDN.parseString(r),i=0;i<n.length;i++)this.addByString(n[i])},this.tohex=function(){if(this.asn1Array.length==0&&this.paramArray.length>0)for(var r=0;r<this.paramArray.length;r++){var n=this.paramArray[r];n.rule!==void 0&&this.sRule!="utf8"&&(n.rule=this.sRule);var i=new t(n);this.asn1Array.push(i)}var a=new g.asn1.DERSet({array:this.asn1Array});return this.TLV=a.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.RDN,g.asn1.ASN1Object);g.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),r=!1,n=[],i=0;t.length>0;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};g.asn1.x509.AttributeTypeAndValue=function(e){g.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=g,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,E=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,A=h.match(/^([^=]+)=(.+)$/);if(A)this.sType=A[1],this.sValue=A[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 A=p.match(/^([^=]+)=(.+)$/);if(A)this.setByAttrTypeAndValueStr(A[1],A[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var p=this.sType,h=this.sValue,A=this.sRule;return A==="prn"?p=="CN"&&d(h)?"ia5":E(h)?"prn":"utf8":A==="utf8"?p=="CN"&&d(h)?"ia5":p=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(p,h,A){A!==void 0&&(this.sRule=A),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=g.asn1.x509.OID.atype2obj(this.sType),h=this.getValueObj(this.dsType,this.sValue),A=new n({array:[p,h]});return this.TLV=A.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.AttributeTypeAndValue,g.asn1.ASN1Object);g.asn1.x509.SubjectPublicKeyInfo=function(e){g.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1,a=i.DERInteger,s=i.DERBitString,u=i.DERObjectIdentifier,l=i.DERSequence,f=i.ASN1Util.newObject,d=i.x509,E=d.AlgorithmIdentifier,p=n.crypto,h=p.ECDSA,A=p.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var m=new l({array:[this.asn1AlgId,this.asn1SubjPKey]});return m},this.tohex=function(){var m=this.getASN1Object();return this.hTLV=m.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(m){try{if(m instanceof We){var S=f({seq:[{int:{bigint:m.n}},{int:{int:m.e}}]}),w=S.tohex();this.asn1AlgId=new E({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+w})}}catch{}try{if(m instanceof g.crypto.ECDSA){var y=new u({name:m.curveName});this.asn1AlgId=new E({name:"ecPublicKey",asn1params:y}),this.asn1SubjPKey=new s({hex:"00"+m.pubKeyHex})}}catch{}try{if(m instanceof g.crypto.DSA){var y=new f({seq:[{int:{bigint:m.p}},{int:{bigint:m.q}},{int:{bigint:m.g}}]});this.asn1AlgId=new E({name:"dsa",asn1params:y});var _=new a({bigint:m.y});this.asn1SubjPKey=new s({hex:"00"+_.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};he(g.asn1.x509.SubjectPublicKeyInfo,g.asn1.ASN1Object);g.asn1.x509.Time=function(e){g.asn1.x509.Time.superclass.constructor.call(this);var t=null,r=null,n=g,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)};g.asn1.x509.Time_bak=function(e){g.asn1.x509.Time_bak.superclass.constructor.call(this);var t=null,r=null,n=g,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)};he(g.asn1.x509.Time,g.asn1.ASN1Object);g.asn1.x509.AlgorithmIdentifier=function(e){g.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=g,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)}};he(g.asn1.x509.AlgorithmIdentifier,g.asn1.ASN1Object);g.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};g.asn1.x509.GeneralName=function(e){g.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87",otherName:"a0"},r=g,n=r.asn1,i=n.x509,a=i.X500Name,s=i.OtherName,u=n.DERIA5String,l=n.DERPrintableString,f=n.DEROctetString,d=n.DERTaggedObject,E=n.ASN1Object,p=Error;this.params=null,this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,A,S,m,S=!1;if(h.other!==void 0)A="a0",m=new s(h.other);else if(h.rfc822!==void 0)A="81",m=new u({str:h.rfc822});else if(h.dns!==void 0)A="82",m=new u({str:h.dns});else if(h.dn!==void 0)A="a4",S=!0,typeof h.dn=="string"?m=new a({str:h.dn}):h.dn instanceof g.asn1.x509.X500Name?m=h.dn:m=new a(h.dn);else if(h.ldapdn!==void 0)A="a4",S=!0,m=new a({ldapstr:h.ldapdn});else if(h.certissuer!==void 0||h.certsubj!==void 0){A="a4",S=!0;var w,y,_=null;if(h.certsubj!==void 0?(w=!1,y=h.certsubj):(w=!0,y=h.certissuer),y.match(/^[0-9A-Fa-f]+$/)&&_==y,y.indexOf("-----BEGIN ")!=-1&&(_=Xt(y)),_==null)throw new Error("certsubj/certissuer not cert");var B=new je;B.hex=_;var D;w?D=B.getIssuerHex():D=B.getSubjectHex(),m=new E,m.hTLV=D}else if(h.uri!==void 0)A="86",m=new u({str:h.uri});else if(h.ip!==void 0){A="87";var j,q=h.ip;try{if(q.match(/^[0-9a-f]+$/)){var F=q.length;if(F==8||F==16||F==32||F==64)j=q;else throw"err"}else j=qd(q)}catch(L){throw new p("malformed IP address: "+h.ip+":"+L.message)}m=new f({hex:j})}else throw new p("improper params");var P=new d({tag:A,explicit:S,obj:m});return P.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.GeneralName,g.asn1.ASN1Object);g.asn1.x509.GeneralNames=function(e){g.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=g,n=r.asn1;this.setByParamArray=function(i){for(var a=0;a<i.length;a++){var s=new n.x509.GeneralName(i[a]);this.asn1Array.push(s)}},this.tohex=function(){var i=new n.DERSequence({array:this.asn1Array});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,typeof e<"u"&&this.setByParamArray(e)};he(g.asn1.x509.GeneralNames,g.asn1.ASN1Object);g.asn1.x509.OtherName=function(e){g.asn1.x509.OtherName.superclass.constructor.call(this);var t=null,r=null,n=g,i=n.asn1,a=i.DERObjectIdentifier,s=i.DERSequence,u=i.ASN1Util.newObject;this.params=null,this.setByParam=function(l){this.params=l},this.tohex=function(){var l=this.params;if(l.oid==null||l.value==null)throw new Error("oid or value not specified");var f=new a({oid:l.oid}),d=u({tag:{tag:"a0",explicit:!0,obj:l.value}}),E=new s({array:[f,d]});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.x509.OtherName,g.asn1.ASN1Object);g.asn1.x509.OID=new function(){var e=g.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]<"u")return this.objCache[t];if(typeof this.name2oidList[t]>"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}}};g.asn1.x509.OID.oid2name=function(e){var t=g.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};g.asn1.x509.OID.oid2atype=function(e){var t=g.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};g.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=g.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};g.asn1.x509.X509Util={};g.asn1.x509.X509Util.newCertPEM=function(e){var t=g.asn1.x509,r=t.TBSCertificate,n=t.Certificate,i=new n(e);return i.getPEM()};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.cms>"u"||!g.asn1.cms)&&(g.asn1.cms={});g.asn1.cms.Attribute=function(e){var t=Error,r=g,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()}};he(g.asn1.cms.Attribute,g.asn1.ASN1Object);g.asn1.cms.ContentType=function(e){var t=g,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)};he(g.asn1.cms.ContentType,g.asn1.cms.Attribute);g.asn1.cms.MessageDigest=function(e){var t=g,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)};he(g.asn1.cms.MessageDigest,g.asn1.cms.Attribute);g.asn1.cms.SigningTime=function(e){var t=g,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)};he(g.asn1.cms.SigningTime,g.asn1.cms.Attribute);g.asn1.cms.SigningCertificate=function(e){var t=Error,r=g,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;d<l.length;d++){var E=l[d];e.hasis==!1&&typeof E=="string"&&(E.indexOf("-----BEGIN")!=-1||Ae.isASN1HEX(E))&&(E={cert:E}),E.hasis!=!1&&e.hasis==!1&&(E.hasis=!1),f.push(new s(E))}var p=new i({array:f}),h=new i({array:[p]});return[h]},e!=null&&this.setByParam(e)};he(g.asn1.cms.SigningCertificate,g.asn1.cms.Attribute);g.asn1.cms.ESSCertID=function(e){g.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,r=g,n=r.asn1,i=n.DEROctetString,a=n.DERSequence,s=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(u,l){if(u.hash!=null)return u.hash;if(typeof u=="string"&&u.indexOf("-----BEGIN")==-1&&!Ae.isASN1HEX(u))return u;var f;if(typeof u=="string")f=u;else if(u.cert!=null)f=u.cert;else throw new t("hash nor cert unspecified");var d;f.indexOf("-----BEGIN")!=-1?d=Xt(f):d=f,typeof u=="string"&&(u.indexOf("-----BEGIN")!=-1?d=Xt(u):Ae.isASN1HEX(u)&&(d=u));var E;if(u.alg!=null)E=u.alg;else if(l!=null)E=l;else throw new t("hash alg unspecified");return r.crypto.Util.hashHex(d,E)},this.tohex=function(){var u=this.params,l=this.getCertHash(u,"sha1"),f=[];f.push(new i({hex:l})),(typeof u=="string"&&u.indexOf("-----BEGIN")!=-1||u.cert!=null&&u.hasis!=!1||u.issuer!=null&&u.serial!=null)&&f.push(new s(u));var d=new a({array:f});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.ESSCertID,g.asn1.ASN1Object);g.asn1.cms.SigningCertificateV2=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,a=n.x509,s=n.cms,u=s.ESSCertIDv2,l=r.crypto;s.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new t("parameter 'array' not specified");for(var f=this.params.array,d=[],E=0;E<f.length;E++){var p=f[E];(e.alg!=null||e.hasis==!1)&&typeof p=="string"&&(p.indexOf("-----BEGIN")!=-1||Ae.isASN1HEX(p))&&(p={cert:p}),p.alg==null&&e.alg!=null&&(p.alg=e.alg),p.hasis!=!1&&e.hasis==!1&&(p.hasis=!1),d.push(new u(p))}var h=new i({array:d}),A=new i({array:[h]});return[A]},e!=null&&this.setByParam(e)};he(g.asn1.cms.SigningCertificateV2,g.asn1.cms.Attribute);g.asn1.cms.ESSCertIDv2=function(e){g.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);var t=Error,r=g,n=r.asn1,i=n.DEROctetString,a=n.DERSequence,s=n.cms.IssuerSerial,u=n.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var l=this.params,f=this.getCertHash(l,"sha256"),d=[];l.alg!=null&&l.alg!="sha256"&&d.push(new u({name:l.alg})),d.push(new i({hex:f})),(typeof l=="string"&&l.indexOf("-----BEGIN")!=-1||l.cert!=null&&l.hasis!=!1||l.issuer!=null&&l.serial!=null)&&d.push(new s(l));var E=new a({array:d});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.ESSCertIDv2,g.asn1.cms.ESSCertID);g.asn1.cms.IssuerSerial=function(e){var t=Error,r=g,n=r.asn1,i=n.DERInteger,a=n.DERSequence,s=n.cms,u=n.x509,l=u.GeneralNames,f=je;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(d){this.params=d},this.tohex=function(){var d=this.params,E,p;if(typeof d=="string"&&d.indexOf("-----BEGIN")!=-1||d.cert!=null){var h;d.cert!=null?h=d.cert:h=d;var A=new f;A.readCertPEM(h),E=A.getIssuer(),p={hex:A.getSerialNumberHex()}}else if(d.issuer!=null&&d.serial)E=d.issuer,p=d.serial;else throw new t("cert or issuer and serial parameter not specified");var m=new l([{dn:E}]),S=new i(p),w=new a({array:[m,S]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.IssuerSerial,g.asn1.ASN1Object);g.asn1.cms.SignerIdentifier=function(e){var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,a=r.cms,s=a.IssuerAndSerialNumber,u=a.SubjectKeyIdentifier,l=r.x509,f=l.X500Name,d=je,E=Error;a.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params;if(p.type=="isssn"){var h=new s(p);return h.tohex()}else if(p.type=="skid"){var A=new u(p);return A.tohex()}else throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.SignerIdentifier,g.asn1.ASN1Object);g.asn1.cms.IssuerAndSerialNumber=function(e){var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,a=r.cms,s=r.x509,u=s.X500Name,l=je,f=Error;a.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params,E,p;if(typeof d=="string"&&d.indexOf("-----BEGIN")!=-1||d.cert!=null){var h;d.cert!=null?h=d.cert:h=d;var A=new l;A.readCertPEM(h),E=A.getIssuer(),p={hex:A.getSerialNumberHex()}}else if(d.issuer!=null&&d.serial)E=d.issuer,p=d.serial;else throw new f("cert or issuer and serial parameter not specified");var m=new u(E),S=new n(p),w=new i({array:[m,S]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(d){this.params=d},e!=null&&this.setByParam(e)};he(g.asn1.cms.IssuerAndSerialNumber,g.asn1.ASN1Object);g.asn1.cms.SubjectKeyIdentifier=function(e){var t=g,r=t.asn1,n=r.DERInteger,i=r.DERSequence,a=r.ASN1Util.newObject,s=r.cms,u=s.IssuerAndSerialName,l=s.SubjectKeyIdentifier,f=r.x509,d=f.X500Name,E=je,p=Error;s.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var h=this.params;if(h.cert==null&&h.skid==null)throw new p("property cert nor skid undefined");var A;if(h.cert!=null){var m=new E(h.cert),S=m.getExtSubjectKeyIdentifier();A=S.kid.hex}else h.skid!=null&&(A=h.skid);var w=a({tag:{tage:"a0",obj:{octstr:{hex:A}}}});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.SubjectKeyIdentifier,g.asn1.ASN1Object);g.asn1.cms.AttributeList=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSet,a=n.cms;a.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(s){this.params=s},this.tohex=function(){var s=this.params;if(this.hTLV!=null)return this.hTLV;var u=!0;s.sortflag!=null&&(u=s.sortflag);for(var l=s.array,f=[],d=0;d<l.length;d++){var E=l[d],p=E.attr;if(p=="contentType")f.push(new a.ContentType(E));else if(p=="messageDigest")f.push(new a.MessageDigest(E));else if(p=="signingTime")f.push(new a.SigningTime(E));else if(p=="signingCertificate")f.push(new a.SigningCertificate(E));else if(p=="signingCertificateV2")f.push(new a.SigningCertificateV2(E));else if(p=="signaturePolicyIdentifier")f.push(new g.asn1.cades.SignaturePolicyIdentifier(E));else if(p=="signatureTimeStamp"||p=="timeStampToken")f.push(new g.asn1.cades.SignatureTimeStamp(E));else throw new t("unknown attr: "+p)}var h=new i({array:f,sortflag:u});return this.hTLV=h.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.AttributeList,g.asn1.ASN1Object);g.asn1.cms.SignerInfo=function(e){var t=Error,r=g,n=r.asn1,i=n.DERInteger,a=n.DEROctetString,s=n.DERSequence,u=n.DERTaggedObject,l=n.cms,f=l.SignerIdentifier,d=l.AttributeList,E=l.ContentType,p=l.EncapsulatedContentInfo,h=l.MessageDigest,A=l.SignedData,m=n.x509,S=m.AlgorithmIdentifier,w=r.crypto,y=ct;l.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var _=this.params,B=_.sigalg,D=new d(_.sattrs).tohex(),j=y.getKey(_.signkey),q=new w.Signature({alg:B});q.init(j),q.updateHex(D);var F=q.sign();_.sighex=F},this.tohex=function(){var _=this.params,B=[];if(B.push(new i({int:_.version})),B.push(new f(_.id)),B.push(new S({name:_.hashalg})),_.sattrs!=null){var D=new d(_.sattrs);try{B.push(new u({tag:"a0",explicit:!1,obj:D}))}catch(q){throw new t("si sattr error: "+q)}}if(_.sigalgfield!=null?B.push(new S({name:_.sigalgfield})):B.push(new S({name:_.sigalg})),_.sighex==null&&_.signkey!=null&&this.sign(),B.push(new a({hex:_.sighex})),_.uattrs!=null){var D=new d(_.uattrs);try{B.push(new u({tag:"a1",explicit:!1,obj:D}))}catch(F){throw new t("si uattr error: "+F)}}var j=new s({array:B});return j.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.SignerInfo,g.asn1.ASN1Object);g.asn1.cms.EncapsulatedContentInfo=function(e){var t=g,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,a=r.DERObjectIdentifier,s=r.DEROctetString,u=r.cms;u.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params,f=[];if(f.push(new a(l.type)),l.content!=null&&(l.content.hex!=null||l.content.str!=null)&&l.isDetached!=!0){var d=new s(l.content),E=new n({tag:"a0",explicit:!0,obj:d});f.push(E)}var p=new i({array:f});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(l){this.params=l},e!=null&&this.setByParam(e)};he(g.asn1.cms.EncapsulatedContentInfo,g.asn1.ASN1Object);g.asn1.cms.ContentInfo=function(e){var t=g,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,a=r.DERObjectIdentifier,s=r.x509,u=s.OID.name2obj;g.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params,f=[];f.push(new a(l.type));var d=new n({tag:"a0",explicit:!0,obj:l.obj});f.push(d);var E=new i({array:f});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(l){this.params=l},e!=null&&this.setByParam(e)};he(g.asn1.cms.ContentInfo,g.asn1.ASN1Object);g.asn1.cms.SignedData=function(e){var t=Error,r=g,n=r.asn1,i=n.ASN1Object,a=n.DERInteger,s=n.DERSet,u=n.DERSequence,l=n.DERTaggedObject,f=n.cms,d=f.EncapsulatedContentInfo,E=f.SignerInfo,p=f.ContentInfo,h=f.CertificateSet,A=f.RevocationInfoChoices,m=n.x509,S=m.AlgorithmIdentifier;g.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var w=this.params;this._setDigestAlgs(w),this._setContentTypeByEContent(w),this._setMessageDigestByEContent(w),this._setSignerInfoVersion(w),this._setSignedDataVersion(w)},this._setDigestAlgs=function(w){for(var y={},_=w.sinfos,B=0;B<_.length;B++){var D=_[B];y[D.hashalg]=1}w.hashalgs=Object.keys(y).sort()},this._setContentTypeByEContent=function(w){for(var y=w.econtent.type,_=w.sinfos,B=0;B<_.length;B++){var D=_[B],j=this._getAttrParamByName(D,"contentType");j.type=y}},this._setMessageDigestByEContent=function(w){var y=w.econtent,_=w.econtent.type,B=y.content.hex;B==null&&y.type=="data"&&y.content.str!=null&&(B=qi(y.content.str));for(var D=w.sinfos,j=0;j<D.length;j++){var q=D[j],F=q.hashalg,P=this._getAttrParamByName(q,"messageDigest"),L=g.crypto.Util.hashHex(B,F);P.hex=L}},this._getAttrParamByName=function(w,y){for(var _=w.sattrs.array,B=0;B<_.length;B++)if(_[B].attr==y)return _[B]},this._setSignerInfoVersion=function(w){for(var y=w.sinfos,_=0;_<y.length;_++){var B=y[_],D=1;B.id.type=="skid"&&(D=3),B.version=D}},this._setSignedDataVersion=function(w){var y=this._getSignedDataVersion(w);w.version=y},this._getSignedDataVersion=function(w){if(w.revinfos!=null)for(var y=w.revinfos,_=0;_<y.length;_++){var B=y[_];if(B.ocsp!=null)return 5}for(var D=w.sinfos,_=0;_<D.length;_++){var j=w.sinfos[_];if(j.version==3)return 3}return w.econtent.type!="data"?3:1},this.tohex=function(){var w=this.params;this.getEncodedHexPrepare!=null&&this.getEncodedHexPrepare(),w.fixed!=!0&&this.checkAndFixParam();var y=[];y.push(new a({int:w.version}));for(var _=[],B=0;B<w.hashalgs.length;B++){var D=w.hashalgs[B];_.push(new S({name:D}))}y.push(new s({array:_})),y.push(new d(w.econtent)),w.certs!=null&&y.push(new h(w.certs)),w.revinfos!=null&&y.push(new A(w.revinfos));for(var j=[],B=0;B<w.sinfos.length;B++){var q=w.sinfos[B];j.push(new E(q))}y.push(new s({array:j}));var F=new u({array:y});return F.tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){var w=new p({type:"signed-data",obj:this});return w},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.SignedData,g.asn1.ASN1Object);g.asn1.cms.CertificateSet=function(e){g.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,r=g.asn1,n=r.DERTaggedObject,i=r.DERSet,a=r.ASN1Object;this.params=null,this.tohex=function(){var s=this.params,u=[],l;if(s instanceof Array)l=s;else if(s.array!=null)l=s.array;else throw new t("cert array not specified");for(var f=0;f<l.length;f++){var d=l[f],E=Xt(d),p=new a;p.hTLV=E,u.push(p)}var h={array:u};s.sortflag==!1&&(h.sortflag=!1);var A=new i(h),m=new n({tag:"a0",explicit:!1,obj:A});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.CertificateSet,g.asn1.ASN1Object);g.asn1.cms.RevocationInfoChoices=function(e){g.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var r=[],n=0;n<t.length;n++)r.push(new g.asn1.cms.RevocationInfoChoice(t[n]));var i=g.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:r}}});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.RevocationInfoChoices,g.asn1.ASN1Object);g.asn1.cms.RevocationInfoChoice=function(e){g.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(t.crl!=null&&typeof t.crl=="string"){var r=t.crl;return t.crl.indexOf("-----BEGIN")!=-1&&(r=Xt(t.crl)),r}else if(t.ocsp!=null){var n=g.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new g.asn1.cms.OtherRevocationFormat(t)}});return n.tohex()}else throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.RevocationInfoChoice,g.asn1.ASN1Object);g.asn1.cms.OtherRevocationFormat=function(e){g.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,r=g,n=r.asn1,i=n.ASN1Util.newObject,a=r.lang.String.isHex;this.params=null,this.tohex=function(){var s=this.params;if(s.ocsp==null)throw new t("property ocsp not specified");if(!a(s.ocsp)||!Ae.isASN1HEX(s.ocsp))throw new t("ocsp value not ASN.1 hex string");var u=i({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:s.ocsp}}]});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cms.OtherRevocationFormat,g.asn1.ASN1Object);g.asn1.cms.CMSUtil=new function(){};g.asn1.cms.CMSUtil.newSignedData=function(e){return new g.asn1.cms.SignedData(e)};g.asn1.cms.CMSUtil.verifySignedData=function(e){var t=g,r=t.asn1,n=r.cms,i=n.SignerInfo,a=n.SignedData,s=n.SigningTime,u=n.SigningCertificate,l=n.SigningCertificateV2,f=r.cades,d=f.SignaturePolicyIdentifier,E=t.lang.String.isHex,p=Ae,h=p.getVbyList,A=p.getTLVbyList,m=p.getIdxbyList,S=p.getChildIdx,w=p.getTLV,y=p.oidname,_=t.crypto.Util.hashHex;e.cms===void 0&&E(e.cms);var B=e.cms,D=function(z,X){for(var ie,Se=3;Se<6;Se++)if(ie=m(z,0,[1,0,Se]),ie!==void 0){var we=z.substr(ie,2);we==="a0"&&(X.certsIdx=ie),we==="a1"&&(X.revinfosIdx=ie),we==="31"&&(X.signerinfosIdx=ie)}},j=function(z,X){var ie=X.signerinfosIdx;if(ie!==void 0){var Se=S(z,ie);X.signerInfoIdxList=Se;for(var we=0;we<Se.length;we++){var Ie=Se[we],Ve={idx:Ie};q(z,Ve),X.signerInfos.push(Ve)}}},q=function(z,X){var ie=X.idx;X.signerid_issuer1=A(z,ie,[1,0],"30"),X.signerid_serial1=h(z,ie,[1,1],"02"),X.hashalg=y(h(z,ie,[2,0],"06"));var Se=m(z,ie,[3],"a0");X.idxSignedAttrs=Se,F(z,X,Se);var we=S(z,ie),Ie=we.length;if(Ie<6)throw"malformed SignerInfo";X.sigalg=y(h(z,ie,[Ie-2,0],"06")),X.sigval=h(z,ie,[Ie-1],"04")},F=function(z,X,ie){var Se=S(z,ie);X.signedAttrIdxList=Se;for(var we=0;we<Se.length;we++){var Ie=Se[we],Ve=h(z,Ie,[0],"06"),ue;Ve==="2a864886f70d010905"?(ue=Rt(h(z,Ie,[1,0])),X.saSigningTime=ue):Ve==="2a864886f70d010904"&&(ue=h(z,Ie,[1,0],"04"),X.saMessageDigest=ue)}},P=function(z,X){if(h(z,0,[0],"06")!=="2a864886f70d010702")return X;X.cmsType="signedData",X.econtent=h(z,0,[1,0,2,1,0]),D(z,X),X.signerInfos=[],j(z,X)},L=function(z,X){for(var ie=X.parse.signerInfos,Se=ie.length,we=!0,Ie=0;Ie<Se;Ie++){var Ve=ie[Ie];V(z,X,Ve,Ie),Ve.isValid||(we=!1)}X.isValid=we},M=function(z,X,ie,Se){var we=X.parse.certsIdx,Ie;if(X.certs===void 0){Ie=[],X.certkeys=[];for(var Ve=S(z,we),ue=0;ue<Ve.length;ue++){var _e=w(z,Ve[ue]),He=new je;He.readCertHex(_e),Ie[ue]=He,X.certkeys[ue]=He.getPublicKey()}X.certs=Ie}else Ie=X.certs;X.cccc=Ie.length,X.cccci=Ve.length;for(var ue=0;ue<Ie.length;ue++){var Sr=He.getIssuerHex(),Ht=He.getSerialNumberHex();ie.signerid_issuer1===Sr&&ie.signerid_serial1===Ht&&(ie.certkey_idx=ue)}},V=function(z,X,ie,Se){ie.verifyDetail={};var we=ie.verifyDetail,Ie=X.parse.econtent,Ve=ie.hashalg,ue=ie.saMessageDigest;we.validMessageDigest=!1,_(Ie,Ve)===ue&&(we.validMessageDigest=!0),M(z,X,ie,Se),we.validSignatureValue=!1;var _e=ie.sigalg,He="31"+w(z,ie.idxSignedAttrs).substr(2);ie.signedattrshex=He;var Sr=X.certs[ie.certkey_idx].getPublicKey(),Ht=new g.crypto.Signature({alg:_e});Ht.init(Sr),Ht.updateHex(He);var wt=Ht.verify(ie.sigval);we.validSignatureValue_isValid=wt,wt===!0&&(we.validSignatureValue=!0),ie.isValid=!1,we.validMessageDigest&&we.validSignatureValue&&(ie.isValid=!0)},W=function(){},G={isValid:!1,parse:{}};return P(B,G.parse),L(B,G),G};g.asn1.cms.CMSParser=function(){var e=Error,t=je,r=new t,n=Ae,i=n.getV,a=n.getTLV,s=n.getIdxbyList,u=n.getTLVbyList,l=n.getTLVbyListEx,f=n.getVbyList,d=n.getVbyListEx,E=n.getChildIdx;this.getCMSSignedData=function(p){var h=u(p,0,[1,0]),A=this.getSignedData(h);return A},this.getSignedData=function(p){var h=E(p,0),A={},m=i(p,h[0]),S=parseInt(m,16);A.version=S;var w=a(p,h[1]);A.hashalgs=this.getHashAlgArray(w);var y=a(p,h[2]);A.econtent=this.getEContent(y);var _=l(p,0,["[0]"]);_!=null&&(A.certs=this.getCertificateSet(_));var B=l(p,0,["[1]"]);B!=null;var D=l(p,0,[3]);return A.sinfos=this.getSignerInfos(D),A},this.getHashAlgArray=function(p){for(var h=E(p,0),A=new t,m=[],S=0;S<h.length;S++){var w=a(p,h[S]),y=A.getAlgorithmIdentifierName(w);m.push(y)}return m},this.getEContent=function(p){var h={},A=f(p,0,[0]),m=f(p,0,[1,0]);return h.type=g.asn1.x509.OID.oid2name(Ae.hextooidstr(A)),h.content={hex:m},h},this.getSignerInfos=function(p){for(var h=[],A=E(p,0),m=0;m<A.length;m++){var S=a(p,A[m]),w=this.getSignerInfo(S);h.push(w)}return h},this.getSignerInfo=function(p){var h={},A=E(p,0),m=n.getInt(p,A[0],-1);m!=-1&&(h.version=m);var S=a(p,A[1]),w=this.getIssuerAndSerialNumber(S);h.id=w;var y=a(p,A[2]),_=r.getAlgorithmIdentifierName(y);h.hashalg=_;var B=l(p,0,["[0]"]);if(B!=null){var D=this.getAttributeList(B);h.sattrs=D}var j=l(p,0,[3]),q=r.getAlgorithmIdentifierName(j);h.sigalg=q;var F=d(p,0,[4]);h.sighex=F;var P=l(p,0,["[1]"]);if(P!=null){var L=this.getAttributeList(P);h.uattrs=L}return h},this.getSignerIdentifier=function(p){if(p.substr(0,2)=="30")return this.getIssuerAndSerialNumber(p);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(p){var h={type:"isssn"},A=E(p,0),m=a(p,A[0]);h.issuer=r.getX500Name(m);var S=i(p,A[1]);return h.serial={hex:S},h},this.getAttributeList=function(p){for(var h=[],A=E(p,0),m=0;m<A.length;m++){var S=a(p,A[m]),w=this.getAttribute(S);h.push(w)}return{array:h}},this.getAttribute=function(p){var h={},A=E(p,0),m=n.getOID(p,A[0]),S=g.asn1.x509.OID.oid2name(m);h.attr=S;var w=a(p,A[1]),y=E(w,0);if(y.length==1)h.valhex=a(w,y[0]);else{for(var _=[],B=0;B<y.length;B++)_.push(a(w,y[B]));h.valhex=_}return S=="contentType"?this.setContentType(h):S=="messageDigest"?this.setMessageDigest(h):S=="signingTime"?this.setSigningTime(h):S=="signingCertificate"?this.setSigningCertificate(h):S=="signingCertificateV2"?this.setSigningCertificateV2(h):S=="signaturePolicyIdentifier"&&this.setSignaturePolicyIdentifier(h),h},this.setContentType=function(p){var h=n.getOIDName(p.valhex,0,null);h!=null&&(p.type=h,delete p.valhex)},this.setSigningTime=function(p){var h=i(p.valhex,0),A=Rt(h);p.str=A,delete p.valhex},this.setMessageDigest=function(p){var h=i(p.valhex,0);p.hex=h,delete p.valhex},this.setSigningCertificate=function(p){var h=E(p.valhex,0);if(h.length>0){for(var A=a(p.valhex,h[0]),m=E(A,0),S=[],w=0;w<m.length;w++){var y=a(A,m[w]),_=this.getESSCertID(y);S.push(_)}p.array=S}if(h.length>1){var B=a(p.valhex,h[1]);p.polhex=B}delete p.valhex},this.setSignaturePolicyIdentifier=function(p){var h=E(p.valhex,0);if(h.length>0){var A=n.getOID(p.valhex,h[0]);p.oid=A}if(h.length>1){var m=new t,S=E(p.valhex,h[1]),w=a(p.valhex,S[0]),y=m.getAlgorithmIdentifierName(w);p.alg=y;var _=i(p.valhex,S[1]);p.hash=_}delete p.valhex},this.setSigningCertificateV2=function(p){var h=E(p.valhex,0);if(h.length>0){for(var A=a(p.valhex,h[0]),m=E(A,0),S=[],w=0;w<m.length;w++){var y=a(A,m[w]),_=this.getESSCertIDv2(y);S.push(_)}p.array=S}if(h.length>1){var B=a(p.valhex,h[1]);p.polhex=B}delete p.valhex},this.getESSCertID=function(p){var h={},A=E(p,0);if(A.length>0){var m=i(p,A[0]);h.hash=m}if(A.length>1){var S=a(p,A[1]),w=this.getIssuerSerial(S);w.serial!=null&&(h.serial=w.serial),w.issuer!=null&&(h.issuer=w.issuer)}return h},this.getESSCertIDv2=function(p){var h={},A=E(p,0);if(A.length<1||3<A.length)throw new e("wrong number of elements");var m=0;if(p.substr(A[0],2)=="30"){var S=a(p,A[0]);h.alg=r.getAlgorithmIdentifierName(S),m++}else h.alg="sha256";var w=i(p,A[m]);if(h.hash=w,A.length>m+1){var y=a(p,A[m+1]),_=this.getIssuerSerial(y);h.issuer=_.issuer,h.serial=_.serial}return h},this.getIssuerSerial=function(p){var h={},A=E(p,0),m=a(p,A[0]),S=r.getGeneralNames(m),w=S[0].dn;h.issuer=w;var y=i(p,A[1]);return h.serial={hex:y},h},this.getCertificateSet=function(p){for(var h=E(p,0),A=[],m=0;m<h.length;m++){var S=a(p,h[m]);if(S.substr(0,2)=="30"){var w=Qr(S,"CERTIFICATE");A.push(w)}}return{array:A,sortflag:!1}}};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.tsp>"u"||!g.asn1.tsp)&&(g.asn1.tsp={});g.asn1.tsp.TimeStampToken=function(e){var t=g,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)};he(g.asn1.tsp.TimeStampToken,g.asn1.cms.SignedData);g.asn1.tsp.TSTInfo=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,a=n.DERInteger,s=n.DERBoolean,u=n.DERGeneralizedTime,l=n.DERObjectIdentifier,f=n.DERTaggedObject,d=n.tsp,E=d.MessageImprint,p=d.Accuracy,h=n.x509.X500Name,A=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 m=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(m.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(m.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(m.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");m.push(this.dGenTime),this.dAccuracy!=null&&m.push(this.dAccuracy),this.dOrdering!=null&&m.push(this.dOrdering),this.dNonce!=null&&m.push(this.dNonce),this.dTsa!=null&&m.push(this.dTsa);var S=new i({array:m});return this.hTLV=S.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 E(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 A({dn:e.tsa})}))}};he(g.asn1.tsp.TSTInfo,g.asn1.ASN1Object);g.asn1.tsp.Accuracy=function(e){var t=g,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)};he(g.asn1.tsp.Accuracy,g.asn1.ASN1Object);g.asn1.tsp.MessageImprint=function(e){var t=g,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)};he(g.asn1.tsp.MessageImprint,g.asn1.ASN1Object);g.asn1.tsp.TimeStampReq=function(e){var t=g,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,E=[];E.push(new i({int:1})),d.messageImprint instanceof g.asn1.ASN1Object?E.push(d.messageImprint):E.push(new f(d.messageImprint)),d.policy!=null&&E.push(new u(d.policy)),d.nonce!=null&&E.push(new i(d.nonce)),d.certreq==!0&&E.push(new a);var p=new n({array:E});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.tsp.TimeStampReq,g.asn1.ASN1Object);g.asn1.tsp.TimeStampResp=function(e){var t=g,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)};he(g.asn1.tsp.TimeStampResp,g.asn1.ASN1Object);g.asn1.tsp.PKIStatusInfo=function(e){var t=Error,r=g,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 E=new i({array:d});return E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.tsp.PKIStatusInfo,g.asn1.ASN1Object);g.asn1.tsp.PKIStatus=function(e){var t=Error,r=g,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)};he(g.asn1.tsp.PKIStatus,g.asn1.ASN1Object);g.asn1.tsp.PKIFreeText=function(e){var t=Error,r=g,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<u.length;f++)l.push(new a({str:u[f]}));var d=new i({array:l});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.tsp.PKIFreeText,g.asn1.ASN1Object);g.asn1.tsp.PKIFailureInfo=function(e){var t=Error,r=g,n=r.asn1,i=n.DERBitString,a=n.tsp,s=a.PKIFailureInfo,u={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};s.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var l=this.params,f=0;if(typeof l=="number"&&0<=l&&l<=25){f|=1<<l;for(var d=f.toString(2),E="",p=d.length-1;p>=0;p--)E+=d[p];return E}else{if(typeof l=="string"&&u[l]!=null)return xf([l],u);if(typeof l=="object"&&l.length!=null)return xf(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)};he(g.asn1.tsp.PKIFailureInfo,g.asn1.ASN1Object);g.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,r){throw"not implemented yet"}};g.asn1.tsp.SimpleTSAAdapter=function(e){var t=g,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)};he(g.asn1.tsp.SimpleTSAAdapter,g.asn1.tsp.AbstractTSAAdapter);g.asn1.tsp.FixedTSAAdapter=function(e){var t=g,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)};he(g.asn1.tsp.FixedTSAAdapter,g.asn1.tsp.AbstractTSAAdapter);g.asn1.tsp.TSPUtil=new function(){};g.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new g.asn1.tsp.TimeStampToken(e)};g.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=new g.asn1.tsp.TSPParser;return t.getTimeStampReq(e)};g.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=new g.asn1.tsp.TSPParser;return t.getMessageImprint(e)};g.asn1.tsp.TSPParser=function(){var e=Error,t=je,r=new t,n=Ae,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(E){var p=l(E,0);if(p.length==1)return this.getPKIStatusInfo(a(E,p[0]));if(p.length>1){var h=this.getPKIStatusInfo(a(E,p[0])),A=a(E,p[1]),m=this.getToken(A);return m.statusinfo=h,m}},this.getToken=function(E){var p=new g.asn1.cms.CMSParser,h=p.getCMSSignedData(E);return this.setTSTInfo(h),h},this.setTSTInfo=function(E){var p=E.econtent;if(p.type=="tstinfo"){var h=p.content.hex,A=this.getTSTInfo(h);p.content=A}},this.getTSTInfo=function(E){var p={},h=l(E,0),A=i(E,h[1]);p.policy=Kf(A);var m=a(E,h[2]);p.messageImprint=this.getMessageImprint(m);var S=i(E,h[3]);p.serial={hex:S};var w=i(E,h[4]);p.genTime={str:Rt(w)};var y=0;if(h.length>5&&E.substr(h[5],2)=="30"){var _=a(E,h[5]);p.accuracy=this.getAccuracy(_),y++}if(h.length>5+y&&E.substr(h[5+y],2)=="01"){var B=i(E,h[5+y]);B=="ff"&&(p.ordering=!0),y++}if(h.length>5+y&&E.substr(h[5+y],2)=="02"){var D=i(E,h[5+y]);p.nonce={hex:D},y++}if(h.length>5+y&&E.substr(h[5+y],2)=="a0"){var j=a(E,h[5+y]);j="30"+j.substr(2),pGeneralNames=r.getGeneralNames(j);var q=pGeneralNames[0].dn;p.tsa=q,y++}if(h.length>5+y&&E.substr(h[5+y],2)=="a1"){var F=a(E,h[5+y]);F="30"+F.substr(2);var P=r.getExtParamArray(F);p.ext=P,y++}return p},this.getAccuracy=function(E){for(var p={},h=l(E,0),A=0;A<h.length;A++){var m=E.substr(h[A],2),S=i(E,h[A]),w=parseInt(S,16);m=="02"?p.seconds=w:m=="80"?p.millis=w:m=="81"&&(p.micros=w)}return p},this.getMessageImprint=function(E){if(E.substr(0,2)!="30")throw new Error("head of messageImprint hex shall be x30");var p={},h=l(E,0),A=s(E,0,[0,0]),m=i(E,A),S=n.hextooidstr(m),w=g.asn1.x509.OID.oid2name(S);if(w=="")throw new Error("hashAlg name undefined: "+S);var y=w,_=s(E,0,[1]);return p.alg=y,p.hash=i(E,_),p},this.getPKIStatusInfo=function(E){var p={},h=l(E,0),A=0;try{var m=i(E,h[0]),S=parseInt(m,16);p.status=f[S]}catch{}if(h.length>1&&E.substr(h[1],2)=="30"){var w=a(E,h[1]);p.statusstr=this.getPKIFreeText(w),A++}if(h.length>A&&E.substr(h[1+A],2)=="03"){var y=a(E,h[1+A]);p.failinfo=this.getPKIFailureInfo(y)}return p},this.getPKIFreeText=function(E){for(var p=[],h=l(E,0),A=0;A<h.length;A++)p.push(n.getString(E,h[A]));return p},this.getPKIFailureInfo=function(E){var p=n.getInt(E,0);return d[p]!=null?d[p]:p},this.getTimeStampReq=function(E){var p={};p.certreq=!1;var h=l(E,0);if(h.length<2)throw new Error("TimeStampReq must have at least 2 items");var A=a(E,h[1]);p.messageImprint=g.asn1.tsp.TSPUtil.parseMessageImprint(A);for(var m=2;m<h.length;m++){var S=h[m],w=E.substr(S,2);if(w=="06"){var y=i(E,S);p.policy=n.hextooidstr(y)}w=="02"&&(p.nonce=i(E,S)),w=="01"&&(p.certreq=!0)}return p}};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.cades>"u"||!g.asn1.cades)&&(g.asn1.cades={});g.asn1.cades.SignaturePolicyIdentifier=function(e){var t=g,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)};he(g.asn1.cades.SignaturePolicyIdentifier,g.asn1.cms.Attribute);g.asn1.cades.SignaturePolicyId=function(e){var t=g,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,E=[];E.push(new i(d.oid)),E.push(new f(d));var p=new n({array:E});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(d){this.params=d},e!=null&&this.setByParam(e)};he(g.asn1.cades.SignaturePolicyId,g.asn1.ASN1Object);g.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,r=g,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 E=null;if(d.hash!=null)E=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=Xt(d.cert)),E=g.crypto.Util.hashHex(p,d.alg)}var h=[];h.push(new u({name:d.alg})),h.push(new a({hex:E}));var A=new i({array:h});return A.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cades.OtherHashAlgAndValue,g.asn1.ASN1Object);g.asn1.cades.OtherHashValue=function(e){g.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,r=g,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=Xt(u.cert)),l=g.crypto.Util.hashHex(f,"sha1")}return new a({hex:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cades.OtherHashValue,g.asn1.ASN1Object);g.asn1.cades.SignatureTimeStamp=function(e){var t=Error,r=g,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 E=Ae.getTLVbyList(d,0,[1]),f=new a;return f.hTLV=l.tst,[f]}},e!=null&&this.setByParam(e)};he(g.asn1.cades.SignatureTimeStamp,g.asn1.cms.Attribute);g.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,r=g,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<l.array.length;d++){var E=l.array[d];if(typeof E=="string")if(E.indexOf("-----BEGIN")!=-1)E={cert:E};else if(u(E))E={hash:E};else throw new t("unsupported value: "+E);l.alg!=null&&E.alg==null&&(E.alg=l.alg),l.hasis!=null&&E.hasis==null&&(E.hasis=l.hasis);var p=new s(E);f.push(p)}var h=new i({array:f});return[h]},e!=null&&this.setByParam(e)};he(g.asn1.cades.CompleteCertificateRefs,g.asn1.cms.Attribute);g.asn1.cades.OtherCertID=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.cms,a=i.IssuerSerial,s=r.cades,u=s.OtherHashValue,l=s.OtherHashAlgAndValue;s.OtherCertID.superclass.constructor.call(this),this.params=e,this.tohex=function(){var f=this.params;typeof f=="string"&&(f.indexOf("-----BEGIN")!=-1?f={cert:f}:_isHex(f)&&(f={hash:f}));var d=[],E=null;if(f.alg!=null?E=new l(f):E=new u(f),d.push(E),f.cert!=null&&f.hasis==!0||f.issuer!=null&&f.serial!=null){var p=new a(f);d.push(p)}var h=new n({array:d});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cades.OtherCertID,g.asn1.ASN1Object);g.asn1.cades.OtherHash=function(e){var t=Error,r=g,n=r.asn1,i=n.cms,a=n.cades,s=a.OtherHashAlgAndValue,u=a.OtherHashValue,l=r.crypto.Util.hashHex,f=r.lang.String.isHex;a.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var d=this.params;typeof d=="string"&&(d.indexOf("-----BEGIN")!=-1?d={cert:d}:f(d)&&(d={hash:d}));var E=null;return d.alg!=null?E=new s(d):E=new u(d),E.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};he(g.asn1.cades.OtherHash,g.asn1.ASN1Object);g.asn1.cades.CAdESUtil=new function(){};g.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){var t=new g.asn1.cms.CMSParser,r=t.getCMSSignedData(e);return r};g.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,r){var n=Ae,i=n.getChildIdx,a=n.getTLV,s=n.getV,u=g,l=u.asn1,f=l.ASN1Object,d=l.cms,E=d.AttributeList,p=d.SignerInfo,h={},A=i(e,t);if(A.length!=6)throw"not supported items for SignerInfo (!=6)";var m=A.shift();h.version=a(e,m);var S=A.shift();h.si=a(e,S);var w=A.shift();h.digalg=a(e,w);var y=A.shift();h.sattrs=a(e,y);var _=A.shift();h.sigalg=a(e,_);var B=A.shift();h.sig=a(e,B),h.sigval=s(e,B);var D=null;return h.obj=new p,D=new f,D.hTLV=h.version,h.obj.dCMSVersion=D,D=new f,D.hTLV=h.si,h.obj.dSignerIdentifier=D,D=new f,D.hTLV=h.digalg,h.obj.dDigestAlgorithm=D,D=new f,D.hTLV=h.sattrs,h.obj.dSignedAttrs=D,D=new f,D.hTLV=h.sigalg,h.obj.dSigAlg=D,D=new f,D.hTLV=h.sig,h.obj.dSig=D,h.obj.dUnsignedAttrs=new E,h};(typeof g.asn1.csr>"u"||!g.asn1.csr)&&(g.asn1.csr={});g.asn1.csr.CertificationRequest=function(e){var t=g,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 g.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 Qr(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var l=this.params,f=new g.asn1.csr.CertificationRequestInfo(this.params),d=new g.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 E=new n({hex:"00"+l.sighex}),p=new i({array:[f,d,E]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.csr.CertificationRequest,g.asn1.ASN1Object);g.asn1.csr.CertificationRequestInfo=function(e){var t=g,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,E=d.X500Name,p=d.Extensions,h=d.SubjectPublicKeyInfo,A=f.AttributeList;f.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(S){S!=null&&(this.params=S)},this.tohex=function(){var S=this.params,w=[];if(w.push(new a({int:0})),w.push(new E(S.subject)),w.push(new h(ct.getKey(S.sbjpubkey))),S.attrs!=null){var y=m(S.attrs),_=l({tag:{tage:"a0",obj:y}});w.push(_)}else if(S.extreq!=null){var B=new p(S.extreq),_=l({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[B]}]}}});w.push(_)}else w.push(new u({tag:"a0",explicit:!1,obj:new s({str:""})}));var D=new i({array:w});return D.tohex()},this.getEncodedHex=function(){return this.tohex()};function m(S){for(var w=Error,y=g.asn1.x509.Extensions,_=[],B=0;B<S.length;B++){var D=S[B],j=D.attr;if(j=="extensionRequest"){var q=new y(D.ext),F={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[q]}]};_.push(F)}else if(j=="unstructuredName"){var F={seq:[{oid:"1.2.840.113549.1.9.2"},{set:D.names}]};_.push(F)}else if(j=="challengePassword"){var F={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:D.password}]}]};_.push(F)}else throw new w("unknown CSR attribute")}return{set:_}}e!=null&&this.setByParam(e)};he(g.asn1.csr.CertificationRequestInfo,g.asn1.ASN1Object);g.asn1.csr.AttributeList=function(e){function t(r){}};he(g.asn1.csr.AttributeList,g.asn1.ASN1Object);g.asn1.csr.CSRUtil=new function(){};g.asn1.csr.CSRUtil.newCSRPEM=function(e){var t=ct,r=g.asn1.csr,n=new r.CertificationRequest(e),i=n.getPEM();return i};g.asn1.csr.CSRUtil.getParam=function(e,t){var r=Ae,n=r.getV,i=r.getIdxbyList,a=r.getTLVbyList,s=r.getTLVbyListEx,u=r.getVbyListEx,l=function(y){var _=i(y,0,[0,3,0,0],"06");return n(y,_)!="2a864886f70d01090e"?null:a(y,0,[0,3,0,1,0],"30")},f={};if(e.indexOf("-----BEGIN CERTIFICATE REQUEST")==-1)throw new Error("argument is not PEM file");var d=Xt(e,"CERTIFICATE REQUEST");t&&(f.tbs=a(d,0,[0]));try{var E=s(d,0,[0,1]);if(E=="3000")f.subject={};else{var m=new je;f.subject=m.getX500Name(E)}}catch{}var p=s(d,0,[0,2]),h=ct.getKey(p,null,"pkcs8pub");f.sbjpubkey=ct.getPEM(h,"PKCS8PUB");var A=l(d),m=new je;A!=null&&(f.extreq=m.getExtParamArray(A));try{var S=s(d,0,[1],"30"),m=new je;f.sigalg=m.getAlgorithmIdentifierName(S)}catch{}try{var w=u(d,0,[2]);f.sighex=w}catch{}return f};g.asn1.csr.CSRUtil.verifySignature=function(e){try{var t=null;if(typeof e=="string"&&e.indexOf("-----BEGIN CERTIFICATE REQUEST")!=-1?t=g.asn1.csr.CSRUtil.getParam(e,!0):typeof e=="object"&&e.sbjpubkey!=null&&e.sigalg!=null&&e.sighex!=null&&e.tbs!=null&&(t=e),t==null)return!1;var r=new g.crypto.Signature({alg:t.sigalg});return r.init(t.sbjpubkey),r.updateHex(t.tbs),r.verify(t.sighex)}catch(n){return alert(n),!1}};(typeof g>"u"||!g)&&(g={});(typeof g.asn1>"u"||!g.asn1)&&(g.asn1={});(typeof g.asn1.ocsp>"u"||!g.asn1.ocsp)&&(g.asn1.ocsp={});g.asn1.ocsp.DEFAULT_HASH="sha1";g.asn1.ocsp.OCSPResponse=function(e){g.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var t=g.asn1.DEREnumerated,r=g.asn1.ASN1Util.newObject,n=g.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)};he(g.asn1.ocsp.OCSPResponse,g.asn1.ASN1Object);g.asn1.ocsp.ResponseBytes=function(e){g.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=g.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)};he(g.asn1.ocsp.ResponseBytes,g.asn1.ASN1Object);g.asn1.ocsp.BasicOCSPResponse=function(e){g.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,r=g.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,E=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(),A=new g.crypto.Signature({alg:p.sigalg});A.init(p.reskey),A.updateHex(h),p.sighex=A.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 A=[],m=0;m<p.certs.length;m++){var S=p.certs[m],w=null;if(Ae.isASN1HEX(S))w=S;else if(S.match(/-----BEGIN/))w=Xt(S);else throw new t("certs["+m+"] not hex or PEM");A.push(new n({tlv:w}))}var y=new i({array:A});h.push(new s({tag:"a0",explicit:!0,obj:y}))}var _=new i({array:h});return _.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.ocsp.BasicOCSPResponse,g.asn1.ASN1Object);g.asn1.ocsp.ResponseData=function(e){g.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,r=g.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,a=r.DERTaggedObject,s=r.x509.Extensions,u=r.ocsp,l=u.ResponderID;_SingleResponseList=u.SingleResponseList,this.params=null,this.tohex=function(){var f=this.params;f.respid!=null&&new t("respid not specified"),f.prodat!=null&&new t("prodat not specified"),f.array!=null&&new t("array not specified");var d=[];if(d.push(new l(f.respid)),d.push(new i(f.prodat)),d.push(new _SingleResponseList(f.array)),f.ext!=null){var E=new s(f.ext);d.push(new a({tag:"a1",explicit:!0,obj:E}))}var p=new n({array:d});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(f){this.params=f},e!==void 0&&this.setByParam(e)};he(g.asn1.ocsp.ResponseData,g.asn1.ASN1Object);g.asn1.ocsp.ResponderID=function(e){g.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=g,r=t.asn1,n=r.ASN1Util.newObject,i=r.x509.X500Name,a=t.lang.String.isHex,s=Error;this.params=null,this.tohex=function(){var u=this.params;if(u.key!=null){var l=null;if(typeof u.key=="string"){if(a(u.key)&&(l=u.key),u.key.match(/-----BEGIN CERTIFICATE/)){var f=new je(u.key),d=f.getExtSubjectKeyIdentifier();d!=null&&(l=d.kid.hex)}}else if(u.key instanceof je){var d=u.key.getExtSubjectKeyIdentifier();d!=null&&(l=d.kid.hex)}if(l==null)throw new s("wrong key member value");var E=n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:l}}}});return E.tohex()}else if(u.name!=null){var p=null;if(typeof u.name=="string"&&u.name.match(/-----BEGIN CERTIFICATE/)){var f=new je(u.name);p=f.getSubject()}else u.name instanceof je?p=u.name.getSubject():typeof u.name=="object"&&(u.name.array!=null||u.name.str!=null)&&(p=u.name);if(p==null)throw new s("wrong name member value");var E=n({tag:{tag:"a1",explicit:!0,obj:new i(p)}});return E.tohex()}throw new s("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!==void 0&&this.setByParam(e)};he(g.asn1.ocsp.ResponderID,g.asn1.ASN1Object);g.asn1.ocsp.SingleResponseList=function(e){g.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=g.asn1,r=t.DERSequence,n=t.ocsp.SingleResponse;this.params=null,this.tohex=function(){var i=this.params;if(typeof i!="object"||i.length==null)throw new Error("params not specified properly");for(var a=[],s=0;s<i.length;s++)a.push(new n(i[s]));var u=new r({array:a});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(i){this.params=i},e!==void 0&&this.setByParam(e)};he(g.asn1.ocsp.SingleResponseList,g.asn1.ASN1Object);g.asn1.ocsp.SingleResponse=function(e){var t=Error,r=g,n=r.asn1,i=n.DERSequence,a=n.DERGeneralizedTime,s=n.DERTaggedObject,u=n.ocsp,l=u.CertID,f=u.CertStatus,d=n.x509,E=d.Extensions;u.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params,h=[];if(p.certid==null)throw new t("certid unspecified");if(p.status==null)throw new t("status unspecified");if(p.thisupdate==null)throw new t("thisupdate unspecified");if(h.push(new l(p.certid)),h.push(new f(p.status)),h.push(new a(p.thisupdate)),p.nextupdate!=null){var A=new a(p.nextupdate);h.push(new s({tag:"a0",explicit:!0,obj:A}))}if(p.ext!=null){var m=new E(p.ext);h.push(new s({tag:"a1",explicit:!0,obj:m}))}var S=new i({array:h});return S.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(p){this.params=p},e!==void 0&&this.setByParam(e)};he(g.asn1.ocsp.SingleResponse,g.asn1.ASN1Object);g.asn1.ocsp.CertID=function(e){var t=g,r=t.asn1,n=r.DEROctetString,i=r.DERInteger,a=r.DERSequence,s=r.x509,u=s.AlgorithmIdentifier,l=r.ocsp,f=l.DEFAULT_HASH,d=t.crypto,E=d.Util.hashHex,p=je,h=Ae,A=h.getVbyList;l.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(m,S,w,y){y==null&&(y=this.DEFAULT_HASH),this.params={alg:y,issname:m,isskey:S,sbjsn:w}},this.setByCert=function(m,S,w){w==null&&(w=this.DEFAULT_HASH),this.params={alg:w,issuerCert:m,subjectCert:S}},this.getParamByCerts=function(m,S,w){w==null&&(w=this.DEFAULT_HASH);var y=new p(m),_=new p(S),B=E(y.getSubjectHex(),w),D=y.getPublicKeyHex(),j=E(A(D,0,[1],"03",!0),w),q=_.getSerialNumberHex(),F={alg:w,issname:B,isskey:j,sbjsn:q};return F},this.tohex=function(){if(typeof this.params!="object")throw new Error("params not set");var m=this.params,S,w,y,_;if(m.alg==null?_=this.DEFAULT_HASH:_=m.alg,m.issuerCert!=null&&m.subjectCert!=null){var B=this.getParamByCerts(m.issuerCert,m.subjectCert,_);S=B.issname,w=B.isskey,y=B.sbjsn}else if(m.issname!=null&&m.isskey!=null&&m.sbjsn!=null)S=m.issname,w=m.isskey,y=m.sbjsn;else throw new Error("required param members not defined");var D=new u({name:_}),j=new n({hex:S}),q=new n({hex:w}),F=new i({hex:y}),P=new a({array:[D,j,q,F]});return this.hTLV=P.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};he(g.asn1.ocsp.CertID,g.asn1.ASN1Object);g.asn1.ocsp.CertStatus=function(e){g.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(t.status=="good")return"8000";if(t.status=="unknown")return"8200";if(t.status=="revoked"){var r=[{gentime:{str:t.time}}];t.reason!=null&&r.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var n={tag:"a1",explicit:!1,obj:{seq:r}};return g.asn1.ASN1Util.newObject({tag:n}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},e!==void 0&&this.setByParam(e)};he(g.asn1.ocsp.CertStatus,g.asn1.ASN1Object);g.asn1.ocsp.Request=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.ocsp;if(i.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var s=[];if(this.dReqCert===null)throw"reqCert not set";s.push(this.dReqCert);var u=new n({array:s});return this.hTLV=u.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},typeof e<"u"){var a=new i.CertID(e);this.dReqCert=a}};he(g.asn1.ocsp.Request,g.asn1.ASN1Object);g.asn1.ocsp.TBSRequest=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.ocsp;i.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(a){for(var s=[],u=0;u<a.length;u++){var l=new i.Request(a[0]);s.push(l)}this.dRequestList=s},this.tohex=function(){var a=[];if(this.version!==0)throw"not supported version: "+this.version;if(this.dRequestorName!==null)throw"requestorName not supported";var s=new n({array:this.dRequestList});if(a.push(s),this.dRequestExt!==null)throw"requestExtensions not supported";var u=new n({array:a});return this.hTLV=u.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0&&this.setRequestListByParam(e.reqList)};he(g.asn1.ocsp.TBSRequest,g.asn1.ASN1Object);g.asn1.ocsp.OCSPRequest=function(e){var t=g,r=t.asn1,n=r.DERSequence,i=r.ocsp;if(i.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var s=[];if(this.dTbsRequest!==null)s.push(this.dTbsRequest);else throw"tbsRequest not set";if(this.dOptionalSignature!==null)throw"optionalSignature not supported";var u=new n({array:s});return this.hTLV=u.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0){var a=new i.TBSRequest(e);this.dTbsRequest=a}};he(g.asn1.ocsp.OCSPRequest,g.asn1.ASN1Object);g.asn1.ocsp.OCSPUtil={};g.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,r){var n=g,i=n.asn1,a=i.ocsp;r===void 0&&(r=a.DEFAULT_HASH);var s={alg:r,issuerCert:e,subjectCert:t},u=new a.OCSPRequest({reqList:[s]});return u.tohex()};g.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=Ae,r=t.getVbyList,n=t.getVbyListEx,i=t.getIdxbyList,a=t.getIdxbyListEx,s=t.getV,u={};try{var l=n(e,0,[0],"0a");u.responseStatus=parseInt(l,16)}catch{}if(u.responseStatus!==0)return u;try{var f=i(e,0,[1,0,1,0,0,2,0,1]);e.substr(f,2)==="80"?u.certStatus="good":e.substr(f,2)==="a1"?(u.certStatus="revoked",u.revocationTime=Rt(r(e,f,[0]))):e.substr(f,2)==="82"&&(u.certStatus="unknown")}catch{}try{var d=i(e,0,[1,0,1,0,0,2,0,2]);u.thisUpdate=Rt(s(e,d))}catch{}try{var E=i(e,0,[1,0,1,0,0,2,0,3]);e.substr(E,2)==="a0"&&(u.nextUpdate=Rt(r(e,E,[0])))}catch{}return u};g.asn1.ocsp.OCSPParser=function(){var e=Error,t=je,r=new t,n=Ae,i=n.getV,a=n.getTLV,s=n.getIdxbyList,u=n.getVbyList,l=n.getTLVbyList,f=n.getVbyListEx,d=n.getTLVbyListEx,E=n.getChildIdx;this.getOCSPRequest=function(p){var h=E(p,0);if(h.length!=1&&h.length!=2)throw new e("wrong number elements: "+h.length);var A=this.getTBSRequest(a(p,h[0]));return A},this.getTBSRequest=function(p){var h={},A=d(p,0,[0],"30");h.array=this.getRequestList(A);var m=d(p,0,["[2]",0],"30");return m!=null&&(h.ext=r.getExtParamArray(m)),h},this.getRequestList=function(p){for(var h=[],A=E(p,0),m=0;m<A.length;m++){var p=a(p,A[m]);h.push(this.getRequest(p))}return h},this.getRequest=function(p){var h=E(p,0);if(h.length!=1&&h.length!=2)throw new e("wrong number elements: "+h.length);var A=this.getCertID(a(p,h[0]));if(h.length==2){var m=s(p,0,[1,0]);A.ext=r.getExtParamArray(a(p,m))}return A},this.getCertID=function(p){var h=E(p,0);if(h.length!=4)throw new e("wrong number elements: "+h.length);var A=new t,m={};return m.alg=A.getAlgorithmIdentifierName(a(p,h[0])),m.issname=i(p,h[1]),m.isskey=i(p,h[2]),m.sbjsn=i(p,h[3]),m},this.getOCSPResponse=function(p){var h=E(p,0),A,m=i(p,h[0]),S=parseInt(m);if(h.length==1)return{resstatus:S};var w=l(p,0,[1,0]);return A=this.getResponseBytes(w),A.resstatus=S,A},this.getResponseBytes=function(p){var h=E(p,0),A,m=l(p,0,[1,0]);A=this.getBasicOCSPResponse(m);var S=i(p,h[0]);return A.restype=g.asn1.x509.OID.oid2name(Kf(S)),A},this.getBasicOCSPResponse=function(p){var h=E(p,0),A;A=this.getResponseData(a(p,h[0]));var m=new je;A.alg=m.getAlgorithmIdentifierName(a(p,h[1]));var S=i(p,h[2]);A.sighex=S.substr(2);var w=f(p,0,["[0]"]);if(w!=null){for(var y=E(w,0),_=[],B=0;B<y.length;B++){var D=a(w,y[B]);_.push(D)}A.certs=_}return A},this.getResponseData=function(p){var h=E(p,0),A=h.length,m={},S=0;p.substr(h[0],2)=="a0"&&S++,m.respid=this.getResponderID(a(p,h[S++]));var w=i(p,h[S++]);if(m.prodat=Rt(w),m.array=this.getSingleResponseList(a(p,h[S++])),p.substr(h[A-1],2)=="a1"){var y=l(p,h[A-1],[0]),_=new je;m.ext=_.getExtParamArray(y)}return m},this.getResponderID=function(p){var h={};if(p.substr(0,2)=="a2"){var A=u(p,0,[0]);h.key=A}if(p.substr(0,2)=="a1"){var m=l(p,0,[0]),S=new je;h.name=S.getX500Name(m)}return h},this.getSingleResponseList=function(p){for(var h=E(p,0),A=[],m=0;m<h.length;m++){var S=this.getSingleResponse(a(p,h[m]));A.push(S)}return A},this.getSingleResponse=function(p){var h=E(p,0),A={},m=this.getCertID(a(p,h[0]));A.certid=m;var S=this.getCertStatus(a(p,h[1]));if(A.status=S,p.substr(h[2],2)=="18"){var w=i(p,h[2]);A.thisupdate=Rt(w)}for(var y=3;y<h.length;y++){if(p.substr(h[y],2)=="a0"){var _=u(p,h[y],[0],"18");A.nextupdate=Rt(_)}if(p.substr(h[y],2)=="a1"){var B=new je,D=l(p,0,[y,0]);A.ext=B.getExtParamArray(D)}}return A},this.getCertStatus=function(p){var h={};if(p=="8000")return{status:"good"};if(p=="8200")return{status:"unknown"};if(p.substr(0,2)=="a1"){h.status="revoked";var A=u(p,0,[0]),m=Rt(A);h.time=m}return h}};var g;(typeof g>"u"||!g)&&(g={});(typeof g.lang>"u"||!g.lang)&&(g.lang={});g.lang.String=function(){};function yv(e){for(var t=new Array,r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Sv(e){for(var t="",r=0;r<e.length;r++)t=t+String.fromCharCode(e[r]);return t}function Lf(e){for(var t="",r=0;r<e.length;r++){var n=e[r].toString(16);n.length==1&&(n="0"+n),t=t+n}return t}function In(e){return Lf(yv(e))}function s8(e){return Is(In(e))}function a8(e){return wu(Is(In(e)))}function o8(e){return Sv(gv(jc(e)))}function wu(e){return e=e.replace(/\=/g,""),e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}function jc(e){return e.length%4==2?e=e+"==":e.length%4==3&&(e=e+"="),e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/"),e}function Er(e){return e.length%2==1&&(e="0"+e),wu(Is(e))}function qt(e){return Au(jc(e))}var Hc,Si;typeof Buffer=="function"?(Hc=function(e){return wu(Buffer.from(e,"utf8").toString("base64"))},Si=function(e){return Buffer.from(jc(e),"base64").toString("utf8")}):(Hc=function(e){return Er(Mf(qf(e)))},Si=function(e){return decodeURIComponent(jf(qt(e)))});function u8(e){return Is(Mf(qf(e)))}function c8(e){return decodeURIComponent(jf(Au(e)))}function Uf(e){return Mf(qf(e)).toLowerCase()}function Rt(e){try{return decodeURIComponent(jf(e))}catch{return null}}function l8(e){return Rt(f8(e))}function f8(e){for(var t=e.match(/.{1,2}/g),r=[],n=0;n<t.length;n++){var i=parseInt(t[n],16);161<=i&&i<=191?(r.push("c2"),r.push(t[n])):192<=i&&i<=255?(r.push("c3"),r.push((i-64).toString(16))):r.push(t[n])}return r.join("")}function $n(e){for(var t="",r=0;r<e.length-1;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t}function qi(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function Md(e){return Is(e)}function h8(e){return Hf(Md(e),64)}function Hf(e,t){return e=e.replace(new RegExp("(.{"+t+"})","g"),`$1\r
`),e=e.replace(/\s+$/,""),e}function bv(e){var t=e.replace(/[^0-9A-Za-z\/+=]*/g,""),r=Au(t);return r}function p8(e,t){return"-----BEGIN "+t+`-----\r
`+Hf(e,64)+`\r
-----END `+t+`-----\r
`}function Qr(e,t){return"-----BEGIN "+t+`-----\r
`+Hf(Md(e),64)+`\r
-----END `+t+`-----\r
`}function Xt(e,t){if(e.indexOf("-----BEGIN ")==-1)throw new Error("can't find PEM header");return t!==void 0?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),""),e=e.replace(new RegExp("-----END "+t+"-----[^]*$"),"")):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,""),e=e.replace(/-----END [^-]+-----[^]*$/,"")),bv(e)}function d8(e){return e.indexOf("-----BEGIN ")==-1||e.indexOf("-----END ")==-1?null:(e=e.replace(/^[\s\S]*?-----BEGIN [^-]+-----/m,""),e=e.replace(/-----END [\s\S]+$/m,""),e=e.replace(/\s+/g,""),e.match(/^[0-9a-zA-Z+/=]+$/)?e:null)}function g8(e){if(e.length%2!=0)throw"input is not even length";if(e.match(/^[0-9A-Fa-f]+$/)==null)throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),r=new DataView(t),n=0;n<e.length/2;n++)r.setUint8(n,parseInt(e.substr(n*2,2),16));return t}function m8(e){for(var t="",r=new DataView(e),n=0;n<e.byteLength;n++)t+=("00"+r.getUint8(n).toString(16)).slice(-2);return t}function jd(e){var t,r,n,i,a,s,u,l,f,d,E,p;if(e=_v(e),p=e.match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/),p)return t=parseInt(p[1]),r=parseInt(p[2])-1,n=parseInt(p[3]),i=parseInt(p[4]),a=parseInt(p[5]),s=parseInt(p[6]),u=0,d=p[7],d!==""&&(E=(d.substr(1)+"00").substr(0,3),u=parseInt(E)),Date.UTC(t,r,n,i,a,s,u);throw new Error("unsupported zulu format: "+e)}function v8(e){var t=new Date(e),r=("0000"+t.getUTCFullYear()).slice(-4),n=("00"+(t.getUTCMonth()+1)).slice(-2),i=("00"+t.getUTCDate()).slice(-2),a=("00"+t.getUTCHours()).slice(-2),s=("00"+t.getUTCMinutes()).slice(-2),u=("00"+t.getUTCSeconds()).slice(-2),l=("000"+t.getUTCMilliseconds()).slice(-3);return l=l.replace(/0+$/,""),l=l!=""?"."+l:l,r+n+i+a+s+u+l+"Z"}function Cv(e){return Math.round(jd(e)/1e3)}function E8(e){return new Date(jd(e))}function w8(e,t,r){var n,i=e.getUTCFullYear();if(t){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;n=(""+i).slice(-2)}else n=("000"+i).slice(-4);if(n+=("0"+(e.getUTCMonth()+1)).slice(-2),n+=("0"+e.getUTCDate()).slice(-2),n+=("0"+e.getUTCHours()).slice(-2),n+=("0"+e.getUTCMinutes()).slice(-2),n+=("0"+e.getUTCSeconds()).slice(-2),r){var a=e.getUTCMilliseconds();a!==0&&(a=("00"+a).slice(-3),a=a.replace(/0+$/g,""),n+="."+a)}return n+="Z",n}function _v(e){return e.match(/^[0-9]{12}Z$/)||e.match(/^[0-9]{12}[.][0-9]*Z$/)?e.match(/^[0-4]/)?"20"+e:"19"+e:e}function Mf(e){return e.replace(/%/g,"")}function jf(e){return e.replace(/(..)/g,"%$1")}function Od(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;e=e.toLowerCase();var r=e.split(":").length-1;if(r<2)throw t;var n=":".repeat(7-r+2);e=e.replace("::",n);var i=e.split(":");if(i.length!=8)throw t;for(var a=0;a<8;a++)i[a]=("0000"+i[a]).slice(-4);return i.join("")}function xd(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+e);e=e.toLowerCase();var t=e.match(/.{1,4}/g);t=t.map(function(i){return i.replace(/^0+/,"")}),t=t.map(function(i){return i==""?"0":i}),e=":"+t.join(":")+":";var r=e.match(/:(0:){2,}/g);if(r==null)return e.slice(1,-1);var n=r.sort().slice(-1)[0];return e=e.replace(n.substr(0,n.length-1),":"),e.substr(0,2)!="::"&&(e=e.substr(1)),e.substr(-2,2)!="::"&&(e=e.substr(0,e.length-1)),e}function Tf(e){var t=new Error("malformed hex value");if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(e.length==8){var r;try{return r=parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16),r}catch{throw t}}else if(e.length==16)try{return Tf(e.substr(0,8))+"/"+pv(e.substr(8))}catch{throw t}else{if(e.length==32)return xd(e);if(e.length==64){try{return xd(e.substr(0,32))+"/"+pv(e.substr(32))}catch{throw t}return}else return e}}function pv(e){var t=new Error("malformed mask"),r;try{r=new ee(e,16).toString(2)}catch{throw t}if(!r.match(/^1*0*$/))throw t;return r.replace(/0+$/,"").length}function qd(e){var t=new Error("malformed IP address");if(e=e.toLowerCase(e),!e.match(/^[0-9a-f.:/]+$/))throw t;if(e.match(/^[0-9.]+$/)){var r=e.split(".");if(r.length!==4)throw t;var n="";try{for(var i=0;i<4;i++){var a=parseInt(r[i]);n+=("0"+a.toString(16)).slice(-2)}return n}catch{throw t}}else if(e.match(/^[0-9.]+\/[0-9]+$/)){var s=e.split("/");return qd(s[0])+dv(parseInt(s[1]),32)}else{if(e.match(/^[0-9a-f:]+$/)&&e.indexOf(":")!==-1)return Od(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&e.indexOf(":")!==-1){var s=e.split("/");return Od(s[0])+dv(parseInt(s[1]),128)}else throw t}}function dv(e,t){if(t==32&&e==0)return"00000000";if(t==128&&e==0)return"00000000000000000000000000000000";var r=Array(e+1).join("1")+Array(t-e+1).join("0");return new ee(r,2).toString(16)}function Kd(e){function t(i){var a=parseInt(i.substr(0,2),16),s=parseInt(i.substr(2),16);if(a==0&s<128)return String.fromCharCode(s);if(a<8){var u=192|(a&7)<<3|(s&192)>>6,l=128|s&63;return Rt(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 Rt(u.toString(16)+l.toString(16)+f.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function qf(e){for(var t=encodeURIComponent(e),r="",n=0;n<t.length;n++)t[n]=="%"?(r=r+t.substr(n,3),n=n+2):r=r+"%"+In(t[n]);return r}function A8(e){return e=e.replace(/\r\n/mg,`
`),e}function y8(e){return e=e.replace(/\r\n/mg,`
`),e=e.replace(/\n/mg,`\r
`),e}g.lang.String.isInteger=function(e){return e.match(/^[0-9]+$/)?!0:!!e.match(/^-[0-9]+$/)};g.lang.String.isHex=function(e){return Fv(e)};function Fv(e){return!!(e.length%2==0&&(e.match(/^[0-9a-f]+$/)||e.match(/^[0-9A-F]+$/)))}g.lang.String.isBase64=function(e){return e=e.replace(/\s+/g,""),!!(e.match(/^[0-9A-Za-z+\/]+={0,3}$/)&&e.length%4==0)};g.lang.String.isBase64URL=function(e){return e.match(/[+/=]/)?!1:(e=jc(e),g.lang.String.isBase64(e))};function Vd(e){return!!e.match(/^[0-9A-Za-z-_.]+$/)}g.lang.String.isIntegerArray=function(e){return e=e.replace(/\s+/g,""),!!e.match(/^\[[0-9,]+\]$/)};g.lang.String.isPrintable=function(e){return e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)!==null};g.lang.String.isIA5=function(e){return e.match(/^[\x20-\x21\x23-\x7f]*$/)!==null};g.lang.String.isMail=function(e){return e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)!==null};function Nd(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function S8(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||255<a)throw"integer not in range 0-255";var s=("00"+a.toString(16)).slice(-2);return s}).join("");return t}catch(r){throw"malformed integer array string: "+r}}var b8=function(e,t){var r=e.length;e.length>t.length&&(r=t.length);for(var n=0;n<r;n++)if(e.charCodeAt(n)!=t.charCodeAt(n))return n;return e.length!=t.length?r:-1};function Iv(e){var t=function(u){var l=u.toString(16);return l.length==1&&(l="0"+l),l},r=function(u){var l="",f=parseInt(u,10),d=f.toString(2),E=7-d.length%7;E==7&&(E=0);for(var p="",h=0;h<E;h++)p+="0";d=p+d;for(var h=0;h<d.length-1;h+=7){var A=d.substr(h,7);h!=d.length-7&&(A="1"+A),l+=t(parseInt(A,2))}return l};try{if(!e.match(/^[0-9.]+$/))return null;var n="",i=e.split("."),a=parseInt(i[0],10)*40+parseInt(i[1],10);n+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n}catch{return null}}function Kf(e){if(!Fv(e))return null;try{var t=[],r=e.substr(0,2),n=parseInt(r,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var i=e.substr(2),a=[],s=0;s<i.length/2;s++)a.push(parseInt(i.substr(s*2,2),16));for(var u=[],l="",s=0;s<a.length;s++)a[s]&128?l=l+Of((a[s]&127).toString(2),7):(l=l+Of((a[s]&127).toString(2),7),u.push(new String(parseInt(l,2))),l="");var f=t.join(".");return u.length>0&&(f=f+"."+u.join(".")),f}catch{return null}}function $v(e){var t=new ee(String(e),10);return qc(t)}function qc(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<n;a++)i+="f";var s=new ee(i,16),u=s.xor(e).add(ee.ONE);return t=u.toString(16).replace(/^-/,""),t}var Of=function(e,t,r){return r==null&&(r="0"),e.length>=t?e:new Array(t-e.length+1).join(r)+e};function Dv(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 Bv(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+Of("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function Rv(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<t)return null;for(var r=e.substr(2),n="",i=0;i<r.length;i+=2){var a=r.substr(i,2),s=parseInt(a,16).toString(2);s=("0000000"+s).slice(-8),n+=s}return n.substr(0,n.length-t)}catch{return null}}function C8(e){if(typeof e!="string"||e.match(/^[01]+$/)==null)return null;try{var t=parseInt(e,2);return Bv(t)}catch{return null}}function xf(e,t){for(var r=0,n=0;n<e.length;n++)r|=1<<t[e[n]];for(var i=r.toString(2),a="",n=i.length-1;n>=0;n--)a+=i[n];return a}function Nt(e,n,r){if(typeof e=="object"){for(var n=String(n).split("."),i=0;i<n.length&&e;i++){var a=n[i];a.match(/^[0-9]+$/)&&(a=parseInt(a)),e=e[a]}return e||e===!1?e:r}}function he(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}(typeof g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.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:Ce.algo.MD5,sha1:Ce.algo.SHA1,sha224:Ce.algo.SHA224,sha256:Ce.algo.SHA256,sha384:Ce.algo.SHA384,sha512:Ce.algo.SHA512,ripemd160:Ce.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<l;f+=2)u+="ff";var d=a+u+s;return d},this.hashString=function(e,t){var r=new g.crypto.MessageDigest({alg:t});return r.digestString(e)},this.hashHex=function(e,t){var r=new g.crypto.MessageDigest({alg:t});return r.digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof We||e instanceof g.crypto.DSA||e instanceof g.crypto.ECDSA}};g.crypto.Util.md5=function(e){var t=new g.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return t.digestString(e)};g.crypto.Util.ripemd160=function(e){var t=new g.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return t.digestString(e)};g.crypto.Util.SECURERANDOMGEN=new bu;g.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return g.crypto.Util.SECURERANDOMGEN.nextBytes(t),Lf(t)};g.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new ee(g.crypto.Util.getRandomHexOfNbytes(e),16)};g.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,r=(e-t)/8,n=new Array(r+1);return g.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],Lf(n)};g.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new ee(g.crypto.Util.getRandomHexOfNbits(e),16)};g.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var r=g.crypto.Util.getRandomBigIntegerOfNbits(t);if(e.compareTo(r)!=-1)return r}};g.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var r=e.compareTo(t);if(r==1)throw"biMin is greater than biMax";if(r==0)return e;var n=t.subtract(e),i=g.crypto.Util.getRandomBigIntegerZeroToMax(n);return i.add(e)};g.crypto.MessageDigest=function(e){var t=null,r=null,n=null;this.setAlgAndProvider=function(i,a){if(i=g.crypto.MessageDigest.getCanonicalAlgName(i),i!==null&&a===void 0&&(a=g.crypto.Util.DEFAULTPROVIDER[i]),":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)!=-1&&a=="cryptojs"){try{this.md=g.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i].create()}catch(s){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+s}this.updateString=function(s){this.md.update(s)},this.updateHex=function(s){var u=Ce.enc.Hex.parse(s);this.md.update(u)},this.digest=function(){var s=this.md.finalize();return s.toString(Ce.enc.Hex)},this.digestString=function(s){return this.updateString(s),this.digest()},this.digestHex=function(s){return this.updateHex(s),this.digest()}}if(":sha256:".indexOf(i)!=-1&&a=="sjcl"){try{this.md=new sjcl.hash.sha256}catch(s){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+s}this.updateString=function(s){this.md.update(s)},this.updateHex=function(s){var u=sjcl.codec.hex.toBits(s);this.md.update(u)},this.digest=function(){var s=this.md.finalize();return sjcl.codec.hex.fromBits(s)},this.digestString=function(s){return this.updateString(s),this.digest()},this.digestHex=function(s){return this.updateHex(s),this.digest()}}},this.updateString=function(i){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(i){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(i){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(i){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},e!==void 0&&e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0&&(this.provName=g.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))};g.crypto.MessageDigest.getCanonicalAlgName=function(e){return typeof e=="string"&&(e=e.toLowerCase(),e=e.replace(/-/,"")),e};g.crypto.MessageDigest.getHashLength=function(e){var t=g.crypto.MessageDigest,r=t.getCanonicalAlgName(e);if(t.HASHLENGTH[r]===void 0)throw"not supported algorithm: "+e;return t.HASHLENGTH[r]};g.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20};g.crypto.Mac=function(e){var t=null,r=null,n=null,i=null,a=null;this.setAlgAndProvider=function(s,u){if(s=s.toLowerCase(),s==null&&(s="hmacsha1"),s=s.toLowerCase(),s.substr(0,4)!="hmac")throw"setAlgAndProvider unsupported HMAC alg: "+s;u===void 0&&(u=g.crypto.Util.DEFAULTPROVIDER[s]),this.algProv=s+"/"+u;var l=s.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(l)!=-1&&u=="cryptojs"){try{var f=g.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[l];this.mac=Ce.algo.HMAC.create(f,this.pass)}catch(d){throw"setAlgAndProvider hash alg set fail hashAlg="+l+"/"+d}this.updateString=function(d){this.mac.update(d)},this.updateHex=function(d){var E=Ce.enc.Hex.parse(d);this.mac.update(E)},this.doFinal=function(){var d=this.mac.finalize();return d.toString(Ce.enc.Hex)},this.doFinalString=function(d){return this.updateString(d),this.doFinal()},this.doFinalHex=function(d){return this.updateHex(d),this.doFinal()}}},this.updateString=function(s){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(s){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(s){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(s){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(s){if(typeof s=="string"){var u=s;(s.length%2==1||!s.match(/^[0-9A-Fa-f]+$/))&&(u=qi(s)),this.pass=Ce.enc.Hex.parse(u);return}if(typeof s!="object")throw"KJUR.crypto.Mac unsupported password type: "+s;var u=null;if(s.hex!==void 0){if(s.hex.length%2!=0||!s.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+s.hex;u=s.hex}if(s.utf8!==void 0&&(u=Uf(s.utf8)),s.rstr!==void 0&&(u=qi(s.rstr)),s.b64!==void 0&&(u=Au(s.b64)),s.b64u!==void 0&&(u=qt(s.b64u)),u==null)throw"KJUR.crypto.Mac unsupported password type: "+s;this.pass=Ce.enc.Hex.parse(u)},e!==void 0&&(e.pass!==void 0&&this.setPassword(e.pass),e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0&&(this.provName=g.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))};g.crypto.Signature=function(e){var t=null,r=null,n=null,i=null,a=null,s=null,u=null,l=null,f=null,d=null,E=-1,p=null,h=null,A=null,m=null,S=null;if(this._setAlgNames=function(){var w=this.algName.match(/^(.+)with(.+)$/);w&&(this.mdAlgName=w[1].toLowerCase(),this.pubkeyAlgName=w[2].toLowerCase(),this.pubkeyAlgName=="rsaandmgf1"&&this.mdAlgName=="sha"&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(w,y){for(var _="",B=y/4-w.length,D=0;D<B;D++)_=_+"0";return _+w},this.setAlgAndProvider=function(w,y){if(this._setAlgNames(),y!="cryptojs/jsrsa")throw new Error("provider not supported: "+y);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)!=-1){try{this.md=new g.crypto.MessageDigest({alg:this.mdAlgName})}catch(_){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+_)}this.init=function(_,B){var D=null;try{B===void 0?D=ct.getKey(_):D=ct.getKey(_,B)}catch(j){throw"init failed:"+j}if(D.isPrivate===!0)this.prvKey=D,this.state="SIGN";else if(D.isPublic===!0)this.pubKey=D,this.state="VERIFY";else throw"init failed.:"+D},this.updateString=function(_){this.md.updateString(_)},this.updateHex=function(_){this.md.updateHex(_)},this.sign=function(){if(this.sHashHex=this.md.digest(),this.prvKey===void 0&&this.ecprvhex!==void 0&&this.eccurvename!==void 0&&g.crypto.ECDSA!==void 0&&(this.prvKey=new g.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof We&&this.pubkeyAlgName==="rsaandmgf1")this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof We&&this.pubkeyAlgName==="rsa")this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof g.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else if(this.prvKey instanceof g.crypto.DSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;return this.hSign},this.signString=function(_){return this.updateString(_),this.sign()},this.signHex=function(_){return this.updateHex(_),this.sign()},this.verify=function(_){if(this.sHashHex=this.md.digest(),this.pubKey===void 0&&this.ecpubhex!==void 0&&this.eccurvename!==void 0&&g.crypto.ECDSA!==void 0&&(this.pubKey=new g.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof We&&this.pubkeyAlgName==="rsaandmgf1")return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,_,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof We&&this.pubkeyAlgName==="rsa")return this.pubKey.verifyWithMessageHash(this.sHashHex,_);if(g.crypto.ECDSA!==void 0&&this.pubKey instanceof g.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,_);if(g.crypto.DSA!==void 0&&this.pubKey instanceof g.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,_);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(w,y){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(w){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(w){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(w){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(w){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(w){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,e!==void 0&&(e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0?this.provName=g.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),e.psssaltlen!==void 0&&(this.pssSaltLen=e.psssaltlen),e.prvkeypem!==void 0)){if(e.prvkeypas!==void 0)throw"both prvkeypem and prvkeypas parameters not supported";try{var t=ct.getKey(e.prvkeypem);this.init(t)}catch(w){throw"fatal error to load pem private key: "+w}}};g.crypto.Cipher=function(e){};g.crypto.Cipher.encrypt=function(e,t,r,n){if(Nt(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var i=t,a=e;Nt(n,"key")!=null&&(i=n.key),Nt(n,"enc")!=null&&(hEnc=n.enc);var s=Ce.enc.Hex.parse(i),u=Ce.enc.Hex.parse(a),l=Ce.enc.Hex.parse(n.iv),f;if(r=="des-EDE3-CBC")f=Ce.TripleDES.encrypt(u,s,{iv:l});else if(r=="aes128-CBC"||r=="aes256-CBC")f=Ce.AES.encrypt(u,s,{iv:l});else throw new Error("unsupported algorithm: "+r);return f+""}else throw new Error("Cipher.encrypt: unsupported key or algorithm")};g.crypto.Cipher.decrypt=function(e,t,r,n){if(Nt(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var i=t,a=e;Nt(n,"key")!=null&&(i=n.key),Nt(n,"enc")!=null&&(a=n.enc);var s=Ce.enc.Hex.parse(i),u=Ce.enc.Hex.parse(a),l=Ce.enc.Hex.parse(n.iv),f;if(r=="des-EDE3-CBC")f=Ce.TripleDES.decrypt({ciphertext:u},s,{iv:l});else if(r=="aes128-CBC"||r=="aes256-CBC")f=Ce.AES.decrypt({ciphertext:u},s,{iv:l});else throw new Error("unsupported algorithm: "+r);return Ce.enc.Hex.stringify(f)}else throw new Error("Cipher.decrypt: unsupported key or algorithm")};g.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};(typeof g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.crypto.ECDSA=function(e){var t="secp256r1",r=null,n=null,i=null,a=Error,s=ee,u=St,l=g.crypto.ECDSA,f=g.crypto.ECParameterDB,d=l.getName,E=Ae,p=E.getVbyListEx,h=E.isASN1HEX,A=new bu,m=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function S(w,y,_,B){for(var D=Math.max(y.bitLength(),B.bitLength()),j=w.add2D(_),q=w.curve.getInfinity(),F=D-1;F>=0;--F)q=q.twice2D(),q.z=s.ONE,y.testBit(F)?B.testBit(F)?q=q.add2D(j):q=q.add2D(w):B.testBit(F)&&(q=q.add2D(_));return q}this.getBigRandom=function(w){return new s(w.bitLength(),A).mod(w.subtract(s.ONE)).add(s.ONE)},this.setNamedCurve=function(w){this.ecparams=f.getByName(w),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=w},this.setPrivateKeyHex=function(w){this.isPrivate=!0,this.prvKeyHex=w},this.setPublicKeyHex=function(w){this.isPublic=!0,this.pubKeyHex=w},this.getPublicKeyXYHex=function(){var w=this.pubKeyHex;if(w.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var y=this.ecparams.keycharlen;if(w.length!==2+y*2)throw"malformed public key hex length";var _={};return _.x=w.substr(2,y),_.y=w.substr(2+y),_},this.getShortNISTPCurveName=function(){var w=this.curveName;return w==="secp256r1"||w==="NIST P-256"||w==="P-256"||w==="prime256v1"?"P-256":w==="secp384r1"||w==="NIST P-384"||w==="P-384"?"P-384":w==="secp521r1"||w==="NIST P-521"||w==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var w=this.ecparams.n,y=this.getBigRandom(w),_=this.ecparams.keycharlen,B=("0000000000"+y.toString(16)).slice(-_);this.setPrivateKeyHex(B);var D=this.generatePublicKeyHex();return{ecprvhex:B,ecpubhex:D}},this.generatePublicKeyHex=function(){var w=new s(this.prvKeyHex,16),y=this.ecparams.G.multiply(w),_=y.getX().toBigInteger(),B=y.getY().toBigInteger(),D=this.ecparams.keycharlen,j=("0000000000"+_.toString(16)).slice(-D),q=("0000000000"+B.toString(16)).slice(-D),F="04"+j+q;return this.setPublicKeyHex(F),F},this.signWithMessageHash=function(w){return this.signHex(w,this.prvKeyHex)},this.signHex=function(w,y){var _=new s(y,16),B=this.ecparams.n,D=new s(w.substring(0,this.ecparams.keycharlen),16);do var j=this.getBigRandom(B),q=this.ecparams.G,F=q.multiply(j),P=F.getX().toBigInteger().mod(B);while(P.compareTo(s.ZERO)<=0);var L=j.modInverse(B).multiply(D.add(_.multiply(P))).mod(B);return l.biRSSigToASN1Sig(P,L)},this.sign=function(w,y){var _=y,B=this.ecparams.n,D=s.fromByteArrayUnsigned(w);do var j=this.getBigRandom(B),q=this.ecparams.G,F=q.multiply(j),P=F.getX().toBigInteger().mod(B);while(P.compareTo(ee.ZERO)<=0);var L=j.modInverse(B).multiply(D.add(_.multiply(P))).mod(B);return this.serializeSig(P,L)},this.verifyWithMessageHash=function(w,y){return this.verifyHex(w,y,this.pubKeyHex)},this.verifyHex=function(w,y,_){try{var B,D,j=l.parseSigHex(y);B=j.r,D=j.s;var q=u.decodeFromHex(this.ecparams.curve,_),F=new s(w.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(F,B,D,q)}catch{return!1}},this.verify=function(w,y,_){var B,D;if(Bitcoin.Util.isArray(y)){var j=this.parseSig(y);B=j.r,D=j.s}else if(typeof y=="object"&&y.r&&y.s)B=y.r,D=y.s;else throw"Invalid value for signature";var q;if(_ instanceof St)q=_;else if(Bitcoin.Util.isArray(_))q=u.decodeFrom(this.ecparams.curve,_);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var F=s.fromByteArrayUnsigned(w);return this.verifyRaw(F,B,D,q)},this.verifyRaw=function(w,y,_,B){var D=this.ecparams.n,j=this.ecparams.G;if(y.compareTo(s.ONE)<0||y.compareTo(D)>=0||_.compareTo(s.ONE)<0||_.compareTo(D)>=0)return!1;var q=_.modInverse(D),F=w.multiply(q).mod(D),P=y.multiply(q).mod(D),L=j.multiply(F).add(B.multiply(P)),M=L.getX().toBigInteger().mod(D);return M.equals(y)},this.serializeSig=function(w,y){var _=w.toByteArraySigned(),B=y.toByteArraySigned(),D=[];return D.push(2),D.push(_.length),D=D.concat(_),D.push(2),D.push(B.length),D=D.concat(B),D.unshift(D.length),D.unshift(48),D},this.parseSig=function(w){var y;if(w[0]!=48)throw new Error("Signature not a valid DERSequence");if(y=2,w[y]!=2)throw new Error("First element in signature must be a DERInteger");var _=w.slice(y+2,y+2+w[y+1]);if(y+=2+w[y+1],w[y]!=2)throw new Error("Second element in signature must be a DERInteger");var B=w.slice(y+2,y+2+w[y+1]);y+=2+w[y+1];var D=s.fromByteArrayUnsigned(_),j=s.fromByteArrayUnsigned(B);return{r:D,s:j}},this.parseSigCompact=function(w){if(w.length!==65)throw"Signature has the wrong length";var y=w[0]-27;if(y<0||y>7)throw"Invalid signature type";var _=this.ecparams.n,B=s.fromByteArrayUnsigned(w.slice(1,33)).mod(_),D=s.fromByteArrayUnsigned(w.slice(33,65)).mod(_);return{r:B,s:D,i:y}},this.readPKCS5PrvKeyHex=function(w){if(h(w)===!1)throw new Error("not ASN.1 hex string");var y,_,B;try{y=p(w,0,["[0]",0],"06"),_=p(w,0,[1],"04");try{B=p(w,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=d(y),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(B),this.setPrivateKeyHex(_),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(w){if(h(w)===!1)throw new a("not ASN.1 hex string");var y,_,B,D;try{y=p(w,0,[1,0],"06"),_=p(w,0,[1,1],"06"),B=p(w,0,[2,0,1],"04");try{D=p(w,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new a("malformed PKCS#8 plain ECC private key")}if(this.curveName=d(_),this.curveName===void 0)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(D),this.setPrivateKeyHex(B),this.isPublic=!1},this.readPKCS8PubKeyHex=function(w){if(h(w)===!1)throw new a("not ASN.1 hex string");var y,_,B;try{y=p(w,0,[0,0],"06"),_=p(w,0,[0,1],"06"),B=p(w,0,[1],"03")}catch{throw new a("malformed PKCS#8 ECC public key")}if(this.curveName=d(_),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(B)},this.readCertPubKeyHex=function(w,y){if(h(w)===!1)throw new a("not ASN.1 hex string");var _,B;try{_=p(w,0,[0,5,0,1],"06"),B=p(w,0,[0,5,1],"03")}catch{throw new a("malformed X.509 certificate ECC public key")}if(this.curveName=d(_),this.curveName===null)throw new a("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(B)},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))};g.crypto.ECDSA.parseSigHex=function(e){var t=g.crypto.ECDSA.parseSigHexInHexRS(e),r=new ee(t.r,16),n=new ee(t.s,16);return{r,s:n}};g.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=Ae,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}};g.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=g.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};g.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 g.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};g.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new ee(e,16),n=new ee(t,16);return g.crypto.ECDSA.biRSSigToASN1Sig(r,n)};g.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=g.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t}),a=new r.DERSequence({array:[n,i]});return a.tohex()};g.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 g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.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,E,p,h,A){e[n]={};var m=r(a),S=r(s),w=r(u),y=r(l),_=r(f),B=new $s(m,S,w),D=B.decodePointHex("04"+d+E);e[n].name=n,e[n].keylen=i,e[n].keycharlen=Math.ceil(i/8)*2,e[n].curve=B,e[n].G=D,e[n].n=y,e[n].h=_,e[n].oid=h,e[n].info=A;for(var j=0;j<p.length;j++)t[p[j]]=n}};g.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field");g.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field");g.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field");g.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]);g.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]);g.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]);g.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]);g.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]);g.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]);g.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);(typeof g>"u"||!g)&&(g={});(typeof g.crypto>"u"||!g.crypto)&&(g.crypto={});g.crypto.DSA=function(){var e=Ae,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,E,p,h,A;d=new ee(a,16),E=new ee(s,16),p=new ee(u,16),typeof l=="string"&&l.length>1?h=new ee(l,16):h=null,A=new ee(f,16),this.setPrivate(d,E,p,h,A)},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,E,p;f=new ee(a,16),d=new ee(s,16),E=new ee(u,16),p=new ee(l,16),this.setPublic(f,d,E,p)},this.signWithMessageHash=function(a){var s=this.p,u=this.q,l=this.g,f=this.y,d=this.x,E=g.crypto.Util.getRandomBigIntegerMinToMax(ee.ONE.add(ee.ONE),u.subtract(ee.ONE)),p=a.substr(0,u.bitLength()/4),h=new ee(p,16),A=l.modPow(E,s).mod(u),m=E.modInverse(u).multiply(h.add(d.multiply(A))).mod(u),S=g.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:A}},{int:{bigint:m}}]});return S},this.verifyWithMessageHash=function(a,s){var u=this.p,l=this.q,f=this.g,d=this.y,E=this.parseASN1Signature(s),p=E[0],h=E[1],A=a.substr(0,l.bitLength()/4),m=new ee(A,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 S=h.modInverse(l),w=m.multiply(S).mod(l),y=p.multiply(S).mod(l),_=f.modPow(w,u).multiply(d.modPow(y,u)).mod(u).mod(l);return _.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 ct=function(){var e=function(m,S,w){return n(Ce.AES,m,S,w)},t=function(m,S,w){return n(Ce.TripleDES,m,S,w)},r=function(m,S,w){return n(Ce.DES,m,S,w)},n=function(m,S,w,y){var _=Ce.enc.Hex.parse(S),B=Ce.enc.Hex.parse(w),D=Ce.enc.Hex.parse(y),j={};j.key=B,j.iv=D,j.ciphertext=_;var q=m.decrypt(j,B,{iv:D});return Ce.enc.Hex.stringify(q)},i=function(m,S,w){return u(Ce.AES,m,S,w)},a=function(m,S,w){return u(Ce.TripleDES,m,S,w)},s=function(m,S,w){return u(Ce.DES,m,S,w)},u=function(m,S,w,y){var _=Ce.enc.Hex.parse(S),B=Ce.enc.Hex.parse(w),D=Ce.enc.Hex.parse(y),j=m.encrypt(_,B,{iv:D}),q=Ce.enc.Hex.parse(j.toString()),F=Ce.enc.Base64.stringify(q);return F},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(m){return l[m].proc},d=function(m){var S=Ce.lib.WordArray.random(m),w=Ce.enc.Hex.stringify(S);return w},E=function(m){var S={},w=m.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));w&&(S.cipher=w[1],S.ivsalt=w[2]);var y=m.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));y&&(S.type=y[1]);var _=-1,B=0;m.indexOf(`\r
\r
`)!=-1&&(_=m.indexOf(`\r
\r
`),B=2),m.indexOf(`
`)!=-1&&(_=m.indexOf(`
`),B=1);var D=m.indexOf("-----END");if(_!=-1&&D!=-1){var j=m.substring(_+B*2,D-B);j=j.replace(/\s+/g,""),S.data=j}return S},p=function(m,S,w){for(var y=w.substring(0,16),_=Ce.enc.Hex.parse(y),B=Ce.enc.Utf8.parse(S),D=l[m].keylen+l[m].ivlen,j="",q=null;;){var F=Ce.algo.MD5.create();if(q!=null&&F.update(q),F.update(B),F.update(_),q=F.finalize(),j=j+Ce.enc.Hex.stringify(q),j.length>=D*2)break}var P={};return P.keyhex=j.substr(0,l[m].keylen*2),P.ivhex=j.substr(l[m].keylen*2,l[m].ivlen*2),P},h=function(m,S,w,y){var _=Ce.enc.Base64.parse(m),B=Ce.enc.Hex.stringify(_),D=l[S].proc,j=D(B,w,y);return j},A=function(m,S,w,y){var _=l[S].eproc,B=_(m,w,y);return B};return{version:"1.0.0",parsePKCS5PEM:function(m){return E(m)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(m,S,w){return p(m,S,w)},decryptKeyB64:function(m,S,w,y){return h(m,S,w,y)},getDecryptedKeyHex:function(m,S){var w=E(m),y=w.type,_=w.cipher,B=w.ivsalt,D=w.data,j=p(_,S,B),q=j.keyhex,F=h(D,_,q,B);return F},getEncryptedPKCS5PEMFromPrvKeyHex:function(m,S,w,y,_){var L="";if((typeof y>"u"||y==null)&&(y="AES-256-CBC"),typeof l[y]>"u")throw new Error("KEYUTIL unsupported algorithm: "+y);if(typeof _>"u"||_==null){var B=l[y].ivlen,D=d(B);_=D.toUpperCase()}var j=p(y,w,_),q=j.keyhex,F=A(S,y,q,_),P=F.replace(/(.{64})/g,`$1\r
`),L="-----BEGIN "+m+` PRIVATE KEY-----\r
`;return L+=`Proc-Type: 4,ENCRYPTED\r
`,L+="DEK-Info: "+y+","+_+`\r
`,L+=`\r
`,L+=P,L+=`\r
-----END `+m+` PRIVATE KEY-----\r
`,L},getEncryptedPKCS8PEM:function(m,S,w){var y=this.getEncryptedPKCS8Hex(m,S,w);return Qr(y,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(m,S,w){var y;w==null||w==null?y={}:y=JSON.parse(JSON.stringify(w)),y.plain=m,this.initPBES2Param(y),this.encryptPBES2Param(y,S);var _=this.generatePBES2ASN1Param(y);return g.asn1.ASN1Util.newObject(_).tohex()},initPBES2Param:function(m){if(Nt(m,"encalg")==null&&(m.encalg="aes256-CBC"),Nt(m,"iter")==null&&(m.iter=2048),Nt(m,"prf")==null&&(m.prf="hmacWithSHA256"),Nt(m,"salt")==null&&(m.salt=Ce.enc.Hex.stringify(Ce.lib.WordArray.random(8))),Nt(m,"enciv")==null){var S;m.encalg=="des-EDE3-CBC"&&(S=8),m.encalg=="aes128-CBC"&&(S=16),m.encalg=="aes256-CBC"&&(S=16),m.enciv=Ce.enc.Hex.stringify(Ce.lib.WordArray.random(S))}},encryptPBES2Param:function(m,S){var w=ct.getDKFromPBES2Param(m,S);try{var y=g.crypto.Cipher.encrypt(m.plain,w,m.encalg,{iv:m.enciv})}catch{throw new Error("encrypt error: "+m.plain+" "+w+" "+m.encalg+" "+m.enciv)}m.enc=y},generatePBES2ASN1Param:function(m){var S={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:m.salt}},{int:{hex:$v(m.iter)}}]}]},{seq:[{oid:m.encalg},{octstr:{hex:m.enciv}}]}]}]},{octstr:{hex:m.enc}}]};return m.prf!="hmacWithSHA1"&&S.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:m.prf},{null:""}]}),S},parseHexOfEncryptedPKCS8:function(m){var S=Ae,w=S.getChildIdx,y=S.getV,_={},B=w(m,0);if(B.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+B.length);_.ciphertext=y(m,B[1]);var D=w(m,B[0]);if(D.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+D.length);if(y(m,D[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var j=w(m,D[1]);if(D.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+j.length);var q=w(m,j[1]);if(q.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length);if(y(m,q[0])!="2a864886f70d0307")throw"this only supports TripleDES";_.encryptionSchemeAlg="TripleDES",_.encryptionSchemeIV=y(m,q[1]);var F=w(m,j[0]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+F.length);if(y(m,F[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var P=w(m,F[1]);if(P.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+P.length);_.pbkdf2Salt=y(m,P[0]);var L=y(m,P[1]);try{_.pbkdf2Iter=parseInt(L,16)}catch{throw new Error("malformed format pbkdf2Iter: "+L)}return _},getPBKDF2KeyHexFromParam:function(m,S){var w=Ce.enc.Hex.parse(m.pbkdf2Salt),y=m.pbkdf2Iter,_=Ce.PBKDF2(S,w,{keySize:192/32,iterations:y}),B=Ce.enc.Hex.stringify(_);return B},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(m,S){var w=Xt(m,"ENCRYPTED PRIVATE KEY"),y=this.parseHexOfEncryptedPKCS8(w),_=ct.getPBKDF2KeyHexFromParam(y,S),B={};B.ciphertext=Ce.enc.Hex.parse(y.ciphertext);var D=Ce.enc.Hex.parse(_),j=Ce.enc.Hex.parse(y.encryptionSchemeIV),q=Ce.TripleDES.decrypt(B,D,{iv:j}),F=Ce.enc.Hex.stringify(q);return F},parsePBES2:function(m){var S=Ae.parse(m);if(Nt(S,"seq.0.seq.0.oid")!="pkcs5PBES2"||Nt(S,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var w=Nt(S,"seq.0.seq.1.seq.0.seq.1.seq");if(w==null)throw new Error("PBKDF2 parameter not found");var y=Nt(w,"0.octstr.hex"),_=Nt(w,"1.int.hex"),B=Nt(w,"2.seq.0.oid","hmacWithSHA1"),D=-1;try{D=parseInt(_,16)}catch{throw new Error("iter not proper value")}var j=Nt(S,"seq.0.seq.1.seq.1.seq.0.oid"),q=Nt(S,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),F=Nt(S,"seq.1.octstr.hex");if(j==null||q==null||F==null)throw new Error("encalg, enciv or enc is undefined");var P={salt:y,iter:D,prf:B,encalg:j,enciv:q,enc:F};return P},getDKFromPBES2Param:function(m,S){var w={hmacWithSHA1:Ce.algo.SHA1,hmacWithSHA224:Ce.algo.SHA224,hmacWithSHA256:Ce.algo.SHA256,hmacWithSHA384:Ce.algo.SHA384,hmacWithSHA512:Ce.algo.SHA512},y={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},_=w[m.prf];if(_==null)throw new Error("unsupported prf");var B=y[m.encalg];if(B==null)throw new Error("unsupported encalg");var D=Ce.enc.Hex.parse(m.salt),j=m.iter;try{var q=Ce.PBKDF2(S,D,{keySize:B,iterations:j,hasher:_});return Ce.enc.Hex.stringify(q)}catch(F){throw new Error("PBKDF2 error: "+F+" "+JSON.stringify(m)+" "+S)}},getPlainHexFromEncryptedPKCS8PEM:function(m,S){if(m.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var w=Xt(m),y;try{y=ct.parsePBES2(w)}catch(B){throw new Error("malformed PBES2 format: "+B.message)}var _=ct.getDKFromPBES2Param(y,S);return g.crypto.Cipher.decrypt(y.enc,_,y.encalg,{iv:y.enciv})},getKeyFromEncryptedPKCS8PEM:function(m,S){var w=this.getPlainHexFromEncryptedPKCS8PEM(m,S),y=this.getKeyFromPlainPrivatePKCS8Hex(w);return y},parsePlainPrivatePKCS8Hex:function(m){var S=Ae,w=S.getChildIdx,y=S.getV,_={};if(_.algparam=null,m.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var B=w(m,0);if(B.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(m.substr(B[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var D=w(m,B[1]);if(D.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(m.substr(D[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(_.algoid=y(m,D[0]),m.substr(D[1],2)=="06"&&(_.algparam=y(m,D[1])),m.substr(B[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return _.keyidx=S.getVidx(m,B[2]),_},getKeyFromPlainPrivatePKCS8PEM:function(m){var S=Xt(m,"PRIVATE KEY"),w=this.getKeyFromPlainPrivatePKCS8Hex(S);return w},getKeyFromPlainPrivatePKCS8Hex:function(m){var S=this.parsePlainPrivatePKCS8Hex(m),w;if(S.algoid=="2a864886f70d010101")w=new We;else if(S.algoid=="2a8648ce380401")w=new g.crypto.DSA;else if(S.algoid=="2a8648ce3d0201")w=new g.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return w.readPKCS8PrvKeyHex(m),w},_getKeyFromPublicPKCS8Hex:function(m){var S,w=Ae.getVbyList(m,0,[0,0],"06");if(w==="2a864886f70d010101")S=new We;else if(w==="2a8648ce380401")S=new g.crypto.DSA;else if(w==="2a8648ce3d0201")S=new g.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return S.readPKCS8PubKeyHex(m),S},parsePublicRawRSAKeyHex:function(m){var S=Ae,w=S.getChildIdx,y=S.getV,_={};if(m.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var B=w(m,0);if(B.length!=2)throw new Error("malformed RSA key(code:002)");if(m.substr(B[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(_.n=y(m,B[0]),m.substr(B[1],2)!="02")throw new Error("malformed RSA key(code:004)");return _.e=y(m,B[1]),_},parsePublicPKCS8Hex:function(m){var S=Ae,w=S.getChildIdx,y=S.getV,_={};_.algparam=null;var B=w(m,0);if(B.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+B.length);var D=B[0];if(m.substr(D,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var j=w(m,D);if(j.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(m.substr(j[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(_.algoid=y(m,j[0]),m.substr(j[1],2)=="06"?_.algparam=y(m,j[1]):m.substr(j[1],2)=="30"&&(_.algparam={},_.algparam.p=S.getVbyList(m,j[1],[0],"02"),_.algparam.q=S.getVbyList(m,j[1],[1],"02"),_.algparam.g=S.getVbyList(m,j[1],[2],"02")),m.substr(B[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return _.key=y(m,B[1]).substr(2),_}}}();ct.getKey=function(e,t,r){var n=Ae,i=n.getChildIdx,a=n.getV,s=n.getVbyList,u=g.crypto,l=u.ECDSA,f=u.DSA,d=We,E=Xt,p=ct;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(qt(e.n),qt(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(qt(e.n),qt(e.e),qt(e.d),qt(e.p),qt(e.q),qt(e.dp),qt(e.dq),qt(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(qt(e.n),qt(e.e),qt(e.d)),h}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var A=new l({curve:e.crv}),m=A.ecparams.keycharlen,S=("0000000000"+qt(e.x)).slice(-m),w=("0000000000"+qt(e.y)).slice(-m),y="04"+S+w;return A.setPublicKeyHex(y),A}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var A=new l({curve:e.crv}),m=A.ecparams.keycharlen,S=("0000000000"+qt(e.x)).slice(-m),w=("0000000000"+qt(e.y)).slice(-m),y="04"+S+w,_=("0000000000"+qt(e.d)).slice(-m);return A.setPublicKeyHex(y),A.setPrivateKeyHex(_),A}if(r==="pkcs5prv"){var B=e,n=Ae,D,h;if(D=i(B,0),D.length===9)h=new d,h.readPKCS5PrvKeyHex(B);else if(D.length===6)h=new f,h.readPKCS5PrvKeyHex(B);else if(D.length>2&&B.substr(D[1],2)==="04")h=new l,h.readPKCS5PrvKeyHex(B);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 je.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return je.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var j=Xt(e,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(j)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var q=E(e,"RSA PRIVATE KEY");return p.getKey(q,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var F=E(e,"DSA PRIVATE KEY"),P=s(F,0,[1],"02"),L=s(F,0,[2],"02"),M=s(F,0,[3],"02"),V=s(F,0,[4],"02"),W=s(F,0,[5],"02"),h=new f;return h.setPrivate(new ee(P,16),new ee(L,16),new ee(M,16),new ee(V,16),new ee(W,16)),h}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var q=E(e,"EC PRIVATE KEY");return p.getKey(q,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 G=p.getDecryptedKeyHex(e,t),z=new We;return z.readPKCS5PrvKeyHex(G),z}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var F=p.getDecryptedKeyHex(e,t),h=s(F,0,[1],"04"),X=s(F,0,[2,0],"06"),ie=s(F,0,[3,0],"03").substr(2),Se="";if(g.crypto.OID.oidhex2name[X]!==void 0)Se=g.crypto.OID.oidhex2name[X];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+X);var A=new l({curve:Se});return A.setPublicKeyHex(ie),A.setPrivateKeyHex(h),A.isPublic=!1,A}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var F=p.getDecryptedKeyHex(e,t),P=s(F,0,[1],"02"),L=s(F,0,[2],"02"),M=s(F,0,[3],"02"),V=s(F,0,[4],"02"),W=s(F,0,[5],"02"),h=new f;return h.setPrivate(new ee(P,16),new ee(L,16),new ee(M,16),new ee(V,16),new ee(W,16)),h}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};ct.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new We;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new We,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 g.crypto.ECDSA({curve:l}),d=f.generateKeyPairHex(),n=new g.crypto.ECDSA({curve:l});n.setPublicKeyHex(d.ecpubhex),n.setPrivateKeyHex(d.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new g.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)};ct.getPEM=function(e,t,r,n,i,a){var s=g,u=s.asn1,l=u.DERObjectIdentifier,f=u.DERInteger,d=u.ASN1Util.newObject,E=u.x509,p=E.SubjectPublicKeyInfo,h=s.crypto,A=h.DSA,m=h.ECDSA,S=We;function w(z){var X=d({seq:[{int:0},{int:{bigint:z.n}},{int:z.e},{int:{bigint:z.d}},{int:{bigint:z.p}},{int:{bigint:z.q}},{int:{bigint:z.dmp1}},{int:{bigint:z.dmq1}},{int:{bigint:z.coeff}}]});return X}function y(z){var X=d({seq:[{int:1},{octstr:{hex:z.prvKeyHex}},{tag:["a0",!0,{oid:{name:z.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+z.pubKeyHex}}]}]});return X}function _(z){var X=d({seq:[{int:0},{int:{bigint:z.p}},{int:{bigint:z.q}},{int:{bigint:z.g}},{int:{bigint:z.y}},{int:{bigint:z.x}}]});return X}if((S!==void 0&&e instanceof S||A!==void 0&&e instanceof A||m!==void 0&&e instanceof m)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var B=new p(e),D=B.tohex();return Qr(D,"PUBLIC KEY")}if(t=="PKCS1PRV"&&S!==void 0&&e instanceof S&&(r===void 0||r==null)&&e.isPrivate==!0){var B=w(e),D=B.tohex();return Qr(D,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&m!==void 0&&e instanceof m&&(r===void 0||r==null)&&e.isPrivate==!0){var j=new l({name:e.curveName}),q=j.tohex(),F=y(e),P=F.tohex(),L="";return L+=Qr(q,"EC PARAMETERS"),L+=Qr(P,"EC PRIVATE KEY"),L}if(t=="PKCS1PRV"&&A!==void 0&&e instanceof A&&(r===void 0||r==null)&&e.isPrivate==!0){var B=_(e),D=B.tohex();return Qr(D,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&S!==void 0&&e instanceof S&&r!==void 0&&r!=null&&e.isPrivate==!0){var B=w(e),D=B.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",D,r,n,a)}if(t=="PKCS5PRV"&&m!==void 0&&e instanceof m&&r!==void 0&&r!=null&&e.isPrivate==!0){var B=y(e),D=B.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",D,r,n,a)}if(t=="PKCS5PRV"&&A!==void 0&&e instanceof A&&r!==void 0&&r!=null&&e.isPrivate==!0){var B=_(e),D=B.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",D,r,n,a)}var M=function(z,X){if(typeof X=="string")return ct.getEncryptedPKCS8PEM(z,X);if(typeof X=="object"&&Nt(X,"passcode")!=null){var ie=JSON.parse(JSON.stringify(X)),Se=ie.passcode;return delete ie.passcode,ct.getEncryptedPKCS8PEM(z,Se,ie)}};if(t=="PKCS8PRV"&&S!=null&&e instanceof S&&e.isPrivate==!0){var V=w(e),W=V.tohex(),B=d({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:W}}]}),D=B.tohex();return r===void 0||r==null?Qr(D,"PRIVATE KEY"):M(D,r)}if(t=="PKCS8PRV"&&m!==void 0&&e instanceof m&&e.isPrivate==!0){var G={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&G.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var V=new d(G),W=V.tohex(),B=d({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:W}}]}),D=B.tohex();return r===void 0||r==null?Qr(D,"PRIVATE KEY"):M(D,r)}if(t=="PKCS8PRV"&&A!==void 0&&e instanceof A&&e.isPrivate==!0){var V=new f({bigint:e.x}),W=V.tohex(),B=d({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:W}}]}),D=B.tohex();return r===void 0||r==null?Qr(D,"PRIVATE KEY"):M(D,r)}throw new Error("unsupported object nor format")};ct.getKeyFromCSRPEM=function(e){var t=Xt(e,"CERTIFICATE REQUEST"),r=ct.getKeyFromCSRHex(t);return r};ct.getKeyFromCSRHex=function(e){var t=ct.parseCSRHex(e),r=ct.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};ct.parseCSRHex=function(e){var t=Ae,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};ct.getKeyID=function(e){var t=ct,r=Ae;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=Xt(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),a=r.getV(n,i).substring(2);return g.crypto.Util.hashHex(a,"sha1")};ct.getJWK=function(e,t,r,n,i){var a,s={},u,l=g.crypto.Util.hashHex;if(typeof e=="string")a=ct.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(u=Xt(e));else if(typeof e=="object")e instanceof je?(a=e.getPublicKey(),u=e.hex):a=e;else throw new Error("unsupported keyinfo type");if(a instanceof We&&a.isPrivate)s.kty="RSA",s.n=Er(a.n.toString(16)),s.e=Er(a.e.toString(16)),s.d=Er(a.d.toString(16)),s.p=Er(a.p.toString(16)),s.q=Er(a.q.toString(16)),s.dp=Er(a.dmp1.toString(16)),s.dq=Er(a.dmq1.toString(16)),s.qi=Er(a.coeff.toString(16));else if(a instanceof We&&a.isPublic)s.kty="RSA",s.n=Er(a.n.toString(16)),s.e=Er(a.e.toString(16));else if(a instanceof g.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=Er(d.x),s.y=Er(d.y),s.d=Er(a.prvKeyHex)}else if(a instanceof g.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=Er(d.x),s.y=Er(d.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!a.isPrivate&&t!=!0&&(s.kid=g.jws.JWS.getJWKthumbprint(s)),u!=null&&r!=!0&&(s.x5c=[Is(u)]),u!=null&&n!=!0&&(s.x5t=wu(Is(l(u,"sha1")))),u!=null&&i!=!0&&(s["x5t#S256"]=wu(Is(l(u,"sha256")))),s};ct.getJWKFromKey=function(e){return ct.getJWK(e,!0,!0,!0,!0)};We.getPosArrayOfChildrenFromHex=function(e){return Ae.getChildIdx(e,0)};We.getHexValueArrayOfChildrenFromHex=function(e){var t=Ae,r=t.getV,p=We.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]),E=r(e,p[8]),p=new Array;return p.push(n,i,a,s,u,l,f,d,E),p};We.prototype.readPrivateKeyFromPEMString=function(e){var t=Xt(e),r=We.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};We.prototype.readPKCS5PrvKeyHex=function(e){var t=We.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};We.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,a,s,u,l,f=Ae,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)};We.prototype.readPKCS5PubKeyHex=function(e){var t=Ae,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)};We.prototype.readPKCS8PubKeyHex=function(e){var t=Ae;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)};We.prototype.readCertPubKeyHex=function(e,t){var r,n;r=new je,r.readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var CT=new RegExp("[^0-9a-f]","gi");function Pv(e,t){for(var r="",n=t/4-e.length,i=0;i<n;i++)r=r+"0";return r+e}We.prototype.sign=function(e,t){var r=function(i){return g.crypto.Util.hashString(i,t)},n=r(e);return this.signWithMessageHash(n,t)};We.prototype.signWithMessageHash=function(e,t){var r=g.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),n=Fn(r,16),i=this.doPrivate(n),a=i.toString(16);return Pv(a,this.n.bitLength())};function Tv(e,t,r){for(var n="",i=0;n.length<t;)n+=$n(r(qi(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}We.prototype.signPSS=function(e,t,r){var n=function(a){return g.crypto.Util.hashHex(a,t)},i=n(qi(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,t,r)};We.prototype.signWithMessageHashPSS=function(e,t,r){var n=$n(e),i=n.length,a=this.n.bitLength()-1,s=Math.ceil(a/8),u,l=function(S){return g.crypto.Util.hashHex(S,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(s<i+r+2)throw new Error("data too long");var f="";r>0&&(f=new Array(r),new bu().nextBytes(f),f=String.fromCharCode.apply(String,f));var d=$n(l(qi("\0\0\0\0\0\0\0\0"+n+f))),E=[];for(u=0;u<s-r-i-2;u+=1)E[u]=0;var p=String.fromCharCode.apply(String,E)+""+f,h=Tv(d,p.length,l),A=[];for(u=0;u<p.length;u+=1)A[u]=p.charCodeAt(u)^h.charCodeAt(u);var m=65280>>8*s-a&255;for(A[0]&=~m,u=0;u<i;u++)A.push(d.charCodeAt(u));return A.push(188),Pv(this.doPrivate(new ee(A)).toString(16),this.n.bitLength())};function Ov(e){for(var t in g.crypto.Util.DIGESTINFOHEAD){var r=g.crypto.Util.DIGESTINFOHEAD[t],n=r.length;if(e.substring(0,n)==r){var i=[t,e.substring(n)];return i}}return[]}We.prototype.verify=function(e,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var r=Fn(t,16),n=this.n.bitLength();if(r.bitLength()>n)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=Ov(s);if(u.length==0)return!1;var l=u[0],f=u[1],d=function(p){return g.crypto.Util.hashString(p,l)},E=d(e);return f==E};We.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=Fn(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),a=Ov(i);if(a.length==0)return!1;var s=a[0],u=a[1];return u==e};We.prototype.verifyPSS=function(e,t,r,n){var i=function(s){return g.crypto.Util.hashHex(s,r)},a=i(qi(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(a,t,r,n)};We.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(y){return g.crypto.Util.hashHex(y,r)},s=$n(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<u+n+2)throw new Error("data too long");var E=this.doPublic(i).toByteArray();for(d=0;d<E.length;d+=1)E[d]&=255;for(;E.length<f;)E.unshift(0);if(E[f-1]!==188)throw new Error("encoded message does not end in 0xbc");E=String.fromCharCode.apply(String,E);var p=E.substr(0,f-u-1),h=E.substr(p.length,u),A=65280>>8*f-l&255;if(p.charCodeAt(0)&A)throw new Error("bits beyond keysize not zero");var m=Tv(h,p.length,a),S=[];for(d=0;d<p.length;d+=1)S[d]=p.charCodeAt(d)^m.charCodeAt(d);S[0]&=~A;var w=f-u-n-2;for(d=0;d<w;d+=1)if(S[d]!==0)throw new Error("leftmost octets not zero");if(S[w]!==1)throw new Error("0x01 marker not found");return h===$n(a(qi("\0\0\0\0\0\0\0\0"+s+String.fromCharCode.apply(String,S.slice(-n)))))};We.SALT_LEN_HLEN=-1;We.SALT_LEN_MAX=-2;We.SALT_LEN_RECOVER=-2;function je(e){var t=Ae,r=t.getChildIdx,n=t.getV,i=t.dump,a=t.parse,s=t.getTLV,u=t.getVbyList,l=t.getVbyListEx,f=t.getTLVbyList,d=t.getTLVbyListEx,E=t.getIdxbyList,p=t.getIdxbyListEx,h=t.getVidx,A=t.getInt,m=t.oidname,S=t.hextooidstr,w=je,y=Xt,_,B=Error;try{_=g.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch{}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(this.hex===null||this.version!==0)return this.version;var F=f(this.hex,0,[0,0]);if(F.substr(0,2)=="a0"){var P=f(F,0,[0]),L=A(P,0);if(L<0||2<L)throw new Error("malformed version field");return this.version=L+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return l(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var F=d(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(F)},this.getAlgorithmIdentifierName=function(F){for(var P in _)if(F===_[P])return P;return m(l(F,0,[0],"06"))},this.getIssuer=function(F,P){return this.getX500Name(this.getIssuerHex(),F,P)},this.getIssuerHex=function(){return f(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var F=this.getIssuer();return F.str},this.getSubject=function(F,P){return this.getX500Name(this.getSubjectHex(),F,P)},this.getSubjectHex=function(){return f(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var F=this.getSubject();return F.str},this.getNotBefore=function(){var F=u(this.hex,0,[0,4+this.foffset,0]);return F=F.replace(/(..)/g,"%$1"),F=decodeURIComponent(F),F},this.getNotAfter=function(){var F=u(this.hex,0,[0,4+this.foffset,1]);return F=F.replace(/(..)/g,"%$1"),F=decodeURIComponent(F),F},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return f(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var F=this.getSPKI();return F==null?null:u(F,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return E(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var F=this.getPublicKeyIdx();return E(this.hex,F,[1,0],"30")},this.getPublicKey=function(){return ct.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var F=f(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(F)},this.getSignatureValueHex=function(){return u(this.hex,0,[2],"03",!0)},this.verifySignature=function(F){var P=this.getSignatureAlgorithmField(),L=this.getSignatureValueHex(),M=f(this.hex,0,[0],"30"),V=new g.crypto.Signature({alg:P});return V.init(F),V.updateHex(M),V.verify(L)},this.parseExt=function(F){var P,L,M;if(F===void 0){if(M=this.hex,this.version!==3)return-1;P=E(M,0,[0,7,0],"30"),L=r(M,P)}else{M=Xt(F);var V=E(M,0,[0,3,0,0],"06");if(n(M,V)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}P=E(M,0,[0,3,0,1,0],"30"),L=r(M,P),this.hex=M}this.aExtInfo=new Array;for(var W=0;W<L.length;W++){var G={};G.critical=!1;var z=r(M,L[W]),X=0;z.length===3&&(G.critical=!0,X=1),G.oid=t.hextooidstr(u(M,L[W],[0],"06"));var ie=E(M,L[W],[1+X]);G.vidx=h(M,ie),this.aExtInfo.push(G)}},this.getExtInfo=function(F){var P=this.aExtInfo,L=F;if(F.match(/^[0-9.]+$/)||(L=g.asn1.x509.OID.name2oid(F)),L!==""){for(var M=0;M<P.length;M++)if(P[M].oid===L)return P[M]}},this.getCriticalExtV=function(F,P,L){if(P!=null)return[P,L];var M=this.getExtInfo(F);return M==null?[null,null]:[s(this.hex,M.vidx),M.critical]},this.getExtBasicConstraints=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("basicConstraints");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"basicConstraints"};if(P&&(M.critical=!0),F==="3000")return M;if(F==="30030101ff")return M.cA=!0,M;if(F.substr(0,12)==="30060101ff02"){var V=n(F,10),W=parseInt(V,16);return M.cA=!0,M.pathLen=W,M}throw new Error("hExtV parse error: "+F)},this.getExtNameConstraints=function(F,P){var L=this.getCriticalExtV("nameConstraints",F,P);if(F=L[0],P=L[1],F!=null){var M={extname:"nameConstraints"};P&&(M.critical=!0);for(var V=r(F,0),W=0;W<V.length;W++){for(var G=[],z=r(F,V[W]),X=0;X<z.length;X++){var ie=s(F,z[X]),Se=this.getGeneralSubtree(ie);G.push(Se)}var we=F.substr(V[W],2);we=="a0"?M.permit=G:we=="a1"&&(M.exclude=G)}return M}},this.getGeneralSubtree=function(F){var P=r(F,0),L=P.length;if(L<1||2<L)throw new Error("wrong num elements");for(var M=this.getGeneralName(s(F,P[0])),V=1;V<L;V++){var W=F.substr(P[V],2),G=n(F,P[V]),z=parseInt(G,16);W=="80"&&(M.min=z),W=="81"&&(M.max=z)}return M},this.getExtKeyUsage=function(F,P){var L=this.getCriticalExtV("keyUsage",F,P);if(F=L[0],P=L[1],F!=null){var M={extname:"keyUsage"};return P&&(M.critical=!0),M.names=this.getExtKeyUsageString(F).split(","),M}},this.getExtKeyUsageBin=function(F){if(F===void 0){var P=this.getExtInfo("keyUsage");if(P===void 0)return"";F=s(this.hex,P.vidx)}if(F.length!=8&&F.length!=10)throw new Error("malformed key usage value: "+F);var L="000000000000000"+parseInt(F.substr(6),16).toString(2);return F.length==8&&(L=L.slice(-8)),F.length==10&&(L=L.slice(-16)),L=L.replace(/0+$/,""),L==""&&(L="0"),L},this.getExtKeyUsageString=function(F){for(var P=this.getExtKeyUsageBin(F),L=new Array,M=0;M<P.length;M++)P.substr(M,1)=="1"&&L.push(je.KEYUSAGE_NAME[M]);return L.join(",")},this.getExtSubjectKeyIdentifier=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("subjectKeyIdentifier");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"subjectKeyIdentifier"};P&&(M.critical=!0);var V=n(F,0);return M.kid={hex:V},M},this.getExtAuthorityKeyIdentifier=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("authorityKeyIdentifier");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"authorityKeyIdentifier"};P&&(M.critical=!0);for(var V=r(F,0),W=0;W<V.length;W++){var G=F.substr(V[W],2);if(G==="80"&&(M.kid={hex:n(F,V[W])}),G==="a1"){var z=s(F,V[W]),X=this.getGeneralNames(z);M.issuer=X[0].dn}G==="82"&&(M.sn={hex:n(F,V[W])})}return M},this.getExtExtKeyUsage=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("extKeyUsage");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"extKeyUsage",array:[]};P&&(M.critical=!0);for(var V=r(F,0),W=0;W<V.length;W++)M.array.push(m(n(F,V[W])));return M},this.getExtExtKeyUsageName=function(){var F=this.getExtInfo("extKeyUsage");if(F===void 0)return F;var P=new Array,L=s(this.hex,F.vidx);if(L==="")return P;for(var M=r(L,0),V=0;V<M.length;V++)P.push(m(n(L,M[V])));return P},this.getExtSubjectAltName=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("subjectAltName");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"subjectAltName",array:[]};return P&&(M.critical=!0),M.array=this.getGeneralNames(F),M},this.getExtIssuerAltName=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("issuerAltName");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"issuerAltName",array:[]};return P&&(M.critical=!0),M.array=this.getGeneralNames(F),M},this.getGeneralNames=function(F){for(var P=r(F,0),L=[],M=0;M<P.length;M++){var V=this.getGeneralName(s(F,P[M]));V!==void 0&&L.push(V)}return L},this.getGeneralName=function(F){var P=F.substr(0,2),L=n(F,0),M=$n(L);if(P=="81")return{rfc822:M};if(P=="82")return{dns:M};if(P=="86")return{uri:M};if(P=="87")return{ip:Tf(L)};if(P=="a4")return{dn:this.getX500Name(L)};if(P=="a0")return{other:this.getOtherName(F)}},this.getExtSubjectAltName2=function(){var F,P,L,M=this.getExtInfo("subjectAltName");if(M===void 0)return M;for(var V=new Array,W=s(this.hex,M.vidx),G=r(W,0),z=0;z<G.length;z++)L=W.substr(G[z],2),F=n(W,G[z]),L==="81"&&(P=Rt(F),V.push(["MAIL",P])),L==="82"&&(P=Rt(F),V.push(["DNS",P])),L==="84"&&(P=je.hex2dn(F,0),V.push(["DN",P])),L==="86"&&(P=Rt(F),V.push(["URI",P])),L==="87"&&(P=Tf(F),V.push(["IP",P]));return V},this.getExtCRLDistributionPoints=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("cRLDistributionPoints");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"cRLDistributionPoints",array:[]};P&&(M.critical=!0);for(var V=r(F,0),W=0;W<V.length;W++){var G=s(F,V[W]);M.array.push(this.getDistributionPoint(G))}return M},this.getDistributionPoint=function(F){for(var P={},L=r(F,0),M=0;M<L.length;M++){var V=F.substr(L[M],2),W=s(F,L[M]);V=="a0"&&(P.dpname=this.getDistributionPointName(W))}return P},this.getDistributionPointName=function(F){for(var P={},L=r(F,0),M=0;M<L.length;M++){var V=F.substr(L[M],2),W=s(F,L[M]);V=="a0"&&(P.full=this.getGeneralNames(W))}return P},this.getExtCRLDistributionPointsURI=function(){var F=this.getExtCRLDistributionPoints();if(F==null)return F;for(var P=F.array,L=[],M=0;M<P.length;M++)try{P[M].dpname.full[0].uri!=null&&L.push(P[M].dpname.full[0].uri)}catch{}return L},this.getExtAIAInfo=function(){var F=this.getExtInfo("authorityInfoAccess");if(F===void 0)return F;for(var P={ocsp:[],caissuer:[]},L=r(this.hex,F.vidx),M=0;M<L.length;M++){var V=u(this.hex,L[M],[0],"06"),W=u(this.hex,L[M],[1],"86");V==="2b06010505073001"&&P.ocsp.push(Rt(W)),V==="2b06010505073002"&&P.caissuer.push(Rt(W))}return P},this.getExtAuthorityInfoAccess=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("authorityInfoAccess");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"authorityInfoAccess",array:[]};P&&(M.critical=!0);for(var V=r(F,0),W=0;W<V.length;W++){var G=l(F,V[W],[0],"06"),z=u(F,V[W],[1],"86"),X=Rt(z);if(G=="2b06010505073001")M.array.push({ocsp:X});else if(G=="2b06010505073002")M.array.push({caissuer:X});else throw new Error("unknown method: "+G)}return M},this.getExtCertificatePolicies=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("certificatePolicies");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"certificatePolicies",array:[]};P&&(M.critical=!0);for(var V=r(F,0),W=0;W<V.length;W++){var G=s(F,V[W]),z=this.getPolicyInformation(G);M.array.push(z)}return M},this.getPolicyInformation=function(F){var P={},L=u(F,0,[0],"06");P.policyoid=m(L);var M=p(F,0,[1],"30");if(M!=-1){P.array=[];for(var V=r(F,M),W=0;W<V.length;W++){var G=s(F,V[W]),z=this.getPolicyQualifierInfo(G);P.array.push(z)}}return P},this.getOtherName=function(F){var P={},L=r(F,0),M=u(F,L[0],[],"06"),V=u(F,L[1],[]);return P.oid=m(M),P.value=a(V),P},this.getPolicyQualifierInfo=function(F){var P={},L=u(F,0,[0],"06");if(L==="2b06010505070201"){var M=l(F,0,[1],"16");P.cps=$n(M)}else if(L==="2b06010505070202"){var V=f(F,0,[1],"30");P.unotice=this.getUserNotice(V)}return P},this.getUserNotice=function(F){var P=null,L={};try{P=t.parse(F);var M=this._asn1ToUnotice(P);return M}catch{return}},this._asn1ToUnotice=function(F){try{for(var P={},L=Nt(F,"seq"),M=0;M<L.length;M++){var V=this._asn1ToNoticeRef(L[M]);V!=null&&(P.noticeref=V);var W=this.asn1ToDisplayText(L[M]);W!=null&&(P.exptext=W)}return Object.keys(P).length>0?P:void 0}catch{return}},this._asn1ToNoticeRef=function(F){try{for(var P={},L=Nt(F,"seq"),M=0;M<L.length;M++){var V=this._asn1ToNoticeNum(L[M]);V!=null&&(P.noticenum=V);var W=this.asn1ToDisplayText(L[M]);W!=null&&(P.org=W)}return Object.keys(P).length>0?P:void 0}catch{return}},this._asn1ToNoticeNum=function(F){try{for(var P=Nt(F,"seq"),L=[],M=0;M<P.length;M++){var V=P[M];L.push(parseInt(Nt(V,"int.hex"),16))}return L}catch{return}},this.getDisplayText=function(F){var P={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},L={};return L.type=P[F.substr(0,2)],L.str=$n(n(F,0)),L},this.asn1ToDisplayText=function(F){if(F.utf8str!=null)return{type:"utf8",str:F.utf8str.str};if(F.ia5str!=null)return{type:"ia5",str:F.ia5str.str};if(F.visstr!=null)return{type:"vis",str:F.visstr.str};if(F.bmpstr!=null)return{type:"bmp",str:F.bmpstr.str};if(F.prnstr!=null)return{type:"prn",str:F.prnstr.str}},this.getExtPolicyMappings=function(F,P){var L=this.getCriticalExtV("policyMappings",F,P);if(F=L[0],P=L[1],F!=null){var M={extname:"policyMappings"};P&&(M.critical=!0);try{for(var V=a(F),W=V.seq,G=[],z=0;z<W.length;z++){var X=W[z].seq;G.push([X[0].oid,X[1].oid])}M.array=G}catch{throw new B("malformed policyMappings")}return M}},this.getExtPolicyConstraints=function(F,P){var L=this.getCriticalExtV("policyConstraints",F,P);if(F=L[0],P=L[1],F!=null){var M={extname:"policyConstraints"};P&&(M.critical=!0);var V=a(F);try{for(var W=V.seq,G=0;G<W.length;G++){var z=W[G].tag;z.explicit==!1&&(z.tag=="80"&&(M.reqexp=parseInt(z.hex,16)),z.tag=="81"&&(M.inhibit=parseInt(z.hex,16)))}}catch{return new B("malformed policyConstraints value")}return M}},this.getExtInhibitAnyPolicy=function(F,P){var L=this.getCriticalExtV("inhibitAnyPolicy",F,P);if(F=L[0],P=L[1],F!=null){var M={extname:"inhibitAnyPolicy"};P&&(M.critical=!0);var V=A(F,0);return V==-1?new B("wrong value"):(M.skip=V,M)}},this.getExtCRLNumber=function(F,P){var L={extname:"cRLNumber"};if(P&&(L.critical=!0),F.substr(0,2)=="02")return L.num={hex:n(F,0)},L;throw new B("hExtV parse error: "+F)},this.getExtCRLReason=function(F,P){var L={extname:"cRLReason"};if(P&&(L.critical=!0),F.substr(0,2)=="0a")return L.code=parseInt(n(F,0),16),L;throw new Error("hExtV parse error: "+F)},this.getExtOcspNonce=function(F,P){var L={extname:"ocspNonce"};P&&(L.critical=!0);var M=n(F,0);return L.hex=M,L},this.getExtOcspNoCheck=function(F,P){var L={extname:"ocspNoCheck"};return P&&(L.critical=!0),L},this.getExtAdobeTimeStamp=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("adobeTimeStamp");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"adobeTimeStamp"};P&&(M.critical=!0);var V=r(F,0);if(V.length>1){var W=s(F,V[1]),G=this.getGeneralName(W);G.uri!=null&&(M.uri=G.uri)}if(V.length>2){var z=s(F,V[2]);z=="0101ff"&&(M.reqauth=!0),z=="010100"&&(M.reqauth=!1)}return M},this.getExtSubjectDirectoryAttributes=function(F,P){if(F===void 0&&P===void 0){var L=this.getExtInfo("subjectDirectoryAttributes");if(L===void 0)return;F=s(this.hex,L.vidx),P=L.critical}var M={extname:"subjectDirectoryAttributes"};P&&(M.critical=!0);try{for(var V=a(F),W=[],G=0;G<V.seq.length;G++){var z=V.seq[G],X=Nt(z,"seq.0.oid"),ie=Nt(z,"seq.1.set");if(X==null||ie==null)throw"error";W.push({attr:X,array:ie})}return M.array=W,M}catch{throw new Error("malformed subjectDirectoryAttributes extension value")}};var D=function(F){var P={};try{var L=F.seq[0].oid,M=g.asn1.x509.OID.name2oid(L);P.type=g.asn1.x509.OID.oid2atype(M);var V=F.seq[1];if(V.utf8str!=null)P.ds="utf8",P.value=V.utf8str.str;else if(V.numstr!=null)P.ds="num",P.value=V.numstr.str;else if(V.telstr!=null)P.ds="tel",P.value=V.telstr.str;else if(V.prnstr!=null)P.ds="prn",P.value=V.prnstr.str;else if(V.ia5str!=null)P.ds="ia5",P.value=V.ia5str.str;else if(V.visstr!=null)P.ds="vis",P.value=V.visstr.str;else if(V.bmpstr!=null)P.ds="bmp",P.value=V.bmpstr.str;else throw"error";return P}catch{throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},j=function(F){try{return F.set.map(function(P){return D(P)})}catch(P){throw new Error("improper ASN.1 parsed RDN: "+P)}},q=function(F){try{return F.seq.map(function(P){return j(P)})}catch(P){throw new Error("improper ASN.1 parsed X500Name: "+P)}};this.getX500NameRule=function(F){for(var P=!0,L=!0,M=!1,V="",W="",G=null,z=[],X=0;X<F.length;X++)for(var ie=F[X],Se=0;Se<ie.length;Se++)z.push(ie[Se]);for(var X=0;X<z.length;X++){var we=z[X],Ie=we.ds,Ve=we.value,ue=we.type;if(V+=":"+Ie,Ie!="prn"&&Ie!="utf8"&&Ie!="ia5")return"mixed";if(Ie=="ia5"){if(ue!="CN")return"mixed";if(g.lang.String.isMail(Ve))continue;return"mixed"}if(ue=="C"){if(Ie=="prn")continue;return"mixed"}if(W+=":"+Ie,G==null)G=Ie;else if(G!==Ie)return"mixed"}return G??"prn"},this.getAttrTypeAndValue=function(F){var P=a(F);return D(P)},this.getRDN=function(F){var P=a(F);return j(P)},this.getX500NameArray=function(F){var P=a(F);return q(P)},this.getX500Name=function(F,P,L){var M=this.getX500NameArray(F),V=this.dnarraytostr(M),W={str:V};return W.array=M,L==!0&&(W.hex=F),P==!0&&(W.canon=this.c14nRDNArray(M)),W},this.readCertPEM=function(F){this.readCertHex(y(F))},this.readCertHex=function(F){this.hex=F,this.getVersion();try{E(this.hex,0,[0,7],"a3"),this.parseExt()}catch{}},this.getParam=function(F){var P={};return F==null&&(F={}),P.version=this.getVersion(),P.serial={hex:this.getSerialNumberHex()},P.sigalg=this.getSignatureAlgorithmField(),P.issuer=this.getIssuer(F.dncanon,F.dnhex),P.notbefore=this.getNotBefore(),P.notafter=this.getNotAfter(),P.subject=this.getSubject(F.dncanon,F.dnhex),P.sbjpubkey=Qr(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo!=null&&this.aExtInfo.length>0&&(P.ext=this.getExtParamArray()),P.sighex=this.getSignatureValueHex(),F.tbshex==!0&&(P.tbshex=f(this.hex,0,[0])),F.nodnarray==!0&&(delete P.issuer.array,delete P.subject.array),P},this.getExtParamArray=function(F){if(F==null){var P=p(this.hex,0,[0,"[3]"]);P!=-1&&(F=d(this.hex,0,[0,"[3]",0],"30"))}for(var L=[],M=r(F,0),V=0;V<M.length;V++){var W=s(F,M[V]),G=this.getExtParam(W);G!=null&&L.push(G)}return L},this.getExtParam=function(F){var P={},L=r(F,0),M=L.length;if(M!=2&&M!=3)throw new Error("wrong number elements in Extension: "+M+" "+F);var V=S(u(F,0,[0],"06")),W=!1;M==3&&f(F,0,[1])=="0101ff"&&(W=!0);var G=f(F,0,[M-1,0]),z=void 0;if(V=="2.5.29.14"?z=this.getExtSubjectKeyIdentifier(G,W):V=="2.5.29.15"?z=this.getExtKeyUsage(G,W):V=="2.5.29.17"?z=this.getExtSubjectAltName(G,W):V=="2.5.29.18"?z=this.getExtIssuerAltName(G,W):V=="2.5.29.19"?z=this.getExtBasicConstraints(G,W):V=="2.5.29.30"?z=this.getExtNameConstraints(G,W):V=="2.5.29.31"?z=this.getExtCRLDistributionPoints(G,W):V=="2.5.29.32"?z=this.getExtCertificatePolicies(G,W):V=="2.5.29.33"?z=this.getExtPolicyMappings(G,W):V=="2.5.29.35"?z=this.getExtAuthorityKeyIdentifier(G,W):V=="2.5.29.36"?z=this.getExtPolicyConstraints(G,W):V=="2.5.29.37"?z=this.getExtExtKeyUsage(G,W):V=="2.5.29.54"?z=this.getExtInhibitAnyPolicy(G,W):V=="1.3.6.1.5.5.7.1.1"?z=this.getExtAuthorityInfoAccess(G,W):V=="2.5.29.20"?z=this.getExtCRLNumber(G,W):V=="2.5.29.21"?z=this.getExtCRLReason(G,W):V=="2.5.29.9"?z=this.getExtSubjectDirectoryAttributes(G,W):V=="1.3.6.1.5.5.7.48.1.2"?z=this.getExtOcspNonce(G,W):V=="1.3.6.1.5.5.7.48.1.5"?z=this.getExtOcspNoCheck(G,W):V=="1.2.840.113583.1.1.9.1"?z=this.getExtAdobeTimeStamp(G,W):je.EXT_PARSER[V]!=null&&(z=je.EXT_PARSER[V](V,W,G)),z!=null)return z;var X={extname:V,extn:G};try{X.extn=a(G)}catch{}return W&&(X.critical=!0),X},this.findExt=function(F,P){for(var L=0;L<F.length;L++)if(F[L].extname==P)return F[L];return null},this.updateExtCDPFullURI=function(F,P){var L=this.findExt(F,"cRLDistributionPoints");if(L!=null&&L.array!=null){for(var M=L.array,V=0;V<M.length;V++)if(M[V].dpname!=null&&M[V].dpname.full!=null)for(var W=M[V].dpname.full,G=0;G<W.length;G++){var z=W[V];z.uri!=null&&(z.uri=P)}}},this.updateExtAIAOCSP=function(F,P){var L=this.findExt(F,"authorityInfoAccess");if(L!=null&&L.array!=null)for(var M=L.array,V=0;V<M.length;V++)M[V].ocsp!=null&&(M[V].ocsp=P)},this.updateExtAIACAIssuer=function(F,P){var L=this.findExt(F,"authorityInfoAccess");if(L!=null&&L.array!=null)for(var M=L.array,V=0;V<M.length;V++)M[V].caissuer!=null&&(M[V].caissuer=P)},this.dnarraytostr=function(F){function P(M){return M.map(function(V){return L(V).replace(/\+/,"\\+")}).join("+")}function L(M){return M.type+"="+M.value}return"/"+F.map(function(M){return P(M).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(F){var P;if(F.str!=null&&F.array==null){var L=new g.asn1.x509.X500Name({str:F.str}),M=L.tohex();P=this.getX500NameArray(M)}else P=F.array;F.canon==null&&(F.canon=this.c14nRDNArray(P))},this.c14nRDNArray=function(F){for(var P=[],L=0;L<F.length;L++){for(var M=F[L],V=[],W=0;W<M.length;W++){var G=M[W],z=G.value;z=z.replace(/^\s*/,""),z=z.replace(/\s*$/,""),z=z.replace(/\s+/g," "),z=z.toLowerCase(),V.push(G.type.toLowerCase()+"="+z)}P.push(V.join("+"))}return"/"+P.join("/")},this.getInfo=function(){var F=function(Gt){for(var at="",kt=" ",it=`
`,bt=Gt.array,sr=0;sr<bt.length;sr++){var et=bt[sr];if(et.dn!=null&&(at+=kt+"dn: "+et.dn.str+it),et.ip!=null&&(at+=kt+"ip: "+et.ip+it),et.rfc822!=null&&(at+=kt+"rfc822: "+et.rfc822+it),et.dns!=null&&(at+=kt+"dns: "+et.dns+it),et.uri!=null&&(at+=kt+"uri: "+et.uri+it),et.other!=null){var Jt=et.other.oid,Zn=JSON.stringify(et.other.value).replace(/\"/g,"");at+=kt+"other: "+Jt+"="+Zn+it}}return at=at.replace(/\n$/,""),at},P=function(Gt){for(var at="",kt=Gt.array,it=0;it<kt.length;it++){var bt=kt[it];if(at+=" policy oid: "+bt.policyoid+`
`,bt.array!==void 0)for(var sr=0;sr<bt.array.length;sr++){var et=bt.array[sr];et.cps!==void 0&&(at+=" cps: "+et.cps+`
`)}}return at},L=function(Gt){for(var at="",kt=Gt.array,it=0;it<kt.length;it++){var bt=kt[it];try{bt.dpname.full[0].uri!==void 0&&(at+=" "+bt.dpname.full[0].uri+`
`)}catch{}try{bt.dname.full[0].dn.hex!==void 0&&(at+=" "+je.hex2dn(bt.dpname.full[0].dn.hex)+`
`)}catch{}}return at},M=function(Gt){for(var at="",kt=Gt.array,it=0;it<kt.length;it++){var bt=kt[it];bt.caissuer!==void 0&&(at+=" caissuer: "+bt.caissuer+`
`),bt.ocsp!==void 0&&(at+=" ocsp: "+bt.ocsp+`
`)}return at},V=je,W,G,z;if(W=`Basic Fields
`,W+=" serial number: "+this.getSerialNumberHex()+`
`,W+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
`,W+=" issuer: "+this.getIssuerString()+`
`,W+=" notBefore: "+this.getNotBefore()+`
`,W+=" notAfter: "+this.getNotAfter()+`
`,W+=" subject: "+this.getSubjectString()+`
`,W+=` subject public key info:
`,G=this.getPublicKey(),W+=" key algorithm: "+G.type+`
`,G.type==="RSA"&&(W+=" n="+Nd(G.n.toString(16)).substr(0,16)+`...
`,W+=" e="+Nd(G.e.toString(16))+`
`),z=this.aExtInfo,z!=null){W+=`X509v3 Extensions:
`;for(var X=0;X<z.length;X++){var ie=z[X],Se=g.asn1.x509.OID.oid2name(ie.oid);Se===""&&(Se=ie.oid);var we="";if(ie.critical===!0&&(we="CRITICAL"),W+=" "+Se+" "+we+`:
`,Se==="basicConstraints"){var Ie=this.getExtBasicConstraints();Ie.cA===void 0?W+=` {}
`:(W+=" cA=true",Ie.pathLen!==void 0&&(W+=", pathLen="+Ie.pathLen),W+=`
`)}else if(Se=="policyMappings"){var Ve=this.getExtPolicyMappings().array,ue=Ve.map(function(Gt){var at=Gt;return at[0]+":"+at[1]}).join(", ");W+=" "+ue+`
`}else if(Se=="policyConstraints"){var _e=this.getExtPolicyConstraints();W+=" ",_e.reqexp!=null&&(W+=" reqexp="+_e.reqexp),_e.inhibit!=null&&(W+=" inhibit="+_e.inhibit),W+=`
`}else if(Se=="inhibitAnyPolicy"){var _e=this.getExtInhibitAnyPolicy();W+=" skip="+_e.skip+`
`}else if(Se=="keyUsage")W+=" "+this.getExtKeyUsageString()+`
`;else if(Se=="subjectKeyIdentifier")W+=" "+this.getExtSubjectKeyIdentifier().kid.hex+`
`;else if(Se=="authorityKeyIdentifier"){var He=this.getExtAuthorityKeyIdentifier();He.kid!==void 0&&(W+=" kid="+He.kid.hex+`
`)}else if(Se=="extKeyUsage"){var Sr=this.getExtExtKeyUsage().array;W+=" "+Sr.join(", ")+`
`}else if(Se=="subjectAltName"){var Ht=F(this.getExtSubjectAltName());W+=Ht+`
`}else if(Se=="cRLDistributionPoints"){var wt=this.getExtCRLDistributionPoints();W+=L(wt)}else if(Se=="authorityInfoAccess"){var ir=this.getExtAuthorityInfoAccess();W+=M(ir)}else Se=="certificatePolicies"&&(W+=P(this.getExtCertificatePolicies()))}}return W+="signature algorithm: "+this.getSignatureAlgorithmName()+`
`,W+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
`,W},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):g.lang.String.isHex(e)&&this.readCertHex(e))}je.EXT_PARSER={};je.registExtParser=function(e,t){je.EXT_PARSER[e]=t};je.hex2dn=function(e,t){t===void 0&&(t=0);var r=new je,n=Ae.getTLV(e,t),i=r.getX500Name(e);return i.str};je.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="31")throw new Error("malformed RDN");for(var r=new Array,n=Ae.getChildIdx(e,t),i=0;i<n.length;i++)r.push(je.hex2attrTypeValue(e,n[i]));return r=r.map(function(a){return a.replace("+","\\+")}),r.join("+")};je.hex2attrTypeValue=function(e,t){var r=Ae,n=r.getV;if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var i=r.getChildIdx(e,t);i.length!==2||e.substr(i[0],2);var a=n(e,i[0]),s=g.asn1.ASN1Util.oidHexToInt(a),u=g.asn1.x509.OID.oid2atype(s),l=n(e,i[1]),f=$n(l);return u+"="+f};je.getPublicKeyFromCertHex=function(e){var t=new je;return t.readCertHex(e),t.getPublicKey()};je.getPublicKeyFromCertPEM=function(e){var t=new je;return t.readCertPEM(e),t.getPublicKey()};je.getPublicKeyInfoPropOfCertPEM=function(e){var t=Ae,r=t.getVbyList,n={},i,a,s;return n.algparam=null,i=new je,i.readCertPEM(e),a=i.getPublicKeyHex(),n.keyhex=r(a,0,[1],"03").substr(2),n.algoid=r(a,0,[0,0],"06"),n.algoid==="2a8648ce3d0201"&&(n.algparam=r(a,0,[0,1],"06")),n};je.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var _8=function(e){var t=g,r=t.lang.String.isHex,n=Ae,i=n.getV,a=n.getTLV,s=n.getVbyList,u=n.getTLVbyList,l=n.getTLVbyListEx,f=n.getIdxbyList,d=n.getIdxbyListEx,E=n.getChildIdx,p=new je;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this.parsed=null,this._setPos=function(){var h=f(this.hex,0,[0,0]),A=this.hex.substr(h,2);if(A=="02")this.posSigAlg=1;else if(A=="30")this.posSigAlg=0;else throw new Error("malformed 1st item of TBSCertList: "+A);var m=f(this.hex,0,[0,this.posSigAlg+3]),S=this.hex.substr(m,2);if(S=="17"||S=="18"){var w,y;w=f(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,w!=-1&&(y=this.hex.substr(w,2),y=="30"&&(this.posRevCert=this.posSigAlg+4))}else if(S=="30")this.posRevCert=this.posSigAlg+3;else if(S=="a0")this.posRevCert=null;else throw new Error("malformed nextUpdate or revCert tag: "+S)},this.getVersion=function(){return this.posSigAlg==0?null:parseInt(s(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var h=u(this.hex,0,[0,this.posSigAlg],"30");return p.getAlgorithmIdentifierName(h)},this.getIssuer=function(){return p.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,this.posSigAlg+1],"30")},this.getThisUpdate=function(){var h=s(this.hex,0,[0,this.posSigAlg+2]);return result=$n(h)},this.getNextUpdate=function(){var h=f(this.hex,0,[0,this.posSigAlg+3]),A=this.hex.substr(h,2);return A!="17"&&A!="18"?null:$n(i(this.hex,h))},this.getRevCertArray=function(){if(this.posRevCert==null)return null;for(var h=[],A=f(this.hex,0,[0,this.posRevCert]),m=E(this.hex,A),S=0;S<m.length;S++){var w=a(this.hex,m[S]);h.push(this.getRevCert(w))}return h},this.getRevCert=function(h){var A={},m=E(h,0);return A.sn={hex:s(h,0,[0],"02")},A.date=$n(s(h,0,[1])),m.length==3&&(A.ext=p.getExtParamArray(u(h,0,[2]))),A},this.findRevCert=function(h){var A=new je(h),m=A.getSerialNumberHex();return this.findRevCertBySN(m)},this.findRevCertBySN=function(h){if(this.parsed==null&&this.getParam(),this.parsed.revcert==null)return null;for(var A=this.parsed.revcert,m=0;m<A.length;m++)if(h==A[m].sn.hex)return A[m];return null},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(h){var A=this.getSignatureAlgorithmField(),m=this.getSignatureValueHex(),S=u(this.hex,0,[0],"30"),w=new g.crypto.Signature({alg:A});return w.init(h),w.updateHex(S),w.verify(m)},this.getParam=function(h){var A={},m=this.getVersion();m!=null&&(A.version=m),A.sigalg=this.getSignatureAlgorithmField(),A.issuer=this.getIssuer(),A.thisupdate=this.getThisUpdate();var S=this.getNextUpdate();S!=null&&(A.nextupdate=S);var w=this.getRevCertArray();w!=null&&(A.revcert=w);var y=d(this.hex,0,[0,"[0]"]);if(y!=-1){var _=l(this.hex,0,[0,"[0]",0]);A.ext=p.getExtParamArray(_)}return A.sighex=this.getSignatureValueHex(),this.parsed=A,typeof h=="object"&&(h.tbshex==!0&&(A.tbshex=u(this.hex,0,[0])),h.nodnarray==!0&&delete A.issuer.array),A},typeof e=="string"&&(r(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=Xt(e)),this._setPos())};(typeof g>"u"||!g)&&(g={});(typeof g.jws>"u"||!g.jws)&&(g.jws={});g.jws.JWS=function(){var e=g,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=qt(l),E=Fn(d,16);this.parsedJWS.sigvalH=d,this.parsedJWS.sigvalBI=E}var p=Si(s),h=Si(u);if(this.parsedJWS.headS=p,this.parsedJWS.payloadS=h,!r(p,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+p}}};g.jws.JWS.sign=function(e,t,r,n,i){var a=g,s=a.jws,u=s.JWS,l=u.readSafeJSONString,f=u.isSafeJSONString,d=a.crypto,E=d.ECDSA,p=d.Mac,h=d.Signature,A=JSON,m,S,w;if(typeof t!="string"&&typeof t!="object")throw"spHeader must be JSON string or object: "+t;if(typeof t=="object"&&(S=t,m=A.stringify(S)),typeof t=="string"){if(m=t,!f(m))throw"JWS Head is not safe JSON string: "+m;S=l(m)}if(w=r,typeof r=="object"&&(w=A.stringify(r)),(e==""||e==null)&&S.alg!==void 0&&(e=S.alg),e!=""&&e!=null&&S.alg===void 0&&(S.alg=e,m=A.stringify(S)),e!==S.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+S.alg;var y=null;if(u.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;y=u.jwsalg2sigalg[e];var _=Hc(m),B=Hc(w),D=_+"."+B,j="";if(y.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var q=new p({alg:y,prov:"cryptojs",pass:n});q.updateString(D),j=q.doFinal()}else if(y.indexOf("withECDSA")!=-1){var F=new h({alg:y});F.init(n,i),F.updateString(D);var P=F.sign();j=g.crypto.ECDSA.asn1SigToConcatSig(P)}else if(y!="none"){var F=new h({alg:y});F.init(n,i),F.updateString(D),j=F.sign()}var L=Er(j);return D+"."+L};g.jws.JWS.verify=function(e,t,r){var n=g,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=n.crypto,l=u.ECDSA,f=u.Mac,d=u.Signature,E;if(typeof We!==void 0&&(E=We),!Vd(e))return!1;var p=e.split(".");if(p.length!==3)return!1;var h=p[0],A=p[1],m=h+"."+A,S=qt(p[2]),w=s(Si(p[0])),y=null,_=null;if(w.alg===void 0)throw"algorithm not specified in header";if(y=w.alg,_=y.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var B=":"+r.join(":")+":";if(B.indexOf(":"+y+":")==-1)throw"algorithm '"+y+"' not accepted in the list"}if(y!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=ct.getKey(t)),(_=="RS"||_=="PS")&&!(t instanceof E))throw"key shall be a RSAKey obj for RS* and PS* algs";if(_=="ES"&&!(t instanceof l))throw"key shall be a ECDSA obj for ES* algs";y=="none";var D=null;if(a.jwsalg2sigalg[w.alg]===void 0)throw"unsupported alg name: "+y;if(D=a.jwsalg2sigalg[y],D=="none")throw"not supported";if(D.substr(0,4)=="Hmac"){var j=null;if(t===void 0)throw"hexadecimal key shall be specified for HMAC";var q=new f({alg:D,pass:t});return q.updateString(m),j=q.doFinal(),S==j}else if(D.indexOf("withECDSA")!=-1){var F=null;try{F=l.concatSigToASN1Sig(S)}catch{return!1}var P=new d({alg:D});return P.init(t),P.updateString(m),P.verify(F)}else{var P=new d({alg:D});return P.init(t),P.updateString(m),P.verify(S)}};g.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=g.jws.JWS.readSafeJSONString(Si(n)),r.payloadObj=g.jws.JWS.readSafeJSONString(Si(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=Si(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),a!==void 0&&(r.sigHex=qt(a)),r};g.jws.JWS.verifyJWT=function(e,t,r){var n=g,i=n.jws,a=i.JWS,s=a.readSafeJSONString,u=a.inArray,l=a.includedArray;if(!Vd(e))return!1;var f=e.split(".");if(f.length!=3)return!1;var d=f[0],E=f[1],p=d+"."+E,h=qt(f[2]),A=s(Si(d)),m=s(Si(E));if(A.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!u(A.alg,r.alg)||m.iss!==void 0&&typeof r.iss=="object"&&!u(m.iss,r.iss)||m.sub!==void 0&&typeof r.sub=="object"&&!u(m.sub,r.sub))return!1;if(m.aud!==void 0&&typeof r.aud=="object"){if(typeof m.aud=="string"){if(!u(m.aud,r.aud))return!1}else if(typeof m.aud=="object"&&!l(m.aud,r.aud))return!1}var S=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(S=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(m.exp!==void 0&&typeof m.exp=="number"&&m.exp+r.gracePeriod<S||m.nbf!==void 0&&typeof m.nbf=="number"&&S<m.nbf-r.gracePeriod||m.iat!==void 0&&typeof m.iat=="number"&&S<m.iat-r.gracePeriod||m.jti!==void 0&&r.jti!==void 0&&m.jti!==r.jti||!a.verify(e,t,r.alg))};g.jws.JWS.includedArray=function(e,t){var r=g.jws.JWS.inArray;if(e===null||typeof e!="object"||typeof e.length!="number")return!1;for(var n=0;n<e.length;n++)if(!r(e[n],t))return!1;return!0};g.jws.JWS.inArray=function(e,t){if(t===null||typeof t!="object"||typeof t.length!="number")return!1;for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1};g.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"};g.jws.JWS.isSafeJSONString=function(e,t,r){var n=null;try{return n=Av(e),typeof n!="object"||n.constructor===Array?0:(t&&(t[r]=n),1)}catch{return 0}};g.jws.JWS.readSafeJSONString=function(e){var t=null;try{return t=Av(e),typeof t!="object"||t.constructor===Array?null:t}catch{return null}};g.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(t==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]};g.jws.JWS.getJWKthumbprint=function(e){if(e.kty!=="RSA"&&e.kty!=="EC"&&e.kty!=="oct")throw"unsupported algorithm for JWK Thumprint";var t="{";if(e.kty==="RSA"){if(typeof e.n!="string"||typeof e.e!="string")throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if(e.kty==="EC"){if(typeof e.crv!="string"||typeof e.x!="string"||typeof e.y!="string")throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if(e.kty==="oct"){if(typeof e.k!="string")throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var r=qi(t),n=g.crypto.Util.hashHex(r,"sha256"),i=Er(n);return i};g.jws.IntDate={};g.jws.IntDate.get=function(e){var t=g.jws.IntDate,r=t.getNow,n=t.getZulu;if(e=="now")return r();if(e=="now + 1hour")return r()+60*60;if(e=="now + 1day")return r()+60*60*24;if(e=="now + 1month")return r()+60*60*24*30;if(e=="now + 1year")return r()+60*60*24*365;if(e.match(/Z$/))return n(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e};g.jws.IntDate.getZulu=function(e){return Cv(e)};g.jws.IntDate.getNow=function(){var e=~~(new Date/1e3);return e};g.jws.IntDate.intDate2UTCString=function(e){var t=new Date(e*1e3);return t.toUTCString()};g.jws.IntDate.intDate2Zulu=function(e){var t=new Date(e*1e3),r=("0000"+t.getUTCFullYear()).slice(-4),n=("00"+(t.getUTCMonth()+1)).slice(-2),i=("00"+t.getUTCDate()).slice(-2),a=("00"+t.getUTCHours()).slice(-2),s=("00"+t.getUTCMinutes()).slice(-2),u=("00"+t.getUTCSeconds()).slice(-2);return r+n+i+a+s+u+"Z"};(typeof g>"u"||!g)&&(g={});(typeof g.jws>"u"||!g.jws)&&(g.jws={});g.jws.JWSJS=function(){var e=g,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=g.jws.JWS.sign(i,a,this.sPayload,s,u),d=f.split("."),E=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;a<i.length;a++){var s=i[a];if(s.length!==2)return!1;var u=this.verifyNth(a,s[0],s[1]);if(u===!1)return!1}return!0},this.verifyNth=function(i,a,s){if(this.aHeader.length<=i||this.aSignature.length<=i)return!1;var u=this.aHeader[i],l=this.aSignature[i],f=u+"."+this.sPayload+"."+l,d=!1;try{d=r.verify(f,a,s)}catch{return!1}return d},this.readJWSJS=function(i){if(typeof i=="string"){var a=n(i);if(a==null)throw"argument is not safe JSON object string";this.aHeader=a.headers,this.sPayload=a.payload,this.aSignature=a.signatures}else try{if(i.headers.length>0)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}};be.SecureRandom=bu;be.rng_seed_time=Hd;be.BigInteger=ee;be.RSAKey=We;be.ECDSA=g.crypto.ECDSA;be.DSA=g.crypto.DSA;be.Signature=g.crypto.Signature;be.MessageDigest=g.crypto.MessageDigest;be.Mac=g.crypto.Mac;be.KEYUTIL=ct;be.ASN1HEX=Ae;be.X509=je;be.X509CRL=_8;be.CryptoJS=Ce;be.b64tohex=Au;be.b64toBA=gv;be.ECFieldElementFp=wr;be.ECPointFp=St;be.ECCurveFp=$s;be.stoBA=yv;be.BAtos=Sv;be.BAtohex=Lf;be.stohex=In;be.stob64=s8;be.stob64u=a8;be.b64utos=o8;be.b64tob64u=wu;be.b64utob64=jc;be.hex2b64=Is;be.hextob64u=Er;be.b64utohex=qt;be.utf8tob64u=Hc;be.b64utoutf8=Si;be.utf8tob64=u8;be.b64toutf8=c8;be.utf8tohex=Uf;be.hextoutf8=Rt;be.hextorstr=$n;be.rstrtohex=qi;be.hextob64=Md;be.hextob64nl=h8;be.b64nltohex=bv;be.hextopem=Qr;be.pemtohex=Xt;be.hextoArrayBuffer=g8;be.ArrayBuffertohex=m8;be.zulutomsec=jd;be.msectozulu=v8;be.zulutosec=Cv;be.zulutodate=E8;be.datetozulu=w8;be.uricmptohex=Mf;be.hextouricmp=jf;be.ipv6tohex=Od;be.hextoipv6=xd;be.hextoip=Tf;be.iptohex=qd;be.ucs2hextoutf8=Kd;be.encodeURIComponentAll=qf;be.newline_toUnix=A8;be.newline_toDos=y8;be.hextoposhex=Nd;be.intarystrtohex=S8;be.strdiffidx=b8;be.oidtohex=Iv;be.hextooid=Kf;be.strpad=Of;be.bitstrtoint=Dv;be.inttobitstr=Bv;be.bitstrtobinstr=Rv;be.binstrtobitstr=C8;be.isBase64URLDot=Vd;be.namearraytobinstr=xf;be.extendClass=he;be.foldnl=Hf;be.b64topem=p8;be.pemtob64=d8;be.timeogen=_v;be.aryval=Nt;be.inttohex=$v;be.twoscompl=qc;be.KJUR=g;be.crypto=g.crypto;be.asn1=g.asn1;be.jws=g.jws;be.lang=g.lang;be.VERSION=O5;be.VERSION_FULL=x5});var oo=ye((IT,ao)=>{"use strict";function kv(e){return typeof e>"u"||e===null}function I8(e){return typeof e=="object"&&e!==null}function $8(e){return Array.isArray(e)?e:kv(e)?[]:[e]}function D8(e,t){var r,n,i,a;if(t)for(a=Object.keys(t),r=0,n=a.length;r<n;r+=1)i=a[r],e[i]=t[i];return e}function B8(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function R8(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}ao.exports.isNothing=kv;ao.exports.isObject=I8;ao.exports.toArray=$8;ao.exports.repeat=B8;ao.exports.isNegativeZero=R8;ao.exports.extend=D8});var Cu=ye(($T,Lv)=>{"use strict";function Kc(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||""}Kc.prototype=Object.create(Error.prototype);Kc.prototype.constructor=Kc;Kc.prototype.toString=function(t){var r=this.name+": ";return r+=this.reason||"(unknown reason)",!t&&this.mark&&(r+=" "+this.mark.toString()),r};Lv.exports=Kc});var Mv=ye((DT,Hv)=>{"use strict";var Uv=oo();function zd(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}zd.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;s<this.buffer.length&&`\0\r
\x85\u2028\u2029`.indexOf(this.buffer.charAt(s))===-1;)if(s+=1,s-this.position>r/2-1){a=" ... ",s-=5;break}return u=this.buffer.slice(i,s),Uv.repeat(" ",t)+n+u+a+`
`+Uv.repeat(" ",t+this.position-i+n.length)+"^"};zd.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};Hv.exports=zd});var Ar=ye((BT,qv)=>{"use strict";var jv=Cu(),P8=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],T8=["scalar","sequence","mapping"];function O8(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function x8(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(P8.indexOf(r)===-1)throw new jv('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=O8(t.styleAliases||null),T8.indexOf(this.kind)===-1)throw new jv('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}qv.exports=x8});var uo=ye((RT,Vv)=>{"use strict";var Kv=oo(),Vf=Cu(),N8=Ar();function Yd(e,t,r){var n=[];return e.include.forEach(function(i){r=Yd(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 k8(){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<r;t+=1)arguments[t].forEach(n);return e}function _u(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(t){if(t.loadKind&&t.loadKind!=="scalar")throw new Vf("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=Yd(this,"implicit",[]),this.compiledExplicit=Yd(this,"explicit",[]),this.compiledTypeMap=k8(this.compiledImplicit,this.compiledExplicit)}_u.DEFAULT=null;_u.create=function(){var t,r;switch(arguments.length){case 1:t=_u.DEFAULT,r=arguments[0];break;case 2:t=arguments[0],r=arguments[1];break;default:throw new Vf("Wrong number of arguments for Schema.create function")}if(t=Kv.toArray(t),r=Kv.toArray(r),!t.every(function(n){return n instanceof _u}))throw new Vf("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!r.every(function(n){return n instanceof N8}))throw new Vf("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new _u({include:t,explicit:r})};Vv.exports=_u});var zv=ye((PT,Gv)=>{"use strict";var L8=Ar();Gv.exports=new L8("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}})});var Wv=ye((TT,Yv)=>{"use strict";var U8=Ar();Yv.exports=new U8("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}})});var Jv=ye((OT,Xv)=>{"use strict";var H8=Ar();Xv.exports=new H8("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}})});var Gf=ye((xT,Zv)=>{"use strict";var M8=uo();Zv.exports=new M8({explicit:[zv(),Wv(),Jv()]})});var e2=ye((NT,Qv)=>{"use strict";var j8=Ar();function q8(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function K8(){return null}function V8(e){return e===null}Qv.exports=new j8("tag:yaml.org,2002:null",{kind:"scalar",resolve:q8,construct:K8,predicate:V8,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var r2=ye((kT,t2)=>{"use strict";var G8=Ar();function z8(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 Y8(e){return e==="true"||e==="True"||e==="TRUE"}function W8(e){return Object.prototype.toString.call(e)==="[object Boolean]"}t2.exports=new G8("tag:yaml.org,2002:bool",{kind:"scalar",resolve:z8,construct:Y8,predicate:W8,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 i2=ye((LT,n2)=>{"use strict";var X8=oo(),J8=Ar();function Z8(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Q8(e){return 48<=e&&e<=55}function eI(e){return 48<=e&&e<=57}function tI(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<t;r++)if(i=e[r],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(r++;r<t;r++)if(i=e[r],i!=="_"){if(!Z8(e.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}for(;r<t;r++)if(i=e[r],i!=="_"){if(!Q8(e.charCodeAt(r)))return!1;n=!0}return n&&i!=="_"}if(i==="_")return!1;for(;r<t;r++)if(i=e[r],i!=="_"){if(i===":")break;if(!eI(e.charCodeAt(r)))return!1;n=!0}return!n||i==="_"?!1:i!==":"?!0:/^(:[0-5]?[0-9])+$/.test(e.slice(r))}function rI(e){var t=e,r=1,n,i,a=[];return t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),n=t[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),t=t.slice(1),n=t[0]),t==="0"?0:n==="0"?t[1]==="b"?r*parseInt(t.slice(2),2):t[1]==="x"?r*parseInt(t,16):r*parseInt(t,8):t.indexOf(":")!==-1?(t.split(":").forEach(function(s){a.unshift(parseInt(s,10))}),t=0,i=1,a.forEach(function(s){t+=s*i,i*=60}),r*t):r*parseInt(t,10)}function nI(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!X8.isNegativeZero(e)}n2.exports=new J8("tag:yaml.org,2002:int",{kind:"scalar",resolve:tI,construct:rI,predicate:nI,represent:{binary:function(e){return e>=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 o2=ye((UT,a2)=>{"use strict";var s2=oo(),iI=Ar(),sI=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 aI(e){return!(e===null||!sI.test(e)||e[e.length-1]==="_")}function oI(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 uI=/^[-+]?[0-9]+e/;function cI(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(s2.isNegativeZero(e))return"-0.0";return r=e.toString(10),uI.test(r)?r.replace("e",".e"):r}function lI(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||s2.isNegativeZero(e))}a2.exports=new iI("tag:yaml.org,2002:float",{kind:"scalar",resolve:aI,construct:oI,predicate:lI,represent:cI,defaultStyle:"lowercase"})});var Wd=ye((HT,u2)=>{"use strict";var fI=uo();u2.exports=new fI({include:[Gf()],implicit:[e2(),r2(),i2(),o2()]})});var Xd=ye((MT,c2)=>{"use strict";var hI=uo();c2.exports=new hI({include:[Wd()]})});var p2=ye((jT,h2)=>{"use strict";var pI=Ar(),l2=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),f2=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 dI(e){return e===null?!1:l2.exec(e)!==null||f2.exec(e)!==null}function gI(e){var t,r,n,i,a,s,u,l=0,f=null,d,E,p;if(t=l2.exec(e),t===null&&(t=f2.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],E=+(t[11]||0),f=(d*60+E)*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 mI(e){return e.toISOString()}h2.exports=new pI("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:dI,construct:gI,instanceOf:Date,represent:mI})});var g2=ye((qT,d2)=>{"use strict";var vI=Ar();function EI(e){return e==="<<"||e===null}d2.exports=new vI("tag:yaml.org,2002:merge",{kind:"scalar",resolve:EI})});var E2=ye((KT,v2)=>{"use strict";var co;try{m2=za,co=m2("buffer").Buffer}catch{}var m2,wI=Ar(),Jd=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;function AI(e){if(e===null)return!1;var t,r,n=0,i=e.length,a=Jd;for(r=0;r<i;r++)if(t=a.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}function yI(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,a=Jd,s=0,u=[];for(t=0;t<i;t++)t%4===0&&t&&(u.push(s>>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),co?co.from?co.from(u):new co(u):u}function SI(e){var t="",r=0,n,i,a=e.length,s=Jd;for(n=0;n<a;n++)n%3===0&&n&&(t+=s[r>>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 bI(e){return co&&co.isBuffer(e)}v2.exports=new wI("tag:yaml.org,2002:binary",{kind:"scalar",resolve:AI,construct:yI,predicate:bI,represent:SI})});var A2=ye((GT,w2)=>{"use strict";var CI=Ar(),_I=Object.prototype.hasOwnProperty,FI=Object.prototype.toString;function II(e){if(e===null)return!0;var t=[],r,n,i,a,s,u=e;for(r=0,n=u.length;r<n;r+=1){if(i=u[r],s=!1,FI.call(i)!=="[object Object]")return!1;for(a in i)if(_I.call(i,a))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(a)===-1)t.push(a);else return!1}return!0}function $I(e){return e!==null?e:[]}w2.exports=new CI("tag:yaml.org,2002:omap",{kind:"sequence",resolve:II,construct:$I})});var S2=ye((zT,y2)=>{"use strict";var DI=Ar(),BI=Object.prototype.toString;function RI(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<r;t+=1){if(n=s[t],BI.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;a[t]=[i[0],n[i[0]]]}return!0}function PI(e){if(e===null)return[];var t,r,n,i,a,s=e;for(a=new Array(s.length),t=0,r=s.length;t<r;t+=1)n=s[t],i=Object.keys(n),a[t]=[i[0],n[i[0]]];return a}y2.exports=new DI("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:RI,construct:PI})});var C2=ye((YT,b2)=>{"use strict";var TI=Ar(),OI=Object.prototype.hasOwnProperty;function xI(e){if(e===null)return!0;var t,r=e;for(t in r)if(OI.call(r,t)&&r[t]!==null)return!1;return!0}function NI(e){return e!==null?e:{}}b2.exports=new TI("tag:yaml.org,2002:set",{kind:"mapping",resolve:xI,construct:NI})});var Fu=ye((WT,_2)=>{"use strict";var kI=uo();_2.exports=new kI({include:[Xd()],implicit:[p2(),g2()],explicit:[E2(),A2(),S2(),C2()]})});var I2=ye((XT,F2)=>{"use strict";var LI=Ar();function UI(){return!0}function HI(){}function MI(){return""}function jI(e){return typeof e>"u"}F2.exports=new LI("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:UI,construct:HI,predicate:jI,represent:MI})});var D2=ye((JT,$2)=>{"use strict";var qI=Ar();function KI(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 VI(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 GI(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function zI(e){return Object.prototype.toString.call(e)==="[object RegExp]"}$2.exports=new qI("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:KI,construct:VI,predicate:zI,represent:GI})});var P2=ye((ZT,R2)=>{"use strict";var zf;try{B2=za,zf=B2("esprima")}catch{typeof window<"u"&&(zf=window.esprima)}var B2,YI=Ar();function WI(e){if(e===null)return!1;try{var t="("+e+")",r=zf.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 XI(e){var t="("+e+")",r=zf.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 JI(e){return e.toString()}function ZI(e){return Object.prototype.toString.call(e)==="[object Function]"}R2.exports=new YI("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:WI,construct:XI,predicate:ZI,represent:JI})});var Vc=ye((eO,O2)=>{"use strict";var T2=uo();O2.exports=T2.DEFAULT=new T2({include:[Fu()],explicit:[I2(),D2(),P2()]})});var Q2=ye((tO,Gc)=>{"use strict";var Ds=oo(),M2=Cu(),QI=Mv(),j2=Fu(),e$=Vc(),ga=Object.prototype.hasOwnProperty,Yf=1,q2=2,K2=3,Wf=4,Zd=1,t$=2,x2=3,r$=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,n$=/[\x85\u2028\u2029]/,i$=/[,\[\]\{\}]/,V2=/^(?:!|!!|![a-z\-]+!)$/i,G2=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function N2(e){return Object.prototype.toString.call(e)}function Ki(e){return e===10||e===13}function fo(e){return e===9||e===32}function Dn(e){return e===9||e===32||e===10||e===13}function Iu(e){return e===44||e===91||e===93||e===123||e===125}function s$(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function a$(e){return e===120?2:e===117?4:e===85?8:0}function o$(e){return 48<=e&&e<=57?e-48:-1}function k2(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 u$(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var z2=new Array(256),Y2=new Array(256);for(lo=0;lo<256;lo++)z2[lo]=k2(lo)?1:0,Y2[lo]=k2(lo);var lo;function c$(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||e$,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 W2(e,t){return new M2(t,new QI(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function Ke(e,t){throw W2(e,t)}function Xf(e,t){e.onWarning&&e.onWarning.call(null,W2(e,t))}var L2={YAML:function(t,r,n){var i,a,s;t.version!==null&&Ke(t,"duplication of %YAML directive"),n.length!==1&&Ke(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&Ke(t,"ill-formed argument of the YAML directive"),a=parseInt(i[1],10),s=parseInt(i[2],10),a!==1&&Ke(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Xf(t,"unsupported YAML version of the document")},TAG:function(t,r,n){var i,a;n.length!==2&&Ke(t,"TAG directive accepts exactly two arguments"),i=n[0],a=n[1],V2.test(i)||Ke(t,"ill-formed tag handle (first argument) of the TAG directive"),ga.call(t.tagMap,i)&&Ke(t,'there is a previously declared suffix for "'+i+'" tag handle'),G2.test(a)||Ke(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[i]=a}};function da(e,t,r,n){var i,a,s,u;if(t<r){if(u=e.input.slice(t,r),n)for(i=0,a=u.length;i<a;i+=1)s=u.charCodeAt(i),s===9||32<=s&&s<=1114111||Ke(e,"expected valid JSON character");else r$.test(u)&&Ke(e,"the stream contains non-printable characters");e.result+=u}}function U2(e,t,r,n){var i,a,s,u;for(Ds.isObject(r)||Ke(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),s=0,u=i.length;s<u;s+=1)a=i[s],ga.call(t,a)||(t[a]=r[a],n[a]=!0)}function $u(e,t,r,n,i,a,s,u){var l,f;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),l=0,f=i.length;l<f;l+=1)Array.isArray(i[l])&&Ke(e,"nested arrays are not supported inside keys"),typeof i=="object"&&N2(i[l])==="[object Object]"&&(i[l]="[object Object]");if(typeof i=="object"&&N2(i)==="[object Object]"&&(i="[object Object]"),i=String(i),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(l=0,f=a.length;l<f;l+=1)U2(e,t,a[l],r);else U2(e,t,a,r);else!e.json&&!ga.call(r,i)&&ga.call(t,i)&&(e.line=s||e.line,e.position=u||e.position,Ke(e,"duplicated mapping key")),t[i]=a,delete r[i];return t}function Qd(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Ke(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function dr(e,t,r){for(var n=0,i=e.input.charCodeAt(e.position);i!==0;){for(;fo(i);)i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(Ki(i))for(Qd(e),i=e.input.charCodeAt(e.position),n++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return r!==-1&&n!==0&&e.lineIndent<r&&Xf(e,"deficient indentation"),n}function Jf(e){var t=e.position,r;return r=e.input.charCodeAt(t),!!((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)&&(t+=3,r=e.input.charCodeAt(t),r===0||Dn(r)))}function e0(e,t){t===1?e.result+=" ":t>1&&(e.result+=Ds.repeat(`
`,t-1))}function l$(e,t,r){var n,i,a,s,u,l,f,d,E=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),Dn(h)||Iu(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),Dn(i)||r&&Iu(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),Dn(i)||r&&Iu(i))break}else if(h===35){if(n=e.input.charCodeAt(e.position-1),Dn(n))break}else{if(e.position===e.lineStart&&Jf(e)||r&&Iu(h))break;if(Ki(h))if(l=e.line,f=e.lineStart,d=e.lineIndent,dr(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&&(da(e,a,s,!1),e0(e,e.line-l),a=s=e.position,u=!1),fo(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return da(e,a,s,!1),e.result?!0:(e.kind=E,e.result=p,!1)}function f$(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(da(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 Ki(r)?(da(e,n,i,!0),e0(e,dr(e,!1,t)),n=i=e.position):e.position===e.lineStart&&Jf(e)?Ke(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Ke(e,"unexpected end of the stream within a single quoted scalar")}function h$(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 da(e,r,e.position,!0),e.position++,!0;if(u===92){if(da(e,r,e.position,!0),u=e.input.charCodeAt(++e.position),Ki(u))dr(e,!1,t);else if(u<256&&z2[u])e.result+=Y2[u],e.position++;else if((s=a$(u))>0){for(i=s,a=0;i>0;i--)u=e.input.charCodeAt(++e.position),(s=s$(u))>=0?a=(a<<4)+s:Ke(e,"expected hexadecimal character");e.result+=u$(a),e.position++}else Ke(e,"unknown escape sequence");r=n=e.position}else Ki(u)?(da(e,r,n,!0),e0(e,dr(e,!1,t)),r=n=e.position):e.position===e.lineStart&&Jf(e)?Ke(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}Ke(e,"unexpected end of the stream within a double quoted scalar")}function p$(e,t){var r=!0,n,i=e.tag,a,s=e.anchor,u,l,f,d,E,p={},h,A,m,S;if(S=e.input.charCodeAt(e.position),S===91)l=93,E=!1,a=[];else if(S===123)l=125,E=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),S=e.input.charCodeAt(++e.position);S!==0;){if(dr(e,!0,t),S=e.input.charCodeAt(e.position),S===l)return e.position++,e.tag=i,e.anchor=s,e.kind=E?"mapping":"sequence",e.result=a,!0;r||Ke(e,"missed comma between flow collection entries"),A=h=m=null,f=d=!1,S===63&&(u=e.input.charCodeAt(e.position+1),Dn(u)&&(f=d=!0,e.position++,dr(e,!0,t))),n=e.line,Du(e,t,Yf,!1,!0),A=e.tag,h=e.result,dr(e,!0,t),S=e.input.charCodeAt(e.position),(d||e.line===n)&&S===58&&(f=!0,S=e.input.charCodeAt(++e.position),dr(e,!0,t),Du(e,t,Yf,!1,!0),m=e.result),E?$u(e,a,p,A,h,m):f?a.push($u(e,null,p,A,h,m)):a.push(h),dr(e,!0,t),S=e.input.charCodeAt(e.position),S===44?(r=!0,S=e.input.charCodeAt(++e.position)):r=!1}Ke(e,"unexpected end of the stream within a flow collection")}function d$(e,t){var r,n,i=Zd,a=!1,s=!1,u=t,l=0,f=!1,d,E;if(E=e.input.charCodeAt(e.position),E===124)n=!1;else if(E===62)n=!0;else return!1;for(e.kind="scalar",e.result="";E!==0;)if(E=e.input.charCodeAt(++e.position),E===43||E===45)Zd===i?i=E===43?x2:t$:Ke(e,"repeat of a chomping mode identifier");else if((d=o$(E))>=0)d===0?Ke(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Ke(e,"repeat of an indentation width identifier"):(u=t+d-1,s=!0);else break;if(fo(E)){do E=e.input.charCodeAt(++e.position);while(fo(E));if(E===35)do E=e.input.charCodeAt(++e.position);while(!Ki(E)&&E!==0)}for(;E!==0;){for(Qd(e),e.lineIndent=0,E=e.input.charCodeAt(e.position);(!s||e.lineIndent<u)&&E===32;)e.lineIndent++,E=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>u&&(u=e.lineIndent),Ki(E)){l++;continue}if(e.lineIndent<u){i===x2?e.result+=Ds.repeat(`
`,a?1+l:l):i===Zd&&a&&(e.result+=`
`);break}for(n?fo(E)?(f=!0,e.result+=Ds.repeat(`
`,a?1+l:l)):f?(f=!1,e.result+=Ds.repeat(`
`,l+1)):l===0?a&&(e.result+=" "):e.result+=Ds.repeat(`
`,l):e.result+=Ds.repeat(`
`,a?1+l:l),a=!0,s=!0,l=0,r=e.position;!Ki(E)&&E!==0;)E=e.input.charCodeAt(++e.position);da(e,r,e.position,!1)}return!0}function H2(e,t){var r,n=e.tag,i=e.anchor,a=[],s,u=!1,l;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),l=e.input.charCodeAt(e.position);l!==0&&!(l!==45||(s=e.input.charCodeAt(e.position+1),!Dn(s)));){if(u=!0,e.position++,dr(e,!0,-1)&&e.lineIndent<=t){a.push(null),l=e.input.charCodeAt(e.position);continue}if(r=e.line,Du(e,t,K2,!1,!0),a.push(e.result),dr(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&l!==0)Ke(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return u?(e.tag=n,e.anchor=i,e.kind="sequence",e.result=a,!0):!1}function g$(e,t,r){var n,i,a,s,u=e.tag,l=e.anchor,f={},d={},E=null,p=null,h=null,A=!1,m=!1,S;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),S=e.input.charCodeAt(e.position);S!==0;){if(n=e.input.charCodeAt(e.position+1),a=e.line,s=e.position,(S===63||S===58)&&Dn(n))S===63?(A&&($u(e,f,d,E,p,null),E=p=h=null),m=!0,A=!0,i=!0):A?(A=!1,i=!0):Ke(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,S=n;else if(Du(e,r,q2,!1,!0))if(e.line===a){for(S=e.input.charCodeAt(e.position);fo(S);)S=e.input.charCodeAt(++e.position);if(S===58)S=e.input.charCodeAt(++e.position),Dn(S)||Ke(e,"a whitespace character is expected after the key-value separator within a block mapping"),A&&($u(e,f,d,E,p,null),E=p=h=null),m=!0,A=!1,i=!1,E=e.tag,p=e.result;else if(m)Ke(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=l,!0}else if(m)Ke(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=l,!0;else break;if((e.line===a||e.lineIndent>t)&&(Du(e,t,Wf,!0,i)&&(A?p=e.result:h=e.result),A||($u(e,f,d,E,p,h,a,s),E=p=h=null),dr(e,!0,-1),S=e.input.charCodeAt(e.position)),e.lineIndent>t&&S!==0)Ke(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return A&&$u(e,f,d,E,p,null),m&&(e.tag=u,e.anchor=l,e.kind="mapping",e.result=f),m}function m$(e){var t,r=!1,n=!1,i,a,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&Ke(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(r=!0,s=e.input.charCodeAt(++e.position)):s===33?(n=!0,i="!!",s=e.input.charCodeAt(++e.position)):i="!",t=e.position,r){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(a=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):Ke(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!Dn(s);)s===33&&(n?Ke(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),V2.test(i)||Ke(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);a=e.input.slice(t,e.position),i$.test(a)&&Ke(e,"tag suffix cannot contain flow indicator characters")}return a&&!G2.test(a)&&Ke(e,"tag name cannot contain such characters: "+a),r?e.tag=a:ga.call(e.tagMap,i)?e.tag=e.tagMap[i]+a:i==="!"?e.tag="!"+a:i==="!!"?e.tag="tag:yaml.org,2002:"+a:Ke(e,'undeclared tag handle "'+i+'"'),!0}function v$(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&Ke(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Dn(r)&&!Iu(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ke(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function E$(e){var t,r,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Dn(n)&&!Iu(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ke(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),ga.call(e.anchorMap,r)||Ke(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],dr(e,!0,-1),!0}function Du(e,t,r,n,i){var a,s,u,l=1,f=!1,d=!1,E,p,h,A,m;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=s=u=Wf===r||K2===r,n&&dr(e,!0,-1)&&(f=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;m$(e)||v$(e);)dr(e,!0,-1)?(f=!0,u=a,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):u=!1;if(u&&(u=f||i),(l===1||Wf===r)&&(Yf===r||q2===r?A=t:A=t+1,m=e.position-e.lineStart,l===1?u&&(H2(e,m)||g$(e,m,A))||p$(e,A)?d=!0:(s&&d$(e,A)||f$(e,A)||h$(e,A)?d=!0:E$(e)?(d=!0,(e.tag!==null||e.anchor!==null)&&Ke(e,"alias node should not have any properties")):l$(e,A,Yf===r)&&(d=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(d=u&&H2(e,m))),e.tag!==null&&e.tag!=="!")if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Ke(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),E=0,p=e.implicitTypes.length;E<p;E+=1)if(h=e.implicitTypes[E],h.resolve(e.result)){e.result=h.construct(e.result),e.tag=h.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else ga.call(e.typeMap[e.kind||"fallback"],e.tag)?(h=e.typeMap[e.kind||"fallback"][e.tag],e.result!==null&&h.kind!==e.kind&&Ke(e,"unacceptable node kind for !<"+e.tag+'> 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)):Ke(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):Ke(e,"unknown tag !<"+e.tag+">");return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function w$(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&&(dr(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&&!Dn(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),i=[],n.length<1&&Ke(e,"directive name must not be less than one character in length");s!==0;){for(;fo(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Ki(s));break}if(Ki(s))break;for(r=e.position;s!==0&&!Dn(s);)s=e.input.charCodeAt(++e.position);i.push(e.input.slice(r,e.position))}s!==0&&Qd(e),ga.call(L2,n)?L2[n](e,n,i):Xf(e,'unknown document directive "'+n+'"')}if(dr(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,dr(e,!0,-1)):a&&Ke(e,"directives end mark is expected"),Du(e,e.lineIndent-1,Wf,!1,!0),dr(e,!0,-1),e.checkLineBreaks&&n$.test(e.input.slice(t,e.position))&&Xf(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Jf(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,dr(e,!0,-1));return}if(e.position<e.length-1)Ke(e,"end of the stream or a document separator is expected");else return}function X2(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new c$(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,Ke(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)w$(r);return r.documents}function J2(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=X2(e,r);if(typeof t!="function")return n;for(var i=0,a=n.length;i<a;i+=1)t(n[i])}function Z2(e,t){var r=X2(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new M2("expected a single document in the stream, but found more")}}function A$(e,t,r){return typeof t=="object"&&t!==null&&typeof r>"u"&&(r=t,t=null),J2(e,t,Ds.extend({schema:j2},r))}function y$(e,t){return Z2(e,Ds.extend({schema:j2},t))}Gc.exports.loadAll=J2;Gc.exports.load=Z2;Gc.exports.safeLoadAll=A$;Gc.exports.safeLoad=y$});var SE=ye((rO,i0)=>{"use strict";var Yc=oo(),Wc=Cu(),S$=Vc(),b$=Fu(),oE=Object.prototype.toString,uE=Object.prototype.hasOwnProperty,C$=9,zc=10,_$=13,F$=32,I$=33,$$=34,cE=35,D$=37,B$=38,R$=39,P$=42,lE=44,T$=45,fE=58,O$=61,x$=62,N$=63,k$=64,hE=91,pE=93,L$=96,dE=123,U$=124,gE=125,en={};en[0]="\\0";en[7]="\\a";en[8]="\\b";en[9]="\\t";en[10]="\\n";en[11]="\\v";en[12]="\\f";en[13]="\\r";en[27]="\\e";en[34]='\\"';en[92]="\\\\";en[133]="\\N";en[160]="\\_";en[8232]="\\L";en[8233]="\\P";var H$=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function M$(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;i<a;i+=1)s=n[i],u=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&uE.call(l.styleAliases,u)&&(u=l.styleAliases[u]),r[s]=u;return r}function eE(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else if(e<=4294967295)r="U",n=8;else throw new Wc("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+Yc.repeat("0",n-t.length)+t}function j$(e){this.schema=e.schema||S$,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Yc.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=M$(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function tE(e,t){for(var r=Yc.repeat(" ",t),n=0,i=-1,a="",s,u=e.length;n<u;)i=e.indexOf(`
`,n),i===-1?(s=e.slice(n),n=u):(s=e.slice(n,i+1),n=i+1),s.length&&s!==`
`&&(a+=r),a+=s;return a}function t0(e,t){return`
`+Yc.repeat(" ",e.indent*t)}function q$(e,t){var r,n,i;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(i=e.implicitTypes[r],i.resolve(t))return!0;return!1}function n0(e){return e===F$||e===C$}function Bu(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==65279||65536<=e&&e<=1114111}function K$(e){return Bu(e)&&!n0(e)&&e!==65279&&e!==_$&&e!==zc}function rE(e,t){return Bu(e)&&e!==65279&&e!==lE&&e!==hE&&e!==pE&&e!==dE&&e!==gE&&e!==fE&&(e!==cE||t&&K$(t))}function V$(e){return Bu(e)&&e!==65279&&!n0(e)&&e!==T$&&e!==N$&&e!==fE&&e!==lE&&e!==hE&&e!==pE&&e!==dE&&e!==gE&&e!==cE&&e!==B$&&e!==P$&&e!==I$&&e!==U$&&e!==O$&&e!==x$&&e!==R$&&e!==$$&&e!==D$&&e!==k$&&e!==L$}function mE(e){var t=/^\n* /;return t.test(e)}var vE=1,EE=2,wE=3,AE=4,Zf=5;function G$(e,t,r,n,i){var a,s,u,l=!1,f=!1,d=n!==-1,E=-1,p=V$(e.charCodeAt(0))&&!n0(e.charCodeAt(e.length-1));if(t)for(a=0;a<e.length;a++){if(s=e.charCodeAt(a),!Bu(s))return Zf;u=a>0?e.charCodeAt(a-1):null,p=p&&rE(s,u)}else{for(a=0;a<e.length;a++){if(s=e.charCodeAt(a),s===zc)l=!0,d&&(f=f||a-E-1>n&&e[E+1]!==" ",E=a);else if(!Bu(s))return Zf;u=a>0?e.charCodeAt(a-1):null,p=p&&rE(s,u)}f=f||d&&a-E-1>n&&e[E+1]!==" "}return!l&&!f?p&&!i(e)?vE:EE:r>9&&mE(e)?Zf:f?AE:wE}function z$(e,t,r,n){e.dump=function(){if(t.length===0)return"''";if(!e.noCompatMode&&H$.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 q$(e,l)}switch(G$(t,s,e.indent,a,u)){case vE:return t;case EE:return"'"+t.replace(/'/g,"''")+"'";case wE:return"|"+nE(t,e.indent)+iE(tE(t,i));case AE:return">"+nE(t,e.indent)+iE(tE(Y$(t,a),i));case Zf:return'"'+W$(t,a)+'"';default:throw new Wc("impossible error: invalid scalar style")}}()}function nE(e,t){var r=mE(e)?String(t):"",n=e[e.length-1]===`
`,i=n&&(e[e.length-2]===`
`||e===`
`),a=i?"+":n?"":"-";return r+a+`
`}function iE(e){return e[e.length-1]===`
`?e.slice(0,-1):e}function Y$(e,t){for(var r=/(\n+)([^\n]*)/g,n=function(){var f=e.indexOf(`
`);return f=f!==-1?f:e.length,r.lastIndex=f,sE(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!==""?`
`:"")+sE(l,t),i=a}return n}function sE(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 W$(e){for(var t="",r,n,i,a=0;a<e.length;a++){if(r=e.charCodeAt(a),r>=55296&&r<=56319&&(n=e.charCodeAt(a+1),n>=56320&&n<=57343)){t+=eE((r-55296)*1024+n-56320+65536),a++;continue}i=en[r],t+=!i&&Bu(r)?e[a]:i||eE(r)}return t}function X$(e,t,r){var n="",i=e.tag,a,s;for(a=0,s=r.length;a<s;a+=1)ho(e,t,r[a],!1,!1)&&(a!==0&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function J$(e,t,r,n){var i="",a=e.tag,s,u;for(s=0,u=r.length;s<u;s+=1)ho(e,t+1,r[s],!0,!0)&&((!n||s!==0)&&(i+=t0(e,t)),e.dump&&zc===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=a,e.dump=i||"[]"}function Z$(e,t,r){var n="",i=e.tag,a=Object.keys(r),s,u,l,f,d;for(s=0,u=a.length;s<u;s+=1)d="",s!==0&&(d+=", "),e.condenseFlow&&(d+='"'),l=a[s],f=r[l],ho(e,t,l,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ho(e,t,f,!1,!1)&&(d+=e.dump,n+=d));e.tag=i,e.dump="{"+n+"}"}function Q$(e,t,r,n){var i="",a=e.tag,s=Object.keys(r),u,l,f,d,E,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new Wc("sortKeys must be a boolean or a function");for(u=0,l=s.length;u<l;u+=1)p="",(!n||u!==0)&&(p+=t0(e,t)),f=s[u],d=r[f],ho(e,t+1,f,!0,!0,!0)&&(E=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,E&&(e.dump&&zc===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,E&&(p+=t0(e,t)),ho(e,t+1,d,!0,E)&&(e.dump&&zc===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=a,e.dump=i||"{}"}function aE(e,t,r){var n,i,a,s,u,l;for(i=r?e.explicitTypes:e.implicitTypes,a=0,s=i.length;a<s;a+=1)if(u=i[a],(u.instanceOf||u.predicate)&&(!u.instanceOf||typeof t=="object"&&t instanceof u.instanceOf)&&(!u.predicate||u.predicate(t))){if(e.tag=r?u.tag:"?",u.represent){if(l=e.styleMap[u.tag]||u.defaultStyle,oE.call(u.represent)==="[object Function]")n=u.represent(t,l);else if(uE.call(u.represent,l))n=u.represent[l](t,l);else throw new Wc("!<"+u.tag+'> tag resolver accepts not "'+l+'" style');e.dump=n}return!0}return!1}function ho(e,t,r,n,i,a){e.tag=null,e.dump=r,aE(e,r,!1)||aE(e,r,!0);var s=oE.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?(Q$(e,t,e.dump,i),f&&(e.dump="&ref_"+l+e.dump)):(Z$(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?(J$(e,d,e.dump,i),f&&(e.dump="&ref_"+l+e.dump)):(X$(e,d,e.dump),f&&(e.dump="&ref_"+l+" "+e.dump))}else if(s==="[object String]")e.tag!=="?"&&z$(e,e.dump,t,a);else{if(e.skipInvalid)return!1;throw new Wc("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function eD(e,t){var r=[],n=[],i,a;for(r0(e,r,n),i=0,a=n.length;i<a;i+=1)t.duplicates.push(r[n[i]]);t.usedDuplicates=new Array(a)}function r0(e,t,r){var n,i,a;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,a=e.length;i<a;i+=1)r0(e[i],t,r);else for(n=Object.keys(e),i=0,a=n.length;i<a;i+=1)r0(e[n[i]],t,r)}function yE(e,t){t=t||{};var r=new j$(t);return r.noRefs||eD(e,r),ho(r,0,e,!0,!0)?r.dump+`
`:""}function tD(e,t){return yE(e,Yc.extend({schema:b$},t))}i0.exports.dump=yE;i0.exports.safeDump=tD});var CE=ye((nO,nr)=>{"use strict";var Qf=Q2(),bE=SE();function eh(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}nr.exports.Type=Ar();nr.exports.Schema=uo();nr.exports.FAILSAFE_SCHEMA=Gf();nr.exports.JSON_SCHEMA=Wd();nr.exports.CORE_SCHEMA=Xd();nr.exports.DEFAULT_SAFE_SCHEMA=Fu();nr.exports.DEFAULT_FULL_SCHEMA=Vc();nr.exports.load=Qf.load;nr.exports.loadAll=Qf.loadAll;nr.exports.safeLoad=Qf.safeLoad;nr.exports.safeLoadAll=Qf.safeLoadAll;nr.exports.dump=bE.dump;nr.exports.safeDump=bE.safeDump;nr.exports.YAMLException=Cu();nr.exports.MINIMAL_SCHEMA=Gf();nr.exports.SAFE_SCHEMA=Fu();nr.exports.DEFAULT_SCHEMA=Vc();nr.exports.scan=eh("scan");nr.exports.parse=eh("parse");nr.exports.compose=eh("compose");nr.exports.addConstructor=eh("addConstructor")});var FE=ye((iO,_E)=>{"use strict";var rD=CE();_E.exports=rD});var $E=ye((sO,IE)=>{"use strict";var th=FE();IE.exports={safeLoad:th.safeLoad,load:th.load,safeDump:th.safeDump,dump:th.dump}});var PE=ye(o0=>{"use strict";o0.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};o0.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 TE=ye(u0=>{"use strict";u0.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};u0.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 OE=ye(c0=>{"use strict";c0.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};c0.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 xE=ye(l0=>{"use strict";l0.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};l0.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 NE=ye(f0=>{"use strict";f0.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}`};f0.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 UE=ye((LE,h0)=>{var kE=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=E,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,A){A=~~A,h=h||new Uint8Array(A+r);let m=p.length,S=0;for(let w=0;w<m;){let y=p.charCodeAt(w++);y===46?(h[A++]=S,S=0):S=S*10+(y-48)}return h[A]=S,h},decode(p,h){return h=~~h,`${p[h++]}.${p[h++]}.${p[h++]}.${p[h]}`}};e.v4=a;let s={name:"v6",size:i,isFormat:p=>p.length>0&&n.test(p),encode(p,h,A){A=~~A;let m=A+i,S=-1,w=0,y=0,_=!0,B=!1;h=h||new Uint8Array(A+i);for(let D=0;D<p.length;D++){let j=p.charCodeAt(D);j===58?(_?S!==-1?(A<m&&(h[A]=0),A<m-1&&(h[A+1]=0),A+=2):A<m&&(S=A):(B===!0?(A<m&&(h[A]=y),A++):(A<m&&(h[A]=w>>8),A<m-1&&(h[A+1]=w&255),A+=2),w=0,y=0),_=!0,B=!1):j===46?(A<m&&(h[A]=y),A++,y=0,w=0,_=!1,B=!0):(_=!1,j>=97?j-=87:j>=65?j-=55:(j-=48,y=y*10+j),w=(w<<4)+j)}if(_===!1)B===!0?(A<m&&(h[A]=y),A++):(A<m&&(h[A]=w>>8),A<m-1&&(h[A+1]=w&255),A+=2);else if(S===0)A<m&&(h[A]=0),A<m-1&&(h[A+1]=0),A+=2;else if(S!==-1){A+=2;for(let D=Math.min(A-1,m-1);D>=S+2;D--)h[D]=h[D-2];h[S]=0,h[S+1]=0,S=A}if(S!==A&&S!==-1)for(A>m-2&&(A=m-2);m>S;)h[--m]=A<m&&A>S?h[--A]:0;else for(;A<m;)h[A++]=0;return h},decode(p,h){h=~~h;let A="";for(let m=0;m<i;m+=2)m!==0&&(A+=":"),A+=(p[h+m]<<8|p[h+m+1]).toString(16);return A.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=s;let u="ip";e.name=u;function l(p){if(a.isFormat(p))return a.size;if(s.isFormat(p))return s.size;throw Error(`Invalid ip address: ${p}`)}function f(p){return l(p)===a.size?1:2}function d(p,h,A){A=~~A;let m=l(p);return typeof h=="function"&&(h=h(A+m)),m===a.size?a.encode(p,h,A):s.encode(p,h,A)}function E(p,h,A){if(h=~~h,A=A||p.length-h,A===a.size)return a.decode(p,h,A);if(A===s.size)return s.decode(p,h,A);throw Error(`Invalid buffer size needs to be ${a.size} for v4 or ${s.size} for v6.`)}return"default"in e?e.default:e}({});typeof define=="function"&&define.amd?define([],function(){return kE}):typeof h0=="object"&&typeof LE=="object"&&(h0.exports=kE)});var jE=ye(Le=>{"use strict";var Ue=Rf().Buffer,Us=PE(),sD=TE(),aD=OE(),ah=xE(),p0=NE(),go=UE(),oD=0,HE=32768,d0=32768,uD=~d0,ME=32768,cD=~ME,De=Le.name={};De.encode=function(e,t,r,{mail:n=!1}={}){t||(t=Ue.alloc(De.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<s.length;u++){let l=t.write(s[u],r+1);t[r]=l,r+=l+1}}return t[r++]=0,De.encode.bytes=r-i,t};De.encode.bytes=0;De.decode=function(e,t,{mail:r=!1}={}){t||(t=0);let n=[],i=t,a=0,s=0,u=!1;for(;;){if(t>=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 De.decode.bytes=s,n.length===0?".":n.join(".")};De.decode.bytes=0;De.encodingLength=function(e){return e==="."||e===".."?1:Ue.byteLength(e.replace(/^\.|\.$/gm,""))+2};var ut={};ut.encode=function(e,t,r){t||(t=Ue.alloc(ut.encodingLength(e))),r||(r=0);let n=t.write(e,r+1);return t[r]=n,ut.encode.bytes=n+1,t};ut.encode.bytes=0;ut.decode=function(e,t){t||(t=0);let r=e[t],n=e.toString("utf-8",t+1,t+1+r);return ut.decode.bytes=r+1,n};ut.decode.bytes=0;ut.encodingLength=function(e){return Ue.byteLength(e)+1};var _i={};_i.encode=function(e,t,r){t||(t=_i.encodingLength(e)),r||(r=0);let n=(e.flags||0)&32767,i=e.type==="response"?HE:oD;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};_i.encode.bytes=12;_i.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&HE?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:aD.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:sD.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))}};_i.decode.bytes=12;_i.encodingLength=function(){return 12};var Bs=Le.unknown={};Bs.encode=function(e,t,r){return t||(t=Ue.alloc(Bs.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),Bs.encode.bytes=e.length+2,t};Bs.encode.bytes=0;Bs.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return Bs.decode.bytes=r+2,n};Bs.decode.bytes=0;Bs.encodingLength=function(e){return e.length+2};var Rs=Le.ns={};Rs.encode=function(e,t,r){return t||(t=Ue.alloc(Rs.encodingLength(e))),r||(r=0),De.encode(e,t,r+2),t.writeUInt16BE(De.encode.bytes,r),Rs.encode.bytes=De.encode.bytes+2,t};Rs.encode.bytes=0;Rs.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=De.decode(e,t+2);return Rs.decode.bytes=r+2,n};Rs.decode.bytes=0;Rs.encodingLength=function(e){return De.encodingLength(e)+2};var Ps=Le.soa={};Ps.encode=function(e,t,r){t||(t=Ue.alloc(Ps.encodingLength(e))),r||(r=0);let n=r;return r+=2,De.encode(e.mname,t,r),r+=De.encode.bytes,De.encode(e.rname,t,r,{mail:!0}),r+=De.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),Ps.encode.bytes=r-n,t};Ps.encode.bytes=0;Ps.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=De.decode(e,t),t+=De.decode.bytes,n.rname=De.decode(e,t,{mail:!0}),t+=De.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,Ps.decode.bytes=t-r,n};Ps.decode.bytes=0;Ps.encodingLength=function(e){return 22+De.encodingLength(e.mname)+De.encodingLength(e.rname)};var Ts=Le.txt={};Ts.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let i=0;i<e.length;i++)if(typeof e[i]=="string"&&(e[i]=Ue.from(e[i])),!Ue.isBuffer(e[i]))throw new Error("Must be a Buffer");t||(t=Ue.alloc(Ts.encodingLength(e))),r||(r=0);let n=r;return r+=2,e.forEach(function(i){t[r++]=i.length,i.copy(t,r,0,i.length),r+=i.length}),t.writeUInt16BE(r-n-2,n),Ts.encode.bytes=r-n,t};Ts.encode.bytes=0;Ts.decode=function(e,t){t||(t=0);let r=t,n=e.readUInt16BE(t);t+=2;let i=[];for(;n>0;){let a=e[t++];if(--n,n<a)throw new Error("Buffer overflow");i.push(e.slice(t,t+a)),t+=a,n-=a}return Ts.decode.bytes=t-r,i};Ts.decode.bytes=0;Ts.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(r){typeof r=="string"?t+=Ue.byteLength(r)+1:t+=r.length+1}),t};var Os=Le.null={};Os.encode=function(e,t,r){t||(t=Ue.alloc(Os.encodingLength(e))),r||(r=0),typeof e=="string"&&(e=Ue.from(e)),e||(e=Ue.alloc(0));let n=r;r+=2;let i=e.length;return e.copy(t,r,0,i),r+=i,t.writeUInt16BE(r-n-2,n),Os.encode.bytes=r-n,t};Os.encode.bytes=0;Os.decode=function(e,t){t||(t=0);let r=t,n=e.readUInt16BE(t);t+=2;let i=e.slice(t,t+n);return t+=n,Os.decode.bytes=t-r,i};Os.decode.bytes=0;Os.encodingLength=function(e){return e?(Ue.isBuffer(e)?e.length:Ue.byteLength(e))+2:2};var xs=Le.hinfo={};xs.encode=function(e,t,r){t||(t=Ue.alloc(xs.encodingLength(e))),r||(r=0);let n=r;return r+=2,ut.encode(e.cpu,t,r),r+=ut.encode.bytes,ut.encode(e.os,t,r),r+=ut.encode.bytes,t.writeUInt16BE(r-n-2,n),xs.encode.bytes=r-n,t};xs.encode.bytes=0;xs.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.cpu=ut.decode(e,t),t+=ut.decode.bytes,n.os=ut.decode(e,t),t+=ut.decode.bytes,xs.decode.bytes=t-r,n};xs.decode.bytes=0;xs.encodingLength=function(e){return ut.encodingLength(e.cpu)+ut.encodingLength(e.os)+2};var bi=Le.ptr={},lD=Le.cname=bi,fD=Le.dname=bi;bi.encode=function(e,t,r){return t||(t=Ue.alloc(bi.encodingLength(e))),r||(r=0),De.encode(e,t,r+2),t.writeUInt16BE(De.encode.bytes,r),bi.encode.bytes=De.encode.bytes+2,t};bi.encode.bytes=0;bi.decode=function(e,t){t||(t=0);let r=De.decode(e,t+2);return bi.decode.bytes=De.decode.bytes+2,r};bi.decode.bytes=0;bi.encodingLength=function(e){return De.encodingLength(e)+2};var Ns=Le.srv={};Ns.encode=function(e,t,r){t||(t=Ue.alloc(Ns.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.priority||0,r+2),t.writeUInt16BE(e.weight||0,r+4),t.writeUInt16BE(e.port||0,r+6),De.encode(e.target,t,r+8);let n=De.encode.bytes+6;return t.writeUInt16BE(n,r),Ns.encode.bytes=n+2,t};Ns.encode.bytes=0;Ns.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n={};return n.priority=e.readUInt16BE(t+2),n.weight=e.readUInt16BE(t+4),n.port=e.readUInt16BE(t+6),n.target=De.decode(e,t+8),Ns.decode.bytes=r+2,n};Ns.decode.bytes=0;Ns.encodingLength=function(e){return 8+De.encodingLength(e.target)};var Kn=Le.caa={};Kn.ISSUER_CRITICAL=128;Kn.encode=function(e,t,r){let n=Kn.encodingLength(e);return t||(t=Ue.alloc(Kn.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=Kn.ISSUER_CRITICAL),t.writeUInt16BE(n-2,r),r+=2,t.writeUInt8(e.flags||0,r),r+=1,ut.encode(e.tag,t,r),r+=ut.encode.bytes,t.write(e.value,r),r+=Ue.byteLength(e.value),Kn.encode.bytes=n,t};Kn.encode.bytes=0;Kn.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t);t+=2;let n=t,i={};return i.flags=e.readUInt8(t),t+=1,i.tag=ut.decode(e,t),t+=ut.decode.bytes,i.value=e.toString("utf-8",t,n+r),i.issuerCritical=!!(i.flags&Kn.ISSUER_CRITICAL),Kn.decode.bytes=r+2,i};Kn.decode.bytes=0;Kn.encodingLength=function(e){return ut.encodingLength(e.tag)+ut.encodingLength(e.value)+2};var ma=Le.mx={};ma.encode=function(e,t,r){t||(t=Ue.alloc(ma.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,De.encode(e.exchange,t,r),r+=De.encode.bytes,t.writeUInt16BE(r-n-2,n),ma.encode.bytes=r-n,t};ma.encode.bytes=0;ma.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.preference=e.readUInt16BE(t),t+=2,n.exchange=De.decode(e,t),t+=De.decode.bytes,ma.decode.bytes=t-r,n};ma.encodingLength=function(e){return 4+De.encodingLength(e.exchange)};var ks=Le.a={};ks.encode=function(e,t,r){return t||(t=Ue.alloc(ks.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,go.v4.encode(e,t,r),ks.encode.bytes=6,t};ks.encode.bytes=0;ks.decode=function(e,t){t||(t=0),t+=2;let r=go.v4.decode(e,t);return ks.decode.bytes=6,r};ks.decode.bytes=0;ks.encodingLength=function(){return 6};var Ls=Le.aaaa={};Ls.encode=function(e,t,r){return t||(t=Ue.alloc(Ls.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,go.v6.encode(e,t,r),Ls.encode.bytes=18,t};Ls.encode.bytes=0;Ls.decode=function(e,t){t||(t=0),t+=2;let r=go.v6.decode(e,t);return Ls.decode.bytes=18,r};Ls.decode.bytes=0;Ls.encodingLength=function(){return 18};var Bn=Le.option={};Bn.encode=function(e,t,r){t||(t=Ue.alloc(Bn.encodingLength(e))),r||(r=0);let n=r,i=p0.toCode(e.code);if(t.writeUInt16BE(i,r),r+=2,e.data)t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;else switch(i){case 8:let a=e.sourcePrefixLength||0,s=e.family||go.familyOf(e.ip),u=go.encode(e.ip,Ue.alloc),l=Math.ceil(a/8);t.writeUInt16BE(l+4,r),r+=2,t.writeUInt16BE(s,r),r+=2,t.writeUInt8(a,r++),t.writeUInt8(e.scopePrefixLength||0,r++),u.copy(t,r,0,l),r+=l;break;case 11:e.timeout?(t.writeUInt16BE(2,r),r+=2,t.writeUInt16BE(e.timeout,r),r+=2):(t.writeUInt16BE(0,r),r+=2);break;case 12:let f=e.length||0;t.writeUInt16BE(f,r),r+=2,t.fill(0,r,r+f),r+=f;break;case 14:let d=e.tags.length*2;t.writeUInt16BE(d,r),r+=2;for(let E of e.tags)t.writeUInt16BE(E,r),r+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return Bn.encode.bytes=r-n,t};Bn.encode.bytes=0;Bn.decode=function(e,t){t||(t=0);let r={};r.code=e.readUInt16BE(t),r.type=p0.toString(r.code),t+=2;let n=e.readUInt16BE(t);switch(t+=2,r.data=e.slice(t,t+n),r.code){case 8:r.family=e.readUInt16BE(t),t+=2,r.sourcePrefixLength=e.readUInt8(t++),r.scopePrefixLength=e.readUInt8(t++);let i=Ue.alloc(r.family===1?4:16);e.copy(i,0,t,t+n-4),r.ip=go.decode(i);break;case 11:n>0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let a=0;a<n;a+=2)r.tags.push(e.readUInt16BE(t)),t+=2}return Bn.decode.bytes=n+4,r};Bn.decode.bytes=0;Bn.encodingLength=function(e){if(e.data)return e.data.length+4;switch(p0.toCode(e.code)){case 8:let r=e.sourcePrefixLength||0;return Math.ceil(r/8)+8;case 11:return typeof e.timeout=="number"?6:4;case 12:return e.length+4;case 14:return 4+e.tags.length*2}throw new Error(`Unknown roption code: ${e.code}`)};var Gn=Le.opt={};Gn.encode=function(e,t,r){t||(t=Ue.alloc(Gn.encodingLength(e))),r||(r=0);let n=r,i=Pu(e,Bn);return t.writeUInt16BE(i,r),r=el(e,Bn,t,r+2),Gn.encode.bytes=r-n,t};Gn.encode.bytes=0;Gn.decode=function(e,t){t||(t=0);let r=t,n=[],i=e.readUInt16BE(t);t+=2;let a=0;for(;i>0;)n[a++]=Bn.decode(e,t),t+=Bn.decode.bytes,i-=Bn.decode.bytes;return Gn.decode.bytes=t-r,n};Gn.decode.bytes=0;Gn.encodingLength=function(e){return 2+Pu(e||[],Bn)};var dn=Le.dnskey={};dn.PROTOCOL_DNSSEC=3;dn.ZONE_KEY=128;dn.SECURE_ENTRYPOINT=32768;dn.encode=function(e,t,r){t||(t=Ue.alloc(dn.encodingLength(e))),r||(r=0);let n=r,i=e.key;if(!Ue.isBuffer(i))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(dn.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,dn.encode.bytes=r-n,t.writeUInt16BE(dn.encode.bytes-2,n),t};dn.encode.bytes=0;dn.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)!==dn.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,dn.decode.bytes=t-r,n};dn.decode.bytes=0;dn.encodingLength=function(e){return 6+Ue.byteLength(e.key)};var Vi=Le.rrsig={};Vi.encode=function(e,t,r){t||(t=Ue.alloc(Vi.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!Ue.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(Us.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,De.encode(e.signersName,t,r),r+=De.encode.bytes,i.copy(t,r,0,i.length),r+=i.length,Vi.encode.bytes=r-n,t.writeUInt16BE(Vi.encode.bytes-2,n),t};Vi.encode.bytes=0;Vi.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=Us.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=De.decode(e,t),t+=De.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,Vi.decode.bytes=t-r,n};Vi.decode.bytes=0;Vi.encodingLength=function(e){return 20+De.encodingLength(e.signersName)+Ue.byteLength(e.signature)};var Gi=Le.rp={};Gi.encode=function(e,t,r){t||(t=Ue.alloc(Gi.encodingLength(e))),r||(r=0);let n=r;return r+=2,De.encode(e.mbox||".",t,r,{mail:!0}),r+=De.encode.bytes,De.encode(e.txt||".",t,r),r+=De.encode.bytes,Gi.encode.bytes=r-n,t.writeUInt16BE(Gi.encode.bytes-2,n),t};Gi.encode.bytes=0;Gi.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=De.decode(e,t,{mail:!0})||".",t+=De.decode.bytes,n.txt=De.decode(e,t)||".",t+=De.decode.bytes,Gi.decode.bytes=t-r,n};Gi.decode.bytes=0;Gi.encodingLength=function(e){return 2+De.encodingLength(e.mbox||".")+De.encodingLength(e.txt||".")};var Rr={};Rr.encode=function(e,t,r){t||(t=Ue.alloc(Rr.encodingLength(e))),r||(r=0);let n=r;for(var i=[],a=0;a<e.length;a++){var s=Us.toType(e[a]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(a=0;a<i.length;a++)if(i[a]!==void 0){var u=Ue.from(i[a]);t.writeUInt8(a,r),r+=1,t.writeUInt8(u.length,r),r+=1,u.copy(t,r),r+=u.length}return Rr.encode.bytes=r-n,t};Rr.encode.bytes=0;Rr.decode=function(e,t,r){t||(t=0);let n=t;for(var i=[];t-n<r;){var a=e.readUInt8(t);t+=1;var s=e.readUInt8(t);t+=1;for(var u=0;u<s;u++)for(var l=e.readUInt8(t+u),f=0;f<8;f++)if(l&1<<7-f){var d=Us.toString(a<<8|u<<3|f);i.push(d)}t+=s}return Rr.decode.bytes=t-n,i};Rr.decode.bytes=0;Rr.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var n=Us.toType(e[r]);t[n>>8]=Math.max(t[n>>8]||0,n&255)}var i=0;for(r=0;r<t.length;r++)t[r]!==void 0&&(i+=2+Math.ceil((t[r]+1)/8));return i};var zi=Le.nsec={};zi.encode=function(e,t,r){t||(t=Ue.alloc(zi.encodingLength(e))),r||(r=0);let n=r;return r+=2,De.encode(e.nextDomain,t,r),r+=De.encode.bytes,Rr.encode(e.rrtypes,t,r),r+=Rr.encode.bytes,zi.encode.bytes=r-n,t.writeUInt16BE(zi.encode.bytes-2,n),t};zi.encode.bytes=0;zi.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.nextDomain=De.decode(e,t),t+=De.decode.bytes,n.rrtypes=Rr.decode(e,t,i-(t-r)),t+=Rr.decode.bytes,zi.decode.bytes=t-r,n};zi.decode.bytes=0;zi.encodingLength=function(e){return 2+De.encodingLength(e.nextDomain)+Rr.encodingLength(e.rrtypes)};var Yi=Le.nsec3={};Yi.encode=function(e,t,r){t||(t=Ue.alloc(Yi.encodingLength(e))),r||(r=0);let n=r,i=e.salt;if(!Ue.isBuffer(i))throw new Error("salt must be a Buffer");let a=e.nextDomain;if(!Ue.isBuffer(a))throw new Error("nextDomain must be a Buffer");return r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.flags,r),r+=1,t.writeUInt16BE(e.iterations,r),r+=2,t.writeUInt8(i.length,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,t.writeUInt8(a.length,r),r+=1,a.copy(t,r,0,a.length),r+=a.length,Rr.encode(e.rrtypes,t,r),r+=Rr.encode.bytes,Yi.encode.bytes=r-n,t.writeUInt16BE(Yi.encode.bytes-2,n),t};Yi.encode.bytes=0;Yi.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);t+=2,n.algorithm=e.readUInt8(t),t+=1,n.flags=e.readUInt8(t),t+=1,n.iterations=e.readUInt16BE(t),t+=2;let a=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+a),t+=a;let s=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=Rr.decode(e,t,i-(t-r)),t+=Rr.decode.bytes,Yi.decode.bytes=t-r,n};Yi.decode.bytes=0;Yi.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+Rr.encodingLength(e.rrtypes)};var Wi=Le.ds={};Wi.encode=function(e,t,r){t||(t=Ue.alloc(Wi.encodingLength(e))),r||(r=0);let n=r,i=e.digest;if(!Ue.isBuffer(i))throw new Error("Digest must be a Buffer");return r+=2,t.writeUInt16BE(e.keyTag,r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.digestType,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Wi.encode.bytes=r-n,t.writeUInt16BE(Wi.encode.bytes-2,n),t};Wi.encode.bytes=0;Wi.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.keyTag=e.readUInt16BE(t),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.digestType=e.readUInt8(t),t+=1,n.digest=e.slice(t,r+i+2),t+=n.digest.length,Wi.decode.bytes=t-r,n};Wi.decode.bytes=0;Wi.encodingLength=function(e){return 6+Ue.byteLength(e.digest)};var Vn=Le.sshfp={};Vn.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};Vn.encode=function(t,r,n){r||(r=Ue.alloc(Vn.encodingLength(t))),n||(n=0);let i=n;n+=2,r[n]=t.algorithm,n+=1,r[n]=t.hash,n+=1;let a=Ue.from(t.fingerprint.toUpperCase(),"hex");if(a.length!==Vn.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return a.copy(r,n),n+=a.byteLength,Vn.encode.bytes=n-i,r.writeUInt16BE(Vn.encode.bytes-2,i),r};Vn.encode.bytes=0;Vn.decode=function(t,r){r||(r=0);let n=r,i={};r+=2,i.algorithm=t[r],r+=1,i.hash=t[r],r+=1;let a=Vn.getFingerprintLengthForHashType(i.hash);return i.fingerprint=t.slice(r,r+a).toString("hex").toUpperCase(),r+=a,Vn.decode.bytes=r-n,i};Vn.decode.bytes=0;Vn.encodingLength=function(e){return 4+Ue.from(e.fingerprint,"hex").byteLength};var Xi=Le.naptr={};Xi.encode=function(e,t,r){t||(t=Ue.alloc(Xi.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.order||0,r),r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,ut.encode(e.flags,t,r),r+=ut.encode.bytes,ut.encode(e.services,t,r),r+=ut.encode.bytes,ut.encode(e.regexp,t,r),r+=ut.encode.bytes,De.encode(e.replacement,t,r),r+=De.encode.bytes,Xi.encode.bytes=r-n,t.writeUInt16BE(Xi.encode.bytes-2,n),t};Xi.encode.bytes=0;Xi.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.order=e.readUInt16BE(t),t+=2,n.preference=e.readUInt16BE(t),t+=2,n.flags=ut.decode(e,t),t+=ut.decode.bytes,n.services=ut.decode(e,t),t+=ut.decode.bytes,n.regexp=ut.decode(e,t),t+=ut.decode.bytes,n.replacement=De.decode(e,t),t+=De.decode.bytes,Xi.decode.bytes=t-r,n};Xi.decode.bytes=0;Xi.encodingLength=function(e){return ut.encodingLength(e.flags)+ut.encodingLength(e.services)+ut.encodingLength(e.regexp)+De.encodingLength(e.replacement)+6};var Ji=Le.tlsa={};Ji.encode=function(e,t,r){t||(t=Ue.alloc(Ji.encodingLength(e))),r||(r=0);let n=r,i=e.certificate;if(!Ue.isBuffer(i))throw new Error("Certificate must be a Buffer");return r+=2,t.writeUInt8(e.usage,r),r+=1,t.writeUInt8(e.selector,r),r+=1,t.writeUInt8(e.matchingType,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Ji.encode.bytes=r-n,t.writeUInt16BE(Ji.encode.bytes-2,n),t};Ji.encode.bytes=0;Ji.decode=function(e,t){t||(t=0);let r=t,n={},i=e.readUInt16BE(t);return t+=2,n.usage=e.readUInt8(t),t+=1,n.selector=e.readUInt8(t),t+=1,n.matchingType=e.readUInt8(t),t+=1,n.certificate=e.slice(t,r+i+2),t+=n.certificate.length,Ji.decode.bytes=t-r,n};Ji.decode.bytes=0;Ji.encodingLength=function(e){return 5+Ue.byteLength(e.certificate)};var g0=Le.record=function(e){switch(e.toUpperCase()){case"A":return ks;case"PTR":return bi;case"CNAME":return lD;case"DNAME":return fD;case"TXT":return Ts;case"NULL":return Os;case"AAAA":return Ls;case"SRV":return Ns;case"HINFO":return xs;case"CAA":return Kn;case"NS":return Rs;case"SOA":return Ps;case"MX":return ma;case"OPT":return Gn;case"DNSKEY":return dn;case"RRSIG":return Vi;case"RP":return Gi;case"NSEC":return zi;case"NSEC3":return Yi;case"SSHFP":return Vn;case"DS":return Wi;case"NAPTR":return Xi;case"TLSA":return Ji}return Bs},Hr=Le.answer={};Hr.encode=function(e,t,r){t||(t=Ue.alloc(Hr.encodingLength(e))),r||(r=0);let n=r;if(De.encode(e.name,t,r),r+=De.encode.bytes,t.writeUInt16BE(Us.toType(e.type),r),e.type.toUpperCase()==="OPT"){if(e.name!==".")throw new Error("OPT name must be root.");t.writeUInt16BE(e.udpPayloadSize||4096,r+2),t.writeUInt8(e.extendedRcode||0,r+4),t.writeUInt8(e.ednsVersion||0,r+5),t.writeUInt16BE(e.flags||0,r+6),r+=8,Gn.encode(e.options||[],t,r),r+=Gn.encode.bytes}else{let i=ah.toClass(e.class===void 0?"IN":e.class);e.flush&&(i|=d0),t.writeUInt16BE(i,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let a=g0(e.type);a.encode(e.data,t,r),r+=a.encode.bytes}return Hr.encode.bytes=r-n,t};Hr.encode.bytes=0;Hr.decode=function(e,t){t||(t=0);let r={},n=t;if(r.name=De.decode(e,t),t+=De.decode.bytes,r.type=Us.toString(e.readUInt16BE(t)),r.type==="OPT")r.udpPayloadSize=e.readUInt16BE(t+2),r.extendedRcode=e.readUInt8(t+4),r.ednsVersion=e.readUInt8(t+5),r.flags=e.readUInt16BE(t+6),r.flag_do=(r.flags>>15&1)===1,r.options=Gn.decode(e,t+8),t+=8+Gn.decode.bytes;else{let i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=ah.toString(i&uD),r.flush=!!(i&d0);let a=g0(r.type);r.data=a.decode(e,t+8),t+=8+a.decode.bytes}return Hr.decode.bytes=t-n,r};Hr.decode.bytes=0;Hr.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return De.encodingLength(e.name)+8+g0(e.type).encodingLength(t)};var Ci=Le.question={};Ci.encode=function(e,t,r){t||(t=Ue.alloc(Ci.encodingLength(e))),r||(r=0);let n=r;return De.encode(e.name,t,r),r+=De.encode.bytes,t.writeUInt16BE(Us.toType(e.type),r),r+=2,t.writeUInt16BE(ah.toClass(e.class===void 0?"IN":e.class),r),r+=2,Ci.encode.bytes=r-n,e};Ci.encode.bytes=0;Ci.decode=function(e,t){t||(t=0);let r=t,n={};return n.name=De.decode(e,t),t+=De.decode.bytes,n.type=Us.toString(e.readUInt16BE(t)),t+=2,n.class=ah.toString(e.readUInt16BE(t)),t+=2,!!(n.class&ME)&&(n.class&=cD),Ci.decode.bytes=t-r,n};Ci.decode.bytes=0;Ci.encodingLength=function(e){return De.encodingLength(e.name)+4};Le.AUTHORITATIVE_ANSWER=1024;Le.TRUNCATED_RESPONSE=512;Le.RECURSION_DESIRED=256;Le.RECURSION_AVAILABLE=128;Le.AUTHENTIC_DATA=32;Le.CHECKING_DISABLED=16;Le.DNSSEC_OK=32768;Le.encode=function(e,t,r){let n=!t;n&&(t=Ue.alloc(Le.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=[]),_i.encode(e,t,r),r+=_i.encode.bytes,r=el(e.questions,Ci,t,r),r=el(e.answers,Hr,t,r),r=el(e.authorities,Hr,t,r),r=el(e.additionals,Hr,t,r),Le.encode.bytes=r-i,n&&Le.encode.bytes!==t.length?t.slice(0,Le.encode.bytes):t};Le.encode.bytes=0;Le.decode=function(e,t){t||(t=0);let r=t,n=_i.decode(e,t);return t+=_i.decode.bytes,t=sh(n.questions,Ci,e,t),t=sh(n.answers,Hr,e,t),t=sh(n.authorities,Hr,e,t),t=sh(n.additionals,Hr,e,t),Le.decode.bytes=t-r,n};Le.decode.bytes=0;Le.encodingLength=function(e){return _i.encodingLength(e)+Pu(e.questions||[],Ci)+Pu(e.answers||[],Hr)+Pu(e.authorities||[],Hr)+Pu(e.additionals||[],Hr)};Le.streamEncode=function(e){let t=Le.encode(e),r=Ue.alloc(2);r.writeUInt16BE(t.byteLength);let n=Ue.concat([r,t]);return Le.streamEncode.bytes=n.byteLength,n};Le.streamEncode.bytes=0;Le.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let r=Le.decode(e.slice(2));return Le.streamDecode.bytes=Le.decode.bytes,r};Le.streamDecode.bytes=0;function Pu(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function el(e,t,r,n){for(let i=0;i<e.length;i++)t.encode(e[i],r,n),n+=t.encode.bytes;return n}function sh(e,t,r,n){for(let i=0;i<e.length;i++)e[i]=t.decode(r,n),n+=t.decode.bytes;return n}});var m0=ye((Ou,tl)=>{(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,E=4,p=1,h=2,A=1,m=2,S=4,w=8,y=16,_=32,B=64,D=128,j=256,q=512,F=30,P="...",L=800,M=16,V=1,W=2,G=3,z=1/0,X=9007199254740991,ie=17976931348623157e292,Se=NaN,we=4294967295,Ie=we-1,Ve=we>>>1,ue=[["ary",D],["bind",A],["bindKey",m],["curry",w],["curryRight",y],["flip",q],["partial",_],["partialRight",B],["rearg",j]],_e="[object Arguments]",He="[object Array]",Sr="[object AsyncFunction]",Ht="[object Boolean]",wt="[object Date]",ir="[object DOMException]",Gt="[object Error]",at="[object Function]",kt="[object GeneratorFunction]",it="[object Map]",bt="[object Number]",sr="[object Null]",et="[object Object]",Jt="[object Promise]",Zn="[object Proxy]",br="[object RegExp]",Tr="[object Set]",cr="[object String]",Mr="[object Symbol]",Sa="[object Undefined]",tn="[object WeakMap]",Ct="[object WeakSet]",lr="[object ArrayBuffer]",tt="[object DataView]",jr="[object Float32Array]",ba="[object Float64Array]",Ca="[object Int8Array]",_a="[object Int16Array]",Fa="[object Int32Array]",rs="[object Uint8Array]",Ia="[object Uint8ClampedArray]",Vs="[object Uint16Array]",Fi="[object Uint32Array]",ns=/\b__p \+= '';/g,Ao=/\b(__p \+=) '' \+/g,yo=/(__e\(.*?\)|\b__t\)) \+\n'';/g,So=/&(?:amp|lt|gt|quot|#39);/g,bo=/[&<>"']/g,Co=RegExp(So.source),_o=RegExp(bo.source),Fo=/<%-([\s\S]+?)%>/g,ju=/<%([\s\S]+?)%>/g,Io=/<%=([\s\S]+?)%>/g,qu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ku=/^\w*$/,Vu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gs=/[\\^$.*+?()[\]{}|]/g,Gu=RegExp(Gs.source),$a=/^\s+/,zu=/\s/,Yu=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Wu=/\{\n\/\* \[wrapped with (.+)\] \*/,Xu=/,? & /,Ju=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Zu=/[()=,{}\[\]\/\s]/,Qu=/\\(\\)?/g,ec=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ii=/\w*$/,$o=/^[-+]0x[0-9a-f]+$/i,tc=/^0b[01]+$/i,rc=/^\[object .+?Constructor\]$/,nc=/^0o[0-7]+$/i,Do=/^(?:0|[1-9]\d*)$/,$i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,gn=/($^)/,ic=/['\n\r\u2028\u2029\\]/g,zs="\\ud800-\\udfff",Pn="\\u0300-\\u036f",sc="\\ufe20-\\ufe2f",ac="\\u20d0-\\u20ff",Bo=Pn+sc+ac,Da="\\u2700-\\u27bf",Ro="a-z\\xdf-\\xf6\\xf8-\\xff",Ys="\\xac\\xb1\\xd7\\xf7",Zt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",oc="\\u2000-\\u206f",uc=" \\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",Po="A-Z\\xc0-\\xd6\\xd8-\\xde",Di="\\ufe0e\\ufe0f",Cr=Ys+Zt+oc+uc,Kt="['\u2019]",cc="["+zs+"]",Ba="["+Cr+"]",_r="["+Bo+"]",Ra="\\d+",To="["+Da+"]",Oo="["+Ro+"]",Pa="[^"+zs+Cr+Ra+Da+Ro+Po+"]",Bi="\\ud83c[\\udffb-\\udfff]",Ta="(?:"+_r+"|"+Bi+")",xo="[^"+zs+"]",Oa="(?:\\ud83c[\\udde6-\\uddff]){2}",xa="[\\ud800-\\udbff][\\udc00-\\udfff]",rn="["+Po+"]",T="\\u200d",x="(?:"+Oo+"|"+Pa+")",H="(?:"+rn+"|"+Pa+")",Q="(?:"+Kt+"(?:d|ll|m|re|s|t|ve))?",de="(?:"+Kt+"(?:D|LL|M|RE|S|T|VE))?",ve=Ta+"?",Fe="["+Di+"]?",Re="(?:"+T+"(?:"+[xo,Oa,xa].join("|")+")"+Fe+ve+")*",Pt="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Qt="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Or=Fe+ve+Re,xr="(?:"+[To,Oa,xa].join("|")+")"+Or,Tn="(?:"+[xo+_r+"?",_r,Oa,xa,cc].join("|")+")",Ws=RegExp(Kt,"g"),nn=RegExp(_r,"g"),Nr=RegExp(Bi+"(?="+Bi+")|"+Tn+Or,"g"),Xs=RegExp([rn+"?"+Oo+"+"+Q+"(?="+[Ba,rn,"$"].join("|")+")",H+"+"+de+"(?="+[Ba,rn+x,"$"].join("|")+")",rn+"?"+x+"+"+Q,rn+"+"+de,Qt,Pt,Ra,xr].join("|"),"g"),Qn=RegExp("["+T+zs+Bo+Di+"]"),Na=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xh=["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"],Nh=-1,Lt={};Lt[jr]=Lt[ba]=Lt[Ca]=Lt[_a]=Lt[Fa]=Lt[rs]=Lt[Ia]=Lt[Vs]=Lt[Fi]=!0,Lt[_e]=Lt[He]=Lt[lr]=Lt[Ht]=Lt[tt]=Lt[wt]=Lt[Gt]=Lt[at]=Lt[it]=Lt[bt]=Lt[et]=Lt[br]=Lt[Tr]=Lt[cr]=Lt[tn]=!1;var xt={};xt[_e]=xt[He]=xt[lr]=xt[tt]=xt[Ht]=xt[wt]=xt[jr]=xt[ba]=xt[Ca]=xt[_a]=xt[Fa]=xt[it]=xt[bt]=xt[et]=xt[br]=xt[Tr]=xt[cr]=xt[Mr]=xt[rs]=xt[Ia]=xt[Vs]=xt[Fi]=!0,xt[Gt]=xt[at]=xt[tn]=!1;var kh={\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"},Lh={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Uh={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Hh={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mh=parseFloat,jh=parseInt,dl=typeof global=="object"&&global&&global.Object===Object&&global,qh=typeof self=="object"&&self&&self.Object===Object&&self,fr=dl||qh||Function("return this")(),lc=typeof Ou=="object"&&Ou&&!Ou.nodeType&&Ou,is=lc&&typeof tl=="object"&&tl&&!tl.nodeType&&tl,gl=is&&is.exports===lc,fc=gl&&dl.process,mn=function(){try{var re=is&&is.require&&is.require("util").types;return re||fc&&fc.binding&&fc.binding("util")}catch{}}(),ml=mn&&mn.isArrayBuffer,vl=mn&&mn.isDate,El=mn&&mn.isMap,wl=mn&&mn.isRegExp,Al=mn&&mn.isSet,yl=mn&&mn.isTypedArray;function sn(re,le,oe){switch(oe.length){case 0:return re.call(le);case 1:return re.call(le,oe[0]);case 2:return re.call(le,oe[0],oe[1]);case 3:return re.call(le,oe[0],oe[1],oe[2])}return re.apply(le,oe)}function Kh(re,le,oe,Te){for(var Ye=-1,pt=re==null?0:re.length;++Ye<pt;){var Yt=re[Ye];le(Te,Yt,oe(Yt),re)}return Te}function vn(re,le){for(var oe=-1,Te=re==null?0:re.length;++oe<Te&&le(re[oe],oe,re)!==!1;);return re}function R(re,le){for(var oe=re==null?0:re.length;oe--&&le(re[oe],oe,re)!==!1;);return re}function Xe(re,le){for(var oe=-1,Te=re==null?0:re.length;++oe<Te;)if(!le(re[oe],oe,re))return!1;return!0}function On(re,le){for(var oe=-1,Te=re==null?0:re.length,Ye=0,pt=[];++oe<Te;){var Yt=re[oe];le(Yt,oe,re)&&(pt[Ye++]=Yt)}return pt}function an(re,le){var oe=re==null?0:re.length;return!!oe&&Js(re,le,0)>-1}function ka(re,le,oe){for(var Te=-1,Ye=re==null?0:re.length;++Te<Ye;)if(oe(le,re[Te]))return!0;return!1}function te(re,le){for(var oe=-1,Te=re==null?0:re.length,Ye=Array(Te);++oe<Te;)Ye[oe]=le(re[oe],oe,re);return Ye}function xn(re,le){for(var oe=-1,Te=le.length,Ye=re.length;++oe<Te;)re[Ye+oe]=le[oe];return re}function hc(re,le,oe,Te){var Ye=-1,pt=re==null?0:re.length;for(Te&&pt&&(oe=re[++Ye]);++Ye<pt;)oe=le(oe,re[Ye],Ye,re);return oe}function y1(re,le,oe,Te){var Ye=re==null?0:re.length;for(Te&&Ye&&(oe=re[--Ye]);Ye--;)oe=le(oe,re[Ye],Ye,re);return oe}function Sl(re,le){for(var oe=-1,Te=re==null?0:re.length;++oe<Te;)if(le(re[oe],oe,re))return!0;return!1}var zt=ss("length");function S1(re){return re.split("")}function pc(re){return re.match(Ju)||[]}function Me(re,le,oe){var Te;return oe(re,function(Ye,pt,Yt){if(le(Ye,pt,Yt))return Te=pt,!1}),Te}function hr(re,le,oe,Te){for(var Ye=re.length,pt=oe+(Te?1:-1);Te?pt--:++pt<Ye;)if(le(re[pt],pt,re))return pt;return-1}function Js(re,le,oe){return le===le?$l(re,le,oe):hr(re,ei,oe)}function Vh(re,le,oe,Te){for(var Ye=oe-1,pt=re.length;++Ye<pt;)if(Te(re[Ye],le))return Ye;return-1}function ei(re){return re!==re}function dc(re,le){var oe=re==null?0:re.length;return oe?No(re,le)/oe:Se}function ss(re){return function(le){return le==null?e:le[re]}}function pe(re){return function(le){return re==null?e:re[le]}}function bl(re,le,oe,Te,Ye){return Ye(re,function(pt,Yt,Tt){oe=Te?(Te=!1,pt):le(oe,pt,Yt,Tt)}),oe}function Cl(re,le){var oe=re.length;for(re.sort(le);oe--;)re[oe]=re[oe].value;return re}function No(re,le){for(var oe,Te=-1,Ye=re.length;++Te<Ye;){var pt=le(re[Te]);pt!==e&&(oe=oe===e?pt:oe+pt)}return oe}function gc(re,le){for(var oe=-1,Te=Array(re);++oe<re;)Te[oe]=le(oe);return Te}function Gh(re,le){return te(le,function(oe){return[oe,re[oe]]})}function mc(re){return re&&re.slice(0,Uo(re)+1).replace($a,"")}function qr(re){return function(le){return re(le)}}function La(re,le){return te(le,function(oe){return re[oe]})}function Ua(re,le){return re.has(le)}function ko(re,le){for(var oe=-1,Te=re.length;++oe<Te&&Js(le,re[oe],0)>-1;);return oe}function _l(re,le){for(var oe=re.length;oe--&&Js(le,re[oe],0)>-1;);return oe}function Fl(re,le){for(var oe=re.length,Te=0;oe--;)re[oe]===le&&++Te;return Te}var vc=pe(kh),zh=pe(Lh);function Il(re){return"\\"+Hh[re]}function Yh(re,le){return re==null?e:re[le]}function as(re){return Qn.test(re)}function Wh(re){return Na.test(re)}function Xh(re){for(var le,oe=[];!(le=re.next()).done;)oe.push(le.value);return oe}function Ec(re){var le=-1,oe=Array(re.size);return re.forEach(function(Te,Ye){oe[++le]=[Ye,Te]}),oe}function kr(re,le){return function(oe){return re(le(oe))}}function Nn(re,le){for(var oe=-1,Te=re.length,Ye=0,pt=[];++oe<Te;){var Yt=re[oe];(Yt===le||Yt===l)&&(re[oe]=l,pt[Ye++]=oe)}return pt}function kn(re){var le=-1,oe=Array(re.size);return re.forEach(function(Te){oe[++le]=Te}),oe}function Lo(re){var le=-1,oe=Array(re.size);return re.forEach(function(Te){oe[++le]=[Te,Te]}),oe}function $l(re,le,oe){for(var Te=oe-1,Ye=re.length;++Te<Ye;)if(re[Te]===le)return Te;return-1}function Jh(re,le,oe){for(var Te=oe+1;Te--;)if(re[Te]===le)return Te;return Te}function os(re){return as(re)?Bl(re):zt(re)}function En(re){return as(re)?Zh(re):S1(re)}function Uo(re){for(var le=re.length;le--&&zu.test(re.charAt(le)););return le}var Dl=pe(Uh);function Bl(re){for(var le=Nr.lastIndex=0;Nr.test(re);)++le;return le}function Zh(re){return re.match(Nr)||[]}function Qh(re){return re.match(Xs)||[]}var ep=function re(le){le=le==null?fr:ti.defaults(fr.Object(),le,ti.pick(fr,xh));var oe=le.Array,Te=le.Date,Ye=le.Error,pt=le.Function,Yt=le.Math,Tt=le.Object,Ho=le.RegExp,tp=le.String,wn=le.TypeError,Mo=oe.prototype,Rl=pt.prototype,us=Tt.prototype,gi=le["__core-js_shared__"],jo=Rl.toString,mt=us.hasOwnProperty,rp=0,qo=function(){var o=/[^.]+$/.exec(gi&&gi.keys&&gi.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),Ko=us.toString,np=jo.call(Tt),ip=fr._,sp=Ho("^"+jo.call(mt).replace(Gs,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vo=gl?le.Buffer:e,Ri=le.Symbol,Go=le.Uint8Array,Pl=Vo?Vo.allocUnsafe:e,zo=kr(Tt.getPrototypeOf,Tt),Tl=Tt.create,Ol=us.propertyIsEnumerable,_t=Mo.splice,xl=Ri?Ri.isConcatSpreadable:e,cs=Ri?Ri.iterator:e,ls=Ri?Ri.toStringTag:e,Yo=function(){try{var o=Ka(Tt,"defineProperty");return o({},"",{}),o}catch{}}(),b=le.clearTimeout!==fr.clearTimeout&&le.clearTimeout,N=Te&&Te.now!==fr.Date.now&&Te.now,J=le.setTimeout!==fr.setTimeout&&le.setTimeout,K=Yt.ceil,se=Yt.floor,ce=Tt.getOwnPropertySymbols,Ot=Vo?Vo.isBuffer:e,er=le.isFinite,JA=Mo.join,ZA=kr(Tt.keys,Tt),mr=Yt.max,Kr=Yt.min,QA=Te.now,ey=le.parseInt,b1=Yt.random,ty=Mo.reverse,ap=Ka(le,"DataView"),wc=Ka(le,"Map"),op=Ka(le,"Promise"),Wo=Ka(le,"Set"),Ac=Ka(le,"WeakMap"),yc=Ka(Tt,"create"),Nl=Ac&&new Ac,Xo={},ry=Va(ap),ny=Va(wc),iy=Va(op),sy=Va(Wo),ay=Va(Ac),kl=Ri?Ri.prototype:e,Sc=kl?kl.valueOf:e,C1=kl?kl.toString:e;function k(o){if(tr(o)&&!Ze(o)&&!(o instanceof ft)){if(o instanceof ri)return o;if(mt.call(o,"__wrapped__"))return _g(o)}return new ri(o)}var Jo=function(){function o(){}return function(c){if(!Wt(c))return{};if(Tl)return Tl(c);o.prototype=c;var v=new o;return o.prototype=e,v}}();function Ll(){}function ri(o,c){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=e}k.templateSettings={escape:Fo,evaluate:ju,interpolate:Io,variable:"",imports:{_:k}},k.prototype=Ll.prototype,k.prototype.constructor=k,ri.prototype=Jo(Ll.prototype),ri.prototype.constructor=ri;function ft(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=we,this.__views__=[]}function oy(){var o=new ft(this.__wrapped__);return o.__actions__=An(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=An(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=An(this.__views__),o}function uy(){if(this.__filtered__){var o=new ft(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function cy(){var o=this.__wrapped__.value(),c=this.__dir__,v=Ze(o),C=c<0,O=v?o.length:0,U=yS(0,O,this.__views__),Y=U.start,Z=U.end,ne=Z-Y,ge=C?Z:Y-1,me=this.__iteratees__,Ee=me.length,$e=0,ke=Kr(ne,this.__takeCount__);if(!v||!C&&O==ne&&ke==ne)return Y1(o,this.__actions__);var Ge=[];e:for(;ne--&&$e<ke;){ge+=c;for(var st=-1,ze=o[ge];++st<Ee;){var lt=me[st],dt=lt.iteratee,Hn=lt.type,cn=dt(ze);if(Hn==W)ze=cn;else if(!cn){if(Hn==V)continue e;break e}}Ge[$e++]=ze}return Ge}ft.prototype=Jo(Ll.prototype),ft.prototype.constructor=ft;function Ha(o){var c=-1,v=o==null?0:o.length;for(this.clear();++c<v;){var C=o[c];this.set(C[0],C[1])}}function ly(){this.__data__=yc?yc(null):{},this.size=0}function fy(o){var c=this.has(o)&&delete this.__data__[o];return this.size-=c?1:0,c}function hy(o){var c=this.__data__;if(yc){var v=c[o];return v===s?e:v}return mt.call(c,o)?c[o]:e}function py(o){var c=this.__data__;return yc?c[o]!==e:mt.call(c,o)}function dy(o,c){var v=this.__data__;return this.size+=this.has(o)?0:1,v[o]=yc&&c===e?s:c,this}Ha.prototype.clear=ly,Ha.prototype.delete=fy,Ha.prototype.get=hy,Ha.prototype.has=py,Ha.prototype.set=dy;function hs(o){var c=-1,v=o==null?0:o.length;for(this.clear();++c<v;){var C=o[c];this.set(C[0],C[1])}}function gy(){this.__data__=[],this.size=0}function my(o){var c=this.__data__,v=Ul(c,o);if(v<0)return!1;var C=c.length-1;return v==C?c.pop():_t.call(c,v,1),--this.size,!0}function vy(o){var c=this.__data__,v=Ul(c,o);return v<0?e:c[v][1]}function Ey(o){return Ul(this.__data__,o)>-1}function wy(o,c){var v=this.__data__,C=Ul(v,o);return C<0?(++this.size,v.push([o,c])):v[C][1]=c,this}hs.prototype.clear=gy,hs.prototype.delete=my,hs.prototype.get=vy,hs.prototype.has=Ey,hs.prototype.set=wy;function ps(o){var c=-1,v=o==null?0:o.length;for(this.clear();++c<v;){var C=o[c];this.set(C[0],C[1])}}function Ay(){this.size=0,this.__data__={hash:new Ha,map:new(wc||hs),string:new Ha}}function yy(o){var c=Jl(this,o).delete(o);return this.size-=c?1:0,c}function Sy(o){return Jl(this,o).get(o)}function by(o){return Jl(this,o).has(o)}function Cy(o,c){var v=Jl(this,o),C=v.size;return v.set(o,c),this.size+=v.size==C?0:1,this}ps.prototype.clear=Ay,ps.prototype.delete=yy,ps.prototype.get=Sy,ps.prototype.has=by,ps.prototype.set=Cy;function Ma(o){var c=-1,v=o==null?0:o.length;for(this.__data__=new ps;++c<v;)this.add(o[c])}function _y(o){return this.__data__.set(o,s),this}function Fy(o){return this.__data__.has(o)}Ma.prototype.add=Ma.prototype.push=_y,Ma.prototype.has=Fy;function mi(o){var c=this.__data__=new hs(o);this.size=c.size}function Iy(){this.__data__=new hs,this.size=0}function $y(o){var c=this.__data__,v=c.delete(o);return this.size=c.size,v}function Dy(o){return this.__data__.get(o)}function By(o){return this.__data__.has(o)}function Ry(o,c){var v=this.__data__;if(v instanceof hs){var C=v.__data__;if(!wc||C.length<r-1)return C.push([o,c]),this.size=++v.size,this;v=this.__data__=new ps(C)}return v.set(o,c),this.size=v.size,this}mi.prototype.clear=Iy,mi.prototype.delete=$y,mi.prototype.get=Dy,mi.prototype.has=By,mi.prototype.set=Ry;function _1(o,c){var v=Ze(o),C=!v&&Ga(o),O=!v&&!C&&ra(o),U=!v&&!C&&!O&&tu(o),Y=v||C||O||U,Z=Y?gc(o.length,tp):[],ne=Z.length;for(var ge in o)(c||mt.call(o,ge))&&!(Y&&(ge=="length"||O&&(ge=="offset"||ge=="parent")||U&&(ge=="buffer"||ge=="byteLength"||ge=="byteOffset")||Es(ge,ne)))&&Z.push(ge);return Z}function F1(o){var c=o.length;return c?o[Ep(0,c-1)]:e}function Py(o,c){return Zl(An(o),ja(c,0,o.length))}function Ty(o){return Zl(An(o))}function up(o,c,v){(v!==e&&!vi(o[c],v)||v===e&&!(c in o))&&ds(o,c,v)}function bc(o,c,v){var C=o[c];(!(mt.call(o,c)&&vi(C,v))||v===e&&!(c in o))&&ds(o,c,v)}function Ul(o,c){for(var v=o.length;v--;)if(vi(o[v][0],c))return v;return-1}function Oy(o,c,v,C){return Zs(o,function(O,U,Y){c(C,O,v(O),Y)}),C}function I1(o,c){return o&&Ti(c,Fr(c),o)}function xy(o,c){return o&&Ti(c,Sn(c),o)}function ds(o,c,v){c=="__proto__"&&Yo?Yo(o,c,{configurable:!0,enumerable:!0,value:v,writable:!0}):o[c]=v}function cp(o,c){for(var v=-1,C=c.length,O=oe(C),U=o==null;++v<C;)O[v]=U?e:qp(o,c[v]);return O}function ja(o,c,v){return o===o&&(v!==e&&(o=o<=v?o:v),c!==e&&(o=o>=c?o:c)),o}function ni(o,c,v,C,O,U){var Y,Z=c&f,ne=c&d,ge=c&E;if(v&&(Y=O?v(o,C,O,U):v(o)),Y!==e)return Y;if(!Wt(o))return o;var me=Ze(o);if(me){if(Y=bS(o),!Z)return An(o,Y)}else{var Ee=Vr(o),$e=Ee==at||Ee==kt;if(ra(o))return J1(o,Z);if(Ee==et||Ee==_e||$e&&!O){if(Y=ne||$e?{}:mg(o),!Z)return ne?hS(o,xy(Y,o)):fS(o,I1(Y,o))}else{if(!xt[Ee])return O?o:{};Y=CS(o,Ee,Z)}}U||(U=new mi);var ke=U.get(o);if(ke)return ke;U.set(o,Y),Vg(o)?o.forEach(function(ze){Y.add(ni(ze,c,v,ze,o,U))}):qg(o)&&o.forEach(function(ze,lt){Y.set(lt,ni(ze,c,v,lt,o,U))});var Ge=ge?ne?Dp:$p:ne?Sn:Fr,st=me?e:Ge(o);return vn(st||o,function(ze,lt){st&&(lt=ze,ze=o[lt]),bc(Y,lt,ni(ze,c,v,lt,o,U))}),Y}function Ny(o){var c=Fr(o);return function(v){return $1(v,o,c)}}function $1(o,c,v){var C=v.length;if(o==null)return!C;for(o=Tt(o);C--;){var O=v[C],U=c[O],Y=o[O];if(Y===e&&!(O in o)||!U(Y))return!1}return!0}function D1(o,c,v){if(typeof o!="function")throw new wn(i);return Bc(function(){o.apply(e,v)},c)}function Cc(o,c,v,C){var O=-1,U=an,Y=!0,Z=o.length,ne=[],ge=c.length;if(!Z)return ne;v&&(c=te(c,qr(v))),C?(U=ka,Y=!1):c.length>=r&&(U=Ua,Y=!1,c=new Ma(c));e:for(;++O<Z;){var me=o[O],Ee=v==null?me:v(me);if(me=C||me!==0?me:0,Y&&Ee===Ee){for(var $e=ge;$e--;)if(c[$e]===Ee)continue e;ne.push(me)}else U(c,Ee,C)||ne.push(me)}return ne}var Zs=rg(Pi),B1=rg(fp,!0);function ky(o,c){var v=!0;return Zs(o,function(C,O,U){return v=!!c(C,O,U),v}),v}function Hl(o,c,v){for(var C=-1,O=o.length;++C<O;){var U=o[C],Y=c(U);if(Y!=null&&(Z===e?Y===Y&&!Un(Y):v(Y,Z)))var Z=Y,ne=U}return ne}function Ly(o,c,v,C){var O=o.length;for(v=nt(v),v<0&&(v=-v>O?0:O+v),C=C===e||C>O?O:nt(C),C<0&&(C+=O),C=v>C?0:zg(C);v<C;)o[v++]=c;return o}function R1(o,c){var v=[];return Zs(o,function(C,O,U){c(C,O,U)&&v.push(C)}),v}function Lr(o,c,v,C,O){var U=-1,Y=o.length;for(v||(v=FS),O||(O=[]);++U<Y;){var Z=o[U];c>0&&v(Z)?c>1?Lr(Z,c-1,v,C,O):xn(O,Z):C||(O[O.length]=Z)}return O}var lp=ng(),P1=ng(!0);function Pi(o,c){return o&&lp(o,c,Fr)}function fp(o,c){return o&&P1(o,c,Fr)}function Ml(o,c){return On(c,function(v){return ws(o[v])})}function qa(o,c){c=ea(c,o);for(var v=0,C=c.length;o!=null&&v<C;)o=o[Oi(c[v++])];return v&&v==C?o:e}function T1(o,c,v){var C=c(o);return Ze(o)?C:xn(C,v(o))}function on(o){return o==null?o===e?Sa:sr:ls&&ls in Tt(o)?AS(o):TS(o)}function hp(o,c){return o>c}function Uy(o,c){return o!=null&&mt.call(o,c)}function Hy(o,c){return o!=null&&c in Tt(o)}function My(o,c,v){return o>=Kr(c,v)&&o<mr(c,v)}function pp(o,c,v){for(var C=v?ka:an,O=o[0].length,U=o.length,Y=U,Z=oe(U),ne=1/0,ge=[];Y--;){var me=o[Y];Y&&c&&(me=te(me,qr(c))),ne=Kr(me.length,ne),Z[Y]=!v&&(c||O>=120&&me.length>=120)?new Ma(Y&&me):e}me=o[0];var Ee=-1,$e=Z[0];e:for(;++Ee<O&&ge.length<ne;){var ke=me[Ee],Ge=c?c(ke):ke;if(ke=v||ke!==0?ke:0,!($e?Ua($e,Ge):C(ge,Ge,v))){for(Y=U;--Y;){var st=Z[Y];if(!(st?Ua(st,Ge):C(o[Y],Ge,v)))continue e}$e&&$e.push(Ge),ge.push(ke)}}return ge}function jy(o,c,v,C){return Pi(o,function(O,U,Y){c(C,v(O),U,Y)}),C}function _c(o,c,v){c=ea(c,o),o=Ag(o,c);var C=o==null?o:o[Oi(si(c))];return C==null?e:sn(C,o,v)}function O1(o){return tr(o)&&on(o)==_e}function qy(o){return tr(o)&&on(o)==lr}function Ky(o){return tr(o)&&on(o)==wt}function Fc(o,c,v,C,O){return o===c?!0:o==null||c==null||!tr(o)&&!tr(c)?o!==o&&c!==c:Vy(o,c,v,C,Fc,O)}function Vy(o,c,v,C,O,U){var Y=Ze(o),Z=Ze(c),ne=Y?He:Vr(o),ge=Z?He:Vr(c);ne=ne==_e?et:ne,ge=ge==_e?et:ge;var me=ne==et,Ee=ge==et,$e=ne==ge;if($e&&ra(o)){if(!ra(c))return!1;Y=!0,me=!1}if($e&&!me)return U||(U=new mi),Y||tu(o)?pg(o,c,v,C,O,U):ES(o,c,ne,v,C,O,U);if(!(v&p)){var ke=me&&mt.call(o,"__wrapped__"),Ge=Ee&&mt.call(c,"__wrapped__");if(ke||Ge){var st=ke?o.value():o,ze=Ge?c.value():c;return U||(U=new mi),O(st,ze,v,C,U)}}return $e?(U||(U=new mi),wS(o,c,v,C,O,U)):!1}function Gy(o){return tr(o)&&Vr(o)==it}function dp(o,c,v,C){var O=v.length,U=O,Y=!C;if(o==null)return!U;for(o=Tt(o);O--;){var Z=v[O];if(Y&&Z[2]?Z[1]!==o[Z[0]]:!(Z[0]in o))return!1}for(;++O<U;){Z=v[O];var ne=Z[0],ge=o[ne],me=Z[1];if(Y&&Z[2]){if(ge===e&&!(ne in o))return!1}else{var Ee=new mi;if(C)var $e=C(ge,me,ne,o,c,Ee);if(!($e===e?Fc(me,ge,p|h,C,Ee):$e))return!1}}return!0}function x1(o){if(!Wt(o)||$S(o))return!1;var c=ws(o)?sp:rc;return c.test(Va(o))}function zy(o){return tr(o)&&on(o)==br}function Yy(o){return tr(o)&&Vr(o)==Tr}function Wy(o){return tr(o)&&sf(o.length)&&!!Lt[on(o)]}function N1(o){return typeof o=="function"?o:o==null?bn:typeof o=="object"?Ze(o)?U1(o[0],o[1]):L1(o):im(o)}function gp(o){if(!Dc(o))return ZA(o);var c=[];for(var v in Tt(o))mt.call(o,v)&&v!="constructor"&&c.push(v);return c}function Xy(o){if(!Wt(o))return PS(o);var c=Dc(o),v=[];for(var C in o)C=="constructor"&&(c||!mt.call(o,C))||v.push(C);return v}function mp(o,c){return o<c}function k1(o,c){var v=-1,C=yn(o)?oe(o.length):[];return Zs(o,function(O,U,Y){C[++v]=c(O,U,Y)}),C}function L1(o){var c=Rp(o);return c.length==1&&c[0][2]?Eg(c[0][0],c[0][1]):function(v){return v===o||dp(v,o,c)}}function U1(o,c){return Tp(o)&&vg(c)?Eg(Oi(o),c):function(v){var C=qp(v,o);return C===e&&C===c?Kp(v,o):Fc(c,C,p|h)}}function jl(o,c,v,C,O){o!==c&&lp(c,function(U,Y){if(O||(O=new mi),Wt(U))Jy(o,c,Y,v,jl,C,O);else{var Z=C?C(xp(o,Y),U,Y+"",o,c,O):e;Z===e&&(Z=U),up(o,Y,Z)}},Sn)}function Jy(o,c,v,C,O,U,Y){var Z=xp(o,v),ne=xp(c,v),ge=Y.get(ne);if(ge){up(o,v,ge);return}var me=U?U(Z,ne,v+"",o,c,Y):e,Ee=me===e;if(Ee){var $e=Ze(ne),ke=!$e&&ra(ne),Ge=!$e&&!ke&&tu(ne);me=ne,$e||ke||Ge?Ze(Z)?me=Z:ar(Z)?me=An(Z):ke?(Ee=!1,me=J1(ne,!0)):Ge?(Ee=!1,me=Z1(ne,!0)):me=[]:Rc(ne)||Ga(ne)?(me=Z,Ga(Z)?me=Yg(Z):(!Wt(Z)||ws(Z))&&(me=mg(ne))):Ee=!1}Ee&&(Y.set(ne,me),O(me,ne,C,U,Y),Y.delete(ne)),up(o,v,me)}function H1(o,c){var v=o.length;if(v)return c+=c<0?v:0,Es(c,v)?o[c]:e}function M1(o,c,v){c.length?c=te(c,function(U){return Ze(U)?function(Y){return qa(Y,U.length===1?U[0]:U)}:U}):c=[bn];var C=-1;c=te(c,qr(qe()));var O=k1(o,function(U,Y,Z){var ne=te(c,function(ge){return ge(U)});return{criteria:ne,index:++C,value:U}});return Cl(O,function(U,Y){return lS(U,Y,v)})}function Zy(o,c){return j1(o,c,function(v,C){return Kp(o,C)})}function j1(o,c,v){for(var C=-1,O=c.length,U={};++C<O;){var Y=c[C],Z=qa(o,Y);v(Z,Y)&&Ic(U,ea(Y,o),Z)}return U}function Qy(o){return function(c){return qa(c,o)}}function vp(o,c,v,C){var O=C?Vh:Js,U=-1,Y=c.length,Z=o;for(o===c&&(c=An(c)),v&&(Z=te(o,qr(v)));++U<Y;)for(var ne=0,ge=c[U],me=v?v(ge):ge;(ne=O(Z,me,ne,C))>-1;)Z!==o&&_t.call(Z,ne,1),_t.call(o,ne,1);return o}function q1(o,c){for(var v=o?c.length:0,C=v-1;v--;){var O=c[v];if(v==C||O!==U){var U=O;Es(O)?_t.call(o,O,1):yp(o,O)}}return o}function Ep(o,c){return o+se(b1()*(c-o+1))}function eS(o,c,v,C){for(var O=-1,U=mr(K((c-o)/(v||1)),0),Y=oe(U);U--;)Y[C?U:++O]=o,o+=v;return Y}function wp(o,c){var v="";if(!o||c<1||c>X)return v;do c%2&&(v+=o),c=se(c/2),c&&(o+=o);while(c);return v}function ot(o,c){return Np(wg(o,c,bn),o+"")}function tS(o){return F1(ru(o))}function rS(o,c){var v=ru(o);return Zl(v,ja(c,0,v.length))}function Ic(o,c,v,C){if(!Wt(o))return o;c=ea(c,o);for(var O=-1,U=c.length,Y=U-1,Z=o;Z!=null&&++O<U;){var ne=Oi(c[O]),ge=v;if(ne==="__proto__"||ne==="constructor"||ne==="prototype")return o;if(O!=Y){var me=Z[ne];ge=C?C(me,ne,Z):e,ge===e&&(ge=Wt(me)?me:Es(c[O+1])?[]:{})}bc(Z,ne,ge),Z=Z[ne]}return o}var K1=Nl?function(o,c){return Nl.set(o,c),o}:bn,nS=Yo?function(o,c){return Yo(o,"toString",{configurable:!0,enumerable:!1,value:Gp(c),writable:!0})}:bn;function iS(o){return Zl(ru(o))}function ii(o,c,v){var C=-1,O=o.length;c<0&&(c=-c>O?0:O+c),v=v>O?O:v,v<0&&(v+=O),O=c>v?0:v-c>>>0,c>>>=0;for(var U=oe(O);++C<O;)U[C]=o[C+c];return U}function sS(o,c){var v;return Zs(o,function(C,O,U){return v=c(C,O,U),!v}),!!v}function ql(o,c,v){var C=0,O=o==null?C:o.length;if(typeof c=="number"&&c===c&&O<=Ve){for(;C<O;){var U=C+O>>>1,Y=o[U];Y!==null&&!Un(Y)&&(v?Y<=c:Y<c)?C=U+1:O=U}return O}return Ap(o,c,bn,v)}function Ap(o,c,v,C){var O=0,U=o==null?0:o.length;if(U===0)return 0;c=v(c);for(var Y=c!==c,Z=c===null,ne=Un(c),ge=c===e;O<U;){var me=se((O+U)/2),Ee=v(o[me]),$e=Ee!==e,ke=Ee===null,Ge=Ee===Ee,st=Un(Ee);if(Y)var ze=C||Ge;else ge?ze=Ge&&(C||$e):Z?ze=Ge&&$e&&(C||!ke):ne?ze=Ge&&$e&&!ke&&(C||!st):ke||st?ze=!1:ze=C?Ee<=c:Ee<c;ze?O=me+1:U=me}return Kr(U,Ie)}function V1(o,c){for(var v=-1,C=o.length,O=0,U=[];++v<C;){var Y=o[v],Z=c?c(Y):Y;if(!v||!vi(Z,ne)){var ne=Z;U[O++]=Y===0?0:Y}}return U}function G1(o){return typeof o=="number"?o:Un(o)?Se:+o}function Ln(o){if(typeof o=="string")return o;if(Ze(o))return te(o,Ln)+"";if(Un(o))return C1?C1.call(o):"";var c=o+"";return c=="0"&&1/o==-z?"-0":c}function Qs(o,c,v){var C=-1,O=an,U=o.length,Y=!0,Z=[],ne=Z;if(v)Y=!1,O=ka;else if(U>=r){var ge=c?null:mS(o);if(ge)return kn(ge);Y=!1,O=Ua,ne=new Ma}else ne=c?[]:Z;e:for(;++C<U;){var me=o[C],Ee=c?c(me):me;if(me=v||me!==0?me:0,Y&&Ee===Ee){for(var $e=ne.length;$e--;)if(ne[$e]===Ee)continue e;c&&ne.push(Ee),Z.push(me)}else O(ne,Ee,v)||(ne!==Z&&ne.push(Ee),Z.push(me))}return Z}function yp(o,c){return c=ea(c,o),o=Ag(o,c),o==null||delete o[Oi(si(c))]}function z1(o,c,v,C){return Ic(o,c,v(qa(o,c)),C)}function Kl(o,c,v,C){for(var O=o.length,U=C?O:-1;(C?U--:++U<O)&&c(o[U],U,o););return v?ii(o,C?0:U,C?U+1:O):ii(o,C?U+1:0,C?O:U)}function Y1(o,c){var v=o;return v instanceof ft&&(v=v.value()),hc(c,function(C,O){return O.func.apply(O.thisArg,xn([C],O.args))},v)}function Sp(o,c,v){var C=o.length;if(C<2)return C?Qs(o[0]):[];for(var O=-1,U=oe(C);++O<C;)for(var Y=o[O],Z=-1;++Z<C;)Z!=O&&(U[O]=Cc(U[O]||Y,o[Z],c,v));return Qs(Lr(U,1),c,v)}function W1(o,c,v){for(var C=-1,O=o.length,U=c.length,Y={};++C<O;){var Z=C<U?c[C]:e;v(Y,o[C],Z)}return Y}function bp(o){return ar(o)?o:[]}function Cp(o){return typeof o=="function"?o:bn}function ea(o,c){return Ze(o)?o:Tp(o,c)?[o]:Cg($t(o))}var aS=ot;function ta(o,c,v){var C=o.length;return v=v===e?C:v,!c&&v>=C?o:ii(o,c,v)}var X1=b||function(o){return fr.clearTimeout(o)};function J1(o,c){if(c)return o.slice();var v=o.length,C=Pl?Pl(v):new o.constructor(v);return o.copy(C),C}function _p(o){var c=new o.constructor(o.byteLength);return new Go(c).set(new Go(o)),c}function oS(o,c){var v=c?_p(o.buffer):o.buffer;return new o.constructor(v,o.byteOffset,o.byteLength)}function uS(o){var c=new o.constructor(o.source,Ii.exec(o));return c.lastIndex=o.lastIndex,c}function cS(o){return Sc?Tt(Sc.call(o)):{}}function Z1(o,c){var v=c?_p(o.buffer):o.buffer;return new o.constructor(v,o.byteOffset,o.length)}function Q1(o,c){if(o!==c){var v=o!==e,C=o===null,O=o===o,U=Un(o),Y=c!==e,Z=c===null,ne=c===c,ge=Un(c);if(!Z&&!ge&&!U&&o>c||U&&Y&&ne&&!Z&&!ge||C&&Y&&ne||!v&&ne||!O)return 1;if(!C&&!U&&!ge&&o<c||ge&&v&&O&&!C&&!U||Z&&v&&O||!Y&&O||!ne)return-1}return 0}function lS(o,c,v){for(var C=-1,O=o.criteria,U=c.criteria,Y=O.length,Z=v.length;++C<Y;){var ne=Q1(O[C],U[C]);if(ne){if(C>=Z)return ne;var ge=v[C];return ne*(ge=="desc"?-1:1)}}return o.index-c.index}function eg(o,c,v,C){for(var O=-1,U=o.length,Y=v.length,Z=-1,ne=c.length,ge=mr(U-Y,0),me=oe(ne+ge),Ee=!C;++Z<ne;)me[Z]=c[Z];for(;++O<Y;)(Ee||O<U)&&(me[v[O]]=o[O]);for(;ge--;)me[Z++]=o[O++];return me}function tg(o,c,v,C){for(var O=-1,U=o.length,Y=-1,Z=v.length,ne=-1,ge=c.length,me=mr(U-Z,0),Ee=oe(me+ge),$e=!C;++O<me;)Ee[O]=o[O];for(var ke=O;++ne<ge;)Ee[ke+ne]=c[ne];for(;++Y<Z;)($e||O<U)&&(Ee[ke+v[Y]]=o[O++]);return Ee}function An(o,c){var v=-1,C=o.length;for(c||(c=oe(C));++v<C;)c[v]=o[v];return c}function Ti(o,c,v,C){var O=!v;v||(v={});for(var U=-1,Y=c.length;++U<Y;){var Z=c[U],ne=C?C(v[Z],o[Z],Z,v,o):e;ne===e&&(ne=o[Z]),O?ds(v,Z,ne):bc(v,Z,ne)}return v}function fS(o,c){return Ti(o,Pp(o),c)}function hS(o,c){return Ti(o,dg(o),c)}function Vl(o,c){return function(v,C){var O=Ze(v)?Kh:Oy,U=c?c():{};return O(v,o,qe(C,2),U)}}function Zo(o){return ot(function(c,v){var C=-1,O=v.length,U=O>1?v[O-1]:e,Y=O>2?v[2]:e;for(U=o.length>3&&typeof U=="function"?(O--,U):e,Y&&un(v[0],v[1],Y)&&(U=O<3?e:U,O=1),c=Tt(c);++C<O;){var Z=v[C];Z&&o(c,Z,C,U)}return c})}function rg(o,c){return function(v,C){if(v==null)return v;if(!yn(v))return o(v,C);for(var O=v.length,U=c?O:-1,Y=Tt(v);(c?U--:++U<O)&&C(Y[U],U,Y)!==!1;);return v}}function ng(o){return function(c,v,C){for(var O=-1,U=Tt(c),Y=C(c),Z=Y.length;Z--;){var ne=Y[o?Z:++O];if(v(U[ne],ne,U)===!1)break}return c}}function pS(o,c,v){var C=c&A,O=$c(o);function U(){var Y=this&&this!==fr&&this instanceof U?O:o;return Y.apply(C?v:this,arguments)}return U}function ig(o){return function(c){c=$t(c);var v=as(c)?En(c):e,C=v?v[0]:c.charAt(0),O=v?ta(v,1).join(""):c.slice(1);return C[o]()+O}}function Qo(o){return function(c){return hc(rm(tm(c).replace(Ws,"")),o,"")}}function $c(o){return function(){var c=arguments;switch(c.length){case 0:return new o;case 1:return new o(c[0]);case 2:return new o(c[0],c[1]);case 3:return new o(c[0],c[1],c[2]);case 4:return new o(c[0],c[1],c[2],c[3]);case 5:return new o(c[0],c[1],c[2],c[3],c[4]);case 6:return new o(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new o(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var v=Jo(o.prototype),C=o.apply(v,c);return Wt(C)?C:v}}function dS(o,c,v){var C=$c(o);function O(){for(var U=arguments.length,Y=oe(U),Z=U,ne=eu(O);Z--;)Y[Z]=arguments[Z];var ge=U<3&&Y[0]!==ne&&Y[U-1]!==ne?[]:Nn(Y,ne);if(U-=ge.length,U<v)return cg(o,c,Gl,O.placeholder,e,Y,ge,e,e,v-U);var me=this&&this!==fr&&this instanceof O?C:o;return sn(me,this,Y)}return O}function sg(o){return function(c,v,C){var O=Tt(c);if(!yn(c)){var U=qe(v,3);c=Fr(c),v=function(Z){return U(O[Z],Z,O)}}var Y=o(c,v,C);return Y>-1?O[U?c[Y]:Y]:e}}function ag(o){return vs(function(c){var v=c.length,C=v,O=ri.prototype.thru;for(o&&c.reverse();C--;){var U=c[C];if(typeof U!="function")throw new wn(i);if(O&&!Y&&Xl(U)=="wrapper")var Y=new ri([],!0)}for(C=Y?C:v;++C<v;){U=c[C];var Z=Xl(U),ne=Z=="wrapper"?Bp(U):e;ne&&Op(ne[0])&&ne[1]==(D|w|_|j)&&!ne[4].length&&ne[9]==1?Y=Y[Xl(ne[0])].apply(Y,ne[3]):Y=U.length==1&&Op(U)?Y[Z]():Y.thru(U)}return function(){var ge=arguments,me=ge[0];if(Y&&ge.length==1&&Ze(me))return Y.plant(me).value();for(var Ee=0,$e=v?c[Ee].apply(this,ge):me;++Ee<v;)$e=c[Ee].call(this,$e);return $e}})}function Gl(o,c,v,C,O,U,Y,Z,ne,ge){var me=c&D,Ee=c&A,$e=c&m,ke=c&(w|y),Ge=c&q,st=$e?e:$c(o);function ze(){for(var lt=arguments.length,dt=oe(lt),Hn=lt;Hn--;)dt[Hn]=arguments[Hn];if(ke)var cn=eu(ze),Mn=Fl(dt,cn);if(C&&(dt=eg(dt,C,O,ke)),U&&(dt=tg(dt,U,Y,ke)),lt-=Mn,ke&&lt<ge){var or=Nn(dt,cn);return cg(o,c,Gl,ze.placeholder,v,dt,or,Z,ne,ge-lt)}var Ei=Ee?v:this,ys=$e?Ei[o]:o;return lt=dt.length,Z?dt=OS(dt,Z):Ge&&lt>1&&dt.reverse(),me&&ne<lt&&(dt.length=ne),this&&this!==fr&&this instanceof ze&&(ys=st||$c(ys)),ys.apply(Ei,dt)}return ze}function og(o,c){return function(v,C){return jy(v,o,c(C),{})}}function zl(o,c){return function(v,C){var O;if(v===e&&C===e)return c;if(v!==e&&(O=v),C!==e){if(O===e)return C;typeof v=="string"||typeof C=="string"?(v=Ln(v),C=Ln(C)):(v=G1(v),C=G1(C)),O=o(v,C)}return O}}function Fp(o){return vs(function(c){return c=te(c,qr(qe())),ot(function(v){var C=this;return o(c,function(O){return sn(O,C,v)})})})}function Yl(o,c){c=c===e?" ":Ln(c);var v=c.length;if(v<2)return v?wp(c,o):c;var C=wp(c,K(o/os(c)));return as(c)?ta(En(C),0,o).join(""):C.slice(0,o)}function gS(o,c,v,C){var O=c&A,U=$c(o);function Y(){for(var Z=-1,ne=arguments.length,ge=-1,me=C.length,Ee=oe(me+ne),$e=this&&this!==fr&&this instanceof Y?U:o;++ge<me;)Ee[ge]=C[ge];for(;ne--;)Ee[ge++]=arguments[++Z];return sn($e,O?v:this,Ee)}return Y}function ug(o){return function(c,v,C){return C&&typeof C!="number"&&un(c,v,C)&&(v=C=e),c=As(c),v===e?(v=c,c=0):v=As(v),C=C===e?c<v?1:-1:As(C),eS(c,v,C,o)}}function Wl(o){return function(c,v){return typeof c=="string"&&typeof v=="string"||(c=ai(c),v=ai(v)),o(c,v)}}function cg(o,c,v,C,O,U,Y,Z,ne,ge){var me=c&w,Ee=me?Y:e,$e=me?e:Y,ke=me?U:e,Ge=me?e:U;c|=me?_:B,c&=~(me?B:_),c&S||(c&=~(A|m));var st=[o,c,O,ke,Ee,Ge,$e,Z,ne,ge],ze=v.apply(e,st);return Op(o)&&yg(ze,st),ze.placeholder=C,Sg(ze,o,c)}function Ip(o){var c=Yt[o];return function(v,C){if(v=ai(v),C=C==null?0:Kr(nt(C),292),C&&er(v)){var O=($t(v)+"e").split("e"),U=c(O[0]+"e"+(+O[1]+C));return O=($t(U)+"e").split("e"),+(O[0]+"e"+(+O[1]-C))}return c(v)}}var mS=Wo&&1/kn(new Wo([,-0]))[1]==z?function(o){return new Wo(o)}:Wp;function lg(o){return function(c){var v=Vr(c);return v==it?Ec(c):v==Tr?Lo(c):Gh(c,o(c))}}function gs(o,c,v,C,O,U,Y,Z){var ne=c&m;if(!ne&&typeof o!="function")throw new wn(i);var ge=C?C.length:0;if(ge||(c&=~(_|B),C=O=e),Y=Y===e?Y:mr(nt(Y),0),Z=Z===e?Z:nt(Z),ge-=O?O.length:0,c&B){var me=C,Ee=O;C=O=e}var $e=ne?e:Bp(o),ke=[o,c,v,C,O,me,Ee,U,Y,Z];if($e&&RS(ke,$e),o=ke[0],c=ke[1],v=ke[2],C=ke[3],O=ke[4],Z=ke[9]=ke[9]===e?ne?0:o.length:mr(ke[9]-ge,0),!Z&&c&(w|y)&&(c&=~(w|y)),!c||c==A)var Ge=pS(o,c,v);else c==w||c==y?Ge=dS(o,c,Z):(c==_||c==(A|_))&&!O.length?Ge=gS(o,c,v,C):Ge=Gl.apply(e,ke);var st=$e?K1:yg;return Sg(st(Ge,ke),o,c)}function fg(o,c,v,C){return o===e||vi(o,us[v])&&!mt.call(C,v)?c:o}function hg(o,c,v,C,O,U){return Wt(o)&&Wt(c)&&(U.set(c,o),jl(o,c,e,hg,U),U.delete(c)),o}function vS(o){return Rc(o)?e:o}function pg(o,c,v,C,O,U){var Y=v&p,Z=o.length,ne=c.length;if(Z!=ne&&!(Y&&ne>Z))return!1;var ge=U.get(o),me=U.get(c);if(ge&&me)return ge==c&&me==o;var Ee=-1,$e=!0,ke=v&h?new Ma:e;for(U.set(o,c),U.set(c,o);++Ee<Z;){var Ge=o[Ee],st=c[Ee];if(C)var ze=Y?C(st,Ge,Ee,c,o,U):C(Ge,st,Ee,o,c,U);if(ze!==e){if(ze)continue;$e=!1;break}if(ke){if(!Sl(c,function(lt,dt){if(!Ua(ke,dt)&&(Ge===lt||O(Ge,lt,v,C,U)))return ke.push(dt)})){$e=!1;break}}else if(!(Ge===st||O(Ge,st,v,C,U))){$e=!1;break}}return U.delete(o),U.delete(c),$e}function ES(o,c,v,C,O,U,Y){switch(v){case tt:if(o.byteLength!=c.byteLength||o.byteOffset!=c.byteOffset)return!1;o=o.buffer,c=c.buffer;case lr:return!(o.byteLength!=c.byteLength||!U(new Go(o),new Go(c)));case Ht:case wt:case bt:return vi(+o,+c);case Gt:return o.name==c.name&&o.message==c.message;case br:case cr:return o==c+"";case it:var Z=Ec;case Tr:var ne=C&p;if(Z||(Z=kn),o.size!=c.size&&!ne)return!1;var ge=Y.get(o);if(ge)return ge==c;C|=h,Y.set(o,c);var me=pg(Z(o),Z(c),C,O,U,Y);return Y.delete(o),me;case Mr:if(Sc)return Sc.call(o)==Sc.call(c)}return!1}function wS(o,c,v,C,O,U){var Y=v&p,Z=$p(o),ne=Z.length,ge=$p(c),me=ge.length;if(ne!=me&&!Y)return!1;for(var Ee=ne;Ee--;){var $e=Z[Ee];if(!(Y?$e in c:mt.call(c,$e)))return!1}var ke=U.get(o),Ge=U.get(c);if(ke&&Ge)return ke==c&&Ge==o;var st=!0;U.set(o,c),U.set(c,o);for(var ze=Y;++Ee<ne;){$e=Z[Ee];var lt=o[$e],dt=c[$e];if(C)var Hn=Y?C(dt,lt,$e,c,o,U):C(lt,dt,$e,o,c,U);if(!(Hn===e?lt===dt||O(lt,dt,v,C,U):Hn)){st=!1;break}ze||(ze=$e=="constructor")}if(st&&!ze){var cn=o.constructor,Mn=c.constructor;cn!=Mn&&"constructor"in o&&"constructor"in c&&!(typeof cn=="function"&&cn instanceof cn&&typeof Mn=="function"&&Mn instanceof Mn)&&(st=!1)}return U.delete(o),U.delete(c),st}function vs(o){return Np(wg(o,e,$g),o+"")}function $p(o){return T1(o,Fr,Pp)}function Dp(o){return T1(o,Sn,dg)}var Bp=Nl?function(o){return Nl.get(o)}:Wp;function Xl(o){for(var c=o.name+"",v=Xo[c],C=mt.call(Xo,c)?v.length:0;C--;){var O=v[C],U=O.func;if(U==null||U==o)return O.name}return c}function eu(o){var c=mt.call(k,"placeholder")?k:o;return c.placeholder}function qe(){var o=k.iteratee||zp;return o=o===zp?N1:o,arguments.length?o(arguments[0],arguments[1]):o}function Jl(o,c){var v=o.__data__;return IS(c)?v[typeof c=="string"?"string":"hash"]:v.map}function Rp(o){for(var c=Fr(o),v=c.length;v--;){var C=c[v],O=o[C];c[v]=[C,O,vg(O)]}return c}function Ka(o,c){var v=Yh(o,c);return x1(v)?v:e}function AS(o){var c=mt.call(o,ls),v=o[ls];try{o[ls]=e;var C=!0}catch{}var O=Ko.call(o);return C&&(c?o[ls]=v:delete o[ls]),O}var Pp=ce?function(o){return o==null?[]:(o=Tt(o),On(ce(o),function(c){return Ol.call(o,c)}))}:Xp,dg=ce?function(o){for(var c=[];o;)xn(c,Pp(o)),o=zo(o);return c}:Xp,Vr=on;(ap&&Vr(new ap(new ArrayBuffer(1)))!=tt||wc&&Vr(new wc)!=it||op&&Vr(op.resolve())!=Jt||Wo&&Vr(new Wo)!=Tr||Ac&&Vr(new Ac)!=tn)&&(Vr=function(o){var c=on(o),v=c==et?o.constructor:e,C=v?Va(v):"";if(C)switch(C){case ry:return tt;case ny:return it;case iy:return Jt;case sy:return Tr;case ay:return tn}return c});function yS(o,c,v){for(var C=-1,O=v.length;++C<O;){var U=v[C],Y=U.size;switch(U.type){case"drop":o+=Y;break;case"dropRight":c-=Y;break;case"take":c=Kr(c,o+Y);break;case"takeRight":o=mr(o,c-Y);break}}return{start:o,end:c}}function SS(o){var c=o.match(Wu);return c?c[1].split(Xu):[]}function gg(o,c,v){c=ea(c,o);for(var C=-1,O=c.length,U=!1;++C<O;){var Y=Oi(c[C]);if(!(U=o!=null&&v(o,Y)))break;o=o[Y]}return U||++C!=O?U:(O=o==null?0:o.length,!!O&&sf(O)&&Es(Y,O)&&(Ze(o)||Ga(o)))}function bS(o){var c=o.length,v=new o.constructor(c);return c&&typeof o[0]=="string"&&mt.call(o,"index")&&(v.index=o.index,v.input=o.input),v}function mg(o){return typeof o.constructor=="function"&&!Dc(o)?Jo(zo(o)):{}}function CS(o,c,v){var C=o.constructor;switch(c){case lr:return _p(o);case Ht:case wt:return new C(+o);case tt:return oS(o,v);case jr:case ba:case Ca:case _a:case Fa:case rs:case Ia:case Vs:case Fi:return Z1(o,v);case it:return new C;case bt:case cr:return new C(o);case br:return uS(o);case Tr:return new C;case Mr:return cS(o)}}function _S(o,c){var v=c.length;if(!v)return o;var C=v-1;return c[C]=(v>1?"& ":"")+c[C],c=c.join(v>2?", ":" "),o.replace(Yu,`{
/* [wrapped with `+c+`] */
`)}function FS(o){return Ze(o)||Ga(o)||!!(xl&&o&&o[xl])}function Es(o,c){var v=typeof o;return c=c??X,!!c&&(v=="number"||v!="symbol"&&Do.test(o))&&o>-1&&o%1==0&&o<c}function un(o,c,v){if(!Wt(v))return!1;var C=typeof c;return(C=="number"?yn(v)&&Es(c,v.length):C=="string"&&c in v)?vi(v[c],o):!1}function Tp(o,c){if(Ze(o))return!1;var v=typeof o;return v=="number"||v=="symbol"||v=="boolean"||o==null||Un(o)?!0:Ku.test(o)||!qu.test(o)||c!=null&&o in Tt(c)}function IS(o){var c=typeof o;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?o!=="__proto__":o===null}function Op(o){var c=Xl(o),v=k[c];if(typeof v!="function"||!(c in ft.prototype))return!1;if(o===v)return!0;var C=Bp(v);return!!C&&o===C[0]}function $S(o){return!!qo&&qo in o}var DS=gi?ws:Jp;function Dc(o){var c=o&&o.constructor,v=typeof c=="function"&&c.prototype||us;return o===v}function vg(o){return o===o&&!Wt(o)}function Eg(o,c){return function(v){return v==null?!1:v[o]===c&&(c!==e||o in Tt(v))}}function BS(o){var c=rf(o,function(C){return v.size===u&&v.clear(),C}),v=c.cache;return c}function RS(o,c){var v=o[1],C=c[1],O=v|C,U=O<(A|m|D),Y=C==D&&v==w||C==D&&v==j&&o[7].length<=c[8]||C==(D|j)&&c[7].length<=c[8]&&v==w;if(!(U||Y))return o;C&A&&(o[2]=c[2],O|=v&A?0:S);var Z=c[3];if(Z){var ne=o[3];o[3]=ne?eg(ne,Z,c[4]):Z,o[4]=ne?Nn(o[3],l):c[4]}return Z=c[5],Z&&(ne=o[5],o[5]=ne?tg(ne,Z,c[6]):Z,o[6]=ne?Nn(o[5],l):c[6]),Z=c[7],Z&&(o[7]=Z),C&D&&(o[8]=o[8]==null?c[8]:Kr(o[8],c[8])),o[9]==null&&(o[9]=c[9]),o[0]=c[0],o[1]=O,o}function PS(o){var c=[];if(o!=null)for(var v in Tt(o))c.push(v);return c}function TS(o){return Ko.call(o)}function wg(o,c,v){return c=mr(c===e?o.length-1:c,0),function(){for(var C=arguments,O=-1,U=mr(C.length-c,0),Y=oe(U);++O<U;)Y[O]=C[c+O];O=-1;for(var Z=oe(c+1);++O<c;)Z[O]=C[O];return Z[c]=v(Y),sn(o,this,Z)}}function Ag(o,c){return c.length<2?o:qa(o,ii(c,0,-1))}function OS(o,c){for(var v=o.length,C=Kr(c.length,v),O=An(o);C--;){var U=c[C];o[C]=Es(U,v)?O[U]:e}return o}function xp(o,c){if(!(c==="constructor"&&typeof o[c]=="function")&&c!="__proto__")return o[c]}var yg=bg(K1),Bc=J||function(o,c){return fr.setTimeout(o,c)},Np=bg(nS);function Sg(o,c,v){var C=c+"";return Np(o,_S(C,xS(SS(C),v)))}function bg(o){var c=0,v=0;return function(){var C=QA(),O=M-(C-v);if(v=C,O>0){if(++c>=L)return arguments[0]}else c=0;return o.apply(e,arguments)}}function Zl(o,c){var v=-1,C=o.length,O=C-1;for(c=c===e?C:c;++v<c;){var U=Ep(v,O),Y=o[U];o[U]=o[v],o[v]=Y}return o.length=c,o}var Cg=BS(function(o){var c=[];return o.charCodeAt(0)===46&&c.push(""),o.replace(Vu,function(v,C,O,U){c.push(O?U.replace(Qu,"$1"):C||v)}),c});function Oi(o){if(typeof o=="string"||Un(o))return o;var c=o+"";return c=="0"&&1/o==-z?"-0":c}function Va(o){if(o!=null){try{return jo.call(o)}catch{}try{return o+""}catch{}}return""}function xS(o,c){return vn(ue,function(v){var C="_."+v[0];c&v[1]&&!an(o,C)&&o.push(C)}),o.sort()}function _g(o){if(o instanceof ft)return o.clone();var c=new ri(o.__wrapped__,o.__chain__);return c.__actions__=An(o.__actions__),c.__index__=o.__index__,c.__values__=o.__values__,c}function NS(o,c,v){(v?un(o,c,v):c===e)?c=1:c=mr(nt(c),0);var C=o==null?0:o.length;if(!C||c<1)return[];for(var O=0,U=0,Y=oe(K(C/c));O<C;)Y[U++]=ii(o,O,O+=c);return Y}function kS(o){for(var c=-1,v=o==null?0:o.length,C=0,O=[];++c<v;){var U=o[c];U&&(O[C++]=U)}return O}function LS(){var o=arguments.length;if(!o)return[];for(var c=oe(o-1),v=arguments[0],C=o;C--;)c[C-1]=arguments[C];return xn(Ze(v)?An(v):[v],Lr(c,1))}var US=ot(function(o,c){return ar(o)?Cc(o,Lr(c,1,ar,!0)):[]}),HS=ot(function(o,c){var v=si(c);return ar(v)&&(v=e),ar(o)?Cc(o,Lr(c,1,ar,!0),qe(v,2)):[]}),MS=ot(function(o,c){var v=si(c);return ar(v)&&(v=e),ar(o)?Cc(o,Lr(c,1,ar,!0),e,v):[]});function jS(o,c,v){var C=o==null?0:o.length;return C?(c=v||c===e?1:nt(c),ii(o,c<0?0:c,C)):[]}function qS(o,c,v){var C=o==null?0:o.length;return C?(c=v||c===e?1:nt(c),c=C-c,ii(o,0,c<0?0:c)):[]}function KS(o,c){return o&&o.length?Kl(o,qe(c,3),!0,!0):[]}function VS(o,c){return o&&o.length?Kl(o,qe(c,3),!0):[]}function GS(o,c,v,C){var O=o==null?0:o.length;return O?(v&&typeof v!="number"&&un(o,c,v)&&(v=0,C=O),Ly(o,c,v,C)):[]}function Fg(o,c,v){var C=o==null?0:o.length;if(!C)return-1;var O=v==null?0:nt(v);return O<0&&(O=mr(C+O,0)),hr(o,qe(c,3),O)}function Ig(o,c,v){var C=o==null?0:o.length;if(!C)return-1;var O=C-1;return v!==e&&(O=nt(v),O=v<0?mr(C+O,0):Kr(O,C-1)),hr(o,qe(c,3),O,!0)}function $g(o){var c=o==null?0:o.length;return c?Lr(o,1):[]}function zS(o){var c=o==null?0:o.length;return c?Lr(o,z):[]}function YS(o,c){var v=o==null?0:o.length;return v?(c=c===e?1:nt(c),Lr(o,c)):[]}function WS(o){for(var c=-1,v=o==null?0:o.length,C={};++c<v;){var O=o[c];C[O[0]]=O[1]}return C}function Dg(o){return o&&o.length?o[0]:e}function XS(o,c,v){var C=o==null?0:o.length;if(!C)return-1;var O=v==null?0:nt(v);return O<0&&(O=mr(C+O,0)),Js(o,c,O)}function JS(o){var c=o==null?0:o.length;return c?ii(o,0,-1):[]}var ZS=ot(function(o){var c=te(o,bp);return c.length&&c[0]===o[0]?pp(c):[]}),QS=ot(function(o){var c=si(o),v=te(o,bp);return c===si(v)?c=e:v.pop(),v.length&&v[0]===o[0]?pp(v,qe(c,2)):[]}),e4=ot(function(o){var c=si(o),v=te(o,bp);return c=typeof c=="function"?c:e,c&&v.pop(),v.length&&v[0]===o[0]?pp(v,e,c):[]});function t4(o,c){return o==null?"":JA.call(o,c)}function si(o){var c=o==null?0:o.length;return c?o[c-1]:e}function r4(o,c,v){var C=o==null?0:o.length;if(!C)return-1;var O=C;return v!==e&&(O=nt(v),O=O<0?mr(C+O,0):Kr(O,C-1)),c===c?Jh(o,c,O):hr(o,ei,O,!0)}function n4(o,c){return o&&o.length?H1(o,nt(c)):e}var i4=ot(Bg);function Bg(o,c){return o&&o.length&&c&&c.length?vp(o,c):o}function s4(o,c,v){return o&&o.length&&c&&c.length?vp(o,c,qe(v,2)):o}function a4(o,c,v){return o&&o.length&&c&&c.length?vp(o,c,e,v):o}var o4=vs(function(o,c){var v=o==null?0:o.length,C=cp(o,c);return q1(o,te(c,function(O){return Es(O,v)?+O:O}).sort(Q1)),C});function u4(o,c){var v=[];if(!(o&&o.length))return v;var C=-1,O=[],U=o.length;for(c=qe(c,3);++C<U;){var Y=o[C];c(Y,C,o)&&(v.push(Y),O.push(C))}return q1(o,O),v}function kp(o){return o==null?o:ty.call(o)}function c4(o,c,v){var C=o==null?0:o.length;return C?(v&&typeof v!="number"&&un(o,c,v)?(c=0,v=C):(c=c==null?0:nt(c),v=v===e?C:nt(v)),ii(o,c,v)):[]}function l4(o,c){return ql(o,c)}function f4(o,c,v){return Ap(o,c,qe(v,2))}function h4(o,c){var v=o==null?0:o.length;if(v){var C=ql(o,c);if(C<v&&vi(o[C],c))return C}return-1}function p4(o,c){return ql(o,c,!0)}function d4(o,c,v){return Ap(o,c,qe(v,2),!0)}function g4(o,c){var v=o==null?0:o.length;if(v){var C=ql(o,c,!0)-1;if(vi(o[C],c))return C}return-1}function m4(o){return o&&o.length?V1(o):[]}function v4(o,c){return o&&o.length?V1(o,qe(c,2)):[]}function E4(o){var c=o==null?0:o.length;return c?ii(o,1,c):[]}function w4(o,c,v){return o&&o.length?(c=v||c===e?1:nt(c),ii(o,0,c<0?0:c)):[]}function A4(o,c,v){var C=o==null?0:o.length;return C?(c=v||c===e?1:nt(c),c=C-c,ii(o,c<0?0:c,C)):[]}function y4(o,c){return o&&o.length?Kl(o,qe(c,3),!1,!0):[]}function S4(o,c){return o&&o.length?Kl(o,qe(c,3)):[]}var b4=ot(function(o){return Qs(Lr(o,1,ar,!0))}),C4=ot(function(o){var c=si(o);return ar(c)&&(c=e),Qs(Lr(o,1,ar,!0),qe(c,2))}),_4=ot(function(o){var c=si(o);return c=typeof c=="function"?c:e,Qs(Lr(o,1,ar,!0),e,c)});function F4(o){return o&&o.length?Qs(o):[]}function I4(o,c){return o&&o.length?Qs(o,qe(c,2)):[]}function $4(o,c){return c=typeof c=="function"?c:e,o&&o.length?Qs(o,e,c):[]}function Lp(o){if(!(o&&o.length))return[];var c=0;return o=On(o,function(v){if(ar(v))return c=mr(v.length,c),!0}),gc(c,function(v){return te(o,ss(v))})}function Rg(o,c){if(!(o&&o.length))return[];var v=Lp(o);return c==null?v:te(v,function(C){return sn(c,e,C)})}var D4=ot(function(o,c){return ar(o)?Cc(o,c):[]}),B4=ot(function(o){return Sp(On(o,ar))}),R4=ot(function(o){var c=si(o);return ar(c)&&(c=e),Sp(On(o,ar),qe(c,2))}),P4=ot(function(o){var c=si(o);return c=typeof c=="function"?c:e,Sp(On(o,ar),e,c)}),T4=ot(Lp);function O4(o,c){return W1(o||[],c||[],bc)}function x4(o,c){return W1(o||[],c||[],Ic)}var N4=ot(function(o){var c=o.length,v=c>1?o[c-1]:e;return v=typeof v=="function"?(o.pop(),v):e,Rg(o,v)});function Pg(o){var c=k(o);return c.__chain__=!0,c}function k4(o,c){return c(o),o}function Ql(o,c){return c(o)}var L4=vs(function(o){var c=o.length,v=c?o[0]:0,C=this.__wrapped__,O=function(U){return cp(U,o)};return c>1||this.__actions__.length||!(C instanceof ft)||!Es(v)?this.thru(O):(C=C.slice(v,+v+(c?1:0)),C.__actions__.push({func:Ql,args:[O],thisArg:e}),new ri(C,this.__chain__).thru(function(U){return c&&!U.length&&U.push(e),U}))});function U4(){return Pg(this)}function H4(){return new ri(this.value(),this.__chain__)}function M4(){this.__values__===e&&(this.__values__=Gg(this.value()));var o=this.__index__>=this.__values__.length,c=o?e:this.__values__[this.__index__++];return{done:o,value:c}}function j4(){return this}function q4(o){for(var c,v=this;v instanceof Ll;){var C=_g(v);C.__index__=0,C.__values__=e,c?O.__wrapped__=C:c=C;var O=C;v=v.__wrapped__}return O.__wrapped__=o,c}function K4(){var o=this.__wrapped__;if(o instanceof ft){var c=o;return this.__actions__.length&&(c=new ft(this)),c=c.reverse(),c.__actions__.push({func:Ql,args:[kp],thisArg:e}),new ri(c,this.__chain__)}return this.thru(kp)}function V4(){return Y1(this.__wrapped__,this.__actions__)}var G4=Vl(function(o,c,v){mt.call(o,v)?++o[v]:ds(o,v,1)});function z4(o,c,v){var C=Ze(o)?Xe:ky;return v&&un(o,c,v)&&(c=e),C(o,qe(c,3))}function Y4(o,c){var v=Ze(o)?On:R1;return v(o,qe(c,3))}var W4=sg(Fg),X4=sg(Ig);function J4(o,c){return Lr(ef(o,c),1)}function Z4(o,c){return Lr(ef(o,c),z)}function Q4(o,c,v){return v=v===e?1:nt(v),Lr(ef(o,c),v)}function Tg(o,c){var v=Ze(o)?vn:Zs;return v(o,qe(c,3))}function Og(o,c){var v=Ze(o)?R:B1;return v(o,qe(c,3))}var eb=Vl(function(o,c,v){mt.call(o,v)?o[v].push(c):ds(o,v,[c])});function tb(o,c,v,C){o=yn(o)?o:ru(o),v=v&&!C?nt(v):0;var O=o.length;return v<0&&(v=mr(O+v,0)),af(o)?v<=O&&o.indexOf(c,v)>-1:!!O&&Js(o,c,v)>-1}var rb=ot(function(o,c,v){var C=-1,O=typeof c=="function",U=yn(o)?oe(o.length):[];return Zs(o,function(Y){U[++C]=O?sn(c,Y,v):_c(Y,c,v)}),U}),nb=Vl(function(o,c,v){ds(o,v,c)});function ef(o,c){var v=Ze(o)?te:k1;return v(o,qe(c,3))}function ib(o,c,v,C){return o==null?[]:(Ze(c)||(c=c==null?[]:[c]),v=C?e:v,Ze(v)||(v=v==null?[]:[v]),M1(o,c,v))}var sb=Vl(function(o,c,v){o[v?0:1].push(c)},function(){return[[],[]]});function ab(o,c,v){var C=Ze(o)?hc:bl,O=arguments.length<3;return C(o,qe(c,4),v,O,Zs)}function ob(o,c,v){var C=Ze(o)?y1:bl,O=arguments.length<3;return C(o,qe(c,4),v,O,B1)}function ub(o,c){var v=Ze(o)?On:R1;return v(o,nf(qe(c,3)))}function cb(o){var c=Ze(o)?F1:tS;return c(o)}function lb(o,c,v){(v?un(o,c,v):c===e)?c=1:c=nt(c);var C=Ze(o)?Py:rS;return C(o,c)}function fb(o){var c=Ze(o)?Ty:iS;return c(o)}function hb(o){if(o==null)return 0;if(yn(o))return af(o)?os(o):o.length;var c=Vr(o);return c==it||c==Tr?o.size:gp(o).length}function pb(o,c,v){var C=Ze(o)?Sl:sS;return v&&un(o,c,v)&&(c=e),C(o,qe(c,3))}var db=ot(function(o,c){if(o==null)return[];var v=c.length;return v>1&&un(o,c[0],c[1])?c=[]:v>2&&un(c[0],c[1],c[2])&&(c=[c[0]]),M1(o,Lr(c,1),[])}),tf=N||function(){return fr.Date.now()};function gb(o,c){if(typeof c!="function")throw new wn(i);return o=nt(o),function(){if(--o<1)return c.apply(this,arguments)}}function xg(o,c,v){return c=v?e:c,c=o&&c==null?o.length:c,gs(o,D,e,e,e,e,c)}function Ng(o,c){var v;if(typeof c!="function")throw new wn(i);return o=nt(o),function(){return--o>0&&(v=c.apply(this,arguments)),o<=1&&(c=e),v}}var Up=ot(function(o,c,v){var C=A;if(v.length){var O=Nn(v,eu(Up));C|=_}return gs(o,C,c,v,O)}),kg=ot(function(o,c,v){var C=A|m;if(v.length){var O=Nn(v,eu(kg));C|=_}return gs(c,C,o,v,O)});function Lg(o,c,v){c=v?e:c;var C=gs(o,w,e,e,e,e,e,c);return C.placeholder=Lg.placeholder,C}function Ug(o,c,v){c=v?e:c;var C=gs(o,y,e,e,e,e,e,c);return C.placeholder=Ug.placeholder,C}function Hg(o,c,v){var C,O,U,Y,Z,ne,ge=0,me=!1,Ee=!1,$e=!0;if(typeof o!="function")throw new wn(i);c=ai(c)||0,Wt(v)&&(me=!!v.leading,Ee="maxWait"in v,U=Ee?mr(ai(v.maxWait)||0,c):U,$e="trailing"in v?!!v.trailing:$e);function ke(or){var Ei=C,ys=O;return C=O=e,ge=or,Y=o.apply(ys,Ei),Y}function Ge(or){return ge=or,Z=Bc(lt,c),me?ke(or):Y}function st(or){var Ei=or-ne,ys=or-ge,sm=c-Ei;return Ee?Kr(sm,U-ys):sm}function ze(or){var Ei=or-ne,ys=or-ge;return ne===e||Ei>=c||Ei<0||Ee&&ys>=U}function lt(){var or=tf();if(ze(or))return dt(or);Z=Bc(lt,st(or))}function dt(or){return Z=e,$e&&C?ke(or):(C=O=e,Y)}function Hn(){Z!==e&&X1(Z),ge=0,C=ne=O=Z=e}function cn(){return Z===e?Y:dt(tf())}function Mn(){var or=tf(),Ei=ze(or);if(C=arguments,O=this,ne=or,Ei){if(Z===e)return Ge(ne);if(Ee)return X1(Z),Z=Bc(lt,c),ke(ne)}return Z===e&&(Z=Bc(lt,c)),Y}return Mn.cancel=Hn,Mn.flush=cn,Mn}var mb=ot(function(o,c){return D1(o,1,c)}),vb=ot(function(o,c,v){return D1(o,ai(c)||0,v)});function Eb(o){return gs(o,q)}function rf(o,c){if(typeof o!="function"||c!=null&&typeof c!="function")throw new wn(i);var v=function(){var C=arguments,O=c?c.apply(this,C):C[0],U=v.cache;if(U.has(O))return U.get(O);var Y=o.apply(this,C);return v.cache=U.set(O,Y)||U,Y};return v.cache=new(rf.Cache||ps),v}rf.Cache=ps;function nf(o){if(typeof o!="function")throw new wn(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 wb(o){return Ng(2,o)}var Ab=aS(function(o,c){c=c.length==1&&Ze(c[0])?te(c[0],qr(qe())):te(Lr(c,1),qr(qe()));var v=c.length;return ot(function(C){for(var O=-1,U=Kr(C.length,v);++O<U;)C[O]=c[O].call(this,C[O]);return sn(o,this,C)})}),Hp=ot(function(o,c){var v=Nn(c,eu(Hp));return gs(o,_,e,c,v)}),Mg=ot(function(o,c){var v=Nn(c,eu(Mg));return gs(o,B,e,c,v)}),yb=vs(function(o,c){return gs(o,j,e,e,e,c)});function Sb(o,c){if(typeof o!="function")throw new wn(i);return c=c===e?c:nt(c),ot(o,c)}function bb(o,c){if(typeof o!="function")throw new wn(i);return c=c==null?0:mr(nt(c),0),ot(function(v){var C=v[c],O=ta(v,0,c);return C&&xn(O,C),sn(o,this,O)})}function Cb(o,c,v){var C=!0,O=!0;if(typeof o!="function")throw new wn(i);return Wt(v)&&(C="leading"in v?!!v.leading:C,O="trailing"in v?!!v.trailing:O),Hg(o,c,{leading:C,maxWait:c,trailing:O})}function _b(o){return xg(o,1)}function Fb(o,c){return Hp(Cp(c),o)}function Ib(){if(!arguments.length)return[];var o=arguments[0];return Ze(o)?o:[o]}function $b(o){return ni(o,E)}function Db(o,c){return c=typeof c=="function"?c:e,ni(o,E,c)}function Bb(o){return ni(o,f|E)}function Rb(o,c){return c=typeof c=="function"?c:e,ni(o,f|E,c)}function Pb(o,c){return c==null||$1(o,c,Fr(c))}function vi(o,c){return o===c||o!==o&&c!==c}var Tb=Wl(hp),Ob=Wl(function(o,c){return o>=c}),Ga=O1(function(){return arguments}())?O1:function(o){return tr(o)&&mt.call(o,"callee")&&!Ol.call(o,"callee")},Ze=oe.isArray,xb=ml?qr(ml):qy;function yn(o){return o!=null&&sf(o.length)&&!ws(o)}function ar(o){return tr(o)&&yn(o)}function Nb(o){return o===!0||o===!1||tr(o)&&on(o)==Ht}var ra=Ot||Jp,kb=vl?qr(vl):Ky;function Lb(o){return tr(o)&&o.nodeType===1&&!Rc(o)}function Ub(o){if(o==null)return!0;if(yn(o)&&(Ze(o)||typeof o=="string"||typeof o.splice=="function"||ra(o)||tu(o)||Ga(o)))return!o.length;var c=Vr(o);if(c==it||c==Tr)return!o.size;if(Dc(o))return!gp(o).length;for(var v in o)if(mt.call(o,v))return!1;return!0}function Hb(o,c){return Fc(o,c)}function Mb(o,c,v){v=typeof v=="function"?v:e;var C=v?v(o,c):e;return C===e?Fc(o,c,e,v):!!C}function Mp(o){if(!tr(o))return!1;var c=on(o);return c==Gt||c==ir||typeof o.message=="string"&&typeof o.name=="string"&&!Rc(o)}function jb(o){return typeof o=="number"&&er(o)}function ws(o){if(!Wt(o))return!1;var c=on(o);return c==at||c==kt||c==Sr||c==Zn}function jg(o){return typeof o=="number"&&o==nt(o)}function sf(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=X}function Wt(o){var c=typeof o;return o!=null&&(c=="object"||c=="function")}function tr(o){return o!=null&&typeof o=="object"}var qg=El?qr(El):Gy;function qb(o,c){return o===c||dp(o,c,Rp(c))}function Kb(o,c,v){return v=typeof v=="function"?v:e,dp(o,c,Rp(c),v)}function Vb(o){return Kg(o)&&o!=+o}function Gb(o){if(DS(o))throw new Ye(n);return x1(o)}function zb(o){return o===null}function Yb(o){return o==null}function Kg(o){return typeof o=="number"||tr(o)&&on(o)==bt}function Rc(o){if(!tr(o)||on(o)!=et)return!1;var c=zo(o);if(c===null)return!0;var v=mt.call(c,"constructor")&&c.constructor;return typeof v=="function"&&v instanceof v&&jo.call(v)==np}var jp=wl?qr(wl):zy;function Wb(o){return jg(o)&&o>=-X&&o<=X}var Vg=Al?qr(Al):Yy;function af(o){return typeof o=="string"||!Ze(o)&&tr(o)&&on(o)==cr}function Un(o){return typeof o=="symbol"||tr(o)&&on(o)==Mr}var tu=yl?qr(yl):Wy;function Xb(o){return o===e}function Jb(o){return tr(o)&&Vr(o)==tn}function Zb(o){return tr(o)&&on(o)==Ct}var Qb=Wl(mp),e6=Wl(function(o,c){return o<=c});function Gg(o){if(!o)return[];if(yn(o))return af(o)?En(o):An(o);if(cs&&o[cs])return Xh(o[cs]());var c=Vr(o),v=c==it?Ec:c==Tr?kn:ru;return v(o)}function As(o){if(!o)return o===0?o:0;if(o=ai(o),o===z||o===-z){var c=o<0?-1:1;return c*ie}return o===o?o:0}function nt(o){var c=As(o),v=c%1;return c===c?v?c-v:c:0}function zg(o){return o?ja(nt(o),0,we):0}function ai(o){if(typeof o=="number")return o;if(Un(o))return Se;if(Wt(o)){var c=typeof o.valueOf=="function"?o.valueOf():o;o=Wt(c)?c+"":c}if(typeof o!="string")return o===0?o:+o;o=mc(o);var v=tc.test(o);return v||nc.test(o)?jh(o.slice(2),v?2:8):$o.test(o)?Se:+o}function Yg(o){return Ti(o,Sn(o))}function t6(o){return o?ja(nt(o),-X,X):o===0?o:0}function $t(o){return o==null?"":Ln(o)}var r6=Zo(function(o,c){if(Dc(c)||yn(c)){Ti(c,Fr(c),o);return}for(var v in c)mt.call(c,v)&&bc(o,v,c[v])}),Wg=Zo(function(o,c){Ti(c,Sn(c),o)}),of=Zo(function(o,c,v,C){Ti(c,Sn(c),o,C)}),n6=Zo(function(o,c,v,C){Ti(c,Fr(c),o,C)}),i6=vs(cp);function s6(o,c){var v=Jo(o);return c==null?v:I1(v,c)}var a6=ot(function(o,c){o=Tt(o);var v=-1,C=c.length,O=C>2?c[2]:e;for(O&&un(c[0],c[1],O)&&(C=1);++v<C;)for(var U=c[v],Y=Sn(U),Z=-1,ne=Y.length;++Z<ne;){var ge=Y[Z],me=o[ge];(me===e||vi(me,us[ge])&&!mt.call(o,ge))&&(o[ge]=U[ge])}return o}),o6=ot(function(o){return o.push(e,hg),sn(Xg,e,o)});function u6(o,c){return Me(o,qe(c,3),Pi)}function c6(o,c){return Me(o,qe(c,3),fp)}function l6(o,c){return o==null?o:lp(o,qe(c,3),Sn)}function f6(o,c){return o==null?o:P1(o,qe(c,3),Sn)}function h6(o,c){return o&&Pi(o,qe(c,3))}function p6(o,c){return o&&fp(o,qe(c,3))}function d6(o){return o==null?[]:Ml(o,Fr(o))}function g6(o){return o==null?[]:Ml(o,Sn(o))}function qp(o,c,v){var C=o==null?e:qa(o,c);return C===e?v:C}function m6(o,c){return o!=null&&gg(o,c,Uy)}function Kp(o,c){return o!=null&&gg(o,c,Hy)}var v6=og(function(o,c,v){c!=null&&typeof c.toString!="function"&&(c=Ko.call(c)),o[c]=v},Gp(bn)),E6=og(function(o,c,v){c!=null&&typeof c.toString!="function"&&(c=Ko.call(c)),mt.call(o,c)?o[c].push(v):o[c]=[v]},qe),w6=ot(_c);function Fr(o){return yn(o)?_1(o):gp(o)}function Sn(o){return yn(o)?_1(o,!0):Xy(o)}function A6(o,c){var v={};return c=qe(c,3),Pi(o,function(C,O,U){ds(v,c(C,O,U),C)}),v}function y6(o,c){var v={};return c=qe(c,3),Pi(o,function(C,O,U){ds(v,O,c(C,O,U))}),v}var S6=Zo(function(o,c,v){jl(o,c,v)}),Xg=Zo(function(o,c,v,C){jl(o,c,v,C)}),b6=vs(function(o,c){var v={};if(o==null)return v;var C=!1;c=te(c,function(U){return U=ea(U,o),C||(C=U.length>1),U}),Ti(o,Dp(o),v),C&&(v=ni(v,f|d|E,vS));for(var O=c.length;O--;)yp(v,c[O]);return v});function C6(o,c){return Jg(o,nf(qe(c)))}var _6=vs(function(o,c){return o==null?{}:Zy(o,c)});function Jg(o,c){if(o==null)return{};var v=te(Dp(o),function(C){return[C]});return c=qe(c),j1(o,v,function(C,O){return c(C,O[0])})}function F6(o,c,v){c=ea(c,o);var C=-1,O=c.length;for(O||(O=1,o=e);++C<O;){var U=o==null?e:o[Oi(c[C])];U===e&&(C=O,U=v),o=ws(U)?U.call(o):U}return o}function I6(o,c,v){return o==null?o:Ic(o,c,v)}function $6(o,c,v,C){return C=typeof C=="function"?C:e,o==null?o:Ic(o,c,v,C)}var Zg=lg(Fr),Qg=lg(Sn);function D6(o,c,v){var C=Ze(o),O=C||ra(o)||tu(o);if(c=qe(c,4),v==null){var U=o&&o.constructor;O?v=C?new U:[]:Wt(o)?v=ws(U)?Jo(zo(o)):{}:v={}}return(O?vn:Pi)(o,function(Y,Z,ne){return c(v,Y,Z,ne)}),v}function B6(o,c){return o==null?!0:yp(o,c)}function R6(o,c,v){return o==null?o:z1(o,c,Cp(v))}function P6(o,c,v,C){return C=typeof C=="function"?C:e,o==null?o:z1(o,c,Cp(v),C)}function ru(o){return o==null?[]:La(o,Fr(o))}function T6(o){return o==null?[]:La(o,Sn(o))}function O6(o,c,v){return v===e&&(v=c,c=e),v!==e&&(v=ai(v),v=v===v?v:0),c!==e&&(c=ai(c),c=c===c?c:0),ja(ai(o),c,v)}function x6(o,c,v){return c=As(c),v===e?(v=c,c=0):v=As(v),o=ai(o),My(o,c,v)}function N6(o,c,v){if(v&&typeof v!="boolean"&&un(o,c,v)&&(c=v=e),v===e&&(typeof c=="boolean"?(v=c,c=e):typeof o=="boolean"&&(v=o,o=e)),o===e&&c===e?(o=0,c=1):(o=As(o),c===e?(c=o,o=0):c=As(c)),o>c){var C=o;o=c,c=C}if(v||o%1||c%1){var O=b1();return Kr(o+O*(c-o+Mh("1e-"+((O+"").length-1))),c)}return Ep(o,c)}var k6=Qo(function(o,c,v){return c=c.toLowerCase(),o+(v?em(c):c)});function em(o){return Vp($t(o).toLowerCase())}function tm(o){return o=$t(o),o&&o.replace($i,vc).replace(nn,"")}function L6(o,c,v){o=$t(o),c=Ln(c);var C=o.length;v=v===e?C:ja(nt(v),0,C);var O=v;return v-=c.length,v>=0&&o.slice(v,O)==c}function U6(o){return o=$t(o),o&&_o.test(o)?o.replace(bo,zh):o}function H6(o){return o=$t(o),o&&Gu.test(o)?o.replace(Gs,"\\$&"):o}var M6=Qo(function(o,c,v){return o+(v?"-":"")+c.toLowerCase()}),j6=Qo(function(o,c,v){return o+(v?" ":"")+c.toLowerCase()}),q6=ig("toLowerCase");function K6(o,c,v){o=$t(o),c=nt(c);var C=c?os(o):0;if(!c||C>=c)return o;var O=(c-C)/2;return Yl(se(O),v)+o+Yl(K(O),v)}function V6(o,c,v){o=$t(o),c=nt(c);var C=c?os(o):0;return c&&C<c?o+Yl(c-C,v):o}function G6(o,c,v){o=$t(o),c=nt(c);var C=c?os(o):0;return c&&C<c?Yl(c-C,v)+o:o}function z6(o,c,v){return v||c==null?c=0:c&&(c=+c),ey($t(o).replace($a,""),c||0)}function Y6(o,c,v){return(v?un(o,c,v):c===e)?c=1:c=nt(c),wp($t(o),c)}function W6(){var o=arguments,c=$t(o[0]);return o.length<3?c:c.replace(o[1],o[2])}var X6=Qo(function(o,c,v){return o+(v?"_":"")+c.toLowerCase()});function J6(o,c,v){return v&&typeof v!="number"&&un(o,c,v)&&(c=v=e),v=v===e?we:v>>>0,v?(o=$t(o),o&&(typeof c=="string"||c!=null&&!jp(c))&&(c=Ln(c),!c&&as(o))?ta(En(o),0,v):o.split(c,v)):[]}var Z6=Qo(function(o,c,v){return o+(v?" ":"")+Vp(c)});function Q6(o,c,v){return o=$t(o),v=v==null?0:ja(nt(v),0,o.length),c=Ln(c),o.slice(v,v+c.length)==c}function eC(o,c,v){var C=k.templateSettings;v&&un(o,c,v)&&(c=e),o=$t(o),c=of({},c,C,fg);var O=of({},c.imports,C.imports,fg),U=Fr(O),Y=La(O,U),Z,ne,ge=0,me=c.interpolate||gn,Ee="__p += '",$e=Ho((c.escape||gn).source+"|"+me.source+"|"+(me===Io?ec:gn).source+"|"+(c.evaluate||gn).source+"|$","g"),ke="//# sourceURL="+(mt.call(c,"sourceURL")?(c.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Nh+"]")+`
`;o.replace($e,function(ze,lt,dt,Hn,cn,Mn){return dt||(dt=Hn),Ee+=o.slice(ge,Mn).replace(ic,Il),lt&&(Z=!0,Ee+=`' +
__e(`+lt+`) +
'`),cn&&(ne=!0,Ee+=`';
`+cn+`;
__p += '`),dt&&(Ee+=`' +
((__t = (`+dt+`)) == null ? '' : __t) +
'`),ge=Mn+ze.length,ze}),Ee+=`';
`;var Ge=mt.call(c,"variable")&&c.variable;if(!Ge)Ee=`with (obj) {
`+Ee+`
}
`;else if(Zu.test(Ge))throw new Ye(a);Ee=(ne?Ee.replace(ns,""):Ee).replace(Ao,"$1").replace(yo,"$1;"),Ee="function("+(Ge||"obj")+`) {
`+(Ge?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(Z?", __e = _.escape":"")+(ne?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+Ee+`return __p
}`;var st=nm(function(){return pt(U,ke+"return "+Ee).apply(e,Y)});if(st.source=Ee,Mp(st))throw st;return st}function tC(o){return $t(o).toLowerCase()}function rC(o){return $t(o).toUpperCase()}function nC(o,c,v){if(o=$t(o),o&&(v||c===e))return mc(o);if(!o||!(c=Ln(c)))return o;var C=En(o),O=En(c),U=ko(C,O),Y=_l(C,O)+1;return ta(C,U,Y).join("")}function iC(o,c,v){if(o=$t(o),o&&(v||c===e))return o.slice(0,Uo(o)+1);if(!o||!(c=Ln(c)))return o;var C=En(o),O=_l(C,En(c))+1;return ta(C,0,O).join("")}function sC(o,c,v){if(o=$t(o),o&&(v||c===e))return o.replace($a,"");if(!o||!(c=Ln(c)))return o;var C=En(o),O=ko(C,En(c));return ta(C,O).join("")}function aC(o,c){var v=F,C=P;if(Wt(c)){var O="separator"in c?c.separator:O;v="length"in c?nt(c.length):v,C="omission"in c?Ln(c.omission):C}o=$t(o);var U=o.length;if(as(o)){var Y=En(o);U=Y.length}if(v>=U)return o;var Z=v-os(C);if(Z<1)return C;var ne=Y?ta(Y,0,Z).join(""):o.slice(0,Z);if(O===e)return ne+C;if(Y&&(Z+=ne.length-Z),jp(O)){if(o.slice(Z).search(O)){var ge,me=ne;for(O.global||(O=Ho(O.source,$t(Ii.exec(O))+"g")),O.lastIndex=0;ge=O.exec(me);)var Ee=ge.index;ne=ne.slice(0,Ee===e?Z:Ee)}}else if(o.indexOf(Ln(O),Z)!=Z){var $e=ne.lastIndexOf(O);$e>-1&&(ne=ne.slice(0,$e))}return ne+C}function oC(o){return o=$t(o),o&&Co.test(o)?o.replace(So,Dl):o}var uC=Qo(function(o,c,v){return o+(v?" ":"")+c.toUpperCase()}),Vp=ig("toUpperCase");function rm(o,c,v){return o=$t(o),c=v?e:c,c===e?Wh(o)?Qh(o):pc(o):o.match(c)||[]}var nm=ot(function(o,c){try{return sn(o,e,c)}catch(v){return Mp(v)?v:new Ye(v)}}),cC=vs(function(o,c){return vn(c,function(v){v=Oi(v),ds(o,v,Up(o[v],o))}),o});function lC(o){var c=o==null?0:o.length,v=qe();return o=c?te(o,function(C){if(typeof C[1]!="function")throw new wn(i);return[v(C[0]),C[1]]}):[],ot(function(C){for(var O=-1;++O<c;){var U=o[O];if(sn(U[0],this,C))return sn(U[1],this,C)}})}function fC(o){return Ny(ni(o,f))}function Gp(o){return function(){return o}}function hC(o,c){return o==null||o!==o?c:o}var pC=ag(),dC=ag(!0);function bn(o){return o}function zp(o){return N1(typeof o=="function"?o:ni(o,f))}function gC(o){return L1(ni(o,f))}function mC(o,c){return U1(o,ni(c,f))}var vC=ot(function(o,c){return function(v){return _c(v,o,c)}}),EC=ot(function(o,c){return function(v){return _c(o,v,c)}});function Yp(o,c,v){var C=Fr(c),O=Ml(c,C);v==null&&!(Wt(c)&&(O.length||!C.length))&&(v=c,c=o,o=this,O=Ml(c,Fr(c)));var U=!(Wt(v)&&"chain"in v)||!!v.chain,Y=ws(o);return vn(O,function(Z){var ne=c[Z];o[Z]=ne,Y&&(o.prototype[Z]=function(){var ge=this.__chain__;if(U||ge){var me=o(this.__wrapped__),Ee=me.__actions__=An(this.__actions__);return Ee.push({func:ne,args:arguments,thisArg:o}),me.__chain__=ge,me}return ne.apply(o,xn([this.value()],arguments))})}),o}function wC(){return fr._===this&&(fr._=ip),this}function Wp(){}function AC(o){return o=nt(o),ot(function(c){return H1(c,o)})}var yC=Fp(te),SC=Fp(Xe),bC=Fp(Sl);function im(o){return Tp(o)?ss(Oi(o)):Qy(o)}function CC(o){return function(c){return o==null?e:qa(o,c)}}var _C=ug(),FC=ug(!0);function Xp(){return[]}function Jp(){return!1}function IC(){return{}}function $C(){return""}function DC(){return!0}function BC(o,c){if(o=nt(o),o<1||o>X)return[];var v=we,C=Kr(o,we);c=qe(c),o-=we;for(var O=gc(C,c);++v<o;)c(v);return O}function RC(o){return Ze(o)?te(o,Oi):Un(o)?[o]:An(Cg($t(o)))}function PC(o){var c=++rp;return $t(o)+c}var TC=zl(function(o,c){return o+c},0),OC=Ip("ceil"),xC=zl(function(o,c){return o/c},1),NC=Ip("floor");function kC(o){return o&&o.length?Hl(o,bn,hp):e}function LC(o,c){return o&&o.length?Hl(o,qe(c,2),hp):e}function UC(o){return dc(o,bn)}function HC(o,c){return dc(o,qe(c,2))}function MC(o){return o&&o.length?Hl(o,bn,mp):e}function jC(o,c){return o&&o.length?Hl(o,qe(c,2),mp):e}var qC=zl(function(o,c){return o*c},1),KC=Ip("round"),VC=zl(function(o,c){return o-c},0);function GC(o){return o&&o.length?No(o,bn):0}function zC(o,c){return o&&o.length?No(o,qe(c,2)):0}return k.after=gb,k.ary=xg,k.assign=r6,k.assignIn=Wg,k.assignInWith=of,k.assignWith=n6,k.at=i6,k.before=Ng,k.bind=Up,k.bindAll=cC,k.bindKey=kg,k.castArray=Ib,k.chain=Pg,k.chunk=NS,k.compact=kS,k.concat=LS,k.cond=lC,k.conforms=fC,k.constant=Gp,k.countBy=G4,k.create=s6,k.curry=Lg,k.curryRight=Ug,k.debounce=Hg,k.defaults=a6,k.defaultsDeep=o6,k.defer=mb,k.delay=vb,k.difference=US,k.differenceBy=HS,k.differenceWith=MS,k.drop=jS,k.dropRight=qS,k.dropRightWhile=KS,k.dropWhile=VS,k.fill=GS,k.filter=Y4,k.flatMap=J4,k.flatMapDeep=Z4,k.flatMapDepth=Q4,k.flatten=$g,k.flattenDeep=zS,k.flattenDepth=YS,k.flip=Eb,k.flow=pC,k.flowRight=dC,k.fromPairs=WS,k.functions=d6,k.functionsIn=g6,k.groupBy=eb,k.initial=JS,k.intersection=ZS,k.intersectionBy=QS,k.intersectionWith=e4,k.invert=v6,k.invertBy=E6,k.invokeMap=rb,k.iteratee=zp,k.keyBy=nb,k.keys=Fr,k.keysIn=Sn,k.map=ef,k.mapKeys=A6,k.mapValues=y6,k.matches=gC,k.matchesProperty=mC,k.memoize=rf,k.merge=S6,k.mergeWith=Xg,k.method=vC,k.methodOf=EC,k.mixin=Yp,k.negate=nf,k.nthArg=AC,k.omit=b6,k.omitBy=C6,k.once=wb,k.orderBy=ib,k.over=yC,k.overArgs=Ab,k.overEvery=SC,k.overSome=bC,k.partial=Hp,k.partialRight=Mg,k.partition=sb,k.pick=_6,k.pickBy=Jg,k.property=im,k.propertyOf=CC,k.pull=i4,k.pullAll=Bg,k.pullAllBy=s4,k.pullAllWith=a4,k.pullAt=o4,k.range=_C,k.rangeRight=FC,k.rearg=yb,k.reject=ub,k.remove=u4,k.rest=Sb,k.reverse=kp,k.sampleSize=lb,k.set=I6,k.setWith=$6,k.shuffle=fb,k.slice=c4,k.sortBy=db,k.sortedUniq=m4,k.sortedUniqBy=v4,k.split=J6,k.spread=bb,k.tail=E4,k.take=w4,k.takeRight=A4,k.takeRightWhile=y4,k.takeWhile=S4,k.tap=k4,k.throttle=Cb,k.thru=Ql,k.toArray=Gg,k.toPairs=Zg,k.toPairsIn=Qg,k.toPath=RC,k.toPlainObject=Yg,k.transform=D6,k.unary=_b,k.union=b4,k.unionBy=C4,k.unionWith=_4,k.uniq=F4,k.uniqBy=I4,k.uniqWith=$4,k.unset=B6,k.unzip=Lp,k.unzipWith=Rg,k.update=R6,k.updateWith=P6,k.values=ru,k.valuesIn=T6,k.without=D4,k.words=rm,k.wrap=Fb,k.xor=B4,k.xorBy=R4,k.xorWith=P4,k.zip=T4,k.zipObject=O4,k.zipObjectDeep=x4,k.zipWith=N4,k.entries=Zg,k.entriesIn=Qg,k.extend=Wg,k.extendWith=of,Yp(k,k),k.add=TC,k.attempt=nm,k.camelCase=k6,k.capitalize=em,k.ceil=OC,k.clamp=O6,k.clone=$b,k.cloneDeep=Bb,k.cloneDeepWith=Rb,k.cloneWith=Db,k.conformsTo=Pb,k.deburr=tm,k.defaultTo=hC,k.divide=xC,k.endsWith=L6,k.eq=vi,k.escape=U6,k.escapeRegExp=H6,k.every=z4,k.find=W4,k.findIndex=Fg,k.findKey=u6,k.findLast=X4,k.findLastIndex=Ig,k.findLastKey=c6,k.floor=NC,k.forEach=Tg,k.forEachRight=Og,k.forIn=l6,k.forInRight=f6,k.forOwn=h6,k.forOwnRight=p6,k.get=qp,k.gt=Tb,k.gte=Ob,k.has=m6,k.hasIn=Kp,k.head=Dg,k.identity=bn,k.includes=tb,k.indexOf=XS,k.inRange=x6,k.invoke=w6,k.isArguments=Ga,k.isArray=Ze,k.isArrayBuffer=xb,k.isArrayLike=yn,k.isArrayLikeObject=ar,k.isBoolean=Nb,k.isBuffer=ra,k.isDate=kb,k.isElement=Lb,k.isEmpty=Ub,k.isEqual=Hb,k.isEqualWith=Mb,k.isError=Mp,k.isFinite=jb,k.isFunction=ws,k.isInteger=jg,k.isLength=sf,k.isMap=qg,k.isMatch=qb,k.isMatchWith=Kb,k.isNaN=Vb,k.isNative=Gb,k.isNil=Yb,k.isNull=zb,k.isNumber=Kg,k.isObject=Wt,k.isObjectLike=tr,k.isPlainObject=Rc,k.isRegExp=jp,k.isSafeInteger=Wb,k.isSet=Vg,k.isString=af,k.isSymbol=Un,k.isTypedArray=tu,k.isUndefined=Xb,k.isWeakMap=Jb,k.isWeakSet=Zb,k.join=t4,k.kebabCase=M6,k.last=si,k.lastIndexOf=r4,k.lowerCase=j6,k.lowerFirst=q6,k.lt=Qb,k.lte=e6,k.max=kC,k.maxBy=LC,k.mean=UC,k.meanBy=HC,k.min=MC,k.minBy=jC,k.stubArray=Xp,k.stubFalse=Jp,k.stubObject=IC,k.stubString=$C,k.stubTrue=DC,k.multiply=qC,k.nth=n4,k.noConflict=wC,k.noop=Wp,k.now=tf,k.pad=K6,k.padEnd=V6,k.padStart=G6,k.parseInt=z6,k.random=N6,k.reduce=ab,k.reduceRight=ob,k.repeat=Y6,k.replace=W6,k.result=F6,k.round=KC,k.runInContext=re,k.sample=cb,k.size=hb,k.snakeCase=X6,k.some=pb,k.sortedIndex=l4,k.sortedIndexBy=f4,k.sortedIndexOf=h4,k.sortedLastIndex=p4,k.sortedLastIndexBy=d4,k.sortedLastIndexOf=g4,k.startCase=Z6,k.startsWith=Q6,k.subtract=VC,k.sum=GC,k.sumBy=zC,k.template=eC,k.times=BC,k.toFinite=As,k.toInteger=nt,k.toLength=zg,k.toLower=tC,k.toNumber=ai,k.toSafeInteger=t6,k.toString=$t,k.toUpper=rC,k.trim=nC,k.trimEnd=iC,k.trimStart=sC,k.truncate=aC,k.unescape=oC,k.uniqueId=PC,k.upperCase=uC,k.upperFirst=Vp,k.each=Tg,k.eachRight=Og,k.first=Dg,Yp(k,function(){var o={};return Pi(k,function(c,v){mt.call(k.prototype,v)||(o[v]=c)}),o}(),{chain:!1}),k.VERSION=t,vn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){k[o].placeholder=k}),vn(["drop","take"],function(o,c){ft.prototype[o]=function(v){v=v===e?1:mr(nt(v),0);var C=this.__filtered__&&!c?new ft(this):this.clone();return C.__filtered__?C.__takeCount__=Kr(v,C.__takeCount__):C.__views__.push({size:Kr(v,we),type:o+(C.__dir__<0?"Right":"")}),C},ft.prototype[o+"Right"]=function(v){return this.reverse()[o](v).reverse()}}),vn(["filter","map","takeWhile"],function(o,c){var v=c+1,C=v==V||v==G;ft.prototype[o]=function(O){var U=this.clone();return U.__iteratees__.push({iteratee:qe(O,3),type:v}),U.__filtered__=U.__filtered__||C,U}}),vn(["head","last"],function(o,c){var v="take"+(c?"Right":"");ft.prototype[o]=function(){return this[v](1).value()[0]}}),vn(["initial","tail"],function(o,c){var v="drop"+(c?"":"Right");ft.prototype[o]=function(){return this.__filtered__?new ft(this):this[v](1)}}),ft.prototype.compact=function(){return this.filter(bn)},ft.prototype.find=function(o){return this.filter(o).head()},ft.prototype.findLast=function(o){return this.reverse().find(o)},ft.prototype.invokeMap=ot(function(o,c){return typeof o=="function"?new ft(this):this.map(function(v){return _c(v,o,c)})}),ft.prototype.reject=function(o){return this.filter(nf(qe(o)))},ft.prototype.slice=function(o,c){o=nt(o);var v=this;return v.__filtered__&&(o>0||c<0)?new ft(v):(o<0?v=v.takeRight(-o):o&&(v=v.drop(o)),c!==e&&(c=nt(c),v=c<0?v.dropRight(-c):v.take(c-o)),v)},ft.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},ft.prototype.toArray=function(){return this.take(we)},Pi(ft.prototype,function(o,c){var v=/^(?:filter|find|map|reject)|While$/.test(c),C=/^(?:head|last)$/.test(c),O=k[C?"take"+(c=="last"?"Right":""):c],U=C||/^find/.test(c);O&&(k.prototype[c]=function(){var Y=this.__wrapped__,Z=C?[1]:arguments,ne=Y instanceof ft,ge=Z[0],me=ne||Ze(Y),Ee=function(lt){var dt=O.apply(k,xn([lt],Z));return C&&$e?dt[0]:dt};me&&v&&typeof ge=="function"&&ge.length!=1&&(ne=me=!1);var $e=this.__chain__,ke=!!this.__actions__.length,Ge=U&&!$e,st=ne&&!ke;if(!U&&me){Y=st?Y:new ft(this);var ze=o.apply(Y,Z);return ze.__actions__.push({func:Ql,args:[Ee],thisArg:e}),new ri(ze,$e)}return Ge&&st?o.apply(this,Z):(ze=this.thru(Ee),Ge?C?ze.value()[0]:ze.value():ze)})}),vn(["pop","push","shift","sort","splice","unshift"],function(o){var c=Mo[o],v=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",C=/^(?:pop|shift)$/.test(o);k.prototype[o]=function(){var O=arguments;if(C&&!this.__chain__){var U=this.value();return c.apply(Ze(U)?U:[],O)}return this[v](function(Y){return c.apply(Ze(Y)?Y:[],O)})}}),Pi(ft.prototype,function(o,c){var v=k[c];if(v){var C=v.name+"";mt.call(Xo,C)||(Xo[C]=[]),Xo[C].push({name:c,func:v})}}),Xo[Gl(e,m).name]=[{name:"wrapper",func:e}],ft.prototype.clone=oy,ft.prototype.reverse=uy,ft.prototype.value=cy,k.prototype.at=L4,k.prototype.chain=U4,k.prototype.commit=H4,k.prototype.next=M4,k.prototype.plant=q4,k.prototype.reverse=K4,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=V4,k.prototype.first=k.prototype.head,cs&&(k.prototype[cs]=j4),k},ti=ep();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(fr._=ti,define(function(){return ti})):is?((is.exports=ti)._=ti,lc._=ti):fr._=ti}).call(Ou)});var vh=ye((Xx,iw)=>{"use strict";var W9=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])},_0=class e extends Error{constructor(t,r,n){super(t),W9(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:E})=>E===a.source),d=a.start;if(f){let E=a.end,p=f.text[d.line-1],A=(d.line===E.line?E.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(A,"^")}`}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((E,{location:p})=>Math.max(E,p.start.line),u.start.line):f=Math.max.apply(null,l.map(E=>E.location.start.line)),f=f.toString().length;let d=`${a}: ${s}`;u&&(d+=n(u,f));for(let E of l)d+=n(E.location,f,E.message);return d}return this.problems.filter(a=>a[0]!=="info").map(a=>i(...a)).join(`
`)}};iw.exports=_0});var hi=ye((Jx,sw)=>{"use strict";var X9={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}};sw.exports=X9});var Ea=ye((Zx,ow)=>{"use strict";var J9=hi(),aw={findRule(e,t){for(let r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return e.rules[r]},indexOfRule(e,t){for(let r=0;r<e.rules.length;r++)if(e.rules[r].name===t)return r;return-1},alwaysConsumesOnSuccess(e,t){function r(){return!0}function n(){return!1}let i=J9.build({choice(a){return a.alternatives.every(i)},sequence(a){return a.elements.some(i)},simple_and:n,simple_not:n,optional:n,zero_or_more:n,semantic_and:n,semantic_not:n,rule_ref(a){let s=aw.findRule(e,a.name);return s?i(s):void 0},literal(a){return a.value!==""},class:r,any:r});return i(t)}};ow.exports=aw});var F0=ye((Qx,uw)=>{"use strict";var Z9={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};uw.exports=Z9});var I0=ye((eN,cw)=>{"use strict";var Q9=hi(),eB=Ea(),tB=vh(),al=1,Eo=0,ol=-1;function Eh(e){function t(s){return s.match=Eo}function r(s){return a(s.expression),s.match=al}function n(s){return s.match=a(s.expression)}function i(s,u){let l=s.length,f=0,d=0;for(let E=0;E<l;++E){let p=a(s[E]);p===al&&++f,p===ol&&++d}return f===l?al:u?d===l?ol:Eo:d>0?ol:Eo}let a=Q9.build({rule(s){let u,l=0;if(typeof s.match>"u"){s.match=Eo;do if(u=s.match,s.match=a(s.expression),++l>6)throw new tB("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=eB.findRule(e,s.name);return s.match=a(u)},literal(s){let u=s.value.length===0?al:Eo;return s.match=u},class(s){let u=s.parts.length===0?ol:Eo;return s.match=u},any:t});a(e)}Eh.ALWAYS_MATCH=al;Eh.SOMETIMES_MATCH=Eo;Eh.NEVER_MATCH=ol;cw.exports=Eh});var fw=ye((tN,lw)=>{"use strict";var rB=Ea(),Be=F0(),nB=hi(),{ALWAYS_MATCH:ku,SOMETIMES_MATCH:$0,NEVER_MATCH:D0}=I0();function iB(e){let t=[],r=[],n=[],i=[];function a(y){let _=t.indexOf(y);return _===-1?t.push(y)-1:_}function s(y){let _={value:y.parts,inverted:y.inverted,ignoreCase:y.ignoreCase},B=JSON.stringify(_),D=r.findIndex(j=>JSON.stringify(j)===B);return D===-1?r.push(_)-1:D}function u(y){let _=JSON.stringify(y),B=n.findIndex(D=>JSON.stringify(D)===_);return B===-1?n.push(y)-1:B}function l(y,_,B){let D={predicate:y,params:_,body:B.code,location:B.codeLocation},j=JSON.stringify(D),q=i.findIndex(F=>JSON.stringify(F)===j);return q===-1?i.push(D)-1:q}function f(y){let _={};return Object.keys(y).forEach(B=>{_[B]=y[B]}),_}function d(y,..._){return y.concat(..._)}function E(y,_,B,D){return y===ku?B:y===D0?D:_.concat([B.length,D.length],B,D)}function p(y,_){return y.concat([_.length],_)}function h(y,_,B,D){let j=Object.keys(B).map(q=>D-B[q]);return[Be.CALL,y,_,j.length].concat(j)}function A(y,_,B){let D=y.match|0;return d([Be.PUSH_CURR_POS],[Be.SILENT_FAILS_ON],w(y,{sp:B.sp+1,env:f(B.env),action:null}),[Be.SILENT_FAILS_OFF],E(_?-D:D,[_?Be.IF_ERROR:Be.IF_NOT_ERROR],d([Be.POP],[_?Be.POP:Be.POP_CURR_POS],[Be.PUSH_UNDEFINED]),d([Be.POP],[_?Be.POP_CURR_POS:Be.POP],[Be.PUSH_FAILED])))}function m(y,_,B){let D=l(!0,Object.keys(B.env),y);return d([Be.UPDATE_SAVED_POS],h(D,0,B.env,B.sp),E(y.match|0,[Be.IF],d([Be.POP],_?[Be.PUSH_FAILED]:[Be.PUSH_UNDEFINED]),d([Be.POP],_?[Be.PUSH_UNDEFINED]:[Be.PUSH_FAILED])))}function S(y){return p([Be.WHILE_NOT_ERROR],d([Be.APPEND],y))}let w=nB.build({grammar(y){y.rules.forEach(w),y.literals=t,y.classes=r,y.expectations=n,y.functions=i},rule(y){y.bytecode=w(y.expression,{sp:-1,env:{},pluck:[],action:null})},named(y,_){let B=y.match|0,D=B===D0?null:u({type:"rule",value:y.name});return d([Be.SILENT_FAILS_ON],w(y.expression,_),[Be.SILENT_FAILS_OFF],E(B,[Be.IF_ERROR],[Be.FAIL,D],[]))},choice(y,_){function B(D,j){let q=D[0].match|0,F=w(D[0],{sp:j.sp,env:f(j.env),action:null});return q===ku?F:d(F,D.length>1?E($0,[Be.IF_ERROR],d([Be.POP],B(D.slice(1),j)),[]):[])}return B(y.alternatives,_)},action(y,_){let B=f(_.env),D=y.expression.type!=="sequence"||y.expression.elements.length===0,j=w(y.expression,{sp:_.sp+(D?1:0),env:B,action:y}),q=y.expression.match|0,F=D&&q!==D0?l(!1,Object.keys(B),y):null;return D?d([Be.PUSH_CURR_POS],j,E(q,[Be.IF_NOT_ERROR],d([Be.LOAD_SAVED_POS,1],h(F,1,B,_.sp+2)),[]),[Be.NIP]):j},sequence(y,_){function B(D,j){if(D.length>0){let q=y.elements.length-D.length+1;return d(w(D[0],{sp:j.sp,env:j.env,pluck:j.pluck,action:null}),E(D[0].match|0,[Be.IF_NOT_ERROR],B(D.slice(1),{sp:j.sp+1,env:j.env,pluck:j.pluck,action:j.action}),d(q>1?[Be.POP_N,q]:[Be.POP],[Be.POP_CURR_POS],[Be.PUSH_FAILED])))}else{if(j.pluck.length>0)return d([Be.PLUCK,y.elements.length+1,j.pluck.length],j.pluck.map(q=>j.sp-q));if(j.action){let q=l(!1,Object.keys(j.env),j.action);return d([Be.LOAD_SAVED_POS,y.elements.length],h(q,y.elements.length+1,j.env,j.sp))}else return d([Be.WRAP,y.elements.length],[Be.NIP])}}return d([Be.PUSH_CURR_POS],B(y.elements,{sp:_.sp+1,env:_.env,pluck:[],action:_.action}))},labeled(y,_){let B=_.env,D=y.label,j=_.sp+1;return D&&(B=f(_.env),_.env[y.label]=j),y.pick&&_.pluck.push(j),w(y.expression,{sp:_.sp,env:B,action:null})},text(y,_){return d([Be.PUSH_CURR_POS],w(y.expression,{sp:_.sp+1,env:f(_.env),action:null}),E(y.match|0,[Be.IF_NOT_ERROR],d([Be.POP],[Be.TEXT]),[Be.NIP]))},simple_and(y,_){return A(y.expression,!1,_)},simple_not(y,_){return A(y.expression,!0,_)},optional(y,_){return d(w(y.expression,{sp:_.sp,env:f(_.env),action:null}),E(-(y.expression.match|0),[Be.IF_ERROR],d([Be.POP],[Be.PUSH_NULL]),[]))},zero_or_more(y,_){let B=w(y.expression,{sp:_.sp+1,env:f(_.env),action:null});return d([Be.PUSH_EMPTY_ARRAY],B,S(B),[Be.POP])},one_or_more(y,_){let B=w(y.expression,{sp:_.sp+1,env:f(_.env),action:null});return d([Be.PUSH_EMPTY_ARRAY],B,E(y.expression.match|0,[Be.IF_NOT_ERROR],d(S(B),[Be.POP]),d([Be.POP],[Be.POP],[Be.PUSH_FAILED])))},group(y,_){return w(y.expression,{sp:_.sp,env:f(_.env),action:null})},semantic_and(y,_){return m(y,!1,_)},semantic_not(y,_){return m(y,!0,_)},rule_ref(y){return[Be.RULE,rB.indexOfRule(e,y.name)]},literal(y){if(y.value.length>0){let _=y.match|0,D=_===$0||_===ku&&!y.ignoreCase?a(y.ignoreCase?y.value.toLowerCase():y.value):null,j=_!==ku?u({type:"literal",value:y.value,ignoreCase:y.ignoreCase}):null;return E(_,y.ignoreCase?[Be.MATCH_STRING_IC,D]:[Be.MATCH_STRING,D],y.ignoreCase?[Be.ACCEPT_N,y.value.length]:[Be.ACCEPT_STRING,D],[Be.FAIL,j])}return[Be.PUSH_EMPTY_STRING]},class(y){let _=y.match|0,B=_===$0?s(y):null,D=_!==ku?u({type:"class",value:y.parts,inverted:y.inverted,ignoreCase:y.ignoreCase}):null;return E(_,[Be.MATCH_CHAR_CLASS,B],[Be.ACCEPT_N,1],[Be.FAIL,D])},any(y){let _=y.match|0,B=_!==ku?u({type:"any"}):null;return E(_,[Be.MATCH_ANY],[Be.ACCEPT_N,1],[Be.FAIL,B])}});w(e)}lw.exports=iB});var pw=ye((rN,hw)=>{"use strict";var B0=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}<x>' 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+").")}};hw.exports=B0});var R0=ye((nN,dw)=>{"use strict";dw.exports="2.0.1"});var gw=ye(wh=>{"use strict";function js(e){return e.charCodeAt(0).toString(16).toUpperCase()}wh.hex=js;function sB(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"+js(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+js(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+js(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+js(t))}wh.stringEscape=sB;function aB(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"+js(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+js(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+js(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+js(t))}wh.regexpClassEscape=aB});var Ew=ye(vw=>{var mw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");vw.encode=function(e){if(0<=e&&e<mw.length)return mw[e];throw new TypeError("Must be between 0 and 63: "+e)}});var Sw=ye(yw=>{var oB=Ew(),ww=5,Aw=1<<ww,uB=Aw-1,cB=Aw;function lB(e){return e<0?(-e<<1)+1:(e<<1)+0}yw.encode=function(t){let r="",n,i=lB(t);do n=i&uB,i>>>=ww,i>0&&(n|=cB),r+=oB.encode(n);while(i>0);return r}});var yh=ye(Aa=>{function fB(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}Aa.getArg=fB;var Cw=function(){return!("__proto__"in Object.create(null))}();function _w(e){return e}function hB(e){return Fw(e)?"$"+e:e}Aa.toSetString=Cw?_w:hB;function pB(e){return Fw(e)?e.slice(1):e}Aa.fromSetString=Cw?_w:pB;function Fw(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 bw(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function dB(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=bw(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:bw(e.name,t.name)}Aa.compareByGeneratedPositionsInflated=dB;var P0="http:",ul=`${P0}//host`;function Iw(e){return t=>{let r=cl(t),n=T0(t),i=new URL(t,n);e(i);let a=i.toString();return r==="absolute"?a:r==="scheme-relative"?a.slice(P0.length):r==="path-absolute"?a.slice(ul.length):O0(n,a)}}function wa(e,t){return new URL(e,t).toString()}function gB(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function T0(e){let t=e.split("..").length-1,r=gB("p",e),n=`${ul}/`;for(let i=0;i<t;i++)n+=`${r}/`;return n}var mB=/^[A-Za-z0-9\+\-\.]+:/;function cl(e){return e[0]==="/"?e[1]==="/"?"scheme-relative":"path-absolute":mB.test(e)?"absolute":"path-relative"}function O0(e,t){typeof e=="string"&&(e=new URL(e)),typeof t=="string"&&(t=new URL(t));let r=t.pathname.split("/"),n=e.pathname.split("/");for(n.length>0&&!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 vB=Iw(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),Ah=Iw(e=>{});Aa.normalize=Ah;function EB(e,t){let r=cl(t),n=cl(e);if(e=vB(e),r==="absolute")return wa(t,void 0);if(n==="absolute")return wa(t,e);if(r==="scheme-relative")return Ah(t);if(n==="scheme-relative")return wa(t,wa(e,ul)).slice(P0.length);if(r==="path-absolute")return Ah(t);if(n==="path-absolute")return wa(t,wa(e,ul)).slice(ul.length);let i=T0(t+e),a=wa(t,wa(e,i));return O0(i,a)}Aa.join=EB;function wB(e,t){let r=AB(e,t);return typeof r=="string"?r:Ah(t)}Aa.relative=wB;function AB(e,t){if(cl(e)!==cl(t))return null;let n=T0(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:O0(i,a)}});var Dw=ye($w=>{var x0=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<a;i++)n.add(t[i],r);return n}size(){return this._set.size}add(t,r){let n=this.has(t),i=this._array.length;(!n||r)&&this._array.push(t),n||this._set.set(t,i)}has(t){return this._set.has(t)}indexOf(t){let r=this._set.get(t);if(r>=0)return r;throw new Error('"'+t+'" is not in the set.')}at(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)}toArray(){return this._array.slice()}};$w.ArraySet=x0});var Pw=ye(Rw=>{var Bw=yh();function yB(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,a=t.generatedColumn;return n>r||n==r&&a>=i||Bw.compareByGeneratedPositionsInflated(e,t)<=0}var N0=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){yB(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(Bw.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};Rw.MappingList=N0});var k0=ye(Tw=>{var ll=Sw(),gr=yh(),Sh=Dw().ArraySet,SB=Pw().MappingList,bh=class e{constructor(t){t||(t={}),this._file=gr.getArg(t,"file",null),this._sourceRoot=gr.getArg(t,"sourceRoot",null),this._skipValidation=gr.getArg(t,"skipValidation",!1),this._sources=new Sh,this._names=new Sh,this._mappings=new SB,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=gr.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=gr.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=gr.getArg(t,"generated"),n=gr.getArg(t,"original",null),i=gr.getArg(t,"source",null),a=gr.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=gr.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[gr.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[gr.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=gr.relative(a,i));let s=this._mappings.toArray().length>0?new Sh:this._sources,u=new Sh;this._mappings.unsortedForEach(function(l){if(l.source===i&&l.originalLine!=null){let E=t.originalPositionFor({line:l.originalLine,column:l.originalColumn});E.source!=null&&(l.source=E.source,n!=null&&(l.source=gr.join(n,l.source)),a!=null&&(l.source=gr.relative(a,l.source)),l.originalLine=E.line,l.originalColumn=E.column,E.name!=null&&(l.name=E.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=gr.join(n,l)),a!=null&&(l=gr.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,E,p=this._mappings.toArray();for(let h=0,A=p.length;h<A;h++){if(f=p[h],l="",f.generatedLine!==r)for(t=0;f.generatedLine!==r;)l+=";",r++;else if(h>0){if(!gr.compareByGeneratedPositionsInflated(f,p[h-1]))continue;l+=","}l+=ll.encode(f.generatedColumn-t),t=f.generatedColumn,f.source!=null&&(E=this._sources.indexOf(f.source),l+=ll.encode(E-s),s=E,l+=ll.encode(f.originalLine-1-i),i=f.originalLine-1,l+=ll.encode(f.originalColumn-n),n=f.originalColumn,f.name!=null&&(d=this._names.indexOf(f.name),l+=ll.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=gr.relative(r,n));let i=gr.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())}};bh.prototype._version=3;Tw.SourceMapGenerator=bh});var xw=ye(Ow=>{var bB=k0().SourceMapGenerator,Ch=yh(),CB=/(\r?\n)/,_B=10,Lu="$$$isSourceNode$$$",L0=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[Lu]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,a=t.split(CB),s=0,u=function(){let h=m(),A=m()||"";return h+A;function m(){return s<a.length?a[s++]:void 0}},l=1,f=0,d=null,E;return r.eachMapping(function(h){if(d!==null)if(l<h.generatedLine)p(d,u()),l++,f=0;else{E=a[s]||"";let A=E.substr(0,h.generatedColumn-f);a[s]=E.substr(h.generatedColumn-f),f=h.generatedColumn,p(d,A),d=h;return}for(;l<h.generatedLine;)i.add(u()),l++;f<h.generatedColumn&&(E=a[s]||"",i.add(E.substr(0,h.generatedColumn)),a[s]=E.substr(h.generatedColumn),f=h.generatedColumn),d=h},this),s<a.length&&(d&&p(d,u()),i.add(a.splice(s).join(""))),r.sources.forEach(function(h){let A=r.sourceContentFor(h);A!=null&&(n!=null&&(h=Ch.join(n,h)),i.setSourceContent(h,A))}),i;function p(h,A){if(h===null||h.source===void 0)i.add(A);else{let m=n?Ch.join(n,h.source):h.source;i.add(new e(h.originalLine,h.originalColumn,m,A,h.name))}}}add(t){if(Array.isArray(t))t.forEach(function(r){this.add(r)},this);else if(t[Lu]||typeof t=="string")t&&this.children.push(t);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+t);return this}prepend(t){if(Array.isArray(t))for(let r=t.length-1;r>=0;r--)this.prepend(t[r]);else if(t[Lu]||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;n<i;n++)r=this.children[n],r[Lu]?r.walk(t):r!==""&&t(r,{source:this.source,line:this.line,column:this.column,name:this.name})}join(t){let r,n,i=this.children.length;if(i>0){for(r=[],n=0;n<i-1;n++)r.push(this.children[n]),r.push(t);r.push(this.children[n]),this.children=r}return this}replaceRight(t,r){let n=this.children[this.children.length-1];return n[Lu]?n.replaceRight(t,r):typeof n=="string"?this.children[this.children.length-1]=n.replace(t,r):this.children.push("".replace(t,r)),this}setSourceContent(t,r){this.sourceContents[Ch.toSetString(t)]=r}walkSourceContents(t){for(let n=0,i=this.children.length;n<i;n++)this.children[n][Lu]&&this.children[n].walkSourceContents(t);let r=Object.keys(this.sourceContents);for(let n=0,i=r.length;n<i;n++)t(Ch.fromSetString(r[n]),this.sourceContents[r[n]])}toString(){let t="";return this.walk(function(r){t+=r}),t}toStringWithSourceMap(t){let r={code:"",line:1,column:0},n=new bB(t),i=!1,a=null,s=null,u=null,l=null;return this.walk(function(f,d){r.code+=f,d.source!==null&&d.line!==null&&d.column!==null?((a!==d.source||s!==d.line||u!==d.column||l!==d.name)&&n.addMapping({source:d.source,original:{line:d.line,column:d.column},generated:{line:r.line,column:r.column},name:d.name}),a=d.source,s=d.line,u=d.column,l=d.name,i=!0):i&&(n.addMapping({generated:{line:r.line,column:r.column}}),a=null,i=!1);for(let E=0,p=f.length;E<p;E++)f.charCodeAt(E)===_B?(r.line++,r.column=0,E+1===p?(a=null,i=!1):i&&n.addMapping({source:d.source,original:{line:d.line,column:d.column},generated:{line:r.line,column:r.column},name:d.name})):r.column++}),this.walkSourceContents(function(f,d){n.setSourceContent(f,d)}),{code:r.code,map:n}}};Ow.SourceNode=L0});var Nw=ye(U0=>{U0.SourceMapGenerator=k0().SourceMapGenerator;U0.SourceNode=xw().SourceNode});var Hw=ye((pN,Uw)=>{"use strict";var FB=Ea(),It=F0(),IB=pw(),$B=R0(),{stringEscape:Xn,regexpClassEscape:H0}=gw(),{SourceNode:pi}=Nw();function Lw(e,t,r){let n=t.start.line,i=t.start.column-1,a=e.split(`
`);return a.length===1?new pi(n,i,t.source,e,r):new pi(null,null,t.source,a.map((s,u)=>new pi(n+u,u===0?i:0,t.source,u===a.length-1?s:[s,`
`],r)))}function kw(e,t,r,n,i){return r?new pi(null,null,r.source,[e,Lw(t,r,i),new pi(r.end.line,r.end.column-1,r.source,n)]):new pi(null,null,null,[e,t,n])}function DB(e,t){function r(m){return m instanceof pi?m:m.replace(/^(.+)$/gm," $1")}function n(m){return"peg$c"+m}function i(m){return"peg$r"+m}function a(m){return"peg$e"+m}function s(m){return"peg$f"+m}function u(m){return"peg$parse"+m}function l(){function m(_){return'"'+Xn(_)+'"'}function S(_){return"/^["+(_.inverted?"^":"")+_.value.map(B=>Array.isArray(B)?H0(B[0])+"-"+H0(B[1]):H0(B)).join("")+"]/"+(_.ignoreCase?"i":"")}function w(_){switch(_.type){case"rule":return'peg$otherExpectation("'+Xn(_.value)+'")';case"literal":return'peg$literalExpectation("'+Xn(_.value)+'", '+_.ignoreCase+")";case"class":return"peg$classExpectation(["+_.value.map(D=>Array.isArray(D)?'["'+Xn(D[0])+'", "'+Xn(D[1])+'"]':'"'+Xn(D)+'"').join(", ")+"], "+_.inverted+", "+_.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(_)+")")}}function y(_,B){return kw(`
var ${s(B)} = function(${_.params.join(", ")}) {`,_.body,_.location,"};")}return new pi(null,null,t.grammarSource,[e.literals.map((_,B)=>" var "+n(B)+" = "+m(_)+";").concat("",e.classes.map((_,B)=>" var "+i(B)+" = "+S(_)+";")).concat("",e.expectations.map((_,B)=>" var "+a(B)+" = "+w(_)+";")).concat("").join(`
`),e.functions.map(y)])}function f(m,S){let w=[];return w.push(""),t.trace&&w.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)","});",""),t.cache&&(w.push("var key = peg$currPos * "+e.rules.length+" + "+S+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),t.trace&&w.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+m+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),w.push(" return cached.result;","}","")),w}function d(m,S){let w=[];return t.cache&&w.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+S+" };"),t.trace&&w.push("","if ("+S+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+m+","," result: "+S+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+m+","," location: peg$computeLocation(startPos, startPos)"," });","}"),w.push("","return "+S+";"),w}function E(m){let S=[],w=new IB(m.name,"s","var");function y(B){let D=0,j=B.length,q=[],F;function P(V,W){let G=W+3,z=B[D+G-2],X=B[D+G-1],ie,Se;w.checkedIf(D,()=>{D+=G,ie=y(B.slice(D,D+z)),D+=z},X>0?()=>{Se=y(B.slice(D,D+X)),D+=X}:null),q.push("if ("+V+") {"),q.push(...ie.map(r)),X>0&&(q.push("} else {"),q.push(...Se.map(r))),q.push("}")}function L(V){let G=B[D+2-1],z;w.checkedLoop(D,()=>{D+=2,z=y(B.slice(D,D+G)),D+=G}),q.push("while ("+V+") {"),q.push(...z.map(r)),q.push("}")}function M(){let W=B[D+4-1],G=s(B[D+1])+"("+B.slice(D+4,D+4+W).map(z=>w.index(z)).join(", ")+")";w.pop(B[D+2]),q.push(w.push(G)),D+=4+W}for(;D<j;)switch(B[D]){case It.PUSH_EMPTY_STRING:q.push(w.push("''")),D++;break;case It.PUSH_CURR_POS:q.push(w.push("peg$currPos")),D++;break;case It.PUSH_UNDEFINED:q.push(w.push("undefined")),D++;break;case It.PUSH_NULL:q.push(w.push("null")),D++;break;case It.PUSH_FAILED:q.push(w.push("peg$FAILED")),D++;break;case It.PUSH_EMPTY_ARRAY:q.push(w.push("[]")),D++;break;case It.POP:w.pop(),D++;break;case It.POP_CURR_POS:q.push("peg$currPos = "+w.pop()+";"),D++;break;case It.POP_N:w.pop(B[D+1]),D+=2;break;case It.NIP:F=w.pop(),w.pop(),q.push(w.push(F)),D++;break;case It.APPEND:F=w.pop(),q.push(w.top()+".push("+F+");"),D++;break;case It.WRAP:q.push(w.push("["+w.pop(B[D+1]).join(", ")+"]")),D+=2;break;case It.TEXT:q.push(w.push("input.substring("+w.pop()+", peg$currPos)")),D++;break;case It.PLUCK:{let W=B[D+3-1],G=3+W;F=B.slice(D+3,D+G),F=W===1?w.index(F[0]):`[ ${F.map(z=>w.index(z)).join(", ")} ]`,w.pop(B[D+1]),q.push(w.push(F)),D+=G;break}case It.IF:P(w.top(),0);break;case It.IF_ERROR:P(w.top()+" === peg$FAILED",0);break;case It.IF_NOT_ERROR:P(w.top()+" !== peg$FAILED",0);break;case It.WHILE_NOT_ERROR:L(w.top()+" !== peg$FAILED");break;case It.MATCH_ANY:P("input.length > peg$currPos",0);break;case It.MATCH_STRING:P(e.literals[B[D+1]].length>1?"input.substr(peg$currPos, "+e.literals[B[D+1]].length+") === "+n(B[D+1]):"input.charCodeAt(peg$currPos) === "+e.literals[B[D+1]].charCodeAt(0),1);break;case It.MATCH_STRING_IC:P("input.substr(peg$currPos, "+e.literals[B[D+1]].length+").toLowerCase() === "+n(B[D+1]),1);break;case It.MATCH_CHAR_CLASS:P(i(B[D+1])+".test(input.charAt(peg$currPos))",1);break;case It.ACCEPT_N:q.push(w.push(B[D+1]>1?"input.substr(peg$currPos, "+B[D+1]+")":"input.charAt(peg$currPos)")),q.push(B[D+1]>1?"peg$currPos += "+B[D+1]+";":"peg$currPos++;"),D+=2;break;case It.ACCEPT_STRING:q.push(w.push(n(B[D+1]))),q.push(e.literals[B[D+1]].length>1?"peg$currPos += "+e.literals[B[D+1]].length+";":"peg$currPos++;"),D+=2;break;case It.FAIL:q.push(w.push("peg$FAILED")),q.push("if (peg$silentFails === 0) { peg$fail("+a(B[D+1])+"); }"),D+=2;break;case It.LOAD_SAVED_POS:q.push("peg$savedPos = "+w.index(B[D+1])+";"),D+=2;break;case It.UPDATE_SAVED_POS:q.push("peg$savedPos = peg$currPos;"),D++;break;case It.CALL:M();break;case It.RULE:q.push(w.push(u(e.rules[B[D+1]].name)+"()")),D+=2;break;case It.SILENT_FAILS_ON:q.push("peg$silentFails++;"),D++;break;case It.SILENT_FAILS_OFF:q.push("peg$silentFails--;"),D++;break;default:throw new Error("Invalid opcode: "+B[D]+".")}return q}let _=y(m.bytecode);return S.push(kw(" function ",u(m.name),m.nameLocation,`() {
`,m.name)),t.trace&&S.push(" var startPos = peg$currPos;"),S.push(r(w.defines())),S.push(...f('"'+Xn(m.name)+'"',FB.indexOfRule(e,m.name)).map(r)),S.push(..._.map(r)),S.push(...d('"'+Xn(m.name)+'"',w.result()).map(r)),S.push("}"),S}function p(m){return m.codeLocation?Lw(m.code,m.codeLocation,"$"+m.type):m.code}function h(){let m=[];e.topLevelInitializer&&(m.push(p(e.topLevelInitializer)),m.push("")),m.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&&m.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 S="{ "+t.allowedStartRules.map(y=>y+": "+u(y)).join(", ")+" }",w=u(t.allowedStartRules[0]);return m.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+S+";"," var peg$startRuleFunction = "+w+";","",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&&m.push(" var peg$resultsCache = {};",""),t.trace&&m.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),m.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(y=>{m.push(...E(y).map(r)),m.push("")}),e.initializer&&(m.push(p(e.initializer)),m.push("")),m.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 pi(null,null,t.grammarSource,m.map(y=>y instanceof pi?y:y+`
`))}function A(m){function S(){return[`// Generated by Peggy ${$B}.`,"//","// https://peggyjs.org/"]}function w(){return t.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(`
`):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(`
`)}let _={bare(){return[...S(),"(function() {",' "use strict";',"",m,"",r("return "+w()+";"),"})()"]},commonjs(){let B=Object.keys(t.dependencies),D=S();return D.push("",'"use strict";',""),B.length>0&&(B.forEach(j=>{D.push("var "+j+' = require("'+Xn(t.dependencies[j])+'");')}),D.push("")),D.push(m,"","module.exports = "+w()+";"),D},es(){let B=Object.keys(t.dependencies),D=S();return D.push(""),B.length>0&&(B.forEach(j=>{D.push("import "+j+' from "'+Xn(t.dependencies[j])+'";')}),D.push("")),D.push(m,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),D},amd(){let B=Object.keys(t.dependencies),j="["+B.map(F=>t.dependencies[F]).map(F=>'"'+Xn(F)+'"').join(", ")+"]",q=B.join(", ");return[...S(),"define("+j+", function("+q+") {",' "use strict";',"",m,"",r("return "+w()+";"),"});"]},globals(){return[...S(),"(function(root) {",' "use strict";',"",m,"",r("root."+t.exportVar+" = "+w()+";"),"})(this);"]},umd(){let B=Object.keys(t.dependencies),D=B.map(L=>t.dependencies[L]),j="["+D.map(L=>'"'+Xn(L)+'"').join(", ")+"]",q=D.map(L=>'require("'+Xn(L)+'")').join(", "),F=B.join(", "),P=S();return P.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+j+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+q+");"),t.exportVar!==null&&P.push(" } else {"," root."+t.exportVar+" = factory();"),P.push(" }","})(this, function("+F+") {",' "use strict";',"",m,"",r("return "+w()+";"),"});"),P}}[t.format]();return new pi(null,null,t.grammarSource,_.map(B=>B instanceof pi?B:B+`
`))}e.code=A(h())}Uw.exports=DB});var jw=ye((dN,Mw)=>{"use strict";var BB=Ea(),RB=hi();function PB(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,u,l){RB.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:BB.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)})}Mw.exports=PB});var Kw=ye((gN,qw)=>{"use strict";var TB=hi();function OB(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=TB.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)}qw.exports=OB});var Gw=ye((mN,Vw)=>{"use strict";var xB=hi();function NB(e,t,r){let n={};xB.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)}Vw.exports=NB});var Ww=ye((vN,Yw)=>{"use strict";var zw=Ea(),kB=hi();function LB(e,t,r){let n=[],i=[],a=kB.build({rule(s){n.push(s.name),a(s.expression),n.pop()},sequence(s){s.elements.every(u=>(a(u),!zw.alwaysConsumesOnSuccess(e,u)))},rule_ref(s){i.push(s);let u=zw.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)}Yw.exports=LB});var Zw=ye((EN,Jw)=>{"use strict";var Xw=Ea(),UB=hi();function HB(e,t,r){UB.build({zero_or_more(i){Xw.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){Xw.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)}Jw.exports=HB});var eA=ye((wN,Qw)=>{"use strict";var MB=Ea(),jB=hi();function qB(e,t,r){jB.build({rule_ref(i){MB.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}Qw.exports=qB});var rA=ye((AN,tA)=>{"use strict";var KB=hi();function VB(e,t,r){let n=KB.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)}tA.exports=VB});var iA=ye((yN,nA)=>{"use strict";var GB=vh(),M0=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(){}},j0=class{constructor(t){this._callbacks=new M0(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new GB(...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}};nA.exports=j0});var sA=ye((exports,module)=>{"use strict";var generateBytecode=fw(),generateJS=Hw(),inferenceMatchResult=I0(),removeProxyRules=jw(),reportDuplicateLabels=Kw(),reportDuplicateRules=Gw(),reportInfiniteRecursion=Ww(),reportInfiniteRepetition=Zw(),reportUndefinedRules=eA(),reportIncorrectPlucking=rA(),Session=iA(),visitor=hi();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 oA=ye((SN,aA)=>{"use strict";var zB={$:"text","&":"simple_and","!":"simple_not"},YB={"?":"optional","*":"zero_or_more","+":"one_or_more"},WB={"&":"semantic_and","!":"semantic_not"};function XB(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function ya(e,t,r,n){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,ya.prototype),i.expected=t,i.found=r,i.location=n,i.name="SyntaxError",i}XB(ya,Error);function q0(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}ya.prototype.format=function(e){var t="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n<e.length;n++)if(e[n].source===this.location.source){r=e[n].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,a=this.location.source+":"+i.line+":"+i.column;if(r){var s=this.location.end,u=q0("",i.line.toString().length," "),l=r[i.line-1],f=i.line===s.line?s.column:l.length+1,d=f-i.column||1;t+=`
--> `+a+`
`+u+` |
`+i.line+" | "+l+`
`+u+" | "+q0("",i.column-1," ")+q0("",d,"^")}else t+=`
at `+a}return t};ya.buildMessage=function(e,t){var r={literal:function(f){return'"'+i(f.text)+'"'},class:function(f){var d=f.parts.map(function(E){return Array.isArray(E)?a(E[0])+"-"+a(E[1]):a(E)});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),E,p;if(d.sort(),d.length>0){for(E=1,p=1;E<d.length;E++)d[E-1]!==d[E]&&(d[p]=d[E],p++);d.length=p}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function l(f){return f?'"'+i(f)+'"':"end of input"}return"Expected "+u(e)+" but "+l(t)+" found."};function JB(e,t){t=t!==void 0?t:{};var r={},n=t.grammarSource,i={Grammar:No},a=No,s="{",u="}",l="=",f="/",d="@",E=":",p="$",h="&",A="!",m="?",S="*",w="+",y="(",_=")",B=" ",D="\v",j="\f",q=" ",F="\xA0",P="\uFEFF",L=`
`,M=`\r
`,V="\r",W="\u2028",G="\u2029",z="/*",X="*/",ie="//",Se="_",we="\\",Ie="\u200C",Ve="\u200D",ue="i",_e='"',He="'",Sr="[",Ht="^",wt="]",ir="-",Gt="0",at="b",kt="f",it="n",bt="r",sr="t",et="v",Jt="x",Zn="u",br=".",Tr=";",cr=/^[\n\r\u2028\u2029]/,Mr=/^[0-9]/,Sa=/^[0-9a-f]/i,tn=/^[{}]/,Ct=/^[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137-\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148-\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C-\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA-\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9-\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC-\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF-\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F-\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0-\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB-\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE-\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FC7\u1FD0-\u1FD3\u1FD6-\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6-\u1FF7\u210A\u210E-\u210F\u2113\u212F\u2134\u2139\u213C-\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65-\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73-\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3-\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]/,lr=/^[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5-\u06E6\u07F4-\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C-\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D-\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C-\uA69D\uA717-\uA71F\uA770\uA788\uA7F8-\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3-\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E-\uFF9F]/,tt=/^[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\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\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\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\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A-\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\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\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,jr=/^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,ba=/^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178-\u0179\u017B\u017D\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018B\u018E-\u0191\u0193-\u0194\u0196-\u0198\u019C-\u019D\u019F-\u01A0\u01A2\u01A4\u01A6-\u01A7\u01A9\u01AC\u01AE-\u01AF\u01B1-\u01B3\u01B5\u01B7-\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A-\u023B\u023D-\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E-\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9-\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0-\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E-\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D-\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A]/,Ca=/^[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0982-\u0983\u09BE-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0B02-\u0B03\u0B3E\u0B40\u0B47-\u0B48\u0B4B-\u0B4C\u0B57\u0BBE-\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82-\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7-\u0CC8\u0CCA-\u0CCB\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82-\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2-\u0DF3\u0F3E-\u0F3F\u0F7F\u102B-\u102C\u1031\u1038\u103B-\u103C\u1056-\u1057\u1062-\u1064\u1067-\u106D\u1083-\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7-\u17C8\u1923-\u1926\u1929-\u192B\u1930-\u1931\u1933-\u1938\u1A19-\u1A1A\u1A55\u1A57\u1A61\u1A63-\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B82\u1BA1\u1BA6-\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1C24-\u1C2B\u1C34-\u1C35\u1CE1\u1CF2-\u1CF3\u302E-\u302F\uA823-\uA824\uA827\uA880-\uA881\uA8B4-\uA8C3\uA952-\uA953\uA983\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BD-\uA9C0\uAA2F-\uAA30\uAA33-\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE-\uAAEF\uAAF5\uABE3-\uABE4\uABE6-\uABE7\uABE9-\uABEA\uABEC]/,_a=/^[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962-\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2-\u09E3\u0A01-\u0A02\u0A3C\u0A41-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A70-\u0A71\u0A75\u0A81-\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7-\u0AC8\u0ACD\u0AE2-\u0AE3\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62-\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C62-\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC-\u0CCD\u0CE2-\u0CE3\u0D01\u0D41-\u0D44\u0D4D\u0D62-\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039-\u103A\u103D-\u103E\u1058-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193B\u1A17-\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80-\u1B81\u1BA2-\u1BA5\u1BA8-\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8-\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8-\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099-\u309A\uA66F\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1\uA802\uA806\uA80B\uA825-\uA826\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9E5\uAA29-\uAA2E\uAA31-\uAA32\uAA35-\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1\uAAEC-\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/,Fa=/^[0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]/,rs=/^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/,Ia=/^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/,Vs=/^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,Fi=Me("{",!1),ns=Me("}",!1),Ao=Me("=",!1),yo=Me("/",!1),So=Me("@",!1),bo=Me(":",!1),Co=Me("$",!1),_o=Me("&",!1),Fo=Me("!",!1),ju=Me("?",!1),Io=Me("*",!1),qu=Me("+",!1),Ku=Me("(",!1),Vu=Me(")",!1),Gs=Js(),Gu=ei("whitespace"),$a=Me(" ",!1),zu=Me("\v",!1),Yu=Me("\f",!1),Wu=Me(" ",!1),Xu=Me("\xA0",!1),Ju=Me("\uFEFF",!1),Zu=hr([`
`,"\r","\u2028","\u2029"],!1,!1),Qu=ei("end of line"),ec=Me(`
`,!1),Ii=Me(`\r
`,!1),$o=Me("\r",!1),tc=Me("\u2028",!1),rc=Me("\u2029",!1),nc=ei("comment"),Do=Me("/*",!1),$i=Me("*/",!1),gn=Me("//",!1),ic=ei("identifier"),zs=Me("_",!1),Pn=Me("\\",!1),sc=Me("\u200C",!1),ac=Me("\u200D",!1),Bo=ei("literal"),Da=Me("i",!1),Ro=ei("string"),Ys=Me('"',!1),Zt=Me("'",!1),oc=ei("character class"),uc=Me("[",!1),Po=Me("^",!1),Di=Me("]",!1),Cr=Me("-",!1),Kt=Me("0",!1),cc=Me("b",!1),Ba=Me("f",!1),_r=Me("n",!1),Ra=Me("r",!1),To=Me("t",!1),Oo=Me("v",!1),Pa=Me("x",!1),Bi=Me("u",!1),Ta=hr([["0","9"]],!1,!1),xo=hr([["0","9"],["a","f"]],!1,!0),Oa=Me(".",!1),xa=ei("code block"),rn=hr(["{","}"],!1,!1),T=hr([["a","z"],"\xB5",["\xDF","\xF6"],["\xF8","\xFF"],"\u0101","\u0103","\u0105","\u0107","\u0109","\u010B","\u010D","\u010F","\u0111","\u0113","\u0115","\u0117","\u0119","\u011B","\u011D","\u011F","\u0121","\u0123","\u0125","\u0127","\u0129","\u012B","\u012D","\u012F","\u0131","\u0133","\u0135",["\u0137","\u0138"],"\u013A","\u013C","\u013E","\u0140","\u0142","\u0144","\u0146",["\u0148","\u0149"],"\u014B","\u014D","\u014F","\u0151","\u0153","\u0155","\u0157","\u0159","\u015B","\u015D","\u015F","\u0161","\u0163","\u0165","\u0167","\u0169","\u016B","\u016D","\u016F","\u0171","\u0173","\u0175","\u0177","\u017A","\u017C",["\u017E","\u0180"],"\u0183","\u0185","\u0188",["\u018C","\u018D"],"\u0192","\u0195",["\u0199","\u019B"],"\u019E","\u01A1","\u01A3","\u01A5","\u01A8",["\u01AA","\u01AB"],"\u01AD","\u01B0","\u01B4","\u01B6",["\u01B9","\u01BA"],["\u01BD","\u01BF"],"\u01C6","\u01C9","\u01CC","\u01CE","\u01D0","\u01D2","\u01D4","\u01D6","\u01D8","\u01DA",["\u01DC","\u01DD"],"\u01DF","\u01E1","\u01E3","\u01E5","\u01E7","\u01E9","\u01EB","\u01ED",["\u01EF","\u01F0"],"\u01F3","\u01F5","\u01F9","\u01FB","\u01FD","\u01FF","\u0201","\u0203","\u0205","\u0207","\u0209","\u020B","\u020D","\u020F","\u0211","\u0213","\u0215","\u0217","\u0219","\u021B","\u021D","\u021F","\u0221","\u0223","\u0225","\u0227","\u0229","\u022B","\u022D","\u022F","\u0231",["\u0233","\u0239"],"\u023C",["\u023F","\u0240"],"\u0242","\u0247","\u0249","\u024B","\u024D",["\u024F","\u0293"],["\u0295","\u02AF"],"\u0371","\u0373","\u0377",["\u037B","\u037D"],"\u0390",["\u03AC","\u03CE"],["\u03D0","\u03D1"],["\u03D5","\u03D7"],"\u03D9","\u03DB","\u03DD","\u03DF","\u03E1","\u03E3","\u03E5","\u03E7","\u03E9","\u03EB","\u03ED",["\u03EF","\u03F3"],"\u03F5","\u03F8",["\u03FB","\u03FC"],["\u0430","\u045F"],"\u0461","\u0463","\u0465","\u0467","\u0469","\u046B","\u046D","\u046F","\u0471","\u0473","\u0475","\u0477","\u0479","\u047B","\u047D","\u047F","\u0481","\u048B","\u048D","\u048F","\u0491","\u0493","\u0495","\u0497","\u0499","\u049B","\u049D","\u049F","\u04A1","\u04A3","\u04A5","\u04A7","\u04A9","\u04AB","\u04AD","\u04AF","\u04B1","\u04B3","\u04B5","\u04B7","\u04B9","\u04BB","\u04BD","\u04BF","\u04C2","\u04C4","\u04C6","\u04C8","\u04CA","\u04CC",["\u04CE","\u04CF"],"\u04D1","\u04D3","\u04D5","\u04D7","\u04D9","\u04DB","\u04DD","\u04DF","\u04E1","\u04E3","\u04E5","\u04E7","\u04E9","\u04EB","\u04ED","\u04EF","\u04F1","\u04F3","\u04F5","\u04F7","\u04F9","\u04FB","\u04FD","\u04FF","\u0501","\u0503","\u0505","\u0507","\u0509","\u050B","\u050D","\u050F","\u0511","\u0513","\u0515","\u0517","\u0519","\u051B","\u051D","\u051F","\u0521","\u0523","\u0525","\u0527","\u0529","\u052B","\u052D","\u052F",["\u0561","\u0587"],["\u13F8","\u13FD"],["\u1D00","\u1D2B"],["\u1D6B","\u1D77"],["\u1D79","\u1D9A"],"\u1E01","\u1E03","\u1E05","\u1E07","\u1E09","\u1E0B","\u1E0D","\u1E0F","\u1E11","\u1E13","\u1E15","\u1E17","\u1E19","\u1E1B","\u1E1D","\u1E1F","\u1E21","\u1E23","\u1E25","\u1E27","\u1E29","\u1E2B","\u1E2D","\u1E2F","\u1E31","\u1E33","\u1E35","\u1E37","\u1E39","\u1E3B","\u1E3D","\u1E3F","\u1E41","\u1E43","\u1E45","\u1E47","\u1E49","\u1E4B","\u1E4D","\u1E4F","\u1E51","\u1E53","\u1E55","\u1E57","\u1E59","\u1E5B","\u1E5D","\u1E5F","\u1E61","\u1E63","\u1E65","\u1E67","\u1E69","\u1E6B","\u1E6D","\u1E6F","\u1E71","\u1E73","\u1E75","\u1E77","\u1E79","\u1E7B","\u1E7D","\u1E7F","\u1E81","\u1E83","\u1E85","\u1E87","\u1E89","\u1E8B","\u1E8D","\u1E8F","\u1E91","\u1E93",["\u1E95","\u1E9D"],"\u1E9F","\u1EA1","\u1EA3","\u1EA5","\u1EA7","\u1EA9","\u1EAB","\u1EAD","\u1EAF","\u1EB1","\u1EB3","\u1EB5","\u1EB7","\u1EB9","\u1EBB","\u1EBD","\u1EBF","\u1EC1","\u1EC3","\u1EC5","\u1EC7","\u1EC9","\u1ECB","\u1ECD","\u1ECF","\u1ED1","\u1ED3","\u1ED5","\u1ED7","\u1ED9","\u1EDB","\u1EDD","\u1EDF","\u1EE1","\u1EE3","\u1EE5","\u1EE7","\u1EE9","\u1EEB","\u1EED","\u1EEF","\u1EF1","\u1EF3","\u1EF5","\u1EF7","\u1EF9","\u1EFB","\u1EFD",["\u1EFF","\u1F07"],["\u1F10","\u1F15"],["\u1F20","\u1F27"],["\u1F30","\u1F37"],["\u1F40","\u1F45"],["\u1F50","\u1F57"],["\u1F60","\u1F67"],["\u1F70","\u1F7D"],["\u1F80","\u1F87"],["\u1F90","\u1F97"],["\u1FA0","\u1FA7"],["\u1FB0","\u1FB4"],["\u1FB6","\u1FB7"],"\u1FBE",["\u1FC2","\u1FC4"],["\u1FC6","\u1FC7"],["\u1FD0","\u1FD3"],["\u1FD6","\u1FD7"],["\u1FE0","\u1FE7"],["\u1FF2","\u1FF4"],["\u1FF6","\u1FF7"],"\u210A",["\u210E","\u210F"],"\u2113","\u212F","\u2134","\u2139",["\u213C","\u213D"],["\u2146","\u2149"],"\u214E","\u2184",["\u2C30","\u2C5E"],"\u2C61",["\u2C65","\u2C66"],"\u2C68","\u2C6A","\u2C6C","\u2C71",["\u2C73","\u2C74"],["\u2C76","\u2C7B"],"\u2C81","\u2C83","\u2C85","\u2C87","\u2C89","\u2C8B","\u2C8D","\u2C8F","\u2C91","\u2C93","\u2C95","\u2C97","\u2C99","\u2C9B","\u2C9D","\u2C9F","\u2CA1","\u2CA3","\u2CA5","\u2CA7","\u2CA9","\u2CAB","\u2CAD","\u2CAF","\u2CB1","\u2CB3","\u2CB5","\u2CB7","\u2CB9","\u2CBB","\u2CBD","\u2CBF","\u2CC1","\u2CC3","\u2CC5","\u2CC7","\u2CC9","\u2CCB","\u2CCD","\u2CCF","\u2CD1","\u2CD3","\u2CD5","\u2CD7","\u2CD9","\u2CDB","\u2CDD","\u2CDF","\u2CE1",["\u2CE3","\u2CE4"],"\u2CEC","\u2CEE","\u2CF3",["\u2D00","\u2D25"],"\u2D27","\u2D2D","\uA641","\uA643","\uA645","\uA647","\uA649","\uA64B","\uA64D","\uA64F","\uA651","\uA653","\uA655","\uA657","\uA659","\uA65B","\uA65D","\uA65F","\uA661","\uA663","\uA665","\uA667","\uA669","\uA66B","\uA66D","\uA681","\uA683","\uA685","\uA687","\uA689","\uA68B","\uA68D","\uA68F","\uA691","\uA693","\uA695","\uA697","\uA699","\uA69B","\uA723","\uA725","\uA727","\uA729","\uA72B","\uA72D",["\uA72F","\uA731"],"\uA733","\uA735","\uA737","\uA739","\uA73B","\uA73D","\uA73F","\uA741","\uA743","\uA745","\uA747","\uA749","\uA74B","\uA74D","\uA74F","\uA751","\uA753","\uA755","\uA757","\uA759","\uA75B","\uA75D","\uA75F","\uA761","\uA763","\uA765","\uA767","\uA769","\uA76B","\uA76D","\uA76F",["\uA771","\uA778"],"\uA77A","\uA77C","\uA77F","\uA781","\uA783","\uA785","\uA787","\uA78C","\uA78E","\uA791",["\uA793","\uA795"],"\uA797","\uA799","\uA79B","\uA79D","\uA79F","\uA7A1","\uA7A3","\uA7A5","\uA7A7","\uA7A9","\uA7B5","\uA7B7","\uA7FA",["\uAB30","\uAB5A"],["\uAB60","\uAB65"],["\uAB70","\uABBF"],["\uFB00","\uFB06"],["\uFB13","\uFB17"],["\uFF41","\uFF5A"]],!1,!1),x=hr([["\u02B0","\u02C1"],["\u02C6","\u02D1"],["\u02E0","\u02E4"],"\u02EC","\u02EE","\u0374","\u037A","\u0559","\u0640",["\u06E5","\u06E6"],["\u07F4","\u07F5"],"\u07FA","\u081A","\u0824","\u0828","\u0971","\u0E46","\u0EC6","\u10FC","\u17D7","\u1843","\u1AA7",["\u1C78","\u1C7D"],["\u1D2C","\u1D6A"],"\u1D78",["\u1D9B","\u1DBF"],"\u2071","\u207F",["\u2090","\u209C"],["\u2C7C","\u2C7D"],"\u2D6F","\u2E2F","\u3005",["\u3031","\u3035"],"\u303B",["\u309D","\u309E"],["\u30FC","\u30FE"],"\uA015",["\uA4F8","\uA4FD"],"\uA60C","\uA67F",["\uA69C","\uA69D"],["\uA717","\uA71F"],"\uA770","\uA788",["\uA7F8","\uA7F9"],"\uA9CF","\uA9E6","\uAA70","\uAADD",["\uAAF3","\uAAF4"],["\uAB5C","\uAB5F"],"\uFF70",["\uFF9E","\uFF9F"]],!1,!1),H=hr(["\xAA","\xBA","\u01BB",["\u01C0","\u01C3"],"\u0294",["\u05D0","\u05EA"],["\u05F0","\u05F2"],["\u0620","\u063F"],["\u0641","\u064A"],["\u066E","\u066F"],["\u0671","\u06D3"],"\u06D5",["\u06EE","\u06EF"],["\u06FA","\u06FC"],"\u06FF","\u0710",["\u0712","\u072F"],["\u074D","\u07A5"],"\u07B1",["\u07CA","\u07EA"],["\u0800","\u0815"],["\u0840","\u0858"],["\u08A0","\u08B4"],["\u0904","\u0939"],"\u093D","\u0950",["\u0958","\u0961"],["\u0972","\u0980"],["\u0985","\u098C"],["\u098F","\u0990"],["\u0993","\u09A8"],["\u09AA","\u09B0"],"\u09B2",["\u09B6","\u09B9"],"\u09BD","\u09CE",["\u09DC","\u09DD"],["\u09DF","\u09E1"],["\u09F0","\u09F1"],["\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"],["\u0C85","\u0C8C"],["\u0C8E","\u0C90"],["\u0C92","\u0CA8"],["\u0CAA","\u0CB3"],["\u0CB5","\u0CB9"],"\u0CBD","\u0CDE",["\u0CE0","\u0CE1"],["\u0CF1","\u0CF2"],["\u0D05","\u0D0C"],["\u0D0E","\u0D10"],["\u0D12","\u0D3A"],"\u0D3D","\u0D4E",["\u0D5F","\u0D61"],["\u0D7A","\u0D7F"],["\u0D85","\u0D96"],["\u0D9A","\u0DB1"],["\u0DB3","\u0DBB"],"\u0DBD",["\u0DC0","\u0DC6"],["\u0E01","\u0E30"],["\u0E32","\u0E33"],["\u0E40","\u0E45"],["\u0E81","\u0E82"],"\u0E84",["\u0E87","\u0E88"],"\u0E8A","\u0E8D",["\u0E94","\u0E97"],["\u0E99","\u0E9F"],["\u0EA1","\u0EA3"],"\u0EA5","\u0EA7",["\u0EAA","\u0EAB"],["\u0EAD","\u0EB0"],["\u0EB2","\u0EB3"],"\u0EBD",["\u0EC0","\u0EC4"],["\u0EDC","\u0EDF"],"\u0F00",["\u0F40","\u0F47"],["\u0F49","\u0F6C"],["\u0F88","\u0F8C"],["\u1000","\u102A"],"\u103F",["\u1050","\u1055"],["\u105A","\u105D"],"\u1061",["\u1065","\u1066"],["\u106E","\u1070"],["\u1075","\u1081"],"\u108E",["\u10D0","\u10FA"],["\u10FD","\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"],["\u1401","\u166C"],["\u166F","\u167F"],["\u1681","\u169A"],["\u16A0","\u16EA"],["\u16F1","\u16F8"],["\u1700","\u170C"],["\u170E","\u1711"],["\u1720","\u1731"],["\u1740","\u1751"],["\u1760","\u176C"],["\u176E","\u1770"],["\u1780","\u17B3"],"\u17DC",["\u1820","\u1842"],["\u1844","\u1877"],["\u1880","\u18A8"],"\u18AA",["\u18B0","\u18F5"],["\u1900","\u191E"],["\u1950","\u196D"],["\u1970","\u1974"],["\u1980","\u19AB"],["\u19B0","\u19C9"],["\u1A00","\u1A16"],["\u1A20","\u1A54"],["\u1B05","\u1B33"],["\u1B45","\u1B4B"],["\u1B83","\u1BA0"],["\u1BAE","\u1BAF"],["\u1BBA","\u1BE5"],["\u1C00","\u1C23"],["\u1C4D","\u1C4F"],["\u1C5A","\u1C77"],["\u1CE9","\u1CEC"],["\u1CEE","\u1CF1"],["\u1CF5","\u1CF6"],["\u2135","\u2138"],["\u2D30","\u2D67"],["\u2D80","\u2D96"],["\u2DA0","\u2DA6"],["\u2DA8","\u2DAE"],["\u2DB0","\u2DB6"],["\u2DB8","\u2DBE"],["\u2DC0","\u2DC6"],["\u2DC8","\u2DCE"],["\u2DD0","\u2DD6"],["\u2DD8","\u2DDE"],"\u3006","\u303C",["\u3041","\u3096"],"\u309F",["\u30A1","\u30FA"],"\u30FF",["\u3105","\u312D"],["\u3131","\u318E"],["\u31A0","\u31BA"],["\u31F0","\u31FF"],["\u3400","\u4DB5"],["\u4E00","\u9FD5"],["\uA000","\uA014"],["\uA016","\uA48C"],["\uA4D0","\uA4F7"],["\uA500","\uA60B"],["\uA610","\uA61F"],["\uA62A","\uA62B"],"\uA66E",["\uA6A0","\uA6E5"],"\uA78F","\uA7F7",["\uA7FB","\uA801"],["\uA803","\uA805"],["\uA807","\uA80A"],["\uA80C","\uA822"],["\uA840","\uA873"],["\uA882","\uA8B3"],["\uA8F2","\uA8F7"],"\uA8FB","\uA8FD",["\uA90A","\uA925"],["\uA930","\uA946"],["\uA960","\uA97C"],["\uA984","\uA9B2"],["\uA9E0","\uA9E4"],["\uA9E7","\uA9EF"],["\uA9FA","\uA9FE"],["\uAA00","\uAA28"],["\uAA40","\uAA42"],["\uAA44","\uAA4B"],["\uAA60","\uAA6F"],["\uAA71","\uAA76"],"\uAA7A",["\uAA7E","\uAAAF"],"\uAAB1",["\uAAB5","\uAAB6"],["\uAAB9","\uAABD"],"\uAAC0","\uAAC2",["\uAADB","\uAADC"],["\uAAE0","\uAAEA"],"\uAAF2",["\uAB01","\uAB06"],["\uAB09","\uAB0E"],["\uAB11","\uAB16"],["\uAB20","\uAB26"],["\uAB28","\uAB2E"],["\uABC0","\uABE2"],["\uAC00","\uD7A3"],["\uD7B0","\uD7C6"],["\uD7CB","\uD7FB"],["\uF900","\uFA6D"],["\uFA70","\uFAD9"],"\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"],["\uFF66","\uFF6F"],["\uFF71","\uFF9D"],["\uFFA0","\uFFBE"],["\uFFC2","\uFFC7"],["\uFFCA","\uFFCF"],["\uFFD2","\uFFD7"],["\uFFDA","\uFFDC"]],!1,!1),Q=hr(["\u01C5","\u01C8","\u01CB","\u01F2",["\u1F88","\u1F8F"],["\u1F98","\u1F9F"],["\u1FA8","\u1FAF"],"\u1FBC","\u1FCC","\u1FFC"],!1,!1),de=hr([["A","Z"],["\xC0","\xD6"],["\xD8","\xDE"],"\u0100","\u0102","\u0104","\u0106","\u0108","\u010A","\u010C","\u010E","\u0110","\u0112","\u0114","\u0116","\u0118","\u011A","\u011C","\u011E","\u0120","\u0122","\u0124","\u0126","\u0128","\u012A","\u012C","\u012E","\u0130","\u0132","\u0134","\u0136","\u0139","\u013B","\u013D","\u013F","\u0141","\u0143","\u0145","\u0147","\u014A","\u014C","\u014E","\u0150","\u0152","\u0154","\u0156","\u0158","\u015A","\u015C","\u015E","\u0160","\u0162","\u0164","\u0166","\u0168","\u016A","\u016C","\u016E","\u0170","\u0172","\u0174","\u0176",["\u0178","\u0179"],"\u017B","\u017D",["\u0181","\u0182"],"\u0184",["\u0186","\u0187"],["\u0189","\u018B"],["\u018E","\u0191"],["\u0193","\u0194"],["\u0196","\u0198"],["\u019C","\u019D"],["\u019F","\u01A0"],"\u01A2","\u01A4",["\u01A6","\u01A7"],"\u01A9","\u01AC",["\u01AE","\u01AF"],["\u01B1","\u01B3"],"\u01B5",["\u01B7","\u01B8"],"\u01BC","\u01C4","\u01C7","\u01CA","\u01CD","\u01CF","\u01D1","\u01D3","\u01D5","\u01D7","\u01D9","\u01DB","\u01DE","\u01E0","\u01E2","\u01E4","\u01E6","\u01E8","\u01EA","\u01EC","\u01EE","\u01F1","\u01F4",["\u01F6","\u01F8"],"\u01FA","\u01FC","\u01FE","\u0200","\u0202","\u0204","\u0206","\u0208","\u020A","\u020C","\u020E","\u0210","\u0212","\u0214","\u0216","\u0218","\u021A","\u021C","\u021E","\u0220","\u0222","\u0224","\u0226","\u0228","\u022A","\u022C","\u022E","\u0230","\u0232",["\u023A","\u023B"],["\u023D","\u023E"],"\u0241",["\u0243","\u0246"],"\u0248","\u024A","\u024C","\u024E","\u0370","\u0372","\u0376","\u037F","\u0386",["\u0388","\u038A"],"\u038C",["\u038E","\u038F"],["\u0391","\u03A1"],["\u03A3","\u03AB"],"\u03CF",["\u03D2","\u03D4"],"\u03D8","\u03DA","\u03DC","\u03DE","\u03E0","\u03E2","\u03E4","\u03E6","\u03E8","\u03EA","\u03EC","\u03EE","\u03F4","\u03F7",["\u03F9","\u03FA"],["\u03FD","\u042F"],"\u0460","\u0462","\u0464","\u0466","\u0468","\u046A","\u046C","\u046E","\u0470","\u0472","\u0474","\u0476","\u0478","\u047A","\u047C","\u047E","\u0480","\u048A","\u048C","\u048E","\u0490","\u0492","\u0494","\u0496","\u0498","\u049A","\u049C","\u049E","\u04A0","\u04A2","\u04A4","\u04A6","\u04A8","\u04AA","\u04AC","\u04AE","\u04B0","\u04B2","\u04B4","\u04B6","\u04B8","\u04BA","\u04BC","\u04BE",["\u04C0","\u04C1"],"\u04C3","\u04C5","\u04C7","\u04C9","\u04CB","\u04CD","\u04D0","\u04D2","\u04D4","\u04D6","\u04D8","\u04DA","\u04DC","\u04DE","\u04E0","\u04E2","\u04E4","\u04E6","\u04E8","\u04EA","\u04EC","\u04EE","\u04F0","\u04F2","\u04F4","\u04F6","\u04F8","\u04FA","\u04FC","\u04FE","\u0500","\u0502","\u0504","\u0506","\u0508","\u050A","\u050C","\u050E","\u0510","\u0512","\u0514","\u0516","\u0518","\u051A","\u051C","\u051E","\u0520","\u0522","\u0524","\u0526","\u0528","\u052A","\u052C","\u052E",["\u0531","\u0556"],["\u10A0","\u10C5"],"\u10C7","\u10CD",["\u13A0","\u13F5"],"\u1E00","\u1E02","\u1E04","\u1E06","\u1E08","\u1E0A","\u1E0C","\u1E0E","\u1E10","\u1E12","\u1E14","\u1E16","\u1E18","\u1E1A","\u1E1C","\u1E1E","\u1E20","\u1E22","\u1E24","\u1E26","\u1E28","\u1E2A","\u1E2C","\u1E2E","\u1E30","\u1E32","\u1E34","\u1E36","\u1E38","\u1E3A","\u1E3C","\u1E3E","\u1E40","\u1E42","\u1E44","\u1E46","\u1E48","\u1E4A","\u1E4C","\u1E4E","\u1E50","\u1E52","\u1E54","\u1E56","\u1E58","\u1E5A","\u1E5C","\u1E5E","\u1E60","\u1E62","\u1E64","\u1E66","\u1E68","\u1E6A","\u1E6C","\u1E6E","\u1E70","\u1E72","\u1E74","\u1E76","\u1E78","\u1E7A","\u1E7C","\u1E7E","\u1E80","\u1E82","\u1E84","\u1E86","\u1E88","\u1E8A","\u1E8C","\u1E8E","\u1E90","\u1E92","\u1E94","\u1E9E","\u1EA0","\u1EA2","\u1EA4","\u1EA6","\u1EA8","\u1EAA","\u1EAC","\u1EAE","\u1EB0","\u1EB2","\u1EB4","\u1EB6","\u1EB8","\u1EBA","\u1EBC","\u1EBE","\u1EC0","\u1EC2","\u1EC4","\u1EC6","\u1EC8","\u1ECA","\u1ECC","\u1ECE","\u1ED0","\u1ED2","\u1ED4","\u1ED6","\u1ED8","\u1EDA","\u1EDC","\u1EDE","\u1EE0","\u1EE2","\u1EE4","\u1EE6","\u1EE8","\u1EEA","\u1EEC","\u1EEE","\u1EF0","\u1EF2","\u1EF4","\u1EF6","\u1EF8","\u1EFA","\u1EFC","\u1EFE",["\u1F08","\u1F0F"],["\u1F18","\u1F1D"],["\u1F28","\u1F2F"],["\u1F38","\u1F3F"],["\u1F48","\u1F4D"],"\u1F59","\u1F5B","\u1F5D","\u1F5F",["\u1F68","\u1F6F"],["\u1FB8","\u1FBB"],["\u1FC8","\u1FCB"],["\u1FD8","\u1FDB"],["\u1FE8","\u1FEC"],["\u1FF8","\u1FFB"],"\u2102","\u2107",["\u210B","\u210D"],["\u2110","\u2112"],"\u2115",["\u2119","\u211D"],"\u2124","\u2126","\u2128",["\u212A","\u212D"],["\u2130","\u2133"],["\u213E","\u213F"],"\u2145","\u2183",["\u2C00","\u2C2E"],"\u2C60",["\u2C62","\u2C64"],"\u2C67","\u2C69","\u2C6B",["\u2C6D","\u2C70"],"\u2C72","\u2C75",["\u2C7E","\u2C80"],"\u2C82","\u2C84","\u2C86","\u2C88","\u2C8A","\u2C8C","\u2C8E","\u2C90","\u2C92","\u2C94","\u2C96","\u2C98","\u2C9A","\u2C9C","\u2C9E","\u2CA0","\u2CA2","\u2CA4","\u2CA6","\u2CA8","\u2CAA","\u2CAC","\u2CAE","\u2CB0","\u2CB2","\u2CB4","\u2CB6","\u2CB8","\u2CBA","\u2CBC","\u2CBE","\u2CC0","\u2CC2","\u2CC4","\u2CC6","\u2CC8","\u2CCA","\u2CCC","\u2CCE","\u2CD0","\u2CD2","\u2CD4","\u2CD6","\u2CD8","\u2CDA","\u2CDC","\u2CDE","\u2CE0","\u2CE2","\u2CEB","\u2CED","\u2CF2","\uA640","\uA642","\uA644","\uA646","\uA648","\uA64A","\uA64C","\uA64E","\uA650","\uA652","\uA654","\uA656","\uA658","\uA65A","\uA65C","\uA65E","\uA660","\uA662","\uA664","\uA666","\uA668","\uA66A","\uA66C","\uA680","\uA682","\uA684","\uA686","\uA688","\uA68A","\uA68C","\uA68E","\uA690","\uA692","\uA694","\uA696","\uA698","\uA69A","\uA722","\uA724","\uA726","\uA728","\uA72A","\uA72C","\uA72E","\uA732","\uA734","\uA736","\uA738","\uA73A","\uA73C","\uA73E","\uA740","\uA742","\uA744","\uA746","\uA748","\uA74A","\uA74C","\uA74E","\uA750","\uA752","\uA754","\uA756","\uA758","\uA75A","\uA75C","\uA75E","\uA760","\uA762","\uA764","\uA766","\uA768","\uA76A","\uA76C","\uA76E","\uA779","\uA77B",["\uA77D","\uA77E"],"\uA780","\uA782","\uA784","\uA786","\uA78B","\uA78D","\uA790","\uA792","\uA796","\uA798","\uA79A","\uA79C","\uA79E","\uA7A0","\uA7A2","\uA7A4","\uA7A6","\uA7A8",["\uA7AA","\uA7AD"],["\uA7B0","\uA7B4"],"\uA7B6",["\uFF21","\uFF3A"]],!1,!1),ve=hr(["\u0903","\u093B",["\u093E","\u0940"],["\u0949","\u094C"],["\u094E","\u094F"],["\u0982","\u0983"],["\u09BE","\u09C0"],["\u09C7","\u09C8"],["\u09CB","\u09CC"],"\u09D7","\u0A03",["\u0A3E","\u0A40"],"\u0A83",["\u0ABE","\u0AC0"],"\u0AC9",["\u0ACB","\u0ACC"],["\u0B02","\u0B03"],"\u0B3E","\u0B40",["\u0B47","\u0B48"],["\u0B4B","\u0B4C"],"\u0B57",["\u0BBE","\u0BBF"],["\u0BC1","\u0BC2"],["\u0BC6","\u0BC8"],["\u0BCA","\u0BCC"],"\u0BD7",["\u0C01","\u0C03"],["\u0C41","\u0C44"],["\u0C82","\u0C83"],"\u0CBE",["\u0CC0","\u0CC4"],["\u0CC7","\u0CC8"],["\u0CCA","\u0CCB"],["\u0CD5","\u0CD6"],["\u0D02","\u0D03"],["\u0D3E","\u0D40"],["\u0D46","\u0D48"],["\u0D4A","\u0D4C"],"\u0D57",["\u0D82","\u0D83"],["\u0DCF","\u0DD1"],["\u0DD8","\u0DDF"],["\u0DF2","\u0DF3"],["\u0F3E","\u0F3F"],"\u0F7F",["\u102B","\u102C"],"\u1031","\u1038",["\u103B","\u103C"],["\u1056","\u1057"],["\u1062","\u1064"],["\u1067","\u106D"],["\u1083","\u1084"],["\u1087","\u108C"],"\u108F",["\u109A","\u109C"],"\u17B6",["\u17BE","\u17C5"],["\u17C7","\u17C8"],["\u1923","\u1926"],["\u1929","\u192B"],["\u1930","\u1931"],["\u1933","\u1938"],["\u1A19","\u1A1A"],"\u1A55","\u1A57","\u1A61",["\u1A63","\u1A64"],["\u1A6D","\u1A72"],"\u1B04","\u1B35","\u1B3B",["\u1B3D","\u1B41"],["\u1B43","\u1B44"],"\u1B82","\u1BA1",["\u1BA6","\u1BA7"],"\u1BAA","\u1BE7",["\u1BEA","\u1BEC"],"\u1BEE",["\u1BF2","\u1BF3"],["\u1C24","\u1C2B"],["\u1C34","\u1C35"],"\u1CE1",["\u1CF2","\u1CF3"],["\u302E","\u302F"],["\uA823","\uA824"],"\uA827",["\uA880","\uA881"],["\uA8B4","\uA8C3"],["\uA952","\uA953"],"\uA983",["\uA9B4","\uA9B5"],["\uA9BA","\uA9BB"],["\uA9BD","\uA9C0"],["\uAA2F","\uAA30"],["\uAA33","\uAA34"],"\uAA4D","\uAA7B","\uAA7D","\uAAEB",["\uAAEE","\uAAEF"],"\uAAF5",["\uABE3","\uABE4"],["\uABE6","\uABE7"],["\uABE9","\uABEA"],"\uABEC"],!1,!1),Fe=hr([["\u0300","\u036F"],["\u0483","\u0487"],["\u0591","\u05BD"],"\u05BF",["\u05C1","\u05C2"],["\u05C4","\u05C5"],"\u05C7",["\u0610","\u061A"],["\u064B","\u065F"],"\u0670",["\u06D6","\u06DC"],["\u06DF","\u06E4"],["\u06E7","\u06E8"],["\u06EA","\u06ED"],"\u0711",["\u0730","\u074A"],["\u07A6","\u07B0"],["\u07EB","\u07F3"],["\u0816","\u0819"],["\u081B","\u0823"],["\u0825","\u0827"],["\u0829","\u082D"],["\u0859","\u085B"],["\u08E3","\u0902"],"\u093A","\u093C",["\u0941","\u0948"],"\u094D",["\u0951","\u0957"],["\u0962","\u0963"],"\u0981","\u09BC",["\u09C1","\u09C4"],"\u09CD",["\u09E2","\u09E3"],["\u0A01","\u0A02"],"\u0A3C",["\u0A41","\u0A42"],["\u0A47","\u0A48"],["\u0A4B","\u0A4D"],"\u0A51",["\u0A70","\u0A71"],"\u0A75",["\u0A81","\u0A82"],"\u0ABC",["\u0AC1","\u0AC5"],["\u0AC7","\u0AC8"],"\u0ACD",["\u0AE2","\u0AE3"],"\u0B01","\u0B3C","\u0B3F",["\u0B41","\u0B44"],"\u0B4D","\u0B56",["\u0B62","\u0B63"],"\u0B82","\u0BC0","\u0BCD","\u0C00",["\u0C3E","\u0C40"],["\u0C46","\u0C48"],["\u0C4A","\u0C4D"],["\u0C55","\u0C56"],["\u0C62","\u0C63"],"\u0C81","\u0CBC","\u0CBF","\u0CC6",["\u0CCC","\u0CCD"],["\u0CE2","\u0CE3"],"\u0D01",["\u0D41","\u0D44"],"\u0D4D",["\u0D62","\u0D63"],"\u0DCA",["\u0DD2","\u0DD4"],"\u0DD6","\u0E31",["\u0E34","\u0E3A"],["\u0E47","\u0E4E"],"\u0EB1",["\u0EB4","\u0EB9"],["\u0EBB","\u0EBC"],["\u0EC8","\u0ECD"],["\u0F18","\u0F19"],"\u0F35","\u0F37","\u0F39",["\u0F71","\u0F7E"],["\u0F80","\u0F84"],["\u0F86","\u0F87"],["\u0F8D","\u0F97"],["\u0F99","\u0FBC"],"\u0FC6",["\u102D","\u1030"],["\u1032","\u1037"],["\u1039","\u103A"],["\u103D","\u103E"],["\u1058","\u1059"],["\u105E","\u1060"],["\u1071","\u1074"],"\u1082",["\u1085","\u1086"],"\u108D","\u109D",["\u135D","\u135F"],["\u1712","\u1714"],["\u1732","\u1734"],["\u1752","\u1753"],["\u1772","\u1773"],["\u17B4","\u17B5"],["\u17B7","\u17BD"],"\u17C6",["\u17C9","\u17D3"],"\u17DD",["\u180B","\u180D"],"\u18A9",["\u1920","\u1922"],["\u1927","\u1928"],"\u1932",["\u1939","\u193B"],["\u1A17","\u1A18"],"\u1A1B","\u1A56",["\u1A58","\u1A5E"],"\u1A60","\u1A62",["\u1A65","\u1A6C"],["\u1A73","\u1A7C"],"\u1A7F",["\u1AB0","\u1ABD"],["\u1B00","\u1B03"],"\u1B34",["\u1B36","\u1B3A"],"\u1B3C","\u1B42",["\u1B6B","\u1B73"],["\u1B80","\u1B81"],["\u1BA2","\u1BA5"],["\u1BA8","\u1BA9"],["\u1BAB","\u1BAD"],"\u1BE6",["\u1BE8","\u1BE9"],"\u1BED",["\u1BEF","\u1BF1"],["\u1C2C","\u1C33"],["\u1C36","\u1C37"],["\u1CD0","\u1CD2"],["\u1CD4","\u1CE0"],["\u1CE2","\u1CE8"],"\u1CED","\u1CF4",["\u1CF8","\u1CF9"],["\u1DC0","\u1DF5"],["\u1DFC","\u1DFF"],["\u20D0","\u20DC"],"\u20E1",["\u20E5","\u20F0"],["\u2CEF","\u2CF1"],"\u2D7F",["\u2DE0","\u2DFF"],["\u302A","\u302D"],["\u3099","\u309A"],"\uA66F",["\uA674","\uA67D"],["\uA69E","\uA69F"],["\uA6F0","\uA6F1"],"\uA802","\uA806","\uA80B",["\uA825","\uA826"],"\uA8C4",["\uA8E0","\uA8F1"],["\uA926","\uA92D"],["\uA947","\uA951"],["\uA980","\uA982"],"\uA9B3",["\uA9B6","\uA9B9"],"\uA9BC","\uA9E5",["\uAA29","\uAA2E"],["\uAA31","\uAA32"],["\uAA35","\uAA36"],"\uAA43","\uAA4C","\uAA7C","\uAAB0",["\uAAB2","\uAAB4"],["\uAAB7","\uAAB8"],["\uAABE","\uAABF"],"\uAAC1",["\uAAEC","\uAAED"],"\uAAF6","\uABE5","\uABE8","\uABED","\uFB1E",["\uFE00","\uFE0F"],["\uFE20","\uFE2F"]],!1,!1),Re=hr([["0","9"],["\u0660","\u0669"],["\u06F0","\u06F9"],["\u07C0","\u07C9"],["\u0966","\u096F"],["\u09E6","\u09EF"],["\u0A66","\u0A6F"],["\u0AE6","\u0AEF"],["\u0B66","\u0B6F"],["\u0BE6","\u0BEF"],["\u0C66","\u0C6F"],["\u0CE6","\u0CEF"],["\u0D66","\u0D6F"],["\u0DE6","\u0DEF"],["\u0E50","\u0E59"],["\u0ED0","\u0ED9"],["\u0F20","\u0F29"],["\u1040","\u1049"],["\u1090","\u1099"],["\u17E0","\u17E9"],["\u1810","\u1819"],["\u1946","\u194F"],["\u19D0","\u19D9"],["\u1A80","\u1A89"],["\u1A90","\u1A99"],["\u1B50","\u1B59"],["\u1BB0","\u1BB9"],["\u1C40","\u1C49"],["\u1C50","\u1C59"],["\uA620","\uA629"],["\uA8D0","\uA8D9"],["\uA900","\uA909"],["\uA9D0","\uA9D9"],["\uA9F0","\uA9F9"],["\uAA50","\uAA59"],["\uABF0","\uABF9"],["\uFF10","\uFF19"]],!1,!1),Pt=hr([["\u16EE","\u16F0"],["\u2160","\u2182"],["\u2185","\u2188"],"\u3007",["\u3021","\u3029"],["\u3038","\u303A"],["\uA6E6","\uA6EF"]],!1,!1),Qt=hr(["_",["\u203F","\u2040"],"\u2054",["\uFE33","\uFE34"],["\uFE4D","\uFE4F"],"\uFF3F"],!1,!1),Or=hr([" ","\xA0","\u1680",["\u2000","\u200A"],"\u202F","\u205F","\u3000"],!1,!1),xr=Me(";",!1),Tn=function(b,N,J){return{type:"grammar",topLevelInitializer:b,initializer:N,rules:J,location:zt()}},Ws=function(b){return{type:"top_level_initializer",code:b[0],codeLocation:b[1],location:zt()}},nn=function(b){return{type:"initializer",code:b[0],codeLocation:b[1],location:zt()}},Nr=function(b,N,J){return{type:"rule",name:b[0],nameLocation:b[1],expression:N!==null?{type:"named",name:N,expression:J,location:zt()}:J,location:zt()}},Xs=function(b,N){return N.length>0?{type:"choice",alternatives:[b].concat(N),location:zt()}:b},Qn=function(b,N){return N!==null?{type:"action",expression:b,code:N[0],codeLocation:N[1],location:zt()}:b},Na=function(b,N){return N.length>0||b.type==="labeled"&&b.pick?{type:"sequence",elements:[b].concat(N),location:zt()}:b},xh=function(b,N,J){return J.type.startsWith("semantic_")&&pc('"@" cannot be used on a semantic predicate',b),{type:"labeled",label:N!==null?N[0]:null,labelLocation:N!==null?N[1]:b,pick:!0,expression:J,location:zt()}},Nh=function(b,N){return{type:"labeled",label:b[0],labelLocation:b[1],expression:N,location:zt()}},Lt=function(){return zt()},xt=function(b){return Yo.indexOf(b[0])>=0&&pc(`Label can't be a reserved word "${b[0]}"`,b[1]),b},kh=function(b,N){return{type:zB[b],expression:N,location:zt()}},Lh=function(b,N){return{type:YB[N],expression:b,location:zt()}},Uh=function(b){return b.type==="labeled"||b.type==="sequence"?{type:"group",expression:b,location:zt()}:b},Hh=function(b){return{type:"rule_ref",name:b[0],location:zt()}},Mh=function(b,N){return{type:WB[b],code:N[0],codeLocation:N[1],location:zt()}},jh=function(b,N){return[b+N.join(""),zt()]},dl=function(b,N){return{type:"literal",value:b,ignoreCase:N!==null,location:zt()}},qh=function(b){return b.join("")},fr=function(b){return b.join("")},lc=function(b,N,J){return{type:"class",parts:N.filter(K=>K!==""),inverted:b!==null,ignoreCase:J!==null,location:zt()}},is=function(b,N){return b.charCodeAt(0)>N.charCodeAt(0)&&pc("Invalid character range: "+hc()+"."),[b,N]},gl=function(){return""},fc=function(){return"\0"},mn=function(){return"\b"},ml=function(){return"\f"},vl=function(){return`
`},El=function(){return"\r"},wl=function(){return" "},Al=function(){return"\v"},yl=function(b){return String.fromCharCode(parseInt(b,16))},sn=function(b){return String.fromCharCode(parseInt(b,16))},Kh=function(){return{type:"any",location:zt()}},vn=function(b){return[b,zt()]},R=0,Xe=0,On=[{line:1,column:1}],an=0,ka=[],te=0,xn;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 hc(){return e.substring(Xe,R)}function y1(){return Xe}function Sl(){return{source:n,start:Xe,end:R}}function zt(){return ss(Xe,R)}function S1(b,N){throw N=N!==void 0?N:ss(Xe,R),Cl([ei(b)],e.substring(Xe,R),N)}function pc(b,N){throw N=N!==void 0?N:ss(Xe,R),bl(b,N)}function Me(b,N){return{type:"literal",text:b,ignoreCase:N}}function hr(b,N,J){return{type:"class",parts:b,inverted:N,ignoreCase:J}}function Js(){return{type:"any"}}function Vh(){return{type:"end"}}function ei(b){return{type:"other",description:b}}function dc(b){var N=On[b],J;if(N)return N;for(J=b-1;!On[J];)J--;for(N=On[J],N={line:N.line,column:N.column};J<b;)e.charCodeAt(J)===10?(N.line++,N.column=1):N.column++,J++;return On[b]=N,N}function ss(b,N){var J=dc(b),K=dc(N);return{source:n,start:{offset:b,line:J.line,column:J.column},end:{offset:N,line:K.line,column:K.column}}}function pe(b){R<an||(R>an&&(an=R,ka=[]),ka.push(b))}function bl(b,N){return new ya(b,null,null,N)}function Cl(b,N,J){return new ya(ya.buildMessage(b,N),b,N,J)}function No(){var b,N,J,K,se,ce,Ot,er;if(b=R,N=_t(),J=R,K=gc(),K!==r?(se=_t(),J=K):(R=J,J=r),J===r&&(J=null),K=R,se=Gh(),se!==r?(ce=_t(),K=se):(R=K,K=r),K===r&&(K=null),se=[],ce=R,Ot=mc(),Ot!==r?(er=_t(),ce=Ot):(R=ce,ce=r),ce!==r)for(;ce!==r;)se.push(ce),ce=R,Ot=mc(),Ot!==r?(er=_t(),ce=Ot):(R=ce,ce=r);else se=r;return se!==r?(Xe=b,b=Tn(J,K,se)):(R=b,b=r),b}function gc(){var b,N,J,K,se;return b=R,e.charCodeAt(R)===123?(N=s,R++):(N=r,te===0&&pe(Fi)),N!==r?(J=mt(),J!==r?(e.charCodeAt(R)===125?(K=u,R++):(K=r,te===0&&pe(ns)),K!==r?(se=cs(),se!==r?(Xe=b,b=Ws(J)):(R=b,b=r)):(R=b,b=r)):(R=b,b=r)):(R=b,b=r),b}function Gh(){var b,N,J;return b=R,N=mt(),N!==r?(J=cs(),J!==r?(Xe=b,b=nn(N)):(R=b,b=r)):(R=b,b=r),b}function mc(){var b,N,J,K,se,ce,Ot,er;return b=R,N=Uo(),N!==r?(J=_t(),K=R,se=ti(),se!==r?(ce=_t(),K=se):(R=K,K=r),K===r&&(K=null),e.charCodeAt(R)===61?(se=l,R++):(se=r,te===0&&pe(Ao)),se!==r?(ce=_t(),Ot=qr(),Ot!==r?(er=cs(),er!==r?(Xe=b,b=Nr(N,K,Ot)):(R=b,b=r)):(R=b,b=r)):(R=b,b=r)):(R=b,b=r),b}function qr(){var b,N,J,K,se,ce,Ot,er;if(b=R,N=La(),N!==r){for(J=[],K=R,se=_t(),e.charCodeAt(R)===47?(ce=f,R++):(ce=r,te===0&&pe(yo)),ce!==r?(Ot=_t(),er=La(),er!==r?K=er:(R=K,K=r)):(R=K,K=r);K!==r;)J.push(K),K=R,se=_t(),e.charCodeAt(R)===47?(ce=f,R++):(ce=r,te===0&&pe(yo)),ce!==r?(Ot=_t(),er=La(),er!==r?K=er:(R=K,K=r)):(R=K,K=r);Xe=b,b=Xs(N,J)}else R=b,b=r;return b}function La(){var b,N,J,K,se;return b=R,N=Ua(),N!==r?(J=R,K=_t(),se=mt(),se!==r?J=se:(R=J,J=r),J===r&&(J=null),Xe=b,b=Qn(N,J)):(R=b,b=r),b}function Ua(){var b,N,J,K,se,ce;if(b=R,N=ko(),N!==r){for(J=[],K=R,se=_t(),ce=ko(),ce!==r?K=ce:(R=K,K=r);K!==r;)J.push(K),K=R,se=_t(),ce=ko(),ce!==r?K=ce:(R=K,K=r);Xe=b,b=Na(N,J)}else R=b,b=r;return b}function ko(){var b,N,J,K;return b=R,N=_l(),N!==r?(J=Fl(),J===r&&(J=null),K=vc(),K!==r?(Xe=b,b=xh(N,J,K)):(R=b,b=r)):(R=b,b=r),b===r&&(b=R,N=Fl(),N!==r?(J=_t(),K=vc(),K!==r?(Xe=b,b=Nh(N,K)):(R=b,b=r)):(R=b,b=r),b===r&&(b=vc())),b}function _l(){var b,N;return b=R,e.charCodeAt(R)===64?(N=d,R++):(N=r,te===0&&pe(So)),N!==r&&(Xe=b,N=Lt()),b=N,b}function Fl(){var b,N,J,K;return b=R,N=Uo(),N!==r?(J=_t(),e.charCodeAt(R)===58?(K=E,R++):(K=r,te===0&&pe(bo)),K!==r?(Xe=b,b=xt(N)):(R=b,b=r)):(R=b,b=r),b}function vc(){var b,N,J,K;return b=R,N=zh(),N!==r?(J=_t(),K=Il(),K!==r?(Xe=b,b=kh(N,K)):(R=b,b=r)):(R=b,b=r),b===r&&(b=Il()),b}function zh(){var b;return e.charCodeAt(R)===36?(b=p,R++):(b=r,te===0&&pe(Co)),b===r&&(e.charCodeAt(R)===38?(b=h,R++):(b=r,te===0&&pe(_o)),b===r&&(e.charCodeAt(R)===33?(b=A,R++):(b=r,te===0&&pe(Fo)))),b}function Il(){var b,N,J,K;return b=R,N=as(),N!==r?(J=_t(),K=Yh(),K!==r?(Xe=b,b=Lh(N,K)):(R=b,b=r)):(R=b,b=r),b===r&&(b=as()),b}function Yh(){var b;return e.charCodeAt(R)===63?(b=m,R++):(b=r,te===0&&pe(ju)),b===r&&(e.charCodeAt(R)===42?(b=S,R++):(b=r,te===0&&pe(Io)),b===r&&(e.charCodeAt(R)===43?(b=w,R++):(b=r,te===0&&pe(qu)))),b}function as(){var b,N,J,K,se,ce;return b=ep(),b===r&&(b=oe(),b===r&&(b=jo(),b===r&&(b=Wh(),b===r&&(b=Xh(),b===r&&(b=R,e.charCodeAt(R)===40?(N=y,R++):(N=r,te===0&&pe(Ku)),N!==r?(J=_t(),K=qr(),K!==r?(se=_t(),e.charCodeAt(R)===41?(ce=_,R++):(ce=r,te===0&&pe(Vu)),ce!==r?(Xe=b,b=Uh(K)):(R=b,b=r)):(R=b,b=r)):(R=b,b=r)))))),b}function Wh(){var b,N,J,K,se,ce,Ot,er;return b=R,N=Uo(),N!==r?(J=R,te++,K=R,se=_t(),ce=R,Ot=ti(),Ot!==r?(er=_t(),Ot=[Ot,er],ce=Ot):(R=ce,ce=r),ce===r&&(ce=null),e.charCodeAt(R)===61?(Ot=l,R++):(Ot=r,te===0&&pe(Ao)),Ot!==r?(se=[se,ce,Ot],K=se):(R=K,K=r),te--,K===r?J=void 0:(R=J,J=r),J!==r?(Xe=b,b=Hh(N)):(R=b,b=r)):(R=b,b=r),b}function Xh(){var b,N,J,K;return b=R,N=Ec(),N!==r?(J=_t(),K=mt(),K!==r?(Xe=b,b=Mh(N,K)):(R=b,b=r)):(R=b,b=r),b}function Ec(){var b;return e.charCodeAt(R)===38?(b=h,R++):(b=r,te===0&&pe(_o)),b===r&&(e.charCodeAt(R)===33?(b=A,R++):(b=r,te===0&&pe(Fo))),b}function kr(){var b;return e.length>R?(b=e.charAt(R),R++):(b=r,te===0&&pe(Gs)),b}function Nn(){var b,N;return te++,e.charCodeAt(R)===9?(b=B,R++):(b=r,te===0&&pe($a)),b===r&&(e.charCodeAt(R)===11?(b=D,R++):(b=r,te===0&&pe(zu)),b===r&&(e.charCodeAt(R)===12?(b=j,R++):(b=r,te===0&&pe(Yu)),b===r&&(e.charCodeAt(R)===32?(b=q,R++):(b=r,te===0&&pe(Wu)),b===r&&(e.charCodeAt(R)===160?(b=F,R++):(b=r,te===0&&pe(Xu)),b===r&&(e.charCodeAt(R)===65279?(b=P,R++):(b=r,te===0&&pe(Ju)),b===r&&(b=Ol())))))),te--,b===r&&(N=r,te===0&&pe(Gu)),b}function kn(){var b;return cr.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Zu)),b}function Lo(){var b,N;return te++,e.charCodeAt(R)===10?(b=L,R++):(b=r,te===0&&pe(ec)),b===r&&(e.substr(R,2)===M?(b=M,R+=2):(b=r,te===0&&pe(Ii)),b===r&&(e.charCodeAt(R)===13?(b=V,R++):(b=r,te===0&&pe($o)),b===r&&(e.charCodeAt(R)===8232?(b=W,R++):(b=r,te===0&&pe(tc)),b===r&&(e.charCodeAt(R)===8233?(b=G,R++):(b=r,te===0&&pe(rc)))))),te--,b===r&&(N=r,te===0&&pe(Qu)),b}function $l(){var b,N;return te++,b=Jh(),b===r&&(b=En()),te--,b===r&&(N=r,te===0&&pe(nc)),b}function Jh(){var b,N,J,K,se,ce;if(b=R,e.substr(R,2)===z?(N=z,R+=2):(N=r,te===0&&pe(Do)),N!==r){for(J=[],K=R,se=R,te++,e.substr(R,2)===X?(ce=X,R+=2):(ce=r,te===0&&pe($i)),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);K!==r;)J.push(K),K=R,se=R,te++,e.substr(R,2)===X?(ce=X,R+=2):(ce=r,te===0&&pe($i)),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);e.substr(R,2)===X?(K=X,R+=2):(K=r,te===0&&pe($i)),K!==r?(N=[N,J,K],b=N):(R=b,b=r)}else R=b,b=r;return b}function os(){var b,N,J,K,se,ce;if(b=R,e.substr(R,2)===z?(N=z,R+=2):(N=r,te===0&&pe(Do)),N!==r){for(J=[],K=R,se=R,te++,e.substr(R,2)===X?(ce=X,R+=2):(ce=r,te===0&&pe($i)),ce===r&&(ce=kn()),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);K!==r;)J.push(K),K=R,se=R,te++,e.substr(R,2)===X?(ce=X,R+=2):(ce=r,te===0&&pe($i)),ce===r&&(ce=kn()),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);e.substr(R,2)===X?(K=X,R+=2):(K=r,te===0&&pe($i)),K!==r?(N=[N,J,K],b=N):(R=b,b=r)}else R=b,b=r;return b}function En(){var b,N,J,K,se,ce;if(b=R,e.substr(R,2)===ie?(N=ie,R+=2):(N=r,te===0&&pe(gn)),N!==r){for(J=[],K=R,se=R,te++,ce=kn(),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);K!==r;)J.push(K),K=R,se=R,te++,ce=kn(),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);N=[N,J],b=N}else R=b,b=r;return b}function Uo(){var b,N,J,K;if(te++,b=R,N=Dl(),N!==r){for(J=[],K=Bl();K!==r;)J.push(K),K=Bl();Xe=b,b=jh(N,J)}else R=b,b=r;return te--,b===r&&(N=r,te===0&&pe(ic)),b}function Dl(){var b,N,J;return b=Zh(),b===r&&(e.charCodeAt(R)===36?(b=p,R++):(b=r,te===0&&pe(Co)),b===r&&(e.charCodeAt(R)===95?(b=Se,R++):(b=r,te===0&&pe(zs)),b===r&&(b=R,e.charCodeAt(R)===92?(N=we,R++):(N=r,te===0&&pe(Pn)),N!==r?(J=Rl(),J!==r?b=J:(R=b,b=r)):(R=b,b=r)))),b}function Bl(){var b;return b=Dl(),b===r&&(b=Qh(),b===r&&(b=Pl(),b===r&&(b=Tl(),b===r&&(e.charCodeAt(R)===8204?(b=Ie,R++):(b=r,te===0&&pe(sc)),b===r&&(e.charCodeAt(R)===8205?(b=Ve,R++):(b=r,te===0&&pe(ac))))))),b}function Zh(){var b;return b=Vo(),b===r&&(b=Ko(),b===r&&(b=sp(),b===r&&(b=np(),b===r&&(b=ip(),b===r&&(b=zo()))))),b}function Qh(){var b;return b=Go(),b===r&&(b=Ri()),b}function ep(){var b,N,J;return te++,b=R,N=ti(),N!==r?(e.charCodeAt(R)===105?(J=ue,R++):(J=r,te===0&&pe(Da)),J===r&&(J=null),Xe=b,b=dl(N,J)):(R=b,b=r),te--,b===r&&(N=r,te===0&&pe(Bo)),b}function ti(){var b,N,J,K;if(te++,b=R,e.charCodeAt(R)===34?(N=_e,R++):(N=r,te===0&&pe(Ys)),N!==r){for(J=[],K=re();K!==r;)J.push(K),K=re();e.charCodeAt(R)===34?(K=_e,R++):(K=r,te===0&&pe(Ys)),K!==r?(Xe=b,b=qh(J)):(R=b,b=r)}else R=b,b=r;if(b===r)if(b=R,e.charCodeAt(R)===39?(N=He,R++):(N=r,te===0&&pe(Zt)),N!==r){for(J=[],K=le();K!==r;)J.push(K),K=le();e.charCodeAt(R)===39?(K=He,R++):(K=r,te===0&&pe(Zt)),K!==r?(Xe=b,b=fr(J)):(R=b,b=r)}else R=b,b=r;return te--,b===r&&(N=r,te===0&&pe(Ro)),b}function re(){var b,N,J,K;return b=R,N=R,J=R,te++,e.charCodeAt(R)===34?(K=_e,R++):(K=r,te===0&&pe(Ys)),K===r&&(e.charCodeAt(R)===92?(K=we,R++):(K=r,te===0&&pe(Pn)),K===r&&(K=kn())),te--,K===r?J=void 0:(R=J,J=r),J!==r?(K=kr(),K!==r?(J=[J,K],N=J):(R=N,N=r)):(R=N,N=r),N!==r?b=e.substring(b,R):b=N,b===r&&(b=R,e.charCodeAt(R)===92?(N=we,R++):(N=r,te===0&&pe(Pn)),N!==r?(J=Yt(),J!==r?b=J:(R=b,b=r)):(R=b,b=r),b===r&&(b=pt())),b}function le(){var b,N,J,K;return b=R,N=R,J=R,te++,e.charCodeAt(R)===39?(K=He,R++):(K=r,te===0&&pe(Zt)),K===r&&(e.charCodeAt(R)===92?(K=we,R++):(K=r,te===0&&pe(Pn)),K===r&&(K=kn())),te--,K===r?J=void 0:(R=J,J=r),J!==r?(K=kr(),K!==r?(J=[J,K],N=J):(R=N,N=r)):(R=N,N=r),N!==r?b=e.substring(b,R):b=N,b===r&&(b=R,e.charCodeAt(R)===92?(N=we,R++):(N=r,te===0&&pe(Pn)),N!==r?(J=Yt(),J!==r?b=J:(R=b,b=r)):(R=b,b=r),b===r&&(b=pt())),b}function oe(){var b,N,J,K,se,ce;if(te++,b=R,e.charCodeAt(R)===91?(N=Sr,R++):(N=r,te===0&&pe(uc)),N!==r){for(e.charCodeAt(R)===94?(J=Ht,R++):(J=r,te===0&&pe(Po)),J===r&&(J=null),K=[],se=Te(),se===r&&(se=Ye());se!==r;)K.push(se),se=Te(),se===r&&(se=Ye());e.charCodeAt(R)===93?(se=wt,R++):(se=r,te===0&&pe(Di)),se!==r?(e.charCodeAt(R)===105?(ce=ue,R++):(ce=r,te===0&&pe(Da)),ce===r&&(ce=null),Xe=b,b=lc(J,K,ce)):(R=b,b=r)}else R=b,b=r;return te--,b===r&&(N=r,te===0&&pe(oc)),b}function Te(){var b,N,J,K;return b=R,N=Ye(),N!==r?(e.charCodeAt(R)===45?(J=ir,R++):(J=r,te===0&&pe(Cr)),J!==r?(K=Ye(),K!==r?(Xe=b,b=is(N,K)):(R=b,b=r)):(R=b,b=r)):(R=b,b=r),b}function Ye(){var b,N,J,K;return b=R,N=R,J=R,te++,e.charCodeAt(R)===93?(K=wt,R++):(K=r,te===0&&pe(Di)),K===r&&(e.charCodeAt(R)===92?(K=we,R++):(K=r,te===0&&pe(Pn)),K===r&&(K=kn())),te--,K===r?J=void 0:(R=J,J=r),J!==r?(K=kr(),K!==r?(J=[J,K],N=J):(R=N,N=r)):(R=N,N=r),N!==r?b=e.substring(b,R):b=N,b===r&&(b=R,e.charCodeAt(R)===92?(N=we,R++):(N=r,te===0&&pe(Pn)),N!==r?(J=Yt(),J!==r?b=J:(R=b,b=r)):(R=b,b=r),b===r&&(b=pt())),b}function pt(){var b,N,J;return b=R,e.charCodeAt(R)===92?(N=we,R++):(N=r,te===0&&pe(Pn)),N!==r?(J=Lo(),J!==r?(Xe=b,b=gl()):(R=b,b=r)):(R=b,b=r),b}function Yt(){var b,N,J,K;return b=Tt(),b===r&&(b=R,e.charCodeAt(R)===48?(N=Gt,R++):(N=r,te===0&&pe(Kt)),N!==r?(J=R,te++,K=us(),te--,K===r?J=void 0:(R=J,J=r),J!==r?(Xe=b,b=fc()):(R=b,b=r)):(R=b,b=r),b===r&&(b=Mo(),b===r&&(b=Rl()))),b}function Tt(){var b;return b=Ho(),b===r&&(b=tp()),b}function Ho(){var b,N;return e.charCodeAt(R)===39?(b=He,R++):(b=r,te===0&&pe(Zt)),b===r&&(e.charCodeAt(R)===34?(b=_e,R++):(b=r,te===0&&pe(Ys)),b===r&&(e.charCodeAt(R)===92?(b=we,R++):(b=r,te===0&&pe(Pn)),b===r&&(b=R,e.charCodeAt(R)===98?(N=at,R++):(N=r,te===0&&pe(cc)),N!==r&&(Xe=b,N=mn()),b=N,b===r&&(b=R,e.charCodeAt(R)===102?(N=kt,R++):(N=r,te===0&&pe(Ba)),N!==r&&(Xe=b,N=ml()),b=N,b===r&&(b=R,e.charCodeAt(R)===110?(N=it,R++):(N=r,te===0&&pe(_r)),N!==r&&(Xe=b,N=vl()),b=N,b===r&&(b=R,e.charCodeAt(R)===114?(N=bt,R++):(N=r,te===0&&pe(Ra)),N!==r&&(Xe=b,N=El()),b=N,b===r&&(b=R,e.charCodeAt(R)===116?(N=sr,R++):(N=r,te===0&&pe(To)),N!==r&&(Xe=b,N=wl()),b=N,b===r&&(b=R,e.charCodeAt(R)===118?(N=et,R++):(N=r,te===0&&pe(Oo)),N!==r&&(Xe=b,N=Al()),b=N)))))))),b}function tp(){var b,N,J,K;return b=R,N=R,J=R,te++,K=wn(),K===r&&(K=kn()),te--,K===r?J=void 0:(R=J,J=r),J!==r?(K=kr(),K!==r?(J=[J,K],N=J):(R=N,N=r)):(R=N,N=r),N!==r?b=e.substring(b,R):b=N,b}function wn(){var b;return b=Ho(),b===r&&(b=us(),b===r&&(e.charCodeAt(R)===120?(b=Jt,R++):(b=r,te===0&&pe(Pa)),b===r&&(e.charCodeAt(R)===117?(b=Zn,R++):(b=r,te===0&&pe(Bi))))),b}function Mo(){var b,N,J,K,se,ce;return b=R,e.charCodeAt(R)===120?(N=Jt,R++):(N=r,te===0&&pe(Pa)),N!==r?(J=R,K=R,se=gi(),se!==r?(ce=gi(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r),K!==r?J=e.substring(J,R):J=K,J!==r?(Xe=b,b=yl(J)):(R=b,b=r)):(R=b,b=r),b}function Rl(){var b,N,J,K,se,ce,Ot,er;return b=R,e.charCodeAt(R)===117?(N=Zn,R++):(N=r,te===0&&pe(Bi)),N!==r?(J=R,K=R,se=gi(),se!==r?(ce=gi(),ce!==r?(Ot=gi(),Ot!==r?(er=gi(),er!==r?(se=[se,ce,Ot,er],K=se):(R=K,K=r)):(R=K,K=r)):(R=K,K=r)):(R=K,K=r),K!==r?J=e.substring(J,R):J=K,J!==r?(Xe=b,b=sn(J)):(R=b,b=r)):(R=b,b=r),b}function us(){var b;return Mr.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Ta)),b}function gi(){var b;return Sa.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(xo)),b}function jo(){var b,N;return b=R,e.charCodeAt(R)===46?(N=br,R++):(N=r,te===0&&pe(Oa)),N!==r&&(Xe=b,N=Kh()),b=N,b}function mt(){var b,N,J,K;return te++,b=R,e.charCodeAt(R)===123?(N=s,R++):(N=r,te===0&&pe(Fi)),N!==r?(J=rp(),e.charCodeAt(R)===125?(K=u,R++):(K=r,te===0&&pe(ns)),K!==r?b=J:(R=b,b=r)):(R=b,b=r),te--,b===r&&(N=r,te===0&&pe(xa)),b}function rp(){var b,N;return b=R,N=qo(),Xe=b,N=vn(N),b=N,b}function qo(){var b,N,J,K,se,ce;if(b=R,N=[],J=[],K=R,se=R,te++,tn.test(e.charAt(R))?(ce=e.charAt(R),R++):(ce=r,te===0&&pe(rn)),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r),K!==r)for(;K!==r;)J.push(K),K=R,se=R,te++,tn.test(e.charAt(R))?(ce=e.charAt(R),R++):(ce=r,te===0&&pe(rn)),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);else J=r;for(J===r&&(J=R,e.charCodeAt(R)===123?(K=s,R++):(K=r,te===0&&pe(Fi)),K!==r?(se=qo(),e.charCodeAt(R)===125?(ce=u,R++):(ce=r,te===0&&pe(ns)),ce!==r?(K=[K,se,ce],J=K):(R=J,J=r)):(R=J,J=r));J!==r;){if(N.push(J),J=[],K=R,se=R,te++,tn.test(e.charAt(R))?(ce=e.charAt(R),R++):(ce=r,te===0&&pe(rn)),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r),K!==r)for(;K!==r;)J.push(K),K=R,se=R,te++,tn.test(e.charAt(R))?(ce=e.charAt(R),R++):(ce=r,te===0&&pe(rn)),te--,ce===r?se=void 0:(R=se,se=r),se!==r?(ce=kr(),ce!==r?(se=[se,ce],K=se):(R=K,K=r)):(R=K,K=r);else J=r;J===r&&(J=R,e.charCodeAt(R)===123?(K=s,R++):(K=r,te===0&&pe(Fi)),K!==r?(se=qo(),e.charCodeAt(R)===125?(ce=u,R++):(ce=r,te===0&&pe(ns)),ce!==r?(K=[K,se,ce],J=K):(R=J,J=r)):(R=J,J=r))}return b=e.substring(b,R),b}function Ko(){var b;return Ct.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(T)),b}function np(){var b;return lr.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(x)),b}function ip(){var b;return tt.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(H)),b}function sp(){var b;return jr.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Q)),b}function Vo(){var b;return ba.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(de)),b}function Ri(){var b;return Ca.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(ve)),b}function Go(){var b;return _a.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Fe)),b}function Pl(){var b;return Fa.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Re)),b}function zo(){var b;return rs.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Pt)),b}function Tl(){var b;return Ia.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Qt)),b}function Ol(){var b;return Vs.test(e.charAt(R))?(b=e.charAt(R),R++):(b=r,te===0&&pe(Or)),b}function _t(){var b,N;for(b=[],N=Nn(),N===r&&(N=Lo(),N===r&&(N=$l()));N!==r;)b.push(N),N=Nn(),N===r&&(N=Lo(),N===r&&(N=$l()));return b}function xl(){var b,N;for(b=[],N=Nn(),N===r&&(N=os());N!==r;)b.push(N),N=Nn(),N===r&&(N=os());return b}function cs(){var b,N,J,K;return b=R,N=_t(),e.charCodeAt(R)===59?(J=Tr,R++):(J=r,te===0&&pe(xr)),J!==r?(N=[N,J],b=N):(R=b,b=r),b===r&&(b=R,N=xl(),J=En(),J===r&&(J=null),K=Lo(),K!==r?(N=[N,J,K],b=N):(R=b,b=r),b===r&&(b=R,N=_t(),J=ls(),J!==r?(N=[N,J],b=N):(R=b,b=r))),b}function ls(){var b,N;return b=R,te++,e.length>R?(N=e.charAt(R),R++):(N=r,te===0&&pe(Gs)),te--,N===r?b=void 0:(R=b,b=r),b}let Yo=t.reservedWords||[];if(xn=a(),xn!==r&&R===e.length)return xn;throw xn!==r&&R<e.length&&pe(Vh()),Cl(ka,an<e.length?e.charAt(an):null,an<e.length?ss(an,an+1):ss(an,an))}aA.exports={SyntaxError:ya,parse:JB}});var hl=ye((bN,uA)=>{"use strict";var ZB=vh(),QB=sA(),eR=oA(),tR=R0(),rR=["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"],fl={VERSION:tR,RESERVED_WORDS:rR,GrammarError:ZB,parser:eR,compiler:QB,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:fl.parser,passes:r(fl.compiler.passes),reservedWords:fl.RESERVED_WORDS.slice()};return n.forEach(a=>{a.use(i,t)}),fl.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};uA.exports=fl});var o1=ye((zL,FA)=>{var WP=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};FA.exports=WP});var u1=ye((YL,IA)=>{var XP="2.0.0",JP=Number.MAX_SAFE_INTEGER||9007199254740991,ZP=16,QP=250,e7=["major","premajor","minor","preminor","patch","prepatch","prerelease"];IA.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:ZP,MAX_SAFE_BUILD_LENGTH:QP,MAX_SAFE_INTEGER:JP,RELEASE_TYPES:e7,SEMVER_SPEC_VERSION:XP,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var f1=ye((Ks,$A)=>{var{MAX_SAFE_COMPONENT_LENGTH:c1,MAX_SAFE_BUILD_LENGTH:t7,MAX_LENGTH:r7}=u1(),n7=o1();Ks=$A.exports={};var i7=Ks.re=[],s7=Ks.safeRe=[],Oe=Ks.src=[],xe=Ks.t={},a7=0,l1="[a-zA-Z0-9-]",o7=[["\\s",1],["\\d",r7],[l1,t7]],u7=e=>{for(let[t,r]of o7)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Qe=(e,t,r)=>{let n=u7(t),i=a7++;n7(e,i,t),xe[e]=i,Oe[i]=t,i7[i]=new RegExp(t,r?"g":void 0),s7[i]=new RegExp(n,r?"g":void 0)};Qe("NUMERICIDENTIFIER","0|[1-9]\\d*");Qe("NUMERICIDENTIFIERLOOSE","\\d+");Qe("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${l1}*`);Qe("MAINVERSION",`(${Oe[xe.NUMERICIDENTIFIER]})\\.(${Oe[xe.NUMERICIDENTIFIER]})\\.(${Oe[xe.NUMERICIDENTIFIER]})`);Qe("MAINVERSIONLOOSE",`(${Oe[xe.NUMERICIDENTIFIERLOOSE]})\\.(${Oe[xe.NUMERICIDENTIFIERLOOSE]})\\.(${Oe[xe.NUMERICIDENTIFIERLOOSE]})`);Qe("PRERELEASEIDENTIFIER",`(?:${Oe[xe.NUMERICIDENTIFIER]}|${Oe[xe.NONNUMERICIDENTIFIER]})`);Qe("PRERELEASEIDENTIFIERLOOSE",`(?:${Oe[xe.NUMERICIDENTIFIERLOOSE]}|${Oe[xe.NONNUMERICIDENTIFIER]})`);Qe("PRERELEASE",`(?:-(${Oe[xe.PRERELEASEIDENTIFIER]}(?:\\.${Oe[xe.PRERELEASEIDENTIFIER]})*))`);Qe("PRERELEASELOOSE",`(?:-?(${Oe[xe.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Oe[xe.PRERELEASEIDENTIFIERLOOSE]})*))`);Qe("BUILDIDENTIFIER",`${l1}+`);Qe("BUILD",`(?:\\+(${Oe[xe.BUILDIDENTIFIER]}(?:\\.${Oe[xe.BUILDIDENTIFIER]})*))`);Qe("FULLPLAIN",`v?${Oe[xe.MAINVERSION]}${Oe[xe.PRERELEASE]}?${Oe[xe.BUILD]}?`);Qe("FULL",`^${Oe[xe.FULLPLAIN]}$`);Qe("LOOSEPLAIN",`[v=\\s]*${Oe[xe.MAINVERSIONLOOSE]}${Oe[xe.PRERELEASELOOSE]}?${Oe[xe.BUILD]}?`);Qe("LOOSE",`^${Oe[xe.LOOSEPLAIN]}$`);Qe("GTLT","((?:<|>)?=?)");Qe("XRANGEIDENTIFIERLOOSE",`${Oe[xe.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Qe("XRANGEIDENTIFIER",`${Oe[xe.NUMERICIDENTIFIER]}|x|X|\\*`);Qe("XRANGEPLAIN",`[v=\\s]*(${Oe[xe.XRANGEIDENTIFIER]})(?:\\.(${Oe[xe.XRANGEIDENTIFIER]})(?:\\.(${Oe[xe.XRANGEIDENTIFIER]})(?:${Oe[xe.PRERELEASE]})?${Oe[xe.BUILD]}?)?)?`);Qe("XRANGEPLAINLOOSE",`[v=\\s]*(${Oe[xe.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Oe[xe.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Oe[xe.XRANGEIDENTIFIERLOOSE]})(?:${Oe[xe.PRERELEASELOOSE]})?${Oe[xe.BUILD]}?)?)?`);Qe("XRANGE",`^${Oe[xe.GTLT]}\\s*${Oe[xe.XRANGEPLAIN]}$`);Qe("XRANGELOOSE",`^${Oe[xe.GTLT]}\\s*${Oe[xe.XRANGEPLAINLOOSE]}$`);Qe("COERCEPLAIN",`(^|[^\\d])(\\d{1,${c1}})(?:\\.(\\d{1,${c1}}))?(?:\\.(\\d{1,${c1}}))?`);Qe("COERCE",`${Oe[xe.COERCEPLAIN]}(?:$|[^\\d])`);Qe("COERCEFULL",Oe[xe.COERCEPLAIN]+`(?:${Oe[xe.PRERELEASE]})?(?:${Oe[xe.BUILD]})?(?:$|[^\\d])`);Qe("COERCERTL",Oe[xe.COERCE],!0);Qe("COERCERTLFULL",Oe[xe.COERCEFULL],!0);Qe("LONETILDE","(?:~>?)");Qe("TILDETRIM",`(\\s*)${Oe[xe.LONETILDE]}\\s+`,!0);Ks.tildeTrimReplace="$1~";Qe("TILDE",`^${Oe[xe.LONETILDE]}${Oe[xe.XRANGEPLAIN]}$`);Qe("TILDELOOSE",`^${Oe[xe.LONETILDE]}${Oe[xe.XRANGEPLAINLOOSE]}$`);Qe("LONECARET","(?:\\^)");Qe("CARETTRIM",`(\\s*)${Oe[xe.LONECARET]}\\s+`,!0);Ks.caretTrimReplace="$1^";Qe("CARET",`^${Oe[xe.LONECARET]}${Oe[xe.XRANGEPLAIN]}$`);Qe("CARETLOOSE",`^${Oe[xe.LONECARET]}${Oe[xe.XRANGEPLAINLOOSE]}$`);Qe("COMPARATORLOOSE",`^${Oe[xe.GTLT]}\\s*(${Oe[xe.LOOSEPLAIN]})$|^$`);Qe("COMPARATOR",`^${Oe[xe.GTLT]}\\s*(${Oe[xe.FULLPLAIN]})$|^$`);Qe("COMPARATORTRIM",`(\\s*)${Oe[xe.GTLT]}\\s*(${Oe[xe.LOOSEPLAIN]}|${Oe[xe.XRANGEPLAIN]})`,!0);Ks.comparatorTrimReplace="$1$2$3";Qe("HYPHENRANGE",`^\\s*(${Oe[xe.XRANGEPLAIN]})\\s+-\\s+(${Oe[xe.XRANGEPLAIN]})\\s*$`);Qe("HYPHENRANGELOOSE",`^\\s*(${Oe[xe.XRANGEPLAINLOOSE]})\\s+-\\s+(${Oe[xe.XRANGEPLAINLOOSE]})\\s*$`);Qe("STAR","(<|>)?=?\\s*\\*");Qe("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Qe("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var BA=ye((WL,DA)=>{var c7=Object.freeze({loose:!0}),l7=Object.freeze({}),f7=e=>e?typeof e!="object"?c7:e:l7;DA.exports=f7});var OA=ye((XL,TA)=>{var RA=/^[0-9]+$/,PA=(e,t)=>{let r=RA.test(e),n=RA.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},h7=(e,t)=>PA(t,e);TA.exports={compareIdentifiers:PA,rcompareIdentifiers:h7}});var Ph=ye((JL,LA)=>{var Bh=o1(),{MAX_LENGTH:xA,MAX_SAFE_INTEGER:Rh}=u1(),{safeRe:NA,t:kA}=f1(),p7=BA(),{compareIdentifiers:Uu}=OA(),h1=class e{constructor(t,r){if(r=p7(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>xA)throw new TypeError(`version is longer than ${xA} characters`);Bh("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=t.trim().match(r.loose?NA[kA.LOOSE]:NA[kA.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Rh||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Rh||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Rh||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let a=+i;if(a>=0&&a<Rh)return a}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Bh("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),Uu(this.major,t.major)||Uu(this.minor,t.minor)||Uu(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=t.prerelease[r];if(Bh("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Uu(n,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let n=this.build[r],i=t.build[r];if(Bh("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return Uu(n,i)}while(++r)}inc(t,r,n){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let a=this.prerelease.length;for(;--a>=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);if(a===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let a=[r,i];n===!1&&(a=[r]),Uu(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};LA.exports=h1});var MA=ye((ZL,HA)=>{var UA=Ph(),d7=(e,t,r)=>new UA(e,r).compare(new UA(t,r));HA.exports=d7});var qA=ye((QL,jA)=>{var g7=MA(),m7=(e,t,r)=>g7(e,t,r)>=0;jA.exports=m7});var GA=ye((eU,VA)=>{var KA=Ph(),v7=(e,t,r=!1)=>{if(e instanceof KA)return e;try{return new KA(e,t)}catch(n){if(!r)return null;throw n}};VA.exports=v7});var YA=ye((tU,zA)=>{var E7=Ph(),w7=GA(),{safeRe:Th,t:Oh}=f1(),A7=(e,t)=>{if(e instanceof E7)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Th[Oh.COERCEFULL]:Th[Oh.COERCE]);else{let l=t.includePrerelease?Th[Oh.COERCERTLFULL]:Th[Oh.COERCERTL],f;for(;(f=l.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),l.lastIndex=f.index+f[1].length+f[2].length;l.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",a=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",u=t.includePrerelease&&r[6]?`+${r[6]}`:"";return w7(`${n}.${i}.${a}${s}${u}`,t)};zA.exports=A7});var uf="2.19.60";var na=typeof $task<"u",Ss=typeof $loon<"u",ia=typeof $httpClient<"u"&&!Ss,xi=eval('typeof process !== "undefined"'),um=typeof $environment<"u"&&$environment["stash-version"],cm=typeof $rocket<"u",t_=typeof egern=="object",r_=typeof $native<"u",sa=typeof $Plugins<"u";function om(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}var cf=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=wi(),this.env=Ir(),xi){let dotenv=require("dotenv");dotenv.config()}this.node=(()=>{if(xi){let fs=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(na&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(Ss||ia)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),sa&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),xi){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}`)}om(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{this.cache=JSON.parse(this.node.fs.readFileSync(`${fpath}`))}catch(e){this.node.fs.copyFileSync(fpath,backupPath),this.error(`Failed to parse ${fpath}: ${e.message}. Backup created at ${backupPath}`)}om(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(na&&$prefs.setValueForKey(data,this.name),(Ss||ia)&&$persistentStore.write(data,this.name),sa&&$Plugins.SubStoreCache.set(this.name,data),xi){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),ia||Ss)return $persistentStore.write(e,t);if(na)return $prefs.setValueForKey(e,t);if(xi&&(this.root[t]=e),sa)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),ia||Ss)return $persistentStore.read(e);if(na)return $prefs.valueForKey(e);if(xi)return this.root[e];if(sa)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),ia||Ss)return $persistentStore.write(null,e);if(na)return $prefs.removeValueForKey(e);if(xi&&delete this.root[e],sa)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(na&&$notify(title,subtitle,content,options),ia&&$notification.post(title,subtitle,content+`${mediaURL?`
\u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),Ss){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(xi){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){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(`
`)));wi().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}`)})}}sa&&$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={}){na||Ss||ia||sa?$done(e):xi&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function Ir(){return{isQX:na,isLoon:Ss,isSurge:ia,isNode:xi,isStash:um,isShadowRocket:cm,isEgern:t_,isLanceX:r_,isGUIforCores:sa}}function wi(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores}=Ir(),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||um||cm)&&(opts.timeout=Math.ceil(opts.timeout/1e3),e="s")}if(isNode){let undici=require('undici'),{ProxyAgent,EnvHttpProxyAgent,request,interceptors}=undici,agentOpts={connect:{rejectUnauthorized:!(opts.strictSSL===!1||opts.insecure===!0)},bodyTimeout:opts.timeout,headersTimeout:opts.timeout};try{let e=new URL(opts.url);(e.username||e.password)&&(opts.headers={...opts.headers||{},Authorization:`Basic ${Buffer.from(`${e.username||""}:${e.password||""}`).toString("base64")}`});let t=await request(opts.url,{...opts,method:method.toUpperCase(),dispatcher:(opts.proxy?new ProxyAgent({...agentOpts,uri:opts.proxy}):new EnvHttpProxyAgent(agentOpts)).compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirects:!0}))});resolve({statusCode:t.statusCode,headers:t.headers,body:opts.encoding===null?await t.body.arrayBuffer():await t.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,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 n_=new cf("sub-store"),I=n_;var Zp="schemaVersion",Ft="settings",Dt="subs",Bt="collections",vt="files",Gr="modules",ht="artifacts",Pc="rules",ln="tokens",lm="Auto Generated Sub-Store Backup",lf="Sub-Store",Ya="Sub-Store Artifacts Repository",Wa="#sub-store-cached-resource",Xa="#sub-store-cached-headers-resource",ff="#sub-store-chr-expiration-time";var Ja="#sub-store-cached-script-resource",hf="#sub-store-csr-expiration-time";function aa(){i_()}function i_(){let e=I.read(Zp);e||s_(),e!=="2.0"&&I.write("2.0",Zp)}function s_(){I.info("Start migrating...");let e=I.read(Dt)||{},t=Object.values(e).map(A=>(A.source=A.source||"remote",p(A),h(A),A));I.write(t,Dt);let r=I.read(Bt)||{},n=Object.values(r).map(A=>(delete A.ua,p(A),h(A),A));I.write(n,Bt);let i=I.read(ht)||{},a=Object.values(i);I.write(a,ht);let s=I.read(Pc)||{},u=Object.values(s);I.write(u,Pc);let l=I.read(vt)||{},f=Object.values(l);I.write(f,vt);let d=I.read(ln)||{},E=Object.values(d);I.write(E,ln),delete I.cache.builtin,I.info("Migration complete!");function p(A){let m=A["display-name"];m&&(A.displayName=m,delete A["display-name"])}function h(A){let m=A.process;if(!m||m.length===0)return;let S=[],w={type:"Quick Setting Operator",args:{udp:"DEFAULT",tfo:"DEFAULT",scert:"DEFAULT","vmess aead":"DEFAULT",useless:"DEFAULT"}};for(let y of m)if(y.type){if(y.type==="Useless Filter")w.args.useless="ENABLED";else if(y.type==="Set Property Operator"){let{key:_,value:B}=y.args;switch(_){case"udp":w.args.udp=B?"ENABLED":"DISABLED";break;case"tfo":w.args.tfo=B?"ENABLED":"DISABLED";break;case"skip-cert-verify":w.args.scert=B?"ENABLED":"DISABLED";break;case"aead":w.args["vmess aead"]=B?"ENABLED":"DISABLED";break}}else if(y.type.indexOf("Keyword")===-1)if(y.type==="Flag Operator"){let _=typeof y.args>"u"?!0:y.args;y.args={mode:_?"add":"remove"},S.push(y)}else S.push(y)}S.unshift(w),A.process=S}}function Qp({substore:$,port,host}){let{isNode}=Ir(),DEFAULT_HEADERS={"Content-Type":"text/plain;charset=UTF-8","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST,GET,OPTIONS,PATCH,PUT,DELETE","Access-Control-Allow-Headers":"Origin, X-Requested-With, Content-Type, Accept","X-Powered-By":"Sub-Store"};if(isNode){let express_=require("express"),bodyParser=require("body-parser"),app=express_(),limit=eval("process.env.SUB_STORE_BODY_JSON_LIMIT")||"1mb";return $.info(`[BACKEND] body JSON limit: ${limit}`),app.use(bodyParser.json({verify:rawBodySaver,limit})),app.use(bodyParser.urlencoded({verify:rawBodySaver,extended:!0})),app.use(bodyParser.raw({verify:rawBodySaver,type:"*/*"})),app.use((e,t,r)=>{t.set(DEFAULT_HEADERS),r()}),app.start=()=>{let e=app.listen(port,host,()=>{let{address:t,port:r}=e.address();$.info(`[BACKEND] listening on ${t}:${r}`)})},app}let handlers=[],METHODS_NAMES=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD'","ALL"],dispatch=(e,t=0)=>{let{method:r,url:n,headers:i,body:a}=e;i=a_(i),/json/i.test(i["content-type"])&&(a=JSON.parse(a)),r=r.toUpperCase();let{path:s,query:u}=u_(n),l=null,f,d=0;for(f=t;f<handlers.length;f++)if(handlers[f].method==="ALL"||r===handlers[f].method){let{pattern:E}=handlers[f];o_(E,s)&&E.split("/").length>d&&(l=handlers[f],d=E.split("/").length)}if(l){let E=()=>{dispatch(r,n,f)},p={method:r,url:n,path:s,query:u,params:fm(l.pattern,s),headers:i,body:a},h=Response(),A=l.callback,m=S=>{h.status(500).json({status:"failed",message:`Internal Server Error: ${S}`})};if(A.constructor.name==="AsyncFunction")A(p,h,E).catch(m);else try{A(p,h,E)}catch(S){m(S)}}else Response().status(404).json({status:"failed",message:"ERROR: 404 not found"})},app={};return METHODS_NAMES.forEach(e=>{app[e.toLowerCase()]=(t,r)=>{handlers.push({method:e,pattern:t,callback:r})}}),app.route=e=>{let t={};return METHODS_NAMES.forEach(r=>{t[r.toLowerCase()]=n=>(handlers.push({method:r,pattern:e,callback:n}),t)}),t},app.start=()=>{dispatch($request)},app;function rawBodySaver(e,t,r,n){r&&r.length&&(e.rawBody=r.toString(n||"utf8"))}function Response(){let e=200,{isQX:t,isLoon:r,isSurge:n,isGUIforCores:i}=Ir(),a=DEFAULT_HEADERS,s={200:"HTTP/1.1 200 OK",201:"HTTP/1.1 201 Created",302:"HTTP/1.1 302 Found",307:"HTTP/1.1 307 Temporary Redirect",308:"HTTP/1.1 308 Permanent Redirect",404:"HTTP/1.1 404 Not Found",500:"HTTP/1.1 500 Internal Server Error"};return new class{status(u){return e=u,this}send(u=""){let l={status:t?s[e]:e,body:u,headers:a};t||i?$done(l):(r||n)&&$done({response:l})}end(){this.send()}html(u){this.set("Content-Type","text/html;charset=UTF-8"),this.send(u)}json(u){this.set("Content-Type","application/json;charset=UTF-8"),this.send(JSON.stringify(u))}set(u,l){return a[u]=l,this}}}}function a_(e){let t={};for(let r of Object.keys(e))t[r.toLowerCase()]=e[r];return t}function o_(e,t){if(e instanceof RegExp&&e.test(t))return!0;if(e==="/")return!0;if(e.indexOf(":")===-1){let r=t.split("/"),n=e.split("/");for(let i=0;i<n.length;i++)if(r[i]!==n[i])return!1;return!0}else if(fm(e,t))return!0;return!1}function u_(e){let r=(e.match(/https?:\/\/[^/]+(\/[^?]*)/)||[])[1]||"/",n=e.indexOf("?"),i={};if(n!==-1){let a=e.slice(e.indexOf("?")+1).split("&");for(let s=0;s<a.length;s++){let u=a[s].split("=");i[u[0]]=u[1]}}return{path:r,query:i}}function fm(e,t){if(e.indexOf(":")===-1)return null;{let r={};for(let n=0,i=0;n<e.length;n++,i++)if(e[n]===":"){let a=[],s=[];for(;e[++n]!=="/"&&n<e.length;)a.push(e[n]);for(;t[i]!=="/"&&i<t.length;)s.push(t[i++]);r[a.join("")]=s.join("")}else if(e[n]!==t[i])return null;return r}}var ed=0;function jn(e){return l_(c_(f_(e)))}function c_(e){return p_(d_(h_(e),e.length*8))}function l_(e){try{}catch{ed=0}for(var t=ed?"0123456789ABCDEF":"0123456789abcdef",r="",n,i=0;i<e.length;i++)n=e.charCodeAt(i),r+=t.charAt(n>>>4&15)+t.charAt(n&15);return r}function f_(e){for(var t="",r=-1,n,i;++r<e.length;)n=e.charCodeAt(r),i=r+1<e.length?e.charCodeAt(r+1):0,55296<=n&&n<=56319&&56320<=i&&i<=57343&&(n=65536+((n&1023)<<10)+(i&1023),r++),n<=127?t+=String.fromCharCode(n):n<=2047?t+=String.fromCharCode(192|n>>>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 h_(e){for(var t=Array(e.length>>2),r=0;r<t.length;r++)t[r]=0;for(var r=0;r<e.length*8;r+=8)t[r>>5]|=(e.charCodeAt(r/8)&255)<<r%32;return t}function p_(e){for(var t="",r=0;r<e.length*32;r+=8)t+=String.fromCharCode(e[r>>5]>>>r%32&255);return t}function d_(e,t){e[t>>5]|=128<<t%32,e[(t+64>>>9<<4)+14]=t;for(var r=1732584193,n=-271733879,i=-1732584194,a=271733878,s=0;s<e.length;s+=16){var u=r,l=n,f=i,d=a;r=zr(r,n,i,a,e[s+0],7,-680876936),a=zr(a,r,n,i,e[s+1],12,-389564586),i=zr(i,a,r,n,e[s+2],17,606105819),n=zr(n,i,a,r,e[s+3],22,-1044525330),r=zr(r,n,i,a,e[s+4],7,-176418897),a=zr(a,r,n,i,e[s+5],12,1200080426),i=zr(i,a,r,n,e[s+6],17,-1473231341),n=zr(n,i,a,r,e[s+7],22,-45705983),r=zr(r,n,i,a,e[s+8],7,1770035416),a=zr(a,r,n,i,e[s+9],12,-1958414417),i=zr(i,a,r,n,e[s+10],17,-42063),n=zr(n,i,a,r,e[s+11],22,-1990404162),r=zr(r,n,i,a,e[s+12],7,1804603682),a=zr(a,r,n,i,e[s+13],12,-40341101),i=zr(i,a,r,n,e[s+14],17,-1502002290),n=zr(n,i,a,r,e[s+15],22,1236535329),r=Yr(r,n,i,a,e[s+1],5,-165796510),a=Yr(a,r,n,i,e[s+6],9,-1069501632),i=Yr(i,a,r,n,e[s+11],14,643717713),n=Yr(n,i,a,r,e[s+0],20,-373897302),r=Yr(r,n,i,a,e[s+5],5,-701558691),a=Yr(a,r,n,i,e[s+10],9,38016083),i=Yr(i,a,r,n,e[s+15],14,-660478335),n=Yr(n,i,a,r,e[s+4],20,-405537848),r=Yr(r,n,i,a,e[s+9],5,568446438),a=Yr(a,r,n,i,e[s+14],9,-1019803690),i=Yr(i,a,r,n,e[s+3],14,-187363961),n=Yr(n,i,a,r,e[s+8],20,1163531501),r=Yr(r,n,i,a,e[s+13],5,-1444681467),a=Yr(a,r,n,i,e[s+2],9,-51403784),i=Yr(i,a,r,n,e[s+7],14,1735328473),n=Yr(n,i,a,r,e[s+12],20,-1926607734),r=Wr(r,n,i,a,e[s+5],4,-378558),a=Wr(a,r,n,i,e[s+8],11,-2022574463),i=Wr(i,a,r,n,e[s+11],16,1839030562),n=Wr(n,i,a,r,e[s+14],23,-35309556),r=Wr(r,n,i,a,e[s+1],4,-1530992060),a=Wr(a,r,n,i,e[s+4],11,1272893353),i=Wr(i,a,r,n,e[s+7],16,-155497632),n=Wr(n,i,a,r,e[s+10],23,-1094730640),r=Wr(r,n,i,a,e[s+13],4,681279174),a=Wr(a,r,n,i,e[s+0],11,-358537222),i=Wr(i,a,r,n,e[s+3],16,-722521979),n=Wr(n,i,a,r,e[s+6],23,76029189),r=Wr(r,n,i,a,e[s+9],4,-640364487),a=Wr(a,r,n,i,e[s+12],11,-421815835),i=Wr(i,a,r,n,e[s+15],16,530742520),n=Wr(n,i,a,r,e[s+2],23,-995338651),r=Xr(r,n,i,a,e[s+0],6,-198630844),a=Xr(a,r,n,i,e[s+7],10,1126891415),i=Xr(i,a,r,n,e[s+14],15,-1416354905),n=Xr(n,i,a,r,e[s+5],21,-57434055),r=Xr(r,n,i,a,e[s+12],6,1700485571),a=Xr(a,r,n,i,e[s+3],10,-1894986606),i=Xr(i,a,r,n,e[s+10],15,-1051523),n=Xr(n,i,a,r,e[s+1],21,-2054922799),r=Xr(r,n,i,a,e[s+8],6,1873313359),a=Xr(a,r,n,i,e[s+15],10,-30611744),i=Xr(i,a,r,n,e[s+6],15,-1560198380),n=Xr(n,i,a,r,e[s+13],21,1309151649),r=Xr(r,n,i,a,e[s+4],6,-145523070),a=Xr(a,r,n,i,e[s+11],10,-1120210379),i=Xr(i,a,r,n,e[s+2],15,718787259),n=Xr(n,i,a,r,e[s+9],21,-343485551),r=oa(r,u),n=oa(n,l),i=oa(i,f),a=oa(a,d)}return Array(r,n,i,a)}function pf(e,t,r,n,i,a){return oa(g_(oa(oa(t,e),oa(n,a)),i),r)}function zr(e,t,r,n,i,a,s){return pf(t&r|~t&n,e,t,i,a,s)}function Yr(e,t,r,n,i,a,s){return pf(t&n|r&~n,e,t,i,a,s)}function Wr(e,t,r,n,i,a,s){return pf(t^r^n,e,t,i,a,s)}function Xr(e,t,r,n,i,a,s){return pf(r^(t|~n),e,t,i,a,s)}function oa(e,t){var r=(e&65535)+(t&65535),n=(e>>16)+(t>>16)+(r>>16);return n<<16|r&65535}function g_(e,t){return e<<t|e>>>32-t}var Sf=Cn(Cm()),M_=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,j_=/^(([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 vr(e){return M_.test(e)}function ur(e){return j_.test(e)}function _m(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 Hi(e){return typeof e=="string"&&e.trim().length>0}function Ut(e,t){return Hi(e)?e:t}function au(e){return typeof e<"u"&&e!==null}function ou(e,t){return au(e)?e:t}function Cs(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function q_(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function xc(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return q_(n,i)}else return Number(r)}function Fm(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function bf(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)}function ca(e,t="YYYY-MM-DD_HH-mm-ss"){let r=e instanceof Date?e:new Date(e);if(isNaN(r.getTime()))return"";let n=a=>String(a).padStart(2,"0"),i={YYYY:r.getFullYear(),MM:n(r.getMonth()+1),DD:n(r.getDate()),HH:n(r.getHours()),mm:n(r.getMinutes()),ss:n(r.getSeconds())};return t.replace(/YYYY|MM|DD|HH|mm|ss/g,a=>i[a])}var pd=class{constructor(t){this.expires=t,I.read(Wa)||I.write("{}",Wa);try{this.resourceCache=JSON.parse(I.read(Wa))}catch(r){I.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Wa} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${r?.message??r}`),this.resourceCache={},I.write("{}",Wa)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],I.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(){I.write(JSON.stringify(this.resourceCache),Wa)}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()}},pr=new pd(36e5);var dd=class{constructor(){this.expires=V_(),I.read(Xa)||I.write("{}",Xa);try{this.resourceCache=JSON.parse(I.read(Xa))}catch(t){I.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Xa} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},I.write("{}",Xa)}this._cleanup()}_cleanup(){let t=!1;Object.entries(this.resourceCache).forEach(r=>{let[n,i]=r;i.time||(delete this.resourceCache[n],I.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(){I.write(JSON.stringify(this.resourceCache),Xa)}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 V_(){I.read(ff)||I.write("6e4",ff);let e=6e4;if(I.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=I.read("#\u54CD\u5E94\u5934\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=I.read(ff),e}var eo=new dd;function uu(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 Zr(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}=Ir(),insecure=$arguments?.insecure?I.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=I.read(Ft),proxy=customProxy||defaultProxy;I.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultFlowUserAgent||"clash",requestTimeout=timeout||defaultTimeout||8e3,id=jn(userAgent+url),cached=eo.get(id),flowInfo;if(!$arguments?.noCache&&cached)I.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${userAgent}`),flowInfo=cached;else{let e=wi();if(flowUrl){I.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}=await e.get({url:flowUrl,headers:{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Cs(proxy):{},...insecure||{}});flowInfo=t}else{try{I.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?Cs(proxy):{},...insecure||{}});flowInfo=uu(t)}catch(t){I.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){I.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?Cs(proxy):{},...insecure||{}});flowInfo=uu(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&eo.set(id,flowInfo)}return flowInfo}function to(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),r=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,E=e.match(/app_url=(.*?)\s*?(;|$)/),p=E?decodeURIComponent(E[1]):void 0,h=e.match(/plan_name=(.*?)\s*?(;|$)/),A=h?decodeURIComponent(h[1]):void 0;return{expires:l,total:s,usage:{upload:r,download:i},remainingDays:d,appUrl:p,planName:A}}function Nc(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:e.toFixed(1),unit:t}:Nc(e/1024,r[++n])}function Cf(e){if(!e)throw new Error("\u6CA1\u6709\u6D41\u91CF\u4FE1\u606F");if(e?.expires&&e.expires*1e3<Date.now()){let t=new Date(e.expires*1e3).toLocaleDateString();throw new Error(`\u8BA2\u9605\u5DF2\u8FC7\u671F: ${t}`)}if(e?.total){let t=e.usage?.upload||0,r=e.usage?.download||0;if(e.total-t-r<0){let n=t+r,i=Nc(Math.abs(n));i.value=n<0?"-"+i.value:i.value;let a=Nc(e.total);throw new Error(`\u6D41\u91CF\u5DF2\u7528\u5B8C: ${i.value} ${i.unit} / ${a.value} ${a.unit}`)}}}function _f(e={}){try{let{resetDay:t,startDate:r,cycleDays:n}=e;if(["string","number"].includes(typeof e)&&(t=e),r&&n){if(n=parseInt(n),isNaN(n)||n<=0)throw new Error("\u91CD\u7F6E\u5468\u671F\u5E94\u4E3A\u6B63\u6574\u6570");if(!r||!Date.parse(r))throw new Error("\u5F00\u59CB\u65E5\u671F\u4E0D\u5408\u6CD5");let i=new Date(r),a=new Date;if(i.setHours(0,0,0,0),a.setHours(0,0,0,0),i.getTime()>a.getTime())throw new Error("\u5F00\u59CB\u65E5\u671F\u5E94\u65E9\u4E8E\u73B0\u5728");let s=new Date(r);for(s.setDate(s.getDate()+n);s<a;)s.setDate(s.getDate()+n);s.setHours(0,0,0,0);let u=s.getTime()-a.getTime();return Math.ceil(u/(1e3*3600*24))}else{if(!t)return;if(t=parseInt(t),isNaN(t)||t<=0||t>31)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){I.error(`getRmainingDays failed: ${t.message??t}`)}}function la(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);t.set(i,s)}catch{t.set(i,a)}}),Array.from(t.entries()).map(([r,n])=>`${r}=${encodeURIComponent(n)}`).join("; ")}catch(t){return I.error(`normalizeFlowHeader failed: ${t.message??t}`),e}}function Je(e,t,r="name"){return e.find(n=>n[r]===t)}function Im(e,t,r="name"){return e.findIndex(n=>n[r]===t)}function oi(e,t,r="name"){let n=Im(e,t,r);e.splice(n,1)}function yi(e,t,r,n="name"){let i=Im(e,t,n);e[i]=r}function Ne(e,t,r){e.status(r||200).json({status:"success",data:t})}function Pe(e,t,r){e.status(r||500).json({status:"failed",error:{code:t.code,type:t.type,message:t.message,details:t.details}})}var cu=class{constructor(t,r,n){this.code=t,this.message=r,this.details=n}},jt=class extends cu{constructor(t,r,n){super(t,r,n),this.type="InternalServerError"}},At=class extends cu{constructor(t,r,n){super(t,r,n),this.type="RequestInvalidError"}},Vt=class extends cu{constructor(t,r,n){super(t,r,n),this.type="ResourceNotFoundError"}},lu=class extends cu{constructor(t,r,n){super(t,r,n),this.type="NetworkError"}};var Tm="3.7.7",G_=Tm,hu=typeof Buffer=="function",$m=typeof TextDecoder=="function"?new TextDecoder:void 0,Dm=typeof TextEncoder=="function"?new TextEncoder:void 0,z_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",kc=Array.prototype.slice.call(z_),Ff=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(kc),Y_=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Ur=String.fromCharCode.bind(String),Bm=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),Om=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),xm=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Nm=e=>{let t,r,n,i,a="",s=e.length%3;for(let u=0;u<e.length;){if((r=e.charCodeAt(u++))>255||(n=e.charCodeAt(u++))>255||(i=e.charCodeAt(u++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,a+=kc[t>>18&63]+kc[t>>12&63]+kc[t>>6&63]+kc[t&63]}return s?a.slice(0,s-3)+"===".substring(s):a},vd=typeof btoa=="function"?e=>btoa(e):hu?e=>Buffer.from(e,"binary").toString("base64"):Nm,gd=hu?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,i=e.length;n<i;n+=4096)r.push(Ur.apply(null,e.subarray(n,n+4096)));return vd(r.join(""))},If=(e,t=!1)=>t?Om(gd(e)):gd(e),W_=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?Ur(192|t>>>6)+Ur(128|t&63):Ur(224|t>>>12&15)+Ur(128|t>>>6&63)+Ur(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return Ur(240|t>>>18&7)+Ur(128|t>>>12&63)+Ur(128|t>>>6&63)+Ur(128|t&63)}},X_=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,km=e=>e.replace(X_,W_),Rm=hu?e=>Buffer.from(e,"utf8").toString("base64"):Dm?e=>gd(Dm.encode(e)):e=>vd(km(e)),fu=(e,t=!1)=>t?Om(Rm(e)):Rm(e),Pm=e=>fu(e,!0),J_=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Z_=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 Ur((r>>>10)+55296)+Ur((r&1023)+56320);case 3:return Ur((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Ur((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},Lm=e=>e.replace(J_,Z_),Um=e=>{if(e=e.replace(/\s+/g,""),!Y_.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,i;for(let a=0;a<e.length;)t=Ff[e.charAt(a++)]<<18|Ff[e.charAt(a++)]<<12|(n=Ff[e.charAt(a++)])<<6|(i=Ff[e.charAt(a++)]),r+=n===64?Ur(t>>16&255):i===64?Ur(t>>16&255,t>>8&255):Ur(t>>16&255,t>>8&255,t&255);return r},Ed=typeof atob=="function"?e=>atob(xm(e)):hu?e=>Buffer.from(e,"base64").toString("binary"):Um,Hm=hu?e=>Bm(Buffer.from(e,"base64")):e=>Bm(Ed(e).split("").map(t=>t.charCodeAt(0))),Mm=e=>Hm(jm(e)),Q_=hu?e=>Buffer.from(e,"base64").toString("utf8"):$m?e=>$m.decode(Hm(e)):e=>Lm(Ed(e)),jm=e=>xm(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),md=e=>Q_(jm(e)),e5=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)},qm=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),Km=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,qm(r));e("fromBase64",function(){return md(this)}),e("toBase64",function(t){return fu(this,t)}),e("toBase64URI",function(){return fu(this,!0)}),e("toBase64URL",function(){return fu(this,!0)}),e("toUint8Array",function(){return Mm(this)})},Vm=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,qm(r));e("toBase64",function(t){return If(this,t)}),e("toBase64URI",function(){return If(this,!0)}),e("toBase64URL",function(){return If(this,!0)})},t5=()=>{Km(),Vm()},Et={version:Tm,VERSION:G_,atob:Ed,atobPolyfill:Um,btoa:vd,btoaPolyfill:Nm,fromBase64:md,toBase64:fu,encode:fu,encodeURI:Pm,encodeURL:Pm,utob:km,btou:Lm,decode:md,isValid:e5,fromUint8Array:If,toUint8Array:Mm,extendString:Km,extendUint8Array:Vm,extendBuiltins:t5};var _h=Cn(Rf());var Gd=Cn(xv());function F8(e){let t=Gd.default.pemtohex(e);return Gd.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var Nv={generateFingerprint:F8};var Jc=Cn($E());function BE(e,t,...r){try{return e(t,...r)}catch{return e(RE(e(t.replace(/!<str>\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function Xc(e,...t){return BE(Jc.default.safeLoad,JSON.parse(JSON.stringify(e)),...t)}function nD(e,...t){return BE(Jc.default.load,JSON.parse(JSON.stringify(e)),...t)}function DE(e,...t){return Jc.default.safeDump(JSON.parse(JSON.stringify(e)),...t)}function RE(e,...t){return Jc.default.dump(JSON.parse(JSON.stringify(e)),...t)}var po={safeLoad:Xc,load:nD,safeDump:DE,dump:RE,parse:Xc,stringify:DE};var s0=class{constructor(){this.expires=iD(),I.read(Ja)||I.write("{}",Ja);try{this.resourceCache=JSON.parse(I.read(Ja))}catch(t){I.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Ja} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},I.write("{}",Ja)}this._cleanup()}_cleanup(t,r){let n=!1;Object.entries(this.resourceCache).forEach(i=>{let[a,s]=i;s.time||(delete this.resourceCache[a],I.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(){I.write(JSON.stringify(this.resourceCache),Ja)}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 iD(){I.read(hf)||I.write("1728e5",hf);let e=1728e5;if(I.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=I.read("#\u8282\u70B9\u7F13\u5B58\u6709\u6548\u671F");return r in t&&(e=t[r],e==="readcachets"&&(e=r)),e}else return e=I.read(hf),e}var Zc=new s0;function rh(e,t){return[...Array(e).keys()].map(()=>t)}var a0={"\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{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{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{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{1F1EA}":["VE","VEN"],"\u{1F1FB}\u{1F1F3}":["VN","VNM"],"\u{1F1FF}\u{1F1E6}":["ZA","ZAF","JNB"],"\u{1F1E8}\u{1F1F3}":["CN","CHN","BACK"]};function Ru(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"],"\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"],"\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{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{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{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{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(a0))if(a0[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 ih(e){return a0[Ru(e)]?.[0]}function Qc(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴‍☠️|🏳️‍🌈/g,"").trim()}var nh=class{constructor({country,asn}={}){if(I.env.isNode){let Reader=require("@maxmind/geoip2-node").Reader,fs=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 oh=Cn(jE()),qE=Cn(Rf());async function Tu({url:e,domain:t,type:r="A",timeout:n,edns:i}){let a=oh.default.encode({type:"query",id:0,flags:oh.default.RECURSION_DESIRED,questions:[{type:r,name:t}],additionals:[{type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:i,sourcePrefixLength:vr(i)?24:56,scopePrefixLength:0}]}]}),s=await I.http.get({url:`${e}?dns=${a.toString("base64").toString("utf-8").replace(/=/g,"")}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:n});return oh.default.decode(qE.Buffer.from(I.env.isQX?s.bodyBytes:s.body))}var E0=Cn(m0());var{isNode:KE,isQX:hD,isLoon:pD,isSurge:dD,isStash:gD,isShadowRocket:mD,isLanceX:vD,isEgern:ED,isGUIforCores:wD}=Ir(),Zi="Node";KE&&(Zi="Node");hD&&(Zi="QX");pD&&(Zi="Loon");dD&&(Zi="Surge");gD&&(Zi="Stash");mD&&(Zi="ShadowRocket");ED&&(Zi="Egern");vD&&(Zi="LanceX");wD&&(Zi="GUI.for.Cores");var mo={},AD={};try{if(typeof $environment<"u"&&(mo.env=$environment),typeof $loon<"u"&&(mo.loon=$loon),typeof $script<"u"&&(mo.script=$script),typeof $Plugin<"u"&&(mo.plugin=$Plugin),KE){mo.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)&&(mo.node.env[e]=env[e])}}catch(e){}var Qi={backend:Zi,version:uf,feature:AD,meta:mo};function yD(e){return e&&typeof e=="object"&&!Array.isArray(e)}function rl(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function GE(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(yD(r[n]))if(n.endsWith("!")){let i=rl(n.slice(0,-1));e[i]=r[n]}else{let i=rl(n);e[i]||Object.assign(e,{[i]:{}}),GE(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=rl(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=rl(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=rl(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function SD({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>uh(e,r))}}function uh(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=>uh(r,t));case"OR":return e.child.some(r=>uh(r,t));case"NOT":return!uh(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function bD(e){return{name:"Quick Setting Operator",func:r=>{if(t(e.useless)){let i=XE().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 CD({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=Qc(n.name);else{let i=Ru(n.name);n.name=Qc(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 _D(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 E="",p=f[d.name]++,h=0;for(;p>0;)E=s[p%10]+E,p=parseInt(p/10),h++;for(;h++<l;)E=s[0]+E;i==="front"?d.name=E+n+d.name:i==="back"&&(d.name=d.name+n+E)}return d})}}}}function FD(e="asc"){return{name:"Sort Operator",func:t=>{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 kD(t);default:throw new Error("Unknown sort option: "+e)}}}}function ID(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=>w0(i)),n.sort((i,a)=>{let s=VE(r,i.name),u=VE(r,a.name);return s&&!u?-1:u&&!s?1:s&&u?s<u?-1:1:t==="original"?0:t==="desc"?i.name<a.name?1:-1:i.name<a.name?-1:1}))}}function VE(e,t){let r=null;for(let n=0;n<e.length;n++)if(e[n].test(t)){r=n+1;break}return r}function zE(e){return{name:"Regex Rename Operator",func:t=>t.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(w0(n,"g"),i).trim();return r})}}function $D(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:zE(t).func}}function DD(e,t,r,n,i){return{name:"Script Operator",func:async a=>{let s=a;if(s?.$file?.type==="mihomoProfile")try{let u=po.safeLoad(e),l;if(s?.$content)try{l=po.safeLoad(s?.$content)}catch(f){I.error(f.message??f)}if(typeof u!="object")throw new Error("patch is not an object");return s.$content=yt.yaml.safeDump(GE(l||(s?.$file?.sourceType==="none"?{}:{proxies:await Pr({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=ch("operator",e,r,i)(a,t,{source:n,...Qi})}(),s},nodeFunc:async a=>{let s=a;return await async function(){s=ch("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,...Qi})}(),s}}}function BD(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(!vr(t))throw new Error(`Invalid IP address: ${t}`)}catch(n){I.error(`IP4P \u89E3\u6790\u5931\u8D25: ${n}`)}return{server:t,port:r}}var YE={Custom:async function(e,t,r,n,i,a){let s=jn(`CUSTOM:${a}:${e}:${t}`),u=pr.get(s);if(!r&&u)return u;let l=t==="IPv6"?"AAAA":"A",f=await Tu({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 E=d.filter(p=>p?.type===l).map(p=>p?.data).filter(p=>p);if(E.length===0)throw new Error("No answers");return pr.set(s,E),E},Google:async function(e,t,r,n,i){let a=jn(`GOOGLE:${e}:${t}`),s=pr.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",l=await Tu({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(E=>E?.type===u).map(E=>E?.data).filter(E=>E);if(d.length===0)throw new Error("No answers");return pr.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=jn(`IP-API:${e}`),a=pr.get(i);if(!r&&a)return a;let s=await I.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 pr.set(i,l),l},Cloudflare:async function(e,t,r,n,i){let a=jn(`CLOUDFLARE:${e}:${t}`),s=pr.get(a);if(!r&&s)return s;let u=t==="IPv6"?"AAAA":"A",l=await Tu({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(E=>E?.type===u).map(E=>E?.data).filter(E=>E);if(d.length===0)throw new Error("No answers");return pr.set(a,d),d},Ali:async function(e,t,r,n,i){let a=jn(`ALI:${e}:${t}`),s=pr.get(a);if(!r&&s)return s;let u=await I.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${i}/24&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 pr.set(a,f),f},Tencent:async function(e,t,r,n,i){let a=jn(`TENCENT:${e}:${t}`),s=pr.get(a);if(!r&&s)return s;let l=(await I.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 pr.set(a,f),f}};function WE({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}=I.read(Ft),l=a||u||8e3,f=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",d=YE[e];if(!d)throw new Error(`\u627E\u4E0D\u5230\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9: ${e}`);let E=s||"223.6.6.6";if(!vo(E))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");return I.info(`Domain Resolver: [${t}] ${e} ${E||""} ${i||""}`),{name:"Resolve Domain Operator",func:async p=>{p.forEach((w,y)=>{!w["_no-resolve"]&&w["no-resolve"]&&(p[y]["_no-resolve"]=w["no-resolve"])});let h={},A=15,m=[...new Set(p.filter(w=>!vo(w.server)&&!w["_no-resolve"]).map(w=>w.server))],S=Math.ceil(m.length/A);for(let w=0;w<S;w++){let y=[];for(let _ of m.splice(0,A))y.push(d(_,f,n==="disabled",l,E,i).then(B=>{h[_]=B,I.info(`Successfully resolved domain: ${_} \u279F ${B}`)}).catch(B=>{I.error(`Failed to resolve domain: ${_} with resolver [${e}]: ${B}`)}));await Promise.all(y)}return p.forEach(w=>{if(!w["_no-resolve"])if(h[w.server]){w._resolved_ips=h[w.server];let y=Array.isArray(h[w.server])?h[w.server][Math.floor(Math.random()*h[w.server].length)]:h[w.server];if(f==="IPv6"&&ur(y)){try{y=new Sf.Address6(y).correctForm()}catch(_){I.error(`Failed to parse IPv6 address: ${y}: ${_}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(y)){w._IP4P=y;let{server:_,port:B}=BD(y);_&&B?(w._domain=w.server,w.server=_,w.port=B,w.resolved=!0,w._IPv4=w.server,vo(w._IP)||(w._IP=w.server)):w.resolved||(w.resolved=!1)}else w._domain=w.server,w.server=y,w.resolved=!0,w[`_${f}`]=w.server,vo(w._IP)||(w._IP=w.server)}else w._domain=w.server,w.server=y,w.resolved=!0,w[`_${f}`]=w.server,vo(w._IP)||(w._IP=w.server)}else w.resolved||(w.resolved=!1)}),p.filter(w=>r==="removeFailed"?vo(w.server)||w["_no-resolve"]||w.resolved:r==="IPOnly"?vo(w.server):r==="IPv4Only"?vr(w.server):r==="IPv6Only"?ur(w.server):!0)}}}function vo(e){return vr(e)||ur(e)}WE.resolver=YE;function v0(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function XE(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!v0(t.cipher))return!1;if(t.password&&!v0(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&&!v0(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function RD(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=Ru(a.name),u=t.some(l=>n[l]===s);return r?u:!u})}}function PD({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(a=>w0(a).test(n.name));return t?i:!i})}}function w0(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function TD(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 OD(e,t,r,n,i){return{name:"Script Filter",func:async a=>{let s=rh(a.length,!0);return await async function(){s=ch("filter",e,r,i)(a,t,{source:n,...Qi})}(),s},nodeFunc:async a=>{let s=rh(a.length,!0);return await async function(){s=ch("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,...Qi})}(),s}}}var lh={"Useless Filter":XE,"Region Filter":RD,"Regex Filter":PD,"Type Filter":TD,"Script Filter":OD,"Conditional Filter":SD,"Quick Setting Operator":bD,"Flag Operator":CD,"Sort Operator":FD,"Regex Sort Operator":ID,"Regex Rename Operator":zE,"Regex Delete Operator":$D,"Script Operator":DD,"Handle Duplicate Operator":_D,"Resolve Domain Operator":WE};async function xD(e,t){let r=rh(t.length,!0);try{r=await e.func(t)}catch(n){let i="",a=`${n.message??n}`;a.includes("$server is not defined")?i="":(I.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){I.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 ND(e,t){let r=LD(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="":(I.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){I.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 JE(e,t){if(e.name.indexOf("Filter")!==-1)return xD(e,t);if(e.name.indexOf("Operator")!==-1)return ND(e,t)}function kD(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 LD(e){return JSON.parse(JSON.stringify(e))}function ch(name,script,$arguments,$options){let flowUtils={getFlowField:uu,getFlowHeaders:Zr,parseFlowHeaders:to,flowTransfer:Nc,validCheck:Cf,getRmainingDays:_f,normalizeFlowHeader:la};return I.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,I,E0.default,$persistentStore,$httpClient,$notification,yt,yt.yaml,yt.Buffer,yt.Base64.decode,yt.Base64.encode,Zc,flowUtils,Pr,eval('typeof require !== "undefined"')?za:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
return ${name}`)($arguments,$options,I,E0.default,yt,yt.yaml,yt.Buffer,yt.Base64.decode,yt.Base64.encode,Zc,flowUtils,Pr,eval('typeof require !== "undefined"')?za:void 0)}function UD(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function HD(){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=Et.decode(i);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(a)?a:(I.error("Base64 Pre-processor error: decoded line does not start with protocol"),i)}}}function MD(){return{name:"Fallback Base64 Pre-processor",test:function(n){return!0},parse:function(n){let i=Et.decode(n);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(i)?i:(I.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),n)}}}function jD(){return{name:"Clash Pre-processor",test:function(n){if(!/proxies/.test(n))return!1;let i=Xc(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}=Xc(a);return(i?`proxies:
`:"")+s.map(l=>(u&&!l["client-fingerprint"]&&(l["client-fingerprint"]=u),`${i?" - ":""}${JSON.stringify(l)}
`)).join("")}}}function qD(){return{name:"SSD Pre-processor",test:function(n){return n.indexOf("ssd://")===0},parse:function(n){let i=[],a=JSON.parse(Et.decode(n.split("ssd://")[1])),s=a.port,u=a.encryption,l=a.password,f=a.servers;for(let d=0;d<f.length;d++){let E=f[d];u=E.encryption?E.encryption:u,l=E.password?E.password:l;let p=Et.encode(u+":"+l),h=E.server;s=E.port?E.port:s;let A=E.remarks?E.remarks:d,m=E.plugin_options?"/?plugin="+encodeURIComponent(E.plugin+";"+E.plugin_options):"";i[d]="ss://"+p+"@"+h+":"+s+m+"#"+A}return i.join(`
`)}}}function KD(){return{name:"Full Config Preprocessor",test:function(n){return/^(\[server_local\]|\[Proxy\])/gm.test(n)},parse:function(n){return n.match(/^\[server_local|Proxy\]([\s\S]+?)^\[.+?\](\r?\n|$)/im)?.[1]||n}}}var fh=[UD(),jD(),HD(),qD(),KD(),MD()];var ZE=Cn(m0()),rt=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){ae(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}};function ae(e,t){let r=ZE.default.get(e,t);return typeof r<"u"&&r!==null}var VD="Surge",fi={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function xu(){return{produce:(t,r,n={})=>{switch(t.name=t.name.replace(/=|,/g,""),t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return GD(t,n["include-unsupported-proxy"]);case"trojan":return zD(t);case"vmess":return YD(t,n["include-unsupported-proxy"]);case"http":return XD(t);case"direct":return JD(t);case"socks5":return ZD(t);case"snell":return QD(t);case"tuic":return e9(t);case"wireguard-surge":return r9(t);case"hysteria2":return n9(t);case"ssh":return WD(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return t9(t);throw new Error(`Platform ${VD} does not support proxy type: ${t.type}`)}}}function GD(e){let t=new rt(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=fi[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"),ae(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"),ae(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 zD(e){let t=new rt(e);t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password");let r=fi[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"),QE(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"),ae(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 YD(e,t){let r=new rt(e);r.append(`${e.name}=${e.type},${e.server},${e.port}`),r.appendIfPresent(`,username=${e.uuid}`,"uuid");let n=fi[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"),QE(r,e,t),ae(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"),ae(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 WD(e){let t=new rt(e);t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${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=fi[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 XD(e){if(e.headers&&Object.keys(e.headers).length>0)throw new Error("headers is unsupported");let t=new rt(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");let n=fi[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"),ae(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 JD(e){let t=new rt(e);t.append(`${e.name}=direct`);let n=fi[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 ZD(e){let t=new rt(e),r=e.tls?"socks5-tls":"socks5";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password");let n=fi[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&&I.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"),ae(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 QD(e){let t=new rt(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=fi[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"),ae(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 e9(e){let t=new rt(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"),ae(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let n=fi[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"),ae(e,"tfo")?t.append(`,tfo=${e.tfo}`):ae(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"),ae(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 t9(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 rt(e);t.append(`# > WireGuard Proxy ${e.name}
# ${e.name}=wireguard`),e["section-name"]=Ut(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=fi[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"),ae(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"];a&&(a=`,preshared-key="${a}"`);let 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 r9(e){let t=new rt(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=fi[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"),ae(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 n9(e){if(e.obfs||e["obfs-password"])throw new Error("obfs is unsupported");let t=new rt(e);t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),ae(e,"ports")&&t.append(`,port-hopping="${e.ports.replace(/,/g,";")}"`),t.appendIfPresent(`,port-hopping-interval=${e["hop-interval"]}`,"hop-interval");let r=fi[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"),ae(e,"tfo")?t.append(`,tfo=${e.tfo}`):ae(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"),ae(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 QE(e,t,r){if(ae(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ae(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ae(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,i=Object.keys(n).map(a=>{let s=n[a];return["Host"].includes(a)&&(s=`"${s}"`),`${a}:${s}`}).join("|");Hi(i)&&e.append(`,ws-headers=${i}`)}}else if(r&&["http"].includes(t.network))I.info(`Include Unsupported Proxy: nework ${t.network} -> tcp`);else throw new Error(`network ${t.network} is unsupported`)}function zn(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&String(s.version)==="4"||["juicity"].includes(s.type)?!1:!(["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))).map(s=>{if(s.type==="vmess"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ae(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ae(s,"version")&&(s.version=5)):s.type==="hysteria"?(ae(s,"auth_str")&&!ae(s,"auth-str")&&(s["auth-str"]=s.auth_str),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(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"?ae(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"&&ae(s,"shadow-tls-password")&&!ae(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;ae(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ae(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;ae(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s["plugin-opts"]?.tls&&ae(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"],ae(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});return n==="internal"?a:`proxies:
`+a.map(s=>" - "+JSON.stringify(s)+`
`).join("")}}}var ew="SurgeMac",i9=xu();function A0(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return tw(t);default:try{return i9.produce(t,r,n)}catch{if(n.useMihomoExternal)return I.log(`${t.name} is not supported on ${ew}, try to use Mihomo(SurgeMac - External Proxy Program) instead`),s9(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 tw(e){let t=new rt(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"),ae(e,"tfo")?t.append(`,tfo=${e.tfo}`):ae(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 s9(e,t,r){let n=zn().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",Et.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 a9(e.server)?s.addresses.push(e.server):I.log(`Platform ${ew}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),r.localPort=i-1,tw(s)}}function a9(e){return vr(e)||ur(e)}function y0(){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"&&String(s.version)==="4"||s.type==="vless"&&(typeof s.flow<"u"||s["reality-opts"])?!1:s["underlying-proxy"]||s["dialer-proxy"]?(I.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"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(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"&&ae(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ae(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ae(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;ae(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s["plugin-opts"]?.tls&&ae(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"],ae(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 hh(){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"&&String(s.version)==="4"||s.type==="vless"&&s["reality-opts"]&&!["xtls-rprx-vision"].includes(s.flow)?!1:s["underlying-proxy"]||s["dialer-proxy"]?(I.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"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(s,"cipher")&&!["auto","aes-128-gcm","chacha20-poly1305","none"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ae(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),(!s.token||s.token.length===0)&&!ae(s,"version")&&(s.version=5)):s.type==="hysteria"?(ae(s,"auth_str")&&!ae(s,"auth-str")&&(s["auth-str"]=s.auth_str),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ae(s,"down")&&!ae(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ae(s,"up")&&!ae(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ae(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ae(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="hysteria2"?(ae(s,"password")&&!ae(s,"auth")&&(s.auth=s.password,delete s.password),ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),ae(s,"down")&&!ae(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),ae(s,"up")&&!ae(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),ae(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),ae(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"&&ae(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let u=s["http-opts"]?.path;ae(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ae(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;ae(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s["plugin-opts"]?.tls&&ae(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"],ae(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 o9="Loon",Hs={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function S0(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return u9(t);case"ssr":return c9(t);case"trojan":return l9(t);case"vmess":return f9(t,n["include-unsupported-proxy"]);case"vless":return h9(t,n["include-unsupported-proxy"]);case"http":return p9(t);case"socks5":return d9(t);case"wireguard":return g9(t);case"hysteria2":return m9(t)}throw new Error(`Platform ${o9} does not support proxy type: ${t.type}`)}}}function u9(e){let t=new rt(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}"`),ae(e,"plugin")){if(e.plugin==="obfs")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(ae(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=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function c9(e){let t=new rt(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"),ae(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=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function l9(e){let t=new rt(e);if(t.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,ae(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=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function f9(e){let t=!!e["reality-opts"],r=new rt(e);if(r.append(`${e.name}=vmess,${e.server},${e.port},${e.cipher},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ae(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")),ae(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=Hs[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${n}`,"ip-version"),r.toString()}function h9(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 rt(e);if(n.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,ae(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=Hs[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${i}`,"ip-version"),n.toString()}function p9(e){let t=new rt(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=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function d9(e){let t=new rt(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=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function g9(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 rt(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=>vr(u));s||(s=e.dns.find(u=>!vr(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=Hs[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 m9(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new rt(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=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function Nu(){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(Et.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)}`:Et.encode(i)}@${r.server}:${r.port}${r.plugin?"/":""}`,r.plugin){n+="?plugin=";let ue=r["plugin-opts"];switch(r.plugin){case"obfs":n+=encodeURIComponent(`simple-obfs;obfs=${ue.mode}${ue.host?";obfs-host="+ue.host:""}`);break;case"v2ray-plugin":n+=encodeURIComponent(`v2ray-plugin;obfs=${ue.mode}${ue.host?";obfs-host"+ue.host:""}${ue.tls?";tls":""}`);break;case"shadow-tls":n+=encodeURIComponent(`shadow-tls;host=${ue.host};password=${ue.password};version=${ue.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}:${Et.encode(r.password)}/`,n+=`?remarks=${Et.encode(r.name)}${r["obfs-param"]?"&obfsparam="+Et.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protocolparam="+Et.encode(r["protocol-param"]):""}`,n="ssr://"+Et.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 ue=r[`${r.network}-opts`]?.path,_e=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`]):(ue&&(n.path=Array.isArray(ue)?ue[0]:ue),_e&&(n.host=Array.isArray(_e)?_e[0]:_e))}n="vmess://"+Et.encode(JSON.stringify(n));break;case"vless":let u="none",l=r["reality-opts"],f="",d="",E="";if(l){u="reality";let ue=r["reality-opts"]?.["public-key"];ue&&(d=`&pbk=${encodeURIComponent(ue)}`);let _e=r["reality-opts"]?.["short-id"];_e&&(f=`&sid=${encodeURIComponent(_e)}`);let He=r["reality-opts"]?.["_spider-x"];He&&(E=`&spx=${encodeURIComponent(He)}`)}else r.tls&&(u="tls");let p="";r.alpn&&(p=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let h="";r["skip-cert-verify"]&&(h="&allowInsecure=1");let A="";r.sni&&(A=`&sni=${encodeURIComponent(r.sni)}`);let m="";r["client-fingerprint"]&&(m=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let S="";r.flow&&(S=`&flow=${encodeURIComponent(r.flow)}`);let w="";r._extra&&(w=`&extra=${encodeURIComponent(r._extra)}`);let y="";r._mode&&(y=`&mode=${encodeURIComponent(r._mode)}`);let _=r.network;r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(_="httpupgrade");let B=`&type=${encodeURIComponent(_)}`;if(["grpc"].includes(r.network)){B+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`;let ue=r[`${r.network}-opts`]?.["_grpc-authority"];ue&&(B+=`&authority=${encodeURIComponent(ue)}`)}let D=r[`${r.network}-opts`]?.[`${r.network}-service-name`],j=r[`${r.network}-opts`]?.path,q=r[`${r.network}-opts`]?.headers?.Host;j&&(B+=`&path=${encodeURIComponent(Array.isArray(j)?j[0]:j)}`),q&&(B+=`&host=${encodeURIComponent(Array.isArray(q)?q[0]:q)}`),D&&(B+=`&serviceName=${encodeURIComponent(D)}`),r.network==="kcp"&&(r.seed&&(B+=`&seed=${encodeURIComponent(r.seed)}`),r.headerType&&(B+=`&headerType=${encodeURIComponent(r.headerType)}`)),n=`vless://${r.uuid}@${r.server}:${r.port}?security=${encodeURIComponent(u)}${B}${p}${h}${A}${m}${S}${f}${E}${d}${y}${w}#${encodeURIComponent(r.name)}`;break;case"trojan":let F="";if(r.network){let ue=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(ue="httpupgrade"),F=`&type=${encodeURIComponent(ue)}`,["grpc"].includes(r.network)){let Sr=r[`${r.network}-opts`]?.[`${r.network}-service-name`],Ht=r[`${r.network}-opts`]?.["_grpc-authority"];Sr&&(F+=`&serviceName=${encodeURIComponent(Sr)}`),Ht&&(F+=`&authority=${encodeURIComponent(Ht)}`),F+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let _e=r[`${r.network}-opts`]?.path,He=r[`${r.network}-opts`]?.headers?.Host;_e&&(F+=`&path=${encodeURIComponent(Array.isArray(_e)?_e[0]:_e)}`),He&&(F+=`&host=${encodeURIComponent(Array.isArray(He)?He[0]:He)}`)}let P="";r["client-fingerprint"]&&(P=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let L="";r.alpn&&(L=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let M=r["reality-opts"],V="",W="",G="",z="",X="",ie="";if(M){z="&security=reality";let ue=r["reality-opts"]?.["public-key"];ue&&(W=`&pbk=${encodeURIComponent(ue)}`);let _e=r["reality-opts"]?.["short-id"];_e&&(V=`&sid=${encodeURIComponent(_e)}`);let He=r["reality-opts"]?.["_spider-x"];He&&(G=`&spx=${encodeURIComponent(He)}`),r._extra&&(ie=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(X=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${r.password}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${F}${L}${P}${z}${V}${W}${G}${X}${ie}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let Se=[];r["hop-interval"]&&Se.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&Se.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&Se.push("insecure=1"),r.obfs&&(Se.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&Se.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&Se.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&Se.push(`mport=${r.ports}`),r["tls-fingerprint"]&&Se.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&Se.push("fastopen=1"),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${Se.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let we=[];Object.keys(r).forEach(ue=>{if(!["name","type","server","port"].includes(ue)){let _e=ue.replace(/-/,"_");["alpn"].includes(ue)?r[ue]&&we.push(`${_e}=${encodeURIComponent(Array.isArray(r[ue])?r[ue][0]:r[ue])}`):["skip-cert-verify"].includes(ue)?r[ue]&&we.push("insecure=1"):["tfo","fast-open"].includes(ue)?r[ue]&&!we.includes("fastopen=1")&&we.push("fastopen=1"):["ports"].includes(ue)?we.push(`mport=${r[ue]}`):["auth-str"].includes(ue)?we.push(`auth=${r[ue]}`):["up"].includes(ue)?we.push(`upmbps=${r[ue]}`):["down"].includes(ue)?we.push(`downmbps=${r[ue]}`):["_obfs"].includes(ue)?we.push(`obfs=${r[ue]}`):["obfs"].includes(ue)?we.push(`obfsParam=${r[ue]}`):["sni"].includes(ue)?we.push(`peer=${r[ue]}`):r[ue]&&!/^_/i.test(ue)&&we.push(`${_e}=${encodeURIComponent(r[ue])}`)}}),n=`hysteria://${r.server}:${r.port}?${we.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let ue=[];Object.keys(r).forEach(_e=>{if(!["name","type","uuid","password","server","port","tls"].includes(_e)){let He=_e.replace(/-/,"_");["alpn"].includes(_e)?r[_e]&&ue.push(`${He}=${encodeURIComponent(Array.isArray(r[_e])?r[_e][0]:r[_e])}`):["skip-cert-verify"].includes(_e)?r[_e]&&ue.push("allow_insecure=1"):["tfo","fast-open"].includes(_e)?r[_e]&&!ue.includes("fast_open=1")&&ue.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(_e)&&r[_e]?ue.push(`${He.replace(/-/g,"_")}=1`):["congestion-controller"].includes(_e)?ue.push(`congestion_control=${r[_e]}`):r[_e]&&!/^_/i.test(_e)&&ue.push(`${He.replace(/-/g,"_")}=${encodeURIComponent(r[_e])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${ue.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":let Ie=[];Object.keys(r).forEach(ue=>{if(!["name","type","password","server","port","tls"].includes(ue)){let _e=ue.replace(/-/,"_");["alpn"].includes(ue)?r[ue]&&Ie.push(`${_e}=${encodeURIComponent(Array.isArray(r[ue])?r[ue][0]:r[ue])}`):["skip-cert-verify"].includes(ue)?r[ue]&&Ie.push("insecure=1"):["udp"].includes(ue)?r[ue]&&Ie.push("udp=1"):r[ue]&&!/^_/i.test(ue)&&Ie.push(`${_e.replace(/-/g,"_")}=${encodeURIComponent(r[ue])}`)}}),n=`anytls://${encodeURIComponent(r.password)}@${r.server}:${r.port}/?${Ie.join("&")}#${encodeURIComponent(r.name)}`;break;case"wireguard":let Ve=[];Object.keys(r).forEach(ue=>{["name","type","server","port","ip","ipv6","private-key"].includes(ue)||(["public-key"].includes(ue)?Ve.push(`publickey=${r[ue]}`):["udp"].includes(ue)?r[ue]&&Ve.push(`${ue}=1`):r[ue]&&!/^_/i.test(ue)&&Ve.push(`${ue}=${encodeURIComponent(r[ue])}`))}),r.ip&&r.ipv6?Ve.push(`address=${r.ip}/32,${r.ipv6}/128`):r.ip?Ve.push(`address=${r.ip}/32`):r.ipv6&&Ve.push(`address=${r.ipv6}/128`),n=`wireguard://${encodeURIComponent(r["private-key"])}@${r.server}:${r.port}/?${Ve.join("&")}#${encodeURIComponent(r.name)}`;break}return n}}}var v9=Nu();function nl(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(v9.produce(i))}catch(a){I.error(`Cannot produce proxy: ${JSON.stringify(i,null,2)}
Reason: ${a}`)}}),Et.encode(n.join(`
`))}}}var E9="QX";function il(){return{produce:(t,r,n={})=>{switch(t.type){case"ss":return w9(t);case"ssr":return A9(t);case"trojan":return y9(t);case"vmess":return S9(t);case"http":return C9(t);case"socks5":return _9(t);case"vless":return b9(t)}throw new Error(`Platform ${E9} does not support proxy type: ${t.type}`)}}}function w9(e){let t=new rt(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}`),Yn(e)&&(e.tls=!0),ae(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 Yn(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 A9(e){let t=new rt(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 y9(e){let t=new rt(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),ae(e,"network"))if(e.network==="ws")Yn(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"&&Yn(e)&&r(",over-tls=true"),Yn(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 S9(e){let t=new rt(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}`),Yn(e)&&(e.tls=!0),ae(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 Yn(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")),ae(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 b9(e){if(typeof e.flow<"u"||e["reality-opts"])throw new Error("VLESS XTLS/REALITY is not supported");let t=new rt(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}`),Yn(e)&&(e.tls=!0),ae(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 Yn(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 C9(e){let t=new rt(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"),Yn(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Yn(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 _9(e){let t=new rt(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"),Yn(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Yn(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 Yn(e){return e.tls}function sl(){return{type:"ALL",produce:(r,n,i={})=>{let a=r.filter(s=>i["include-unsupported-proxy"]?!0:s.type==="snell"&&String(s.version)==="4"?!1:!["mieru"].includes(s.type)).map(s=>{if(s.type==="vmess"?(ae(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),ae(s,"sni")&&(s.servername=s.sni,delete s.sni),ae(s,"cipher")&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(s.cipher)&&(s.cipher="auto")):s.type==="tuic"?(ae(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!ae(s,"version")&&(s.version=5)):s.type==="hysteria"?(ae(s,"auth_str")&&!ae(s,"auth-str")&&(s["auth-str"]=s.auth_str),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(s,"fast-open")&&(s["fast-open"]=s.tfo)):s.type==="hysteria2"?(s["obfs-password"]&&s.obfs=="salamander"&&(s.obfs=s["obfs-password"],delete s["obfs-password"]),ae(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),ae(s,"tfo")&&!ae(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"?ae(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"&&ae(s,"shadow-tls-password")&&!ae(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;ae(s,"http-opts.path")&&!Array.isArray(u)&&(s["http-opts"].path=[u]);let l=s["http-opts"]?.headers?.Host;ae(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;ae(s,"h2-opts.path")&&Array.isArray(u)&&(s["h2-opts"].path=u[0]);let l=s["h2-opts"]?.headers?.host;ae(s,"h2-opts.headers.Host")&&!Array.isArray(l)&&(s["h2-opts"].headers.host=[l])}if(s["plugin-opts"]?.tls&&ae(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"],ae(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 F9="Surfboard";function ph(){return{produce:t=>{switch(t.name=t.name.replace(/=|,/g,""),t.type){case"ss":return I9(t);case"trojan":return $9(t);case"vmess":return D9(t);case"http":return B9(t);case"socks5":return R9(t);case"wireguard-surge":return P9(t)}throw new Error(`Platform ${F9} does not support proxy type: ${t.type}`)}}}function I9(e){let t=new rt(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"),ae(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 $9(e){let t=new rt(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),rw(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 D9(e){let t=new rt(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),rw(t,e),ae(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 B9(e){let t=new rt(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 R9(e){let t=new rt(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 P9(e){let t=new rt(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.toString()}function rw(e,t){if(ae(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),ae(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),ae(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("|");Hi(n)&&e.append(`,ws-headers=${n}`)}}else throw new Error(`network ${t.network} is unsupported`)}var Rn=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},Ms=(e,t)=>{["tcp","udp"].includes(e._network)&&(t.network=e._network)},Wn=(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},es=(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))))},b0=(e,t)=>{let r={type:"ws",headers:{}};if(e["ws-opts"]){let{path:n="",headers:i={}}=e["ws-opts"];if(n!==""&&(r.path=`${n}`),Object.keys(i).length>0){let a={};for(let u of Object.keys(i)){let l=i[u];l!==""&&(Array.isArray(l)||(l=[`${l}`]),l.length>0&&(a[u]=l))}let{Host:s}=a;if(s.length===1)for(let u of`Host:${s[0]}`.split(`
`)){let[l,f]=u.split(":");f.trim()!==""&&(a[l.trim()]=f.trim().split(","))}r.headers=a}}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},T9=(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(r.host){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}},O9=(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},C0=(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},va=(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"]}),t.tls.enabled||delete t.tls},x9=(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),Wn(e,t),Rn(e,t),t},N9=(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),Wn(e,t),Rn(e,t),va(e,t),t},k9=(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),Ms(e,t),Wn(e,t),Rn(e,t),t},L9=(e={})=>{let t={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:`${e.name}_shadowtls`},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),Wn(e,r),Rn(e,r),es(e.smux,t),{type:"ss-with-st",ssPart:t,stPart:r}},U9=(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),Ms(e,t),Wn(e,t),Rn(e,t),es(e.smux,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},H9=(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),Wn(e,t),Rn(e,t),es(e.smux,t),t},M9=(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"&&b0(e,t),e.network==="h2"&&O9(e,t),e.network==="http"&&T9(e,t),e.network==="grpc"&&C0(e,t),Ms(e,t),Wn(e,t),Rn(e,t),va(e,t),es(e.smux,t),t},j9=(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==="xtls-rprx-vision"&&(t.flow=e.flow),e.network==="ws"&&b0(e,t),e.network==="grpc"&&C0(e,t),Ms(e,t),Wn(e,t),Rn(e,t),es(e.smux,t),va(e,t),t},q9=(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"&&C0(e,t),e.network==="ws"&&b0(e,t),Ms(e,t),Wn(e,t),Rn(e,t),va(e,t),es(e.smux,t),t},K9=(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.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)),Ms(e,t),va(e,t),Rn(e,t),Wn(e,t),es(e.smux,t),t},V9=(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=>r.replace(/\s*-\s*/g,":"))),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,Ms(e,t),va(e,t),Wn(e,t),Rn(e,t),es(e.smux,t),t},G9=(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`),Ms(e,t),Wn(e,t),Rn(e,t),va(e,t),es(e.smux,t),t},z9=(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`),Rn(e,t),va(e,t),t},Y9=(e={})=>{let t=["ip","ipv6"].map(n=>e[n]).map(n=>{if(vr(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 Ms(e,r),Wn(e,r),Rn(e,r),es(e.smux,r),r};function dh(){return{type:"ALL",produce:(r,n,i={})=>{let a=[];return zn().produce(r,"internal",{"include-unsupported-proxy":!0}).map(s=>{try{switch(s.type){case"ssh":a.push(x9(s));break;case"http":a.push(N9(s));break;case"socks5":if(s.tls)throw new Error(`Platform sing-box does not support proxy type: ${s.type} with tls`);a.push(k9(s));break;case"ss":if(s.plugin==="shadow-tls"){let{ssPart:u,stPart:l}=L9(s);a.push(u),a.push(l)}else a.push(U9(s));break;case"ssr":if(i["include-unsupported-proxy"])a.push(H9(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(M9(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(j9(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(q9(s));else throw new Error(`Platform sing-box does not support proxy type: ${s.type} with flow ${s.flow}`);break;case"hysteria":a.push(K9(s));break;case"hysteria2":a.push(V9(s,i["include-unsupported-proxy"]));break;case"tuic":if(!s.token||s.token.length===0)a.push(G9(s));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":a.push(Y9(s));break;case"anytls":a.push(z9(s));break;default:throw new Error(`Platform sing-box does not support proxy type: ${s.type}`)}}catch(u){I.error(u.message??u)}}),n==="internal"?a:JSON.stringify({outbounds:a},null,2)}}}function gh(){return{type:"ALL",produce:(r,n)=>{let i=r.filter(a=>!(!["http","socks5","ss","trojan","hysteria2","vless","vmess","tuic"].includes(a.type)||a.type==="ss"&&(a.plugin==="obfs"&&!["http","tls"].includes(a["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(a.cipher))||a.type==="vmess"&&!["http","ws","tcp"].includes(a.network)&&a.network||a.type==="trojan"&&!["http","ws","tcp"].includes(a.network)&&a.network||a.type==="vless"&&(typeof a.flow<"u"||a["reality-opts"]||!["http","ws","tcp"].includes(a.network)&&a.network)||a.type==="tuic"&&a.token&&a.token.length!==0)).map(a=>{let s={...a};a.tls&&!a.sni&&(a.sni=a.server);let u=a.prev_hop||a["underlying-proxy"]||a["dialer-proxy"]||a.detour;if(a.type==="http")a={type:"http",name:a.name,server:a.server,port:a.port,username:a.username,password:a.password,tfo:a.tfo||a["fast-open"],next_hop:a.next_hop};else if(a.type==="socks5")a={type:"socks5",name:a.name,server:a.server,port:a.port,username:a.username,password:a.password,tfo:a.tfo||a["fast-open"],udp_relay:a.udp||a.udp_relay||a.udp_relay,next_hop:a.next_hop};else if(a.type==="ss")a={type:"shadowsocks",name:a.name,method:a.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":a.cipher,server:a.server,port:a.port,password:a.password,tfo:a.tfo||a["fast-open"],udp_relay:a.udp||a.udp_relay||a.udp_relay,next_hop:a.next_hop},s.plugin==="obfs"&&(a.obfs=s["plugin-opts"].mode,a.obfs_host=s["plugin-opts"].host,a.obfs_uri=s["plugin-opts"].path);else if(a.type==="hysteria2")a={type:"hysteria2",name:a.name,server:a.server,port:a.port,auth:a.password,tfo:a.tfo||a["fast-open"],udp_relay:a.udp||a.udp_relay||a.udp_relay,next_hop:a.next_hop,sni:a.sni,skip_tls_verify:a["skip-cert-verify"],port_hopping:a.ports,port_hopping_interval:a["hop-interval"]},s["obfs-password"]&&s.obfs=="salamander"&&(a.obfs="salamander",a.obfs_password=s["obfs-password"]);else if(a.type==="tuic")a={type:"tuic",name:a.name,server:a.server,port:a.port,uuid:a.uuid,password:a.password,next_hop:a.next_hop,sni:a.sni,alpn:Array.isArray(a.alpn)?a.alpn:[a.alpn||"h3"],skip_tls_verify:a["skip-cert-verify"],port_hopping:a.ports,port_hopping_interval:a["hop-interval"]};else if(a.type==="trojan")a.network==="ws"&&(a.websocket={path:a["ws-opts"]?.path,host:a["ws-opts"]?.headers?.Host}),a={type:"trojan",name:a.name,server:a.server,port:a.port,password:a.password,tfo:a.tfo||a["fast-open"],udp_relay:a.udp||a.udp_relay||a.udp_relay,next_hop:a.next_hop,sni:a.sni,skip_tls_verify:a["skip-cert-verify"],websocket:a.websocket};else if(a.type==="vmess"){let l=a.cipher;l&&!["auto","none","zero","aes-128-gcm","chacha20-poly1305"].includes(l)&&(l="auto"),a.network==="ws"?a.transport={[a.tls?"wss":"ws"]:{path:a["ws-opts"]?.path,headers:{Host:a["ws-opts"]?.headers?.Host},sni:a.tls?a.sni:void 0,skip_tls_verify:a.tls?a["skip-cert-verify"]:void 0}}:a.network==="http"?a.transport={http1:{method:a["http-opts"]?.method,path:Array.isArray(a["http-opts"]?.path)?a["http-opts"]?.path[0]:a["http-opts"]?.path,headers:{Host:Array.isArray(a["http-opts"]?.headers?.Host)?a["http-opts"]?.headers?.Host[0]:a["http-opts"]?.headers?.Host},skip_tls_verify:a["skip-cert-verify"]}}:a.network==="h2"?a.transport={http2:{method:a["h2-opts"]?.method,path:Array.isArray(a["h2-opts"]?.path)?a["h2-opts"]?.path[0]:a["h2-opts"]?.path,headers:{Host:Array.isArray(a["h2-opts"]?.headers?.Host)?a["h2-opts"]?.headers?.Host[0]:a["h2-opts"]?.headers?.Host},skip_tls_verify:a["skip-cert-verify"]}}:(a.network==="tcp"||!a.network)&&a.tls&&(a.transport={tls:{sni:a.tls?a.sni:void 0,skip_tls_verify:a.tls?a["skip-cert-verify"]:void 0}}),a={type:"vmess",name:a.name,server:a.server,port:a.port,user_id:a.uuid,security:l,tfo:a.tfo||a["fast-open"],legacy:a.legacy,udp_relay:a.udp||a.udp_relay||a.udp_relay,next_hop:a.next_hop,transport:a.transport}}else a.type==="vless"&&(a.network==="ws"?a.transport={[a.tls?"wss":"ws"]:{path:a["ws-opts"]?.path,headers:{Host:a["ws-opts"]?.headers?.Host},sni:a.tls?a.sni:void 0,skip_tls_verify:a.tls?a["skip-cert-verify"]:void 0}}:a.network==="http"?a.transport={http:{method:a["http-opts"]?.method,path:Array.isArray(a["http-opts"]?.path)?a["http-opts"]?.path[0]:a["http-opts"]?.path,headers:{Host:Array.isArray(a["http-opts"]?.headers?.Host)?a["http-opts"]?.headers?.Host[0]:a["http-opts"]?.headers?.Host},skip_tls_verify:a["skip-cert-verify"]}}:(a.network==="tcp"||!a.network)&&(a.transport={[a.tls?"tls":"tcp"]:{sni:a.tls?a.sni:void 0,skip_tls_verify:a.tls?a["skip-cert-verify"]:void 0}}),a={type:"vless",name:a.name,server:a.server,port:a.port,user_id:a.uuid,security:a.cipher,tfo:a.tfo||a["fast-open"],legacy:a.legacy,udp_relay:a.udp||a.udp_relay||a.udp_relay,next_hop:a.next_hop,transport:a.transport});if(["http","socks5","ss","trojan","vless","vmess"].includes(s.type)){if(ae(s,"shadow-tls-password")){if(s["shadow-tls-version"]!=3)throw new Error(`shadow-tls version ${s["shadow-tls-version"]} is not supported`);a.shadow_tls={password:s["shadow-tls-password"],sni:s["shadow-tls-sni"]}}else if(["shadow-tls"].includes(s.plugin)&&s["plugin-opts"]){if(s["plugin-opts"].version!=3)throw new Error(`shadow-tls version ${s["plugin-opts"].version} is not supported`);a.shadow_tls={password:s["plugin-opts"].password,sni:s["plugin-opts"].host}}}if(delete a.subName,delete a.collectionName,delete a.id,delete a.resolved,delete a["no-resolve"],n!=="internal")for(let l in a)(a[l]==null||/^_/i.test(l))&&delete a[l];return{[a.type]:{...a,type:void 0,prev_hop:u}}});return n==="internal"?i:`proxies:
`+i.map(a=>" - "+JSON.stringify(a)+`
`).join("")}}}function nw(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var mh={qx:il(),QX:il(),QuantumultX:il(),surge:xu(),Surge:xu(),SurgeMac:A0(),Loon:S0(),Clash:y0(),meta:zn(),clashmeta:zn(),"clash.meta":zn(),"Clash.Meta":zn(),ClashMeta:zn(),mihomo:zn(),Mihomo:zn(),uri:Nu(),URI:Nu(),v2:nl(),v2ray:nl(),V2Ray:nl(),json:nw(),JSON:nw(),stash:hh(),Stash:hh(),shadowrocket:sl(),Shadowrocket:sl(),ShadowRocket:sl(),surfboard:ph(),Surfboard:ph(),singbox:dh(),"sing-box":dh(),egern:gh(),Egern:gh()};var cA=Cn(hl()),nR=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/fast_open/tfo/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/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; }
password = comma match:[^,]+ { proxy.password = match.join(""); }
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(""); }
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();
})
obfs["ws-headers"] = result;
}
ws_path = comma "ws-path" equals path:uri { obfs.path = path; }
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 [^=,]+
`,K0;function Jn(){return K0||(K0=cA.generate(nR)),K0}var lA=Cn(hl()),iR=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_host/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_host/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_host/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_host/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_host/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_host/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_host = comma sni:("tls-name"/"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 [^=,]+
`,V0;function ts(){return V0||(V0=lA.generate(iR)),V0}var fA=Cn(hl()),sR=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" }
`,G0;function qs(){return G0||(G0=fA.generate(sR)),G0}var hA=Cn(hl()),aR=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);
}
`,z0;function Y0(){return z0||(z0=hA.generate(aR)),z0}function pA(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 oR(){return{name:"URI PROXY Parser",test:n=>/^(socks5\+tls|socks5|http|https):\/\//.test(n),parse:n=>{let[i,a,s,u,l,f,d,E,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 I.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);I.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 uR(){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 I.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);let E,p;if(s){let A=Et.decode(decodeURIComponent(s)).split(":");E=A[0],p=A[1]}return{name:d!=null?decodeURIComponent(d):`${a} ${u}:${l}`,type:"socks5",server:u,port:l,username:E,password:p}}}}function cR(){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=Et.decode(l);let d="";if(u)i.includes("?")&&(d=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let S=i.match(/^(.*)(\?.*)$/);i=S[1],d=S[2]}if(i=Et.decode(i),d){if(/(&|\?)v2ray-plugin=/.test(d)){let w=d.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];w&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(Et.decode(w)))}i=`${i}${d}`}f=i.match(/(^.*)@/)?.[1],u=i.match(/@([^/@]*)(\/|$)/)}let E=u[1],p=E.lastIndexOf(":");s.server=E.substring(0,p),s.port=`${E.substring(p+1)}`.match(/\d+/)?.[0];let h=f.match(/(^.*?):(.*$)/);s.cipher=h?.[1],s.password=h?.[2];let A=i.match(/[?&]plugin=([^&]+)/),m=i.match(/[?&]shadow-tls=([^&]+)/);if(A){let S=("plugin="+decodeURIComponent(A[1])).split(";"),w={};for(let y of S){let[_,B]=y.split("=");_&&(w[_]=B||!0)}switch(w.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:w.obfs,host:Ut(w["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:"websocket",host:Ut(w["obfs-host"]),path:Ut(w.path),tls:ou(w.tls)};break;case"shadow-tls":{s.plugin="shadow-tls";let y=Ut(w.version);s["plugin-opts"]={host:Ut(w.host),password:Ut(w.password),version:y?parseInt(y,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${w.plugin}`)}}if(m){let S=JSON.parse(Et.decode(m[1])),w=Ut(S.version),y=Ut(S.address),_=Ut(S.port);s.plugin="shadow-tls",s["plugin-opts"]={host:Ut(S.host),password:Ut(S.password),version:w?parseInt(w,10):void 0},y&&(s.server=y),_&&(s.port=parseInt(_,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 lR(){return{name:"URI SSR Parser",test:n=>/^ssr:\/\//.test(n),parse:n=>{n=Et.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:Et.decode(l[3])},d={};if(n=n.split("/?")[1].split("&"),n.length>1)for(let E of n){let[p,h]=E.split("=");h=h.trim(),h.length>0&&h!=="(null)"&&(d[p]=h)}return f={...f,name:d.remarks?Et.decode(d.remarks):f.server,"protocol-param":Ut(Et.decode(d.protoparam||"").replace(/\s/g,"")),"obfs-param":Ut(Et.decode(d.obfsparam||"").replace(/\s/g,""))},f}}}function fR(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{n=n.split("vmess://")[1];let i=Et.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:Ut(a[3],"auto"),uuid:a[4].match(/^"(.*)"$/)[1],tls:s.obfs==="wss",udp:ou(s["udp-relay"]),tfo:ou(s["fast-open"]),"skip-cert-verify":au(s["tls-verification"])?!s["tls-verification"]:void 0};if(au(s.obfs))if(s.obfs==="ws"||s.obfs==="wss"){u.network="ws",u["ws-opts"].path=(Ut(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]),Hi(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[E,p,h]=/(^[^?]+?)\/?\?(.*)$/.exec(n);i=Et.decode(p);for(let _ of h.split("&")){let[B,D]=_.split("="),j=D;j=decodeURIComponent(D),j.indexOf(",")===-1?a[B]=j:a[B]=j.split(",")}let[A,m,S,w,y]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(i);a.scy=m,a.id=S,a.port=y,a.add=w}let s=a.add,u=parseInt(ou(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(ou(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":au(a.verify_cert)?!a.verify_cert:void 0};!l["skip-cert-verify"]&&au(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 E=a.path;if(["ws"].includes(l.network)&&(E=E||"/"),l.network==="http"&&(d&&(d=d.split(",").map(p=>p.trim()),d=Array.isArray(d)?d[0]:d),E?E=Array.isArray(E)?E[0]:E:E="/"),E||d||["kcp","quic"].includes(l.network))if(["grpc"].includes(l.network))l[`${l.network}-opts`]={"grpc-service-name":Ut(E),"_grpc-type":Ut(a.type),"_grpc-authority":Ut(a.authority)};else if(["kcp","quic"].includes(l.network))l[`${l.network}-opts`]={[`_${l.network}-type`]:Ut(a.type),[`_${l.network}-host`]:Ut(Ut(d)),[`_${l.network}-path`]:Ut(E)};else{let p={path:Ut(E),headers:{Host:Ut(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 hR(){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[S,w,y]=/^(.*?)(\?.*?$)/.exec(n);n=`${Et.decode(w)}${y}`,a=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),i=!0}let[s,u,l,f,d,E="",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},A={};for(let S of E.split("&")){let[w,y]=S.split("="),_=y;_=decodeURIComponent(y),A[w]=_}if(h.name=p??A.remarks??A.remark??`VLESS ${l}:${f}`,h.tls=A.security&&A.security!=="none",i&&/TRUE|1/i.test(A.tls)&&(h.tls=!0,A.security=A.security??"reality"),h.sni=A.sni||A.peer,h.flow=A.flow,!h.flow&&i&&A.xtls){let S=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][A.xtls];S&&(h.flow=S)}if(h["client-fingerprint"]=A.fp,h.alpn=A.alpn?A.alpn.split(","):void 0,h["skip-cert-verify"]=/(TRUE)|1/i.test(A.allowInsecure),["reality"].includes(A.security)){let S={};A.pbk&&(S["public-key"]=A.pbk),A.sid&&(S["short-id"]=A.sid),A.spx&&(S["_spider-x"]=A.spx),Object.keys(S).length>0&&(h[`${A.security}-opts`]=S)}let m=!1;if(h.network=A.type,h.network==="tcp"&&A.headerType==="http"?h.network="http":h.network==="httpupgrade"&&(h.network="ws",m=!0),!h.network&&i&&A.obfs&&(h.network=A.obfs,["none"].includes(h.network)&&(h.network="tcp")),["websocket"].includes(h.network)&&(h.network="ws"),h.network&&!["tcp","none"].includes(h.network)){let S={},w=A.host??A.obfsParam;if(w)if(A.obfsParam)try{let y=JSON.parse(w);S.headers=y}catch{S.headers={Host:w}}else S.headers={Host:w};A.serviceName?(S[`${h.network}-service-name`]=A.serviceName,["grpc"].includes(h.network)&&A.authority&&(S["_grpc-authority"]=A.authority)):i&&A.path&&(["ws","http","h2"].includes(h.network)||(S[`${h.network}-service-name`]=A.path,delete A.path)),A.path&&(S.path=A.path),["grpc"].includes(h.network)&&(S["_grpc-type"]=A.mode||"gun"),m&&(S["v2ray-http-upgrade"]=!0,S["v2ray-http-upgrade-fast-open"]=!0),Object.keys(S).length>0&&(h[`${h.network}-opts`]=S),h.network==="kcp"&&(A.seed&&(h.seed=A.seed),h.headerType=A.headerType||"none"),A.mode&&(h._mode=A.mode),A.extra&&(h._extra=A.extra)}return h}}}function pR(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{n=n.split(/anytls:\/\//)[1];let[i,a,s,u,l="",f]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);a=decodeURIComponent(a),u=parseInt(`${u}`,10),isNaN(u)&&(u=443),a=decodeURIComponent(a),f!=null&&(f=decodeURIComponent(f)),f=f??`AnyTLS ${s}:${u}`;let d={type:"anytls",name:f,server:s,port:u,password:a};for(let E of l.split("&")){let[p,h]=E.split("=");p=p.replace(/_/g,"-"),h=decodeURIComponent(h),["alpn"].includes(p)?d[p]=h?h.split(","):void 0:["insecure"].includes(p)?d["skip-cert-verify"]=/(TRUE)|1/i.test(h):["udp"].includes(p)?d[p]=/(TRUE)|1/i.test(h):d[p]=h}return d}}}function dR(){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,E,p,h,A,m="",S]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);/^\d+$/.test(f)?(f=parseInt(`${f}`,10),isNaN(f)&&(f=443)):f?(i=f,f=xc(i)):f=443,s=decodeURIComponent(s),S!=null&&(S=decodeURIComponent(S)),S=S??`Hysteria2 ${u}:${f}`;let w={type:"hysteria2",name:S,server:u,port:f,ports:i,password:s},y={};for(let D of m.split("&")){let[j,q]=D.split("="),F=q;F=decodeURIComponent(q),y[j]=F}w.sni=y.sni,!w.sni&&y.peer&&(w.sni=y.peer),y.obfs&&y.obfs!=="none"&&(w.obfs=y.obfs),y.mport&&(w.ports=y.mport),w["obfs-password"]=y["obfs-password"],w["skip-cert-verify"]=/(TRUE)|1/i.test(y.insecure),w.tfo=/(TRUE)|1/i.test(y.fastopen),w["tls-fingerprint"]=y.pinSHA256;let _=y["hop-interval"]||y.hop_interval;/^\d+$/.test(_)&&(w["hop-interval"]=parseInt(`${_}`,10));let B=y.keepalive;return/^\d+$/.test(B)&&(w.keepalive=parseInt(`${B}`,10)),w}}}function gR(){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 E={type:"hysteria",name:d,server:a,port:u},p={};for(let h of f.split("&")){let[A,m]=h.split("=");A=A.replace(/_/,"-"),m=decodeURIComponent(m),["alpn"].includes(A)?E[A]=m?m.split(","):void 0:["insecure"].includes(A)?E["skip-cert-verify"]=/(TRUE)|1/i.test(m):["auth"].includes(A)?E["auth-str"]=m:["mport"].includes(A)?E.ports=m:["obfsParam"].includes(A)?E.obfs=m:["upmbps"].includes(A)?E.up=m:["downmbps"].includes(A)?E.down=m:["obfs"].includes(A)?E._obfs=m||"":["fast-open","peer"].includes(A)?p[A]=m:E[A]=m}return!E.sni&&p.peer&&(E.sni=p.peer),!E["fast-open"]&&p.fastopen&&(E["fast-open"]=!0),E.protocol||(E.protocol="udp"),E}}}function mR(){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,...E]=a.split(":"),p=E.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 A of l.split("&")){let[m,S]=A.split("=");m=m.replace(/_/g,"-"),S=decodeURIComponent(S),["alpn"].includes(m)?h[m]=S?S.split(","):void 0:["allow-insecure"].includes(m)?h["skip-cert-verify"]=/(TRUE)|1/i.test(S):["fast-open"].includes(m)?h.tfo=!0:["disable-sni","reduce-rtt"].includes(m)?h[m]=/(TRUE)|1/i.test(S):m==="congestion-control"?(h["congestion-controller"]=S,delete h[m]):h[m]=S}return h}}}function vR(){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,E="",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 A of E.split("&")){let[m,S]=A.split("=");if(m=m.replace(/_/,"-"),S=decodeURIComponent(S),["reserved"].includes(m)){let w=S.split(",").map(y=>parseInt(y.trim(),10)).filter(y=>Number.isInteger(y));w.length===3&&(h[m]=w)}else if(["address","ip"].includes(m))S.split(",").map(w=>{let y=w.trim().replace(/\/\d+$/,"").replace(/^\[/,"").replace(/\]$/,"");vr(y)?h.ip=y:ur(y)&&(h.ipv6=y)});else if(["mtu"].includes(m)){let w=parseInt(S.trim(),10);Number.isInteger(w)&&(h[m]=w)}else/publickey/i.test(m)?h["public-key"]=S:/privatekey/i.test(m)?h["private-key"]=S:["udp"].includes(m)?h[m]=/(TRUE)|1/i.test(S):["flag"].includes(m)||(h[m]=S)}return h}}}function ER(){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=Y0().parse(s);if(Hi(u))try{f.name=decodeURIComponent(u)}catch(d){console.log(d)}return f}}}function wR(){return{name:"Clash Parser",test:n=>{try{JSON.parse(n)}catch{return!1}return!0},parse:n=>{let i=JSON.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 AR(){return{name:"QX SS Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")===-1,parse:n=>qs().parse(n)}}function yR(){return{name:"QX SSR Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")!==-1,parse:n=>qs().parse(n)}}function SR(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>qs().parse(n)}}function bR(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>qs().parse(n)}}function CR(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>qs().parse(n)}}function _R(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>qs().parse(n)}}function FR(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>qs().parse(n)}}function IR(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>ts().parse(n)}}function $R(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>ts().parse(n)}}function DR(){return{name:"Loon VMess Parser",test:n=>/^.*=\s*vmess/i.test(n.split(",")[0])&&n.indexOf("username")===-1,parse:n=>ts().parse(n)}}function BR(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>ts().parse(n)}}function RR(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>ts().parse(n)}}function PR(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>ts().parse(n)}}function TR(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>ts().parse(n)}}function OR(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>ts().parse(n)}}function xR(){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 E=a.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];E&&(E=JSON.parse(E));let p,h=n.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],A=n.match(/(,|^)\s*?dnsv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2];(h||A)&&(p=[],h&&p.push(h),A&&p.push(A));let m=a.match(/(,|^)\s*?allowed-ips\s*?=\s*?"(.+?)"\s*?(,|$)/i)?.[2]?.split(",").map(D=>D.trim()),S=a.match(/(,|^)\s*?preshared-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],w=n.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],y=n.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],_=a.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],B={type:"wireguard",name:i,server:u,port:l,ip:w,ipv6:y,"private-key":n.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":_,mtu:f,keepalive:d,reserved:E,"allowed-ips":m,"preshared-key":S,dns:p,udp:!0,peers:[{server:u,port:l,ip:w,ipv6:y,"public-key":_,"pre-shared-key":S,"allowed-ips":m,reserved:E}]};return Array.isArray(B.dns)&&B.dns.length>0&&(B["remote-dns-resolve"]=!0),B}}}function NR(){return{name:"Surge Direct Parser",test:n=>/^.*=\s*direct/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function kR(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function LR(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function UR(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1,parse:n=>Jn().parse(n)}}function HR(){return{name:"Surge Trojan Parser",test:n=>/^.*=\s*trojan/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function MR(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function jR(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function qR(){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,E,p=[];for(;(E=d.exec(n))!==null;)E[3]!=null?p.push(E[3]):E[4]!=null&&p.push(E[4]);let h=/(,|^)\s*?addresses\s*?=\s*("(.*?)"|(.*?))(?=\s*?(,|$))/g,A,m=[];for(;(A=h.exec(n))!==null;){let w;A[3]!=null?w=A[3]:A[4]!=null&&(w=A[4]),w!=null&&(w=`${w}`.trim().replace(/^\[/,"").replace(/\]$/,"")),YR(w)&&m.push(w)}return{type:"external",name:s,exec:l,"local-port":f,args:p,addresses:m}}}}function KR(){return{name:"Surge Snell Parser",test:n=>/^.*=\s*snell/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function VR(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=pA(n),s=Jn().parse(a);return s.ports=i,s}}}function GR(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>Jn().parse(n)}}function zR(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>{let{port_hopping:i,line:a}=pA(n),s=Jn().parse(a);return s.ports=i,s}}}function YR(e){return vr(e)||ur(e)}var dA=[oR(),uR(),cR(),lR(),fR(),hR(),mR(),vR(),gR(),dR(),ER(),pR(),wR(),NR(),kR(),LR(),UR(),HR(),MR(),KR(),VR(),GR(),zR(),jR(),qR(),IR(),$R(),DR(),BR(),PR(),RR(),TR(),OR(),xR(),AR(),yR(),SR(),bR(),CR(),_R(),FR()];var di=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=Ir(),{defaultProxy,defaultTimeout:timeout}=I.read(Ft),proxy=defaultProxy;I.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=wi({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?Cs(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=wi({baseURL:"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?Cs(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);I.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})`)}};function WR(e){for(let t of fh)try{if(t.test(e))return I.info(`Pre-processor [${t.name}] activated`),t.parse(e)}catch(r){I.error(`Parser [${t.name}] failed
Reason: ${r}`)}return e}function XR(e){e=WR(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]=gA(n,i);u||(r.push(vA(s)),a=!0)}if(!a)for(let s of dA){let[u,l]=gA(s,i);if(!l){r.push(vA(u)),n=s,a=!0,I.info(`${s.name} is activated`);break}}a||I.error(`Failed to parse line: ${i}`)}return r.filter(i=>(["vless","vmess"].includes(i.type)&&(bf(i.uuid)||I.error(`UUID may be invalid: ${i.name} ${i.uuid}`)),!0))}async function JR(proxies,operators=[],targetPlatform,source,$options){for(let item of operators){if(item.disabled){I.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"?Gr:vt,n=Je(I.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);e==="module"?script=n.content:script=await Pr({type:"file",name:t})}catch(t){throw I.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=require("fs");script=fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw I.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 yr(url)}catch(e){throw I.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(!lh[item.type]){I.error(`Unknown operator: "${item.type}"`);continue}I.log(`Applying "${item.type}" with arguments:
>>> ${JSON.stringify(item.args,null,2)||"None"}`);let processor;item.type.indexOf("Script")!==-1?processor=lh[item.type](script,targetPlatform,$arguments,source,$options):processor=lh[item.type](item.args||{}),proxies=await JE(processor,proxies)}return proxies}function ZR(e,t,r,n={}){let i=mh[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)&&(bf(s.uuid)||I.error(`UUID may be invalid: ${s.name} ${s.uuid}`)),!0)),e=e.map(s=>(s._resolved=s.resolved,Hi(s.name)||(s.name=`${s.type} ${s.server}:${s.port}`),s["disable-sni"]&&(a?s.sni="off":["tuic"].includes(s.type)||(I.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=xc(s.ports))),s)),I.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 I.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 yt={parse:XR,process:JR,produce:ZR,ipAddress:Sf,getRandomPort:xc,isIPv4:vr,isIPv6:ur,isIP:W0,yaml:po,getFlag:Ru,removeFlag:Qc,getISO:ih,MMDB:nh,Gist:di,download:yr,downloadFile:pl,isValidUUID:bf,doh:Tu,Buffer:_h.Buffer,Base64:Et};function gA(e,t){if(!QR(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function QR(e,t){try{return e.test(t)}catch{return!1}}function mA(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function vA(e){typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=Fm(e.password)),["ss"].includes(e.type)&&e.cipher==="none"&&!e.password&&(e.password=""),e.interface&&(e["interface-name"]=e.interface,delete e.interface),_m(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=>mA(n)):t!=null&&(e[`${e.network}-opts`].path=mA(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&&!W0(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&&(W0(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=_h.Buffer.from(e.name.data).toString("utf8"):e.name=_h.Buffer.from(e.name).toString("utf8")}catch(n){I.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{I.env.isNode&&!r&&e._ca&&(r=I.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(n){I.error(`Read ca file failed
Reason: ${n}`)}return!e["tls-fingerprint"]&&r&&(e["tls-fingerprint"]=Nv.generateFingerprint(r)),["ss"].includes(e.type)&&ae(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 W0(e){return vr(e)||ur(e)}function eP(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function tP(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var EA=[eP(),tP()];function rP(){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 wA(){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 nP(){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))),wA().func(r))}}function iP(){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 po.dump(i)}}}var AA={QX:rP(),Surge:wA(),Loon:nP(),Clash:iP()};var sP=[[/^(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 aP(){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 sP)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 yA=[aP()];var wo=function(){function e(n){for(let i of EA)try{if(i.test(n))return I.info(`Pre-processor [${i.name}] activated`),i.parse(n)}catch(a){I.error(`Parser [${i.name}] failed
Reason: ${a}`)}return n}function t(n){n=e(n);for(let i of yA){let a;try{a=i.test(n)}catch{a=!1}if(a)return I.info(`Rule parser [${i.name}] is activated!`),i.parse(n)}}function r(n,i){let a=AA[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}}();function X0(e){I.read(ht)||I.write({},ht),e.get("/api/artifacts/restore",oP),e.route("/api/artifacts").get(uP).post(fP).put(cP),e.route("/api/artifact/:name").get(lP).patch(hP).delete(pP)}async function oP(e,t){I.info("\u5F00\u59CB\u6062\u590D\u8FDC\u7A0B\u914D\u7F6E...");try{let{gistToken:r,syncPlatform:n}=I.read(Ft);if(!r)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let i=new di({token:r,key:Ya,syncPlatform:n});try{let a=await i.locate();if(!a?.files)throw new Error("\u627E\u4E0D\u5230 Sub-Store Gist \u6587\u4EF6\u5217\u8868");let s=I.read(ht),u=[];Object.keys(a.files).map(l=>{let f=a.files[l]?.filename;if(f)if(encodeURIComponent(f)!==f)I.error(`\u6587\u4EF6\u540D ${f} \u672A\u7F16\u7801 \u4E0D\u4FDD\u5B58`),u.push(f);else{let d=Je(s,f);d?yi(s,f,{...d,url:a.files[l]?.raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1")}):s.push({name:`${f}`,url:a.files[l]?.raw_url.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1")})}}),I.write(s,ht)}catch(a){throw I.error(`\u67E5\u627E Sub-Store Gist \u65F6\u53D1\u751F\u9519\u8BEF: ${a.message??a}`),a}Ne(t)}catch(r){I.error(`\u6062\u590D\u8FDC\u7A0B\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),Pe(t,new jt("FAILED_TO_RESTORE_ARTIFACTS","Failed to restore artifacts",`Reason: ${r.message??r}`))}}function uP(e,t){let r=I.read(ht);Ne(t,r)}function cP(e,t){let r=e.body;I.write(r,ht),Ne(t)}async function lP(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let n=I.read(ht),i=Je(n,r);i?Ne(t,i):Pe(t,new Vt("RESOURCE_NOT_FOUND",`Artifact ${r} does not exist!`),404)}function fP(e,t){let r=e.body;if(!SA(r.name)){Pe(t,new At("INVALID_ARTIFACT_NAME",`Artifact name ${r.name} is invalid.`));return}I.info(`\u6B63\u5728\u521B\u5EFA\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r.name}`);let n=I.read(ht);Je(n,r.name)?Pe(t,new At("DUPLICATE_KEY",`Artifact ${r.name} already exists.`)):(n.push(r),I.write(n,ht),Ne(t,r,201))}function hP(e,t){let r=I.read(ht),n=e.params.name;n=decodeURIComponent(n);let i=Je(r,n);if(i){I.info(`\u6B63\u5728\u66F4\u65B0\u8FDC\u7A0B\u914D\u7F6E\uFF1A${i.name}`);let a={...i,...e.body};if(!SA(a.name)){Pe(t,new At("INVALID_ARTIFACT_NAME",`Artifact name ${a.name} is invalid.`));return}yi(r,n,a),I.write(r,ht),Ne(t,a)}else Pe(t,new At("DUPLICATE_KEY",`Artifact ${n} already exists.`))}async function pP(e,t){let{name:r}=e.params;r=decodeURIComponent(r),I.info(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r}`);let n=I.read(ht);try{let i=Je(n,r);if(!i)throw new Error(`\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r}\u4E0D\u5B58\u5728\uFF01`);if(i.updated){let a={};a[encodeURIComponent(i.name)]={content:""},encodeURIComponent(i.name)!==i.name&&(a[i.name]={content:""});try{await Fh(a)}catch(s){I.error(`Function syncToGist: ${r} : ${s}`)}}oi(n,r),I.write(n,ht),Ne(t)}catch(i){I.error(`\u65E0\u6CD5\u5220\u9664\u8FDC\u7A0B\u914D\u7F6E\uFF1A${r}\uFF0C\u539F\u56E0\uFF1A${i}`),Pe(t,new jt("FAILED_TO_DELETE_ARTIFACT",`Failed to delete artifact ${r}`,`Reason: ${i}`))}}function SA(e){return/^[a-zA-Z0-9._-]*$/.test(e)}async function Fh(e){let{gistToken:t,syncPlatform:r}=I.read(Ft);if(!t)return Promise.reject("\u672A\u8BBE\u7F6E GitHub Token\uFF01");let i=await new di({token:t,key:Ya,syncPlatform:r}).upload(e),a={};try{a=JSON.parse(i.body)}catch{}let s=a?.html_url??a?.web_url,u=I.read(Ft);return s?(I.log(`\u540C\u6B65 Gist \u540E, \u627E\u5230 Sub-Store Gist: ${s}`),u.artifactStore=s,u.artifactStoreStatus="VALID"):(I.error("\u540C\u6B65 Gist \u540E, \u627E\u4E0D\u5230 Sub-Store Gist"),u.artifactStoreStatus="NOT FOUND"),I.write(u,Ft),i}function J0(e){I.read(ht)||I.write({},ht),e.get("/api/sync/artifacts",dP),e.get("/api/sync/artifact/:name",gP)}async function Pr({type:e,name:t,platform:r,url:n,ua:i,content:a,mergeSources:s,ignoreFailedRemoteSub:u,ignoreFailedRemoteFile:l,produceType:f,produceOpts:d={},subscription:E,awaitCustomCache:p,$options:h,proxy:A,noCache:m,all:S}){if(r=r||"JSON",["subscription","sub"].includes(e)){let w;if(t){let D=I.read(Dt);if(w=Je(D,t),!w)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(E)w=E;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let y;if(a&&!["localFirst","remoteFirst"].includes(s))y=a;else if(n){let D={};y=await Promise.all(n.split(/[\r\n]+/).map(q=>q.trim()).filter(q=>q.length).map(async q=>{try{return await yr(q,i||w.ua,void 0,A||w.proxy,void 0,p,m||w.noCache,!0)}catch(F){return D[q]=F,I.error(`\u8BA2\u9605 ${w.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${q} \u53D1\u751F\u9519\u8BEF: ${F}`),""}}));let j=w.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(j=u),Object.keys(D).length>0)if(j)j==="enabled"&&I.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${w.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(D).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${w.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(D).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?y.unshift(a):s==="remoteFirst"&&y.push(a)}else if(w.source==="local"&&!["localFirst","remoteFirst"].includes(w.mergeSources))y=w.content;else{let D={};y=await Promise.all(w.url.split(/[\r\n]+/).map(q=>q.trim()).filter(q=>q.length).map(async q=>{try{return await yr(q,i||w.ua,void 0,A||w.proxy,void 0,p,m||w.noCache,!0)}catch(F){return D[q]=F,I.error(`\u8BA2\u9605 ${w.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${q} \u53D1\u751F\u9519\u8BEF: ${F}`),""}}));let j=w.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(j=u),Object.keys(D).length>0)if(j)j==="enabled"&&I.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${w.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(D).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${w.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(D).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);w.mergeSources==="localFirst"?y.unshift(w.content):w.mergeSources==="remoteFirst"&&y.push(w.content)}if(f==="raw")return JSON.stringify((Array.isArray(y)?y:[y]).flat());let _=(Array.isArray(y)?y:[y]).map(D=>yt.parse(D)).flat();if(_.forEach(D=>{D._subName=w.name,D._subDisplayName=w.displayName}),_=await yt.process(_,w.process||[],r,{[w.name]:w},h),_.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let B={};for(let D of _){if(B[D.name]){I.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${D.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}B[D.name]=!0}return yt.produce(_,r,f,d)}else if(["collection","col"].includes(e)){let w=I.read(Dt),y=I.read(Bt),_=Je(y,t);if(!_)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let B=[..._.subscriptions],D=_.subscriptionTags;Array.isArray(D)&&D.length>0&&w.forEach(V=>{Array.isArray(V.tag)&&V.tag.length>0&&!B.includes(V.name)&&V.tag.some(W=>D.includes(W))&&B.push(V.name)});let j={},q={},F=0;await Promise.all(B.map(async V=>{let W=Je(w,V),G=W.passThroughUA,z=W.ua;G&&(I.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${i}`),z=i);try{I.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${W.name}...`);let X;if(W.source==="local"&&!["localFirst","remoteFirst"].includes(W.mergeSources))X=W.content;else{let Se={};if(X=await await Promise.all(W.url.split(/[\r\n]+/).map(we=>we.trim()).filter(we=>we.length).map(async we=>{try{return await yr(we,z,void 0,A||W.proxy||_.proxy,void 0,void 0,m||W.noCache,!0)}catch(Ie){return Se[we]=Ie,I.error(`\u8BA2\u9605 ${W.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${we} \u53D1\u751F\u9519\u8BEF: ${Ie}`),""}})),Object.keys(Se).length>0)if(W.ignoreFailedRemoteSub)W.ignoreFailedRemoteSub==="enabled"&&I.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${W.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(Se).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${W.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(Se).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);W.mergeSources==="localFirst"?X.unshift(W.content):W.mergeSources==="remoteFirst"&&X.push(W.content)}let ie=(Array.isArray(X)?X:[X]).map(Se=>yt.parse(Se)).flat();ie.forEach(Se=>{Se._subName=W.name,Se._subDisplayName=W.displayName,Se._collectionName=_.name,Se._collectionDisplayName=_.displayName}),ie=await yt.process(ie,W.process||[],r,{[W.name]:W,_collection:_,$options:h}),j[V]=ie,F++,I.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${W.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(F/B.length).toFixed(1)}% `)}catch(X){F++,q[V]=X,I.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${W.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${X}\uFF01\u8FDB\u5EA6--${100*(F/B.length).toFixed(1)}%`)}}));let P=_.ignoreFailedRemoteSub;if(u!=null&&u!==""&&(P=u),Object.keys(q).length>0)if(P)P==="enabled"&&I.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${_.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${_.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let L=Array.prototype.concat.apply([],B.map(V=>j[V]||[]));if(L.forEach(V=>{V._collectionName=_.name,V._collectionDisplayName=_.displayName}),L=await yt.process(L,_.process||[],r,{_collection:_},h),L.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let M={};for(let V of L){if(M[V.name]){I.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${V.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}M[V.name]=!0}return yt.produce(L,r,f,d)}else if(e==="rule"){let w=I.read(Pc),y=Je(w,t);if(!y)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let _=[];for(let B=0;B<y.urls.length;B++){let D=y.urls[B];I.info(`\u6B63\u5728\u5904\u7406URL\uFF1A${D}\uFF0C\u8FDB\u5EA6--${100*((B+1)/y.urls.length).toFixed(1)}% `);try{let{body:j}=await yr(D),q=wo.parse(j);_=_.concat(q)}catch(j){I.error(`\u5904\u7406\u5206\u6D41\u8BA2\u9605\u4E2D\u7684URL: ${D}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${j}! \u8BE5\u8BA2\u9605\u5DF2\u88AB\u8DF3\u8FC7\u3002`)}}return _=await wo.process(_,[{type:"Remove Duplicate Filter"}]),wo.produce(_,r)}else if(e==="file"){let w=I.read(vt),y=Je(w,t);if(!y)throw new Error(`\u627E\u4E0D\u5230\u6587\u4EF6 ${t}`);let _="";if(y.type!=="mihomoProfile")if(a&&!["localFirst","remoteFirst"].includes(s))_=a;else if(n){let q={};_=await Promise.all(n.split(/[\r\n]+/).map(P=>P.trim()).filter(P=>P.length).map(async P=>{try{return await yr(P,i||y.ua,void 0,y.proxy||A,void 0,void 0,m)}catch(L){return q[P]=L,I.error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${P} \u53D1\u751F\u9519\u8BEF: ${L}`),""}}));let F=y.ignoreFailedRemoteFile;if(l!=null&&l!==""&&(F=l),!F&&Object.keys(q).length>0)throw new Error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);s==="localFirst"?_.unshift(a):s==="remoteFirst"&&_.push(a)}else if(y.source==="local"&&!["localFirst","remoteFirst"].includes(y.mergeSources))_=y.content;else{let q={};_=await Promise.all(y.url.split(/[\r\n]+/).map(P=>P.trim()).filter(P=>P.length).map(async P=>{try{return await yr(P,i||y.ua,void 0,y.proxy||A,void 0,void 0,m)}catch(L){return q[P]=L,I.error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${P} \u53D1\u751F\u9519\u8BEF: ${L}`),""}}));let F=y.ignoreFailedRemoteFile;if(l!=null&&l!==""&&(F=l),Object.keys(q).length>0)if(F)F==="enabled"&&I.notify("\u{1F30D} Sub-Store \u5904\u7406\u6587\u4EF6\u5931\u8D25",`\u274C ${y.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${y.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(q).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);y.mergeSources==="localFirst"?_.unshift(y.content):y.mergeSources==="remoteFirst"&&_.push(y.content)}if(f==="raw")return JSON.stringify((Array.isArray(_)?_:[_]).flat());let B=(Array.isArray(_)?_:[_]).flat(),D=B.filter(q=>q!=null&&q!=="").join(`
`),j=Array.isArray(y.process)&&y.process.length>0?await yt.process({$files:B,$content:D,$options:h,$file:y},y.process):{$content:D,$files:B,$options:h};return(S?j:j?.$content)??""}}async function Z0(){I.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");let e=I.read(ht),t={};try{let r=[],n=[],i=I.read(Dt),a=I.read(Bt),s=[],u=0;if(e.map(d=>{if(d.sync&&d.source){if(u++,d.type==="subscription"){let E=d.source,p=Je(i,E);p&&p.url&&!s.includes(E)&&s.push(E)}else if(d.type==="collection"){let E=Je(a,d.source);E&&Array.isArray(E.subscriptions)&&E.subscriptions.map(p=>{let h=Je(i,p);h&&h.url&&!s.includes(p)&&s.push(p)})}}}),u===0){I.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 Pr({type:"subscription",name:d,awaitCustomCache:!0})}catch{}})),await Promise.all(e.map(async d=>{try{if(d.sync&&d.source){I.info(`\u6B63\u5728\u540C\u6B65\u4E91\u914D\u7F6E\uFF1A${d.name}...`);let E=d.platform==="SurgeMac";E&&I.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External");let p=await Pr({type:d.type,name:d.source,platform:d.platform,produceOpts:{"include-unsupported-proxy":d.includeUnsupportedProxy,useMihomoExternal:E}});t[encodeURIComponent(d.name)]={content:p},r.push(d.name)}}catch(E){I.error(`\u751F\u6210\u540C\u6B65\u914D\u7F6E ${d.name} \u53D1\u751F\u9519\u8BEF: ${E.message??E}`),n.push(d.name)}})),I.info(`${r.length} \u4E2A\u540C\u6B65\u914D\u7F6E\u751F\u6210\u6210\u529F: ${r.join(", ")}`),I.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 Fh(t),f=JSON.parse(l.body);delete f.history,delete f.forks,delete f.owner,Object.values(f.files).forEach(d=>{delete d.content}),I.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),I.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 E=f.files,p;Array.isArray(E)&&(p=!0,E=Object.fromEntries(E.map(m=>[m.path,m])));let h=E[encodeURIComponent(d.name)]?.raw_url,A=p?h:h?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");I.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210
\u6587\u4EF6\u5217\u8868: ${Object.keys(E).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: ${A}`),d.url=A}if(I.write(e,ht),I.info("\u4E0A\u4F20\u914D\u7F6E\u6210\u529F"),n.length>0)throw new Error(`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${r.length} \u4E2A, \u5931\u8D25 ${n.length} \u4E2A, \u8BE6\u60C5\u8BF7\u67E5\u770B\u65E5\u5FD7`);I.info(`\u540C\u6B65\u914D\u7F6E\u6210\u529F ${r.length} \u4E2A`)}catch(r){throw I.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),r}}async function dP(e,t){I.info("\u5F00\u59CB\u540C\u6B65\u6240\u6709\u8FDC\u7A0B\u914D\u7F6E...");try{await Z0(),Ne(t)}catch(r){I.error(`\u540C\u6B65\u914D\u7F6E\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A${r.message??r}`),Pe(t,new jt("FAILED_TO_SYNC_ARTIFACTS","Failed to sync all artifacts",`Reason: ${r.message??r}`))}}async function gP(e,t){let{name:r}=e.params;r=decodeURIComponent(r),I.info(`\u5F00\u59CB\u540C\u6B65\u8FDC\u7A0B\u914D\u7F6E ${r}...`);let n=I.read(ht),i=Je(n,r);if(!i){I.error(`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${r}`),Pe(t,new Vt("RESOURCE_NOT_FOUND",`\u627E\u4E0D\u5230\u8FDC\u7A0B\u914D\u7F6E ${r}`),404);return}if(!i.source){I.error(`\u8FDC\u7A0B\u914D\u7F6E ${r} \u672A\u8BBE\u7F6E\u6765\u6E90`),Pe(t,new Vt("RESOURCE_HAS_NO_SOURCE",`\u8FDC\u7A0B\u914D\u7F6E ${r} \u672A\u8BBE\u7F6E\u6765\u6E90`),404);return}try{let a=i.platform==="SurgeMac";a&&I.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External");let s=await Pr({type:i.type,name:i.source,platform:i.platform,produceOpts:{"include-unsupported-proxy":i.includeUnsupportedProxy,useMihomoExternal:a}});I.info(`\u6B63\u5728\u4E0A\u4F20\u914D\u7F6E\uFF1A${i.name}
>>>${JSON.stringify(i,null,2)}`);let u=await Fh({[encodeURIComponent(i.name)]:{content:s}});i.updated=new Date().getTime();let l=JSON.parse(u.body);delete l.history,delete l.forks,delete l.owner,Object.values(l.files).forEach(h=>{delete h.content}),I.info("\u4E0A\u4F20\u914D\u7F6E\u54CD\u5E94:"),I.info(JSON.stringify(l,null,2));let f=l.files,d;Array.isArray(f)&&(d=!0,f=Object.fromEntries(f.map(h=>[h.path,h])));let E=f[encodeURIComponent(i.name)]?.raw_url,p=d?E:E?.replace(/\/raw\/[^/]*\/(.*)/,"/raw/$1");I.info(`\u4E0A\u4F20\u914D\u7F6E\u5B8C\u6210
\u6587\u4EF6\u5217\u8868: ${Object.keys(f).join(", ")}
\u5F53\u524D\u6587\u4EF6: ${encodeURIComponent(i.name)}
\u54CD\u5E94\u8FD4\u56DE\u7684\u539F\u59CB\u94FE\u63A5: ${E}
\u5904\u7406\u5B8C\u7684\u65B0\u94FE\u63A5: ${p}`),i.url=p,I.write(n,ht),Ne(t,i)}catch(a){I.error(`\u8FDC\u7A0B\u914D\u7F6E ${i.name} \u53D1\u751F\u9519\u8BEF: ${a.message??a}`),Pe(t,new jt("FAILED_TO_SYNC_ARTIFACT",`Failed to sync artifact ${r}`,`Reason: ${a}`))}}var bA=fh.find(e=>e.name==="Clash Pre-processor"),Q0=new Map;async function yr(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}=Ir(),{defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=I.read(Ft),cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;I.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultUserAgent||"clash.meta",requestTimeout=timeout||defaultTimeout||8e3,id=jn(userAgent+url);$arguments?.cacheKey===!0&&(I.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=I.read(customCacheKey),t=pr.get(id);if(!noCache&&!$arguments?.noCache&&t)return I.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){I.info(`\u4E50\u89C2\u7F13\u5B58: URL ${url}
\u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await yr(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess)}catch(r){I.error(`\u4E50\u89C2\u7F13\u5B58: URL ${url} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`),I.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),pr.set(id,e)}}else I.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`),yr(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess).catch(r=>{I.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"?Gr:vt,n=Je(I.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return e==="module"?n.content:await Pr({type:"file",name:t})}catch(t){throw I.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=require("fs");return fs.readFileSync(url.split("#")[0],"utf8")}catch(e){throw I.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&&Q0.has(id))return Q0.get(id);let http=wi({headers:{"User-Agent":userAgent,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,cached=pr.get(id);if(!noCache&&!$arguments?.noCache&&cached)I.info(`\u4F7F\u7528\u7F13\u5B58: ${url}, ${userAgent}`),result=cached,customCacheKey&&(I.info(`URL ${url}
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),I.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;I.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?Cs(proxy):{},...e||{}});if(I.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let a=uu(r);a&&eo.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{bA.test(t)&&(t=bA.parse(t,!0))}catch(a){I.error(`Clash Pre-processor error: ${a}`)}let i=!0;if(cacheThreshold){let a=t.length/1024;a>cacheThreshold&&(I.info(`\u8D44\u6E90\u5927\u5C0F ${a.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),i=!1)}i&&(pr.set(id,t),customCacheKey&&(I.info(`URL ${url}
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),I.write(t,customCacheKey))),result=t}catch(t){if(customCacheKey){let r=I.read(customCacheKey);if(r)return I.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 Cf(to(await Zr(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl))),isNode||Q0.set(id,result),result}async function pl(url,file){let undici=require('undici'),fs=require('fs'),{pipeline}=require('stream/promises'),{Agent,interceptors,request}=undici;I.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),I.info(`File downloaded from ${url} to ${file}`),file}function e1(e){I.read(Ft)||I.write({},Ft),e.route("/api/settings").get(mP).patch(vP)}async function mP(e,t){try{let r=I.read(Ft);r||(r={},I.write(r,Ft)),r.avatarUrl||await Ih(),r.artifactStore||await $h(),Ne(t,r)}catch(r){I.error(`Failed to get settings: ${r.message??r}`),Pe(t,new jt("FAILED_TO_GET_SETTINGS","Failed to get settings",`Reason: ${r.message??r}`))}}async function vP(e,t){try{let n={...I.read(Ft),...e.body};I.write(n,Ft),await Ih(),await $h(),Ne(t,n)}catch(r){I.error(`Failed to update settings: ${r.message??r}`),Pe(t,new jt("FAILED_TO_UPDATE_SETTINGS","Failed to update settings",`Reason: ${r.message??r}`))}}async function Ih(){let e=I.read(Ft),{githubUser:t,syncPlatform:r}=e;if(t)if(r==="gitlab")try{let n=await I.http.get({url:`https://gitlab.com/api/v4/users?username=${encodeURIComponent(t)}`,headers:{"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"}}).then(i=>JSON.parse(i.body));e.avatarUrl=n[0].avatar_url.replace(/(\?|&)s=\d+(&|$)/,"$1s=160$2"),I.write(e,Ft)}catch(n){I.error(`Failed to fetch GitLab avatar for User: ${t}. Reason: ${n.message??n}`)}else try{let n=await I.http.get({url:`https://api.github.com/users/${encodeURIComponent(t)}`,headers:{"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"}}).then(i=>JSON.parse(i.body));e.avatarUrl=n.avatar_url,I.write(e,Ft)}catch(n){I.error(`Failed to fetch GitHub avatar for User: ${t}. Reason: ${n.message??n}`)}}async function $h(){I.log("Updating artifact store");let e=I.read(Ft),{gistToken:t,syncPlatform:r}=e;if(t){let n=new di({token:t,key:Ya,syncPlatform:r});try{let i=await n.locate(),a=i?.html_url??i?.web_url;a?(I.log(`\u627E\u5230 Sub-Store Gist: ${a}`),e.artifactStore=a,e.artifactStoreStatus="VALID"):(I.error(`\u627E\u4E0D\u5230 Sub-Store Gist (${Ya})`),e.artifactStoreStatus="NOT FOUND")}catch(i){I.error(`\u67E5\u627E Sub-Store Gist (${Ya}) \u65F6\u53D1\u751F\u9519\u8BEF: ${i.message??i}`),e.artifactStoreStatus="ERROR"}I.write(e,Ft)}}function t1(e){e.get("/api/utils/env",CA),e.get("/api/utils/backup",wP),e.get("/api/utils/refresh",EP),e.route("/api/storage").get((t,r)=>{r.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_data_${ca(new Date)}.json`)}"`).send(I.env.isNode?JSON.stringify(I.cache):I.read("#sub-store"))}).post((t,r)=>{let{content:n}=t.body;I.write(n,"#sub-store"),I.env.isNode&&(I.cache=JSON.parse(n),I.persistCache()),aa(),Ne(r)}),Ir().isNode?e.get("/",CA):e.get("/",async(t,r)=>{r.set("location","https://sub-store.vercel.app/").status(302).end()}),Ir().isQX&&e.options("/",async(t,r)=>{r.status(200).end()}),e.all("/",(t,r)=>{r.send("Hello from sub-store, made with \u2764\uFE0F by Peng-YM")})}function CA(e,t){e.query.share&&(Qi.feature.share=!0),t.set("Content-Type","application/json;charset=UTF-8").send(JSON.stringify({status:"success",data:{guide:"\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F \u60A8\u5F53\u524D\u770B\u5230\u7684\u662F\u540E\u7AEF\u7684\u54CD\u5E94. \u82E5\u60F3\u914D\u5408\u524D\u7AEF\u4F7F\u7528, \u53EF\u8BBF\u95EE\u5B98\u65B9\u524D\u7AEF https://sub-store.vercel.app \u540E\u81EA\u884C\u914D\u7F6E\u540E\u7AEF\u5730\u5740, \u6216\u4E00\u952E\u914D\u7F6E\u540E\u7AEF https://sub-store.vercel.app?api=https://a.com/xxx (\u5047\u8BBE https://a.com \u662F\u4F60\u540E\u7AEF\u7684\u57DF\u540D, /xxx \u662F\u81EA\u5B9A\u4E49\u8DEF\u5F84). \u9700\u6CE8\u610F HTTPS \u524D\u7AEF\u65E0\u6CD5\u8BF7\u6C42\u975E\u672C\u5730\u7684 HTTP \u540E\u7AEF(\u90E8\u5206\u6D4F\u89C8\u5668\u4E0A\u4E5F\u65E0\u6CD5\u8BBF\u95EE\u672C\u5730 HTTP \u540E\u7AEF). \u8BF7\u914D\u7F6E\u53CD\u4EE3\u6216\u5728\u5C40\u57DF\u7F51\u81EA\u5EFA HTTP \u524D\u7AEF. \u5982\u679C\u8FD8\u6709\u95EE\u9898, \u53EF\u67E5\u770B\u6B64\u6392\u67E5\u8BF4\u660E: https://t.me/zhetengsha/1068",...Qi}},null,2))}async function EP(e,t){await Ih(),await $h(),pr.revokeAll(),Zc.revokeAll(),eo.revokeAll(),Ne(t)}async function Dh(e){let{gistToken:t,syncPlatform:r}=I.read(Ft);if(!t)throw new Error("GitHub Token is required for backup!");let n=new di({token:t,key:lm,syncPlatform:r}),i,a=I.read(Ft),s=a.syncTime;switch(e){case"upload":try{if(i=I.read("#sub-store"),I.env.isNode&&(i=JSON.stringify(I.cache,null," ")),I.info("\u4E0B\u8F7D\u5907\u4EFD, \u4E0E\u672C\u5730\u5185\u5BB9\u5BF9\u6BD4..."),await n.download(lf)===i){I.info("\u5185\u5BB9\u4E00\u81F4, \u65E0\u9700\u4E0A\u4F20\u5907\u4EFD");return}}catch(u){I.error(`${u.message??u}`)}a.syncTime=new Date().getTime(),I.write(a,Ft),i=I.read("#sub-store"),I.env.isNode&&(i=JSON.stringify(I.cache,null," ")),I.info("\u4E0A\u4F20\u5907\u4EFD\u4E2D...");try{await n.upload({[lf]:{content:i}}),I.info("\u4E0A\u4F20\u5907\u4EFD\u5B8C\u6210")}catch(u){throw a.syncTime=s,I.write(a,Ft),u}break;case"download":I.info("\u8FD8\u539F\u5907\u4EFD\u4E2D..."),i=await n.download(lf);try{if(Object.keys(JSON.parse(i).settings).length===0)throw new Error("\u5907\u4EFD\u6587\u4EF6\u5E94\u8BE5\u81F3\u5C11\u5305\u542B settings \u5B57\u6BB5")}catch(u){throw I.error(`Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F
Reason: ${u.message??u}`),new Error("Gist \u5907\u4EFD\u6587\u4EF6\u6821\u9A8C\u5931\u8D25, \u65E0\u6CD5\u8FD8\u539F")}I.write(i,"#sub-store"),I.env.isNode&&(i=JSON.parse(i),I.cache=i,I.persistCache()),I.info("perform migration after restoring from gist..."),aa(),I.info("migration completed"),I.info("\u8FD8\u539F\u5907\u4EFD\u5B8C\u6210");break}}async function wP(e,t){let{action:r}=e.query,{gistToken:n}=I.read(Ft);if(!n)Pe(t,new At("GIST_TOKEN_NOT_FOUND","GitHub Token is required for backup!"));else try{await Dh(r),Ne(t)}catch(i){I.error(`Failed to ${r} gist data.
Reason: ${i.message??i}`),Pe(t,new jt("BACKUP_FAILED",`Failed to ${r} gist data!`,`Reason: ${i.message??i}`))}}I.read(Dt)||I.write({},Dt);function r1(e){e.get("/api/sub/flow/:name",AP),e.route("/api/sub/:name").get(SP).patch(bP).delete(CP),e.route("/api/subs").get(_P).post(yP).put(FP)}async function AP(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let{url:n}=e.query;n&&(n=decodeURIComponent(n),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 URL: ${n}`));let i=I.read(Dt),a=Je(i,r);if(!a){Pe(t,new Vt("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404);return}if(a.source==="local"&&!["localFirst","remoteFirst"].includes(a.mergeSources)){if(a.subUserinfo){let s;if(/^https?:\/\//.test(a.subUserinfo))try{s=await Zr(void 0,void 0,void 0,a.proxy,a.subUserinfo)}catch(u){I.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${a.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(u)}`)}else s=a.subUserinfo;try{Ne(t,{...to(s)})}catch(u){I.error(`Failed to parse flow info for local subscription ${r}: ${u.message??u}`),Pe(t,new At("NO_FLOW_INFO","N/A","Failed to parse flow info"))}}else Pe(t,new At("NO_FLOW_INFO","N/A",`Local subscription ${r} has no flow information!`));return}try{n=`${n||a.url}`.split(/[\r\n]+/).map(f=>f.trim()).filter(f=>f.length)?.[0]||"";let s={},u=n.split("#");if(n=n.split("#")[0],u.length>1)try{s=JSON.parse(decodeURIComponent(u[1]))}catch{for(let d of u[1].split("&")){let E=d.split("=")[0],p=d.split("=")[1];s[E]=p==null||p===""?!0:decodeURIComponent(p)}}if(s.noFlow||!/^https?/.test(n)){Pe(t,new At("NO_FLOW_INFO","N/A",`Subscription ${r}: noFlow`));return}let l=await Zr(s?.insecure?`${n}#insecure`:n,s.flowUserAgent,void 0,a.proxy,s.flowUrl);if(!l&&!a.subUserinfo){Pe(t,new jt("NO_FLOW_INFO","No flow info","Failed to fetch flow headers"));return}try{let f=_f({resetDay:s.resetDay,startDate:s.startDate,cycleDays:s.cycleDays}),d;if(/^https?:\/\//.test(a.subUserinfo))try{d=await Zr(void 0,void 0,void 0,a.proxy,a.subUserinfo)}catch(p){I.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${a.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(p)}`)}else d=a.subUserinfo;let E={...to([d,l].filter(p=>p).join("; "))};f!=null&&(E.remainingDays=f),Ne(t,E)}catch(f){I.error(`Failed to parse flow info for local subscription ${r}: ${f.message??f}`),Pe(t,new At("NO_FLOW_INFO","N/A","Failed to parse flow info"))}}catch{Pe(t,new lu("URL_NOT_ACCESSIBLE",`The URL for subscription ${r} is inaccessible.`))}}function yP(e,t){let r=e.body;if(I.info(`\u6B63\u5728\u521B\u5EFA\u8BA2\u9605\uFF1A ${r.name}`),/\//.test(r.name)){Pe(t,new At("INVALID_NAME",`Subscription ${r.name} is invalid`));return}let n=I.read(Dt);if(Je(n,r.name)){Pe(t,new At("DUPLICATE_KEY",`Subscription ${r.name} already exists.`));return}n.push(r),I.write(n,Dt),Ne(t,r,201)}function SP(e,t){let{name:r}=e.params,{raw:n}=e.query;r=decodeURIComponent(r);let i=I.read(Dt),a=Je(i,r);a?n?t.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_subscription_${r}_${ca(new Date)}.json`)}"`).send(JSON.stringify(a)):Ne(t,a):Pe(t,new Vt("SUBSCRIPTION_NOT_FOUND",`Subscription ${r} does not exist`,404))}function bP(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let n=e.body,i=I.read(Dt),a=Je(i,r);if(a){let s={...a,...n};if(I.info(`\u6B63\u5728\u66F4\u65B0\u8BA2\u9605\uFF1A ${r}`),r!==n.name){let u=I.read(Bt)||[];for(let d of u){let E=d.subscriptions.indexOf(r);E!==-1&&(d.subscriptions[E]=n.name)}let l=I.read(ht)||[];for(let d of l)d.type==="subscription"&&d.source==r&&(d.source=n.name);let f=I.read(vt)||[];for(let d of f)d.sourceType==="subscription"&&d.sourceName==r&&(d.sourceName=n.name);I.write(u,Bt),I.write(l,ht),I.write(f,vt)}yi(i,r,s),I.write(i,Dt),Ne(t,s)}else Pe(t,new Vt("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404)}function CP(e,t){let{name:r}=e.params;r=decodeURIComponent(r),I.info(`\u5220\u9664\u8BA2\u9605\uFF1A${r}...`);let n=I.read(Dt);oi(n,r),I.write(n,Dt);let i=I.read(Bt);for(let a of i)a.subscriptions=a.subscriptions.filter(s=>s!==r);I.write(i,Bt),Ne(t)}function _P(e,t){let r=I.read(Dt);Ne(t,r)}function FP(e,t){let r=e.body;I.write(r,Dt),Ne(t)}function n1(e){I.read(Bt)||I.write({},Bt),e.route("/api/collection/:name").get($P).patch(DP).delete(BP),e.route("/api/collections").get(RP).post(IP).put(PP)}function IP(e,t){let r=e.body;if(I.info(`\u6B63\u5728\u521B\u5EFA\u7EC4\u5408\u8BA2\u9605\uFF1A${r.name}`),/\//.test(r.name)){Pe(t,new At("INVALID_NAME",`Collection ${r.name} is invalid`));return}let n=I.read(Bt);if(Je(n,r.name)){Pe(t,new At("DUPLICATE_KEY",`Collection ${r.name} already exists.`));return}n.push(r),I.write(n,Bt),Ne(t,r,201)}function $P(e,t){let{name:r}=e.params,{raw:n}=e.query;r=decodeURIComponent(r);let i=I.read(Bt),a=Je(i,r);a?n?t.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_collection_${r}_${ca(new Date)}.json`)}"`).send(JSON.stringify(a)):Ne(t,a):Pe(t,new Vt("SUBSCRIPTION_NOT_FOUND",`Collection ${r} does not exist`,404))}function DP(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let n=e.body,i=I.read(Bt),a=Je(i,r);if(a){let s={...a,...n};if(I.info(`\u6B63\u5728\u66F4\u65B0\u7EC4\u5408\u8BA2\u9605\uFF1A${r}...`),r!==s.name){let u=I.read(ht)||[];for(let f of u)f.type==="collection"&&f.source===a.name&&(f.source=s.name);let l=I.read(vt)||[];for(let f of l)f.sourceType==="collection"&&f.sourceName===a.name&&(f.sourceName=s.name);I.write(u,ht),I.write(l,vt)}yi(i,r,s),I.write(i,Bt),Ne(t,s)}else Pe(t,new Vt("RESOURCE_NOT_FOUND",`Collection ${r} does not exist!`),404)}function BP(e,t){let{name:r}=e.params;r=decodeURIComponent(r),I.info(`\u6B63\u5728\u5220\u9664\u7EC4\u5408\u8BA2\u9605\uFF1A${r}`);let n=I.read(Bt);oi(n,r),I.write(n,Bt),Ne(t)}function RP(e,t){let r=I.read(Bt);Ne(t,r)}function PP(e,t){let r=e.body;I.write(r,Bt),Ne(t)}function i1(e){I.read(vt)||I.write([],vt),e.get("/share/file/:name",_A),e.route("/api/file/:name").get(_A).patch(xP).delete(NP),e.route("/api/wholeFile/:name").get(OP),e.route("/api/files").get(kP).post(TP).put(UP),e.route("/api/wholeFiles").get(LP)}function TP(e,t){let r=e.body;r.name=`${r.name??Date.now()}`,I.info(`\u6B63\u5728\u521B\u5EFA\u6587\u4EF6\uFF1A${r.name}`);let n=I.read(vt);if(Je(n,r.name))return Pe(t,new At("DUPLICATE_KEY",e.body.name?`\u5DF2\u5B58\u5728 name \u4E3A ${r.name} \u7684\u6587\u4EF6`:"\u65E0\u6CD5\u540C\u65F6\u521B\u5EFA\u76F8\u540C\u7684\u6587\u4EF6 \u53EF\u7A0D\u540E\u91CD\u8BD5"));n.push(r),I.write(n,vt),Ne(t,r,201)}async function _A(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let n=e.headers["user-agent"]||e.headers["User-Agent"];I.info(`\u6B63\u5728\u4E0B\u8F7D\u6587\u4EF6\uFF1A${r}
\u8BF7\u6C42 User-Agent: ${n}`);let{url:i,subInfoUrl:a,subInfoUserAgent:s,ua:u,content:l,mergeSources:f,ignoreFailedRemoteFile:d,proxy:E,noCache:p,produceType:h}=e.query,A={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body}};if(e.query.$options){try{A=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let y of e.query.$options.split("&")){let _=y.split("=")[0],B=y.split("=")[1];A[_]=B==null||B===""?!0:decodeURIComponent(B)}}I.info(`\u4F20\u5165 $options: ${JSON.stringify(A)}`)}i&&(i=decodeURIComponent(i),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u6587\u4EF6 URL: ${i}`)),E&&(E=decodeURIComponent(E),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${E}`)),u&&(u=decodeURIComponent(u),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u6587\u4EF6 User-Agent: ${u}`)),a&&(a=decodeURIComponent(a),I.info(`\u6307\u5B9A\u83B7\u53D6\u6D41\u91CF\u7684 subInfoUrl: ${a}`)),s&&(s=decodeURIComponent(s),I.info(`\u6307\u5B9A\u83B7\u53D6\u6D41\u91CF\u7684 subInfoUserAgent: ${s}`)),l&&(l=decodeURIComponent(l),I.info(`\u6307\u5B9A\u672C\u5730\u6587\u4EF6: ${l}`)),f&&(f=decodeURIComponent(f),I.info(`\u6307\u5B9A\u5408\u5E76\u6765\u6E90: ${f}`)),d!=null&&d!==""&&(d=decodeURIComponent(d),I.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u6587\u4EF6: ${d}`)),p&&I.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${p}`),h&&(h=decodeURIComponent(h),I.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${h}`));let m=I.read(vt),S=Je(m,r);if(S)try{let w=await Pr({type:"file",name:r,url:i,ua:u,content:l,mergeSources:f,ignoreFailedRemoteFile:d,$options:A,proxy:E,noCache:p,produceType:h,all:!0});try{if(a=a||S.subInfoUrl,a){let y=await Zr(a,s||S.subInfoUserAgent,void 0,E||S.proxy);y&&t.set("subscription-userinfo",la(y))}}catch(y){I.error(`\u6587\u4EF6 ${r} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(y)}`)}S.download&&t.set("Content-Disposition",`attachment; filename*=UTF-8''${encodeURIComponent(S.displayName||S.name)}`),t.set("Content-Type","text/plain; charset=utf-8"),w?.$options?._res?.headers&&Object.entries(w.$options._res.headers).forEach(([y,_])=>{t.set(y,_)}),t.send(w?.$content??"")}catch(w){I.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25",`\u274C \u65E0\u6CD5\u4E0B\u8F7D\u6587\u4EF6\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${w.message??w}`),I.error(w.message??w),Pe(t,new jt("INTERNAL_SERVER_ERROR",`Failed to download file: ${r}`,`Reason: ${w.message??w}`))}else I.error(`\u{1F30D} Sub-Store \u4E0B\u8F7D\u6587\u4EF6\u5931\u8D25
\u274C \u672A\u627E\u5230\u6587\u4EF6\uFF1A${r}\uFF01`),Pe(t,new Vt("RESOURCE_NOT_FOUND",`File ${r} does not exist!`),404)}function OP(e,t){let{name:r}=e.params,{raw:n}=e.query;r=decodeURIComponent(r);let i=I.read(vt),a=Je(i,r);a?n?t.set("content-type","application/json").set("content-disposition",`attachment; filename="${encodeURIComponent(`sub-store_file_${r}_${ca(new Date)}.json`)}"`).send(JSON.stringify(a)):Ne(t,a):Pe(t,new Vt("FILE_NOT_FOUND",`File ${r} does not exist`,404))}function xP(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let n=e.body,i=I.read(vt),a=Je(i,r);if(a){let s={...a,...n};if(I.info(`\u6B63\u5728\u66F4\u65B0\u6587\u4EF6\uFF1A${r}...`),r!==s.name){let u=I.read(ht)||[];for(let l of u)l.type==="file"&&l.source===a.name&&(l.source=s.name);I.write(u,ht)}yi(i,r,s),I.write(i,vt),Ne(t,s)}else Pe(t,new Vt("RESOURCE_NOT_FOUND",`File ${r} does not exist!`),404)}function NP(e,t){let{name:r}=e.params;r=decodeURIComponent(r),I.info(`\u6B63\u5728\u5220\u9664\u6587\u4EF6\uFF1A${r}`);let n=I.read(vt);oi(n,r),I.write(n,vt),Ne(t)}function kP(e,t){let r=I.read(vt);Ne(t,r.map(({content:n,...i})=>i))}function LP(e,t){let r=I.read(vt);Ne(t,r)}function UP(e,t){let r=e.body;I.write(r,vt),Ne(t)}function s1(e){I.read(ln)||I.write([],ln),e.post("/api/token",jP),e.route("/api/token/:token").delete(HP),e.route("/api/tokens").get(MP)}function HP(e,t){let{token:r}=e.params;r=decodeURIComponent(r),I.info(`\u6B63\u5728\u5220\u9664\uFF1A${r}`);let n=I.read(ln);oi(n,r,"token"),I.write(n,ln),Ne(t)}function MP(e,t){let{type:r,name:n}=e.query,i=I.read(ln)||[];Ne(t,r||n?i.filter(a=>(r?a.type===r:!0)&&(n?a.name===n:!0)):i)}async function jP(req,res){if(!Ir().isNode)return Pe(res,new At("INVALID_ENV","This endpoint is only available in Node.js environment"));try{let{payload,options}=req.body,ms=require("ms"),token=payload?.token;if(token!=null){if(typeof token!="string"||token.length<1)return Pe(res,new At("INVALID_CUSTOM_TOKEN",`Invalid custom token: ${token}`));if((I.read(ln)||[]).find(t=>t.token===token))return Pe(res,new At("DUPLICATE_TOKEN",`Token ${token} already exists`))}let type=payload?.type,name=payload?.name;if(!type||!name)return Pe(res,new At("INVALID_PAYLOAD","payload type and name are required"));if(type==="col"){if(!(I.read(Bt)||[]).find(r=>r.name===name))return Pe(res,new At("INVALID_COLLECTION",`collection ${name} not found`))}else if(type==="file"){if(!(I.read(vt)||[]).find(r=>r.name===name))return Pe(res,new At("INVALID_FILE",`file ${name} not found`))}else if(type==="sub"){if(!(I.read(Dt)||[]).find(r=>r.name===name))return Pe(res,new At("INVALID_SUB",`sub ${name} not found`))}else return Pe(res,new At("INVALID_TYPE",`type ${name} not supported`));let expiresIn=options?.expiresIn;if(options?.expiresIn!=null&&(expiresIn=ms(options.expiresIn),expiresIn==null||isNaN(expiresIn)||expiresIn<=0))return Pe(res,new At("INVALID_EXPIRES_IN",`Invalid expiresIn option: ${options.expiresIn}`));let nanoid=require("nanoid"),tokens=I.read(ln)||[];if(!token)do token=nanoid.customAlphabet(nanoid.urlAlphabet)();while(tokens.find(e=>e.token===token));return tokens.push({...payload,token,createdAt:Date.now(),expiresIn:expiresIn>0?options?.expiresIn:void 0,exp:expiresIn>0?Date.now()+expiresIn:void 0}),I.write(tokens,ln),Ne(res,{token})}catch(e){return Pe(res,new jt("TOKEN_SIGN_FAILED","Failed to sign token",`Reason: ${e.message??e}`))}}function a1(e){I.read(Gr)||I.write([],Gr),e.route("/api/module/:name").get(KP).patch(VP).delete(GP),e.route("/api/modules").get(zP).post(qP).put(YP)}function qP(e,t){let r=e.body;r.name=`${r.name??jn(JSON.stringify(r))}`,I.info(`\u6B63\u5728\u521B\u5EFA\u6A21\u5757\uFF1A${r.name}`);let n=I.read(Gr);if(Je(n,r.name))return Pe(t,new At("DUPLICATE_KEY",e.body.name?`\u5DF2\u5B58\u5728 name \u4E3A ${r.name} \u7684\u6A21\u5757`:"\u5DF2\u5B58\u5728\u76F8\u540C\u7684\u6A21\u5757 \u8BF7\u52FF\u91CD\u590D\u6DFB\u52A0"));n.push(r),I.write(n,Gr),Ne(t,r,201)}function KP(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let n=I.read(Gr),i=Je(n,r);i?t.set("Content-Type","text/plain; charset=utf-8").send(i.content):Pe(t,new Vt("MODULE_NOT_FOUND",`Module ${r} does not exist`,404))}function VP(e,t){let{name:r}=e.params;r=decodeURIComponent(r);let n=e.body,i=I.read(Gr),a=Je(i,r);if(a){let s={...a,...n};I.info(`\u6B63\u5728\u66F4\u65B0\u6A21\u5757\uFF1A${r}...`),yi(i,r,s),I.write(i,Gr),Ne(t,s)}else Pe(t,new Vt("RESOURCE_NOT_FOUND",`Module ${r} does not exist!`),404)}function GP(e,t){let{name:r}=e.params;r=decodeURIComponent(r),I.info(`\u6B63\u5728\u5220\u9664\u6A21\u5757\uFF1A${r}`);let n=I.read(Gr);oi(n,r),I.write(n,Gr),Ne(t)}function zP(e,t){let r=I.read(Gr);Ne(t,r.map(({content:n,...i})=>i))}function YP(e,t){let r=e.body;I.write(r,Gr),Ne(t)}var rU=Cn(qA()),iU=Cn(YA());function y7(e){let t=Object.keys(e),r="",n="",i="";for(let a of t){let s=a.toLowerCase();s==="user-agent"?(r=e[a],n=r.toLowerCase()):s==="accept"&&(i=e[a])}return{UA:r,ua:n,accept:i}}function S7({ua:e,UA:t,accept:r}){return t.indexOf("Quantumult%20X")!==-1?"QX":e.indexOf("egern")!==-1?"Egern":t.indexOf("Surfboard")!==-1?"Surfboard":t.indexOf("Surge Mac")!==-1?"SurgeMac":t.indexOf("Surge")!==-1?"Surge":t.indexOf("Decar")!==-1||t.indexOf("Loon")!==-1?"Loon":t.indexOf("Shadowrocket")!==-1?"Shadowrocket":t.indexOf("Stash")!==-1?"Stash":e==="meta"||e.indexOf("clash")!==-1&&e.indexOf("meta")!==-1||e.indexOf("clash-verge")!==-1||e.indexOf("flclash")!==-1?"ClashMeta":e.indexOf("clash")!==-1?"Clash":e.indexOf("v2ray")!==-1?"V2Ray":e.indexOf("sing-box")!==-1||e.indexOf("singbox")!==-1?"sing-box":r.indexOf("application/json")===0?"JSON":"V2Ray"}function p1(e){let{UA:t,ua:r,accept:n}=y7(e);return S7({ua:r,UA:t,accept:n})}function d1(e,t){return!1}function g1(e){e.get("/share/col/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,I.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Mu(t,r)}),e.get("/share/col/:name",Mu),e.get("/share/sub/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,I.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Hu(t,r)}),e.get("/share/sub/:name",Hu),e.get("/download/collection/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,I.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Mu(t,r)}),e.get("/download/collection/:name",Mu),e.get("/download/:name/:target",async(t,r)=>{let{target:n}=t.params;n&&(t.query.target=n,I.info(`\u4F7F\u7528\u8DEF\u7531\u6307\u5B9A\u76EE\u6807: ${n}`)),await Hu(t,r)}),e.get("/download/:name",Hu),e.get("/download/collection/:name/api/v1/server/details",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha",await Mu(t,r)}),e.get("/download/:name/api/v1/server/details",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha",await Hu(t,r)}),e.get("/download/collection/:name/api/v1/monitor/:nezhaIndex",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha-monitor",await Mu(t,r)}),e.get("/download/:name/api/v1/monitor/:nezhaIndex",async(t,r)=>{t.query.platform="JSON",t.query.produceType="internal",t.query.resultFormat="nezha-monitor",await Hu(t,r)})}async function Hu(e,t){let{name:r,nezhaIndex:n}=e.params;r=decodeURIComponent(r),n=decodeURIComponent(n);let i=e.query.target==="SurgeMac",a=e.query.target||p1(e.headers)||"JSON",s=e.headers["user-agent"]||e.headers["User-Agent"];I.info(`\u6B63\u5728\u4E0B\u8F7D\u8BA2\u9605\uFF1A${r}
\u8BF7\u6C42 User-Agent: ${s}
\u8BF7\u6C42 target: ${e.query.target}
\u5B9E\u9645\u8F93\u51FA: ${a}`);let{url:u,ua:l,content:f,mergeSources:d,ignoreFailedRemoteSub:E,produceType:p,includeUnsupportedProxy:h,resultFormat:A,proxy:m,noCache:S}=e.query,w={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body}};if(e.query.$options){try{w=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let D of e.query.$options.split("&")){let j=D.split("=")[0],q=D.split("=")[1];w[j]=q==null||q===""?!0:decodeURIComponent(q)}}I.info(`\u4F20\u5165 $options: ${JSON.stringify(w)}`)}u&&(u=decodeURIComponent(u),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 URL: ${u}`),/^https?:\/\//.test(u)||(f=u,I.info("URL \u4E0D\u662F\u94FE\u63A5\uFF0C\u89C6\u4E3A\u672C\u5730\u8BA2\u9605"))),f&&(f=decodeURIComponent(f),I.info(`\u6307\u5B9A\u672C\u5730\u8BA2\u9605: ${f}`)),m&&(m=decodeURIComponent(m),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${m}`)),l&&(l=decodeURIComponent(l),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605 User-Agent: ${l}`)),d&&(d=decodeURIComponent(d),I.info(`\u6307\u5B9A\u5408\u5E76\u6765\u6E90: ${d}`)),E!=null&&E!==""&&(E=decodeURIComponent(E),I.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${E}`)),p&&(p=decodeURIComponent(p),I.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${p}`)),h&&(h=decodeURIComponent(h),I.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${h}`)),!h&&d1(a,s)&&(h=!0,I.info(`\u5F53\u524D\u5BA2\u6237\u7AEF\u53EF\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${h}`)),i&&I.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External"),S&&I.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${S}`);let y=I.read(Dt),_=Je(y,r);if(_)try{_.passThroughUA&&(I.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${s}`),l=s);let D=await Pr({type:"subscription",name:r,platform:a,url:u,ua:l,content:f,mergeSources:d,ignoreFailedRemoteSub:E,produceType:p,produceOpts:{"include-unsupported-proxy":h,useMihomoExternal:i},$options:w,proxy:m,noCache:S}),j;if(_.source!=="local"||["localFirst","remoteFirst"].includes(_.mergeSources))try{u=`${u||_.url}`.split(/[\r\n]+/).map(P=>P.trim()).filter(P=>P.length)?.[0]||"";let q={},F=u.split("#");if(u=u.split("#")[0],F.length>1)try{q=JSON.parse(decodeURIComponent(F[1]))}catch{for(let L of F[1].split("&")){let M=L.split("=")[0],V=L.split("=")[1];q[M]=V==null||V===""?!0:decodeURIComponent(V)}}!q.noFlow&&/^https?/.test(u)&&(j=await Zr(q?.insecure?`${u}#insecure`:u,q.flowUserAgent,void 0,m||_.proxy,q.flowUrl),j&&t.set("subscription-userinfo",la(j)))}catch(q){I.error(`\u8BA2\u9605 ${r} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(q)}`)}if(_.subUserinfo){let q;if(/^https?:\/\//.test(_.subUserinfo))try{q=await Zr(void 0,void 0,void 0,m||_.proxy,_.subUserinfo)}catch(F){I.error(`\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${_.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(F)}`)}else q=_.subUserinfo;t.set("subscription-userinfo",la([q,j].filter(F=>F).join(";")))}a==="JSON"?(A==="nezha"?D=XA(D):A==="nezha-monitor"&&(n=/^\d+$/.test(n)?parseInt(n,10):D.findIndex(q=>q.name===n),D=await WA(D[n],n,e.query)),t.set("Content-Type","application/json;charset=utf-8").send(D)):t.send(D)}catch(B){I.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u8BA2\u9605\u5931\u8D25",`\u274C \u65E0\u6CD5\u4E0B\u8F7D\u8BA2\u9605\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${B.message??B}`),I.error(B.message??B),Pe(t,new jt("INTERNAL_SERVER_ERROR",`Failed to download subscription: ${r}`,`Reason: ${B.message??B}`))}else I.error(`\u{1F30D} Sub-Store \u4E0B\u8F7D\u8BA2\u9605\u5931\u8D25
\u274C \u672A\u627E\u5230\u8BA2\u9605\uFF1A${r}\uFF01`),Pe(t,new Vt("RESOURCE_NOT_FOUND",`Subscription ${r} does not exist!`),404)}async function Mu(e,t){let{name:r,nezhaIndex:n}=e.params;r=decodeURIComponent(r),n=decodeURIComponent(n);let i=e.query.target==="SurgeMac",a=e.query.target||p1(e.headers)||"JSON",s=I.read(Bt),u=Je(s,r),l=e.headers["user-agent"]||e.headers["User-Agent"];I.info(`\u6B63\u5728\u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\uFF1A${r}
\u8BF7\u6C42 User-Agent: ${l}
\u8BF7\u6C42 target: ${e.query.target}
\u5B9E\u9645\u8F93\u51FA: ${a}`);let{ignoreFailedRemoteSub:f,produceType:d,includeUnsupportedProxy:E,resultFormat:p,proxy:h,noCache:A}=e.query,m={_req:{method:e.method,url:e.url,path:e.path,query:e.query,params:e.params,headers:e.headers,body:e.body}};if(e.query.$options){try{m=JSON.parse(decodeURIComponent(e.query.$options))}catch{for(let w of e.query.$options.split("&")){let y=w.split("=")[0],_=w.split("=")[1];m[y]=_==null||_===""?!0:decodeURIComponent(_)}}I.info(`\u4F20\u5165 $options: ${JSON.stringify(m)}`)}if(h&&(h=decodeURIComponent(h),I.info(`\u6307\u5B9A\u8FDC\u7A0B\u8BA2\u9605\u4F7F\u7528\u4EE3\u7406/\u7B56\u7565 proxy: ${h}`)),f!=null&&f!==""&&(f=decodeURIComponent(f),I.info(`\u6307\u5B9A\u5FFD\u7565\u5931\u8D25\u7684\u8FDC\u7A0B\u8BA2\u9605: ${f}`)),d&&(d=decodeURIComponent(d),I.info(`\u6307\u5B9A\u751F\u4EA7\u7C7B\u578B: ${d}`)),E&&(E=decodeURIComponent(E),I.info(`\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${E}`)),!E&&d1(a,l)&&(E=!0,I.info(`\u5F53\u524D\u5BA2\u6237\u7AEF\u53EF\u5305\u542B\u5B98\u65B9/\u5546\u5E97\u7248/\u672A\u7EED\u8D39\u8BA2\u9605\u4E0D\u652F\u6301\u7684\u534F\u8BAE: ${E}`)),i&&I.info("\u624B\u52A8\u6307\u5B9A\u4E86 target \u4E3A SurgeMac, \u5C06\u4F7F\u7528 Mihomo External"),A&&I.info(`\u6307\u5B9A\u4E0D\u4F7F\u7528\u7F13\u5B58: ${A}`),u)try{let S=await Pr({type:"collection",name:r,platform:a,ignoreFailedRemoteSub:f,produceType:d,produceOpts:{"include-unsupported-proxy":E,useMihomoExternal:i},$options:m,proxy:h,noCache:A,ua:l}),w,y=I.read(Dt),_=u.subscriptions;if(_.length>0){let j=Je(y,_[0]);if(j.source!=="local"||["localFirst","remoteFirst"].includes(j.mergeSources))try{let q=`${j.url}`.split(/[\r\n]+/).map(L=>L.trim()).filter(L=>L.length)?.[0]||"",F={},P=q.split("#");if(q=q.split("#")[0],P.length>1)try{F=JSON.parse(decodeURIComponent(P[1]))}catch{for(let M of P[1].split("&")){let V=M.split("=")[0],W=M.split("=")[1];F[V]=W==null||W===""?!0:decodeURIComponent(W)}}!F.noFlow&&/^https?:/.test(q)&&(w=await Zr(F?.insecure?`${q}#insecure`:q,F.flowUserAgent,void 0,h||j.proxy||u.proxy,F.flowUrl))}catch(q){I.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4E2D\u7684\u5B50\u8BA2\u9605 ${j.name} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${q.message??q}`)}if(j.subUserinfo){let q;if(/^https?:\/\//.test(j.subUserinfo))try{q=await Zr(void 0,void 0,void 0,h||j.proxy,j.subUserinfo)}catch(F){I.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${j.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(F)}`)}else q=j.subUserinfo;w=[q,w].filter(F=>F).join("; ")}}I.info(`\u7EC4\u5408\u8BA2\u9605 ${r} \u900F\u4F20\u7684\u7684\u6D41\u91CF\u4FE1\u606F: ${w}`);let B;if(/^https?:\/\//.test(u.subUserinfo))try{B=await Zr(void 0,void 0,void 0,h||u.proxy,u.subUserinfo)}catch(j){I.error(`\u7EC4\u5408\u8BA2\u9605 ${r} \u4F7F\u7528\u81EA\u5B9A\u4E49\u6D41\u91CF\u94FE\u63A5 ${u.subUserinfo} \u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u65F6\u53D1\u751F\u9519\u8BEF: ${JSON.stringify(j)}`)}else B=u.subUserinfo;let D=[B,w].filter(j=>j).join("; ");D&&t.set("subscription-userinfo",la(D)),a==="JSON"?(p==="nezha"?S=XA(S):p==="nezha-monitor"&&(n=/^\d+$/.test(n)?parseInt(n,10):S.findIndex(j=>j.name===n),S=await WA(S[n],n,e.query)),t.set("Content-Type","application/json;charset=utf-8").send(S)):t.send(S)}catch(S){I.notify("\u{1F30D} Sub-Store \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u9519\u8BEF\uFF1A${r}\uFF01`,`\u{1F914} \u539F\u56E0\uFF1A${S}`),Pe(t,new jt("INTERNAL_SERVER_ERROR",`Failed to download collection: ${r}`,`Reason: ${S.message??S}`))}else I.error("\u{1F30D} Sub-Store \u4E0B\u8F7D\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C \u672A\u627E\u5230\u7EC4\u5408\u8BA2\u9605\uFF1A${r}\uFF01`),Pe(t,new Vt("RESOURCE_NOT_FOUND",`Collection ${r} does not exist!`),404)}async function WA(e,t,r){let n={code:0,message:"success",result:[]};try{let{isLoon:i,isSurge:a}=I.env;if(!i&&!a)throw new Error("\u4EC5\u652F\u6301 Loon \u548C Surge(ability=http-client-policy)");let s=yt.produce([e],i?"Loon":"Surge");if(!s)throw new Error("\u5F53\u524D\u5BA2\u6237\u7AEF\u4E0D\u517C\u5BB9\u6B64\u8282\u70B9");let u=e._monitors||[{name:"Cloudflare",url:"http://cp.cloudflare.com/generate_204",method:"HEAD",number:3,timeout:2e3},{name:"Google",url:"http://www.google.com/generate_204",method:"HEAD",number:3,timeout:2e3}],l=r.number||Math.max(...u.map(f=>f.number))||3;for(let f of u){let E={monitor_id:u.indexOf(f),server_id:t,monitor_name:f.name,server_name:e.name,created_at:[],avg_delay:[]};for(let p=0;p<l;p++){let h=Date.now();try{await I.http[(f.method||"HEAD").toLowerCase()]({timeout:f.timeout||2e3,url:f.url,"policy-descriptor":s,node:s});let A=Date.now()-h;I.info(`${f.name} latency: ${A}`),E.avg_delay.push(A)}catch(A){I.error(A),E.avg_delay.push(0)}E.created_at.push(Date.now()-6e5*(f.number-p-1))}n.result.push(E)}}catch(i){I.error(i),n.result.push({monitor_id:0,server_id:0,monitor_name:`\u274C ${i.message??i}`,server_name:e.name,created_at:[Date.now()],avg_delay:[0]})}return JSON.stringify(n,null,2)}function XA(e){let t={code:0,message:"success",result:[]};return e.map((r,n)=>{let i=r._geo?.countryCode||r._geo?.country;if(/^[a-z]{2}$/i.test(i)||(i=ih(r.name)),/^[a-z]{2}$/i.test(i)){let a=Math.round(new Date().getTime()/1e3),s=r._unavailable?0:a,u=parseInt(r._uptime||0,10);t.result.push({id:n,name:r.name,tag:`${r._tag??""}`,last_active:s,valid_ip:r._IP||r.server,ipv4:r._IPv4||r.server,ipv6:r._IPv6||(ur(r.server)?r.server:""),host:{Platform:"Sub-Store",PlatformVersion:Qi.version,CPU:[],MemTotal:1024,DiskTotal:1024,SwapTotal:1024,Arch:"",Virtualization:"",BootTime:a-u,CountryCode:i,Version:"0.0.1"},status:{CPU:0,MemUsed:0,SwapUsed:0,DiskUsed:0,NetInTransfer:0,NetOutTransfer:0,NetInSpeed:0,NetOutSpeed:0,Uptime:u,Load1:0,Load5:0,Load15:0,TcpConnCount:0,UdpConnCount:0,ProcessCount:0}})}}),JSON.stringify(t,null,2)}function m1(e){e.post("/api/preview/sub",C7),e.post("/api/preview/collection",_7),e.post("/api/preview/file",b7)}async function b7(e,t){try{let r=e.body,n="";if(r.type!=="mihomoProfile")if(r.source==="local"&&!["localFirst","remoteFirst"].includes(r.mergeSources))n=r.content;else{let u={};if(n=await Promise.all(r.url.split(/[\r\n]+/).map(l=>l.trim()).filter(l=>l.length).map(async l=>{try{return await yr(l,r.ua,void 0,r.proxy)}catch(f){return u[l]=f,I.error(`\u6587\u4EF6 ${r.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${l} \u53D1\u751F\u9519\u8BEF: ${f}`),""}})),Object.keys(u).length>0)if(r.ignoreFailedRemoteFile)r.ignoreFailedRemoteFile==="enabled"&&I.notify("\u{1F30D} Sub-Store \u9884\u89C8\u6587\u4EF6\u5931\u8D25",`\u274C ${r.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${r.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Object.keys(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);r.mergeSources==="localFirst"?n.unshift(r.content):r.mergeSources==="remoteFirst"&&n.push(r.content)}let i=(Array.isArray(n)?n:[n]).flat(),a=i.filter(u=>u!=null&&u!=="").join(`
`),s=Array.isArray(r.process)&&r.process.length>0?await yt.process({$files:i,$content:a,$file:r},r.process):{$content:a,$files:i};Ne(t,{original:a,processed:s?.$content??""})}catch(r){I.error(r.message??r),Pe(t,new jt("INTERNAL_SERVER_ERROR","Failed to preview file",`Reason: ${r.message??r}`))}}async function C7(e,t){try{let r=e.body,n=e.query.target||"JSON",i;if(r.source==="local"&&!["localFirst","remoteFirst"].includes(r.mergeSources))i=r.content;else{let u={};if(i=await Promise.all(r.url.split(/[\r\n]+/).map(l=>l.trim()).filter(l=>l.length).map(async l=>{try{return await yr(l,r.ua,void 0,r.proxy,void 0,void 0,void 0,!0)}catch(f){return u[l]=f,I.error(`\u8BA2\u9605 ${r.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${l} \u53D1\u751F\u9519\u8BEF: ${f}`),""}})),Object.keys(u).length>0)if(r.ignoreFailedRemoteSub)r.ignoreFailedRemoteSub==="enabled"&&I.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${r.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${r.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);r.mergeSources==="localFirst"?i.unshift(r.content):r.mergeSources==="remoteFirst"&&i.push(r.content)}let a=(Array.isArray(i)?i:[i]).map(u=>yt.parse(u)).flat();a.forEach((u,l)=>{u.id=l,u._subName=r.name,u._subDisplayName=r.displayName});let s=await yt.process(a,r.process||[],n,{[r.name]:r});Ne(t,{original:a,processed:s})}catch(r){I.error(r.message??r),Pe(t,new jt("INTERNAL_SERVER_ERROR","Failed to preview subscription",`Reason: ${r.message??r}`))}}async function _7(e,t){try{let r=I.read(Dt),n=e.body,i=[...n.subscriptions],a=n.subscriptionTags;Array.isArray(a)&&a.length>0&&r.forEach(d=>{Array.isArray(d.tag)&&d.tag.length>0&&!i.includes(d.name)&&d.tag.some(E=>a.includes(E))&&i.push(d.name)});let s={},u={};if(await Promise.all(i.map(async d=>{let E=Je(r,d);try{let p;if(E.source==="local"&&!["localFirst","remoteFirst"].includes(E.mergeSources))p=E.content;else{let A={};if(p=await Promise.all(E.url.split(/[\r\n]+/).map(m=>m.trim()).filter(m=>m.length).map(async m=>{try{return await yr(m,E.ua,void 0,E.proxy,void 0,void 0,void 0,!0)}catch(S){return A[m]=S,I.error(`\u8BA2\u9605 ${E.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${m} \u53D1\u751F\u9519\u8BEF: ${S}`),""}})),Object.keys(A).length>0)if(E.ignoreFailedRemoteSub)E.ignoreFailedRemoteSub==="enabled"&&I.notify("\u{1F30D} Sub-Store \u9884\u89C8\u8BA2\u9605\u5931\u8D25",`\u274C ${E.name}`,`\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(A).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u8BA2\u9605 ${E.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Object.keys(A).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);E.mergeSources==="localFirst"?p.unshift(E.content):E.mergeSources==="remoteFirst"&&p.push(E.content)}let h=(Array.isArray(p)?p:[p]).map(A=>yt.parse(A)).flat();h.forEach(A=>{A._subName=E.name,A._subDisplayName=E.displayName,A._collectionName=n.name,A._collectionDisplayName=n.displayName}),h=await yt.process(h,E.process||[],"JSON",{[E.name]:E,_collection:n}),s[d]=h}catch(p){u[d]=p,I.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605 ${n.name} \u4E2D\u7684\u5B50\u8BA2\u9605: ${E.name} \u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${p}\uFF01`)}})),Object.keys(u).length>0)if(n.ignoreFailedRemoteSub)n.ignoreFailedRemoteSub==="enabled"&&I.notify("\u{1F30D} Sub-Store \u9884\u89C8\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${n.name}`,`\u5B50\u8BA2\u9605 ${Object.keys(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${n.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(u).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);let l=Array.prototype.concat.apply([],i.map(d=>s[d]||[]));l.forEach((d,E)=>{d.id=E,d._collectionName=n.name,d._collectionDisplayName=n.displayName});let f=await yt.process(l,n.process||[],"JSON",{_collection:n});Ne(t,{original:l,processed:f})}catch(r){I.error(r.message??r),Pe(t,new jt("INTERNAL_SERVER_ERROR","Failed to preview collection",`Reason: ${r.message??r}`))}}function v1(e){e.post("/api/sort/subs",F7),e.post("/api/sort/collections",I7),e.post("/api/sort/artifacts",$7),e.post("/api/sort/files",D7)}function F7(e,t){let r=e.body,n=I.read(Dt);n.sort((i,a)=>r.indexOf(i.name)-r.indexOf(a.name)),I.write(n,Dt),Ne(t,n)}function I7(e,t){let r=e.body,n=I.read(Bt);n.sort((i,a)=>r.indexOf(i.name)-r.indexOf(a.name)),I.write(n,Bt),Ne(t,n)}function $7(e,t){let r=e.body,n=I.read(ht);n.sort((i,a)=>r.indexOf(i.name)-r.indexOf(a.name)),I.write(n,ht),Ne(t,n)}function D7(e,t){let r=e.body,n=I.read(vt);n.sort((i,a)=>r.indexOf(i.name)-r.indexOf(a.name)),I.write(n,vt),Ne(t,n)}function E1(e){e.post("/api/utils/node-info",B7)}async function B7(e,t){let r=e.body,n=e.query.lang||"zh-CN",i;try{i=mh.URI.produce(r)}catch{}try{let s=await wi().get({url:`http://ip-api.com/json/${encodeURIComponent(`${r.server}`.trim().replace(/^\[/,"").replace(/\]$/,""))}?lang=${n}`,headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15"}}).then(u=>{let l=JSON.parse(u.body);if(l.status!=="success")throw new Error(l.message);return delete l.status,l});Ne(t,{shareUrl:i,info:s})}catch(a){Pe(t,new lu("FAILED_TO_GET_NODE_INFO","Failed to get node info",`Reason: ${a}`))}}function w1(e){e.route("/api/proxy/parse").post(R7),e.route("/api/rule/parse").post(P7)}function R7(e,t){let{data:r,client:n,content:i,platform:a}=e.body;var s={};try{var u=yt.parse(r??i),l=yt.produce(u,n??a);s.par_res=l}catch(f){Pe(t,f);return}Ne(t,s)}function P7(e,t){let{data:r,client:n,content:i,platform:a}=e.body;var s={};try{let l=wo.parse(r??i);var u=wo.produce(l,n??a);s.par_res=u}catch(l){Pe(t,l);return}Ne(t,s)}function A1(){let port,host;I.env.isNode&&(port=eval("process.env.SUB_STORE_BACKEND_API_PORT")||3e3,host=eval("process.env.SUB_STORE_BACKEND_API_HOST")||"::");let $app=Qp({substore:I,port,host});if(I.env.isNode){let be_merge=eval("process.env.SUB_STORE_BACKEND_MERGE"),be_prefix=eval("process.env.SUB_STORE_BACKEND_PREFIX"),fe_be_path=eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH"),fe_path=eval("process.env.SUB_STORE_FRONTEND_PATH");if(be_prefix||be_merge){if(!fe_be_path.startsWith("/"))throw new Error("SUB_STORE_FRONTEND_BACKEND_PATH should start with /");be_merge&&(I.info("[BACKEND] MERGE mode is [ON]."),I.info(`[BACKEND && FRONTEND] ${host}:${port}`)),I.info(`[BACKEND PREFIX] ${host}:${port}${fe_be_path}`),$app.use((req,res,next)=>{if(req.path.startsWith(fe_be_path)){req.url=req.url.replace(fe_be_path,"")||"/",be_merge&&req.url.startsWith("/api/")&&(req.query.share="true"),next();return}let pathname=decodeURIComponent(req._parsedUrl.pathname)||"/";if(be_merge&&req.path.startsWith("/share/")&&req.query.token){if(req.method.toLowerCase()!=="get"){res.status(405).send("Method not allowed");return}if((I.read(ln)||[]).find(r=>r.token===req.query.token&&`/share/${r.type}/${r.name}`===pathname&&(r.exp==null||r.exp>Date.now()))){next();return}}if(be_merge&&fe_path&&req.path.indexOf("/",1)==-1){req.path.indexOf(".")==-1&&(req.url="/index.html");let express_=require("express"),mime_=require("mime-types"),path_=require("path"),staticFileMiddleware=express_.static(fe_path,{setHeaders:(e,t)=>{let r=mime_.contentType(path_.extname(t));r&&e.set("Content-Type",r)}});staticFileMiddleware(req,res,next);return}res.status(403).end("Forbbiden")})}}if(n1($app),r1($app),g1($app),m1($app),v1($app),e1($app),X0($app),i1($app),s1($app),a1($app),J0($app),E1($app),t1($app),w1($app),$app.start(),I.env.isNode){let backend_sync_cron=eval("process.env.SUB_STORE_BACKEND_SYNC_CRON")||eval("process.env.SUB_STORE_BACKEND_CRON");if(backend_sync_cron){I.info(`[SYNC CRON] ${backend_sync_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_sync_cron,async function(){try{I.info(`[SYNC CRON] ${backend_sync_cron} started`),await Z0(),I.info(`[SYNC CRON] ${backend_sync_cron} finished`)}catch(e){I.error(`[SYNC CRON] ${backend_sync_cron} error: ${e.message??e}`)}},null,!0)}let produce_cron=eval("process.env.SUB_STORE_PRODUCE_CRON");if(produce_cron){I.info(`[PRODUCE CRON] ${produce_cron} enabled`);let{CronJob}=require("cron");produce_cron.split(/\s*;\s*/).map(e=>{let[t,r,n]=e.split(/\s*,\s*/);new CronJob(t.trim(),async function(){try{I.info(`[PRODUCE CRON] ${r} ${n} ${t} started`),await Pr({type:r,name:n}),I.info(`[PRODUCE CRON] ${r} ${n} ${t} finished`)}catch(i){I.error(`[PRODUCE CRON] ${r} ${n} ${t} error: ${i.message??i}`)}},null,!0)})}let backend_download_cron=eval("process.env.SUB_STORE_BACKEND_DOWNLOAD_CRON");if(backend_download_cron){I.info(`[DOWNLOAD CRON] ${backend_download_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_download_cron,async function(){try{I.info(`[DOWNLOAD CRON] ${backend_download_cron} started`),await Dh("download"),I.info(`[DOWNLOAD CRON] ${backend_download_cron} finished`)}catch(e){I.error(`[DOWNLOAD CRON] ${backend_download_cron} error: ${e.message??e}`)}},null,!0)}let backend_upload_cron=eval("process.env.SUB_STORE_BACKEND_UPLOAD_CRON");if(backend_upload_cron){I.info(`[UPLOAD CRON] ${backend_upload_cron} enabled`);let{CronJob}=require("cron");new CronJob(backend_upload_cron,async function(){try{I.info(`[UPLOAD CRON] ${backend_upload_cron} started`),await Dh("upload"),I.info(`[UPLOAD CRON] ${backend_upload_cron} finished`)}catch(e){I.error(`[UPLOAD CRON] ${backend_upload_cron} error: ${e.message??e}`)}},null,!0)}let mmdb_cron=eval("process.env.SUB_STORE_MMDB_CRON"),countryFile=eval("process.env.SUB_STORE_MMDB_COUNTRY_PATH"),countryUrl=eval("process.env.SUB_STORE_MMDB_COUNTRY_URL"),asnFile=eval("process.env.SUB_STORE_MMDB_ASN_PATH"),asnUrl=eval("process.env.SUB_STORE_MMDB_ASN_URL");if(mmdb_cron&&(countryFile&&countryUrl||asnFile&&asnUrl)){I.info(`[MMDB CRON] ${mmdb_cron} enabled`);let{CronJob}=require("cron");new CronJob(mmdb_cron,async function(){try{if(I.info(`[MMDB CRON] ${mmdb_cron} started`),countryFile&&countryUrl)try{I.info(`[MMDB CRON] downloading ${countryUrl} to ${countryFile}`),await pl(countryUrl,countryFile)}catch(e){I.error(`[MMDB CRON] ${countryUrl} download failed: ${e.message??e}`)}if(asnFile&&asnUrl)try{I.info(`[MMDB CRON] downloading ${asnUrl} to ${asnFile}`),await pl(asnUrl,asnFile)}catch(e){I.error(`[MMDB CRON] ${asnUrl} download failed: ${e.message??e}`)}I.info(`[MMDB CRON] ${mmdb_cron} finished`)}catch(e){I.error(`[MMDB CRON] ${mmdb_cron} error: ${e.message??e}`)}},null,!0)}let path=require("path"),fs=require("fs"),data_url=eval("process.env.SUB_STORE_DATA_URL"),fe_be_path=eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH"),fe_port=eval("process.env.SUB_STORE_FRONTEND_PORT")||3001,fe_host=eval("process.env.SUB_STORE_FRONTEND_HOST")||host||"::",fe_path=eval("process.env.SUB_STORE_FRONTEND_PATH"),fe_abs_path=path.resolve(fe_path||path.join(__dirname,"frontend")),be_merge=eval("process.env.SUB_STORE_BACKEND_MERGE");if(fe_path&&!be_merge){try{fs.accessSync(path.join(fe_abs_path,"index.html"))}catch(e){I.error(`[FRONTEND] index.html file not found in ${fe_abs_path}`)}let express_=require("express"),history=require("connect-history-api-fallback"),{createProxyMiddleware}=require("http-proxy-middleware"),app=express_(),staticFileMiddleware=express_.static(fe_path),be_api="/api/",be_download="/download/",be_share="/share/",be_download_rewrite="",be_api_rewrite="",be_share_rewrite=`${be_share}:type/:name`,prefix=eval("process.env.SUB_STORE_BACKEND_PREFIX")?fe_be_path:"";if(fe_be_path){if(!fe_be_path.startsWith("/"))throw new Error("SUB_STORE_FRONTEND_BACKEND_PATH should start with /");be_api_rewrite=`${fe_be_path==="/"?"":fe_be_path}${be_api}`,be_download_rewrite=`${fe_be_path==="/"?"":fe_be_path}${be_download}`,app.use(be_share_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}`,changeOrigin:!0,pathRewrite:async(e,t)=>{if(t.method.toLowerCase()!=="get")throw new Error("Method not allowed");if(!(I.read(ln)||[]).find(i=>i.token===t.query.token&&i.type===t.params.type&&i.name===t.params.name&&(i.exp==null||i.exp>Date.now())))throw new Error("Forbbiden");return t.originalUrl}})),app.use(be_api_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}${be_api}`,pathRewrite:async e=>e.includes("?")?`${e}&share=true`:`${e}?share=true`})),app.use(be_download_rewrite,createProxyMiddleware({target:`http://127.0.0.1:${port}${prefix}${be_download}`,changeOrigin:!0}))}app.use(staticFileMiddleware),app.use(history({disableDotRule:!0,verbose:!1})),app.use(staticFileMiddleware);let listener=app.listen(fe_port,fe_host,()=>{let{address:e,port:t}=listener.address();I.info(`[FRONTEND] ${e}:${t}`),fe_be_path&&(I.info(`[FRONTEND -> BACKEND] ${e}:${t}${be_api_rewrite} -> ${host}:${port}${prefix}${be_api}`),I.info(`[FRONTEND -> BACKEND] ${e}:${t}${be_download_rewrite} -> ${host}:${port}${prefix}${be_download}`),I.info(`[SHARE BACKEND] ${e}:${t}${be_share_rewrite}`))})}data_url&&(I.info(`[BACKEND] downloading data from ${data_url}`),yr(data_url).then(e=>{I.write(e,"#sub-store"),I.cache=JSON.parse(e),I.persistCache(),aa(),I.info(`[BACKEND] restored data from ${data_url}`)}).catch(e=>{throw I.error("[BACKEND] restore data failed"),console.error(e),e}))}}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 -- v${uf}
\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
`);aa();A1();})();
/*! Bundled license information:
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @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 <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
*/