mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-27 15:10:07 +00:00
1902 lines
1.2 MiB
Plaintext
1902 lines
1.2 MiB
Plaintext
var dO=Object.create;var Yv=Object.defineProperty;var pO=Object.getOwnPropertyDescriptor;var mO=Object.getOwnPropertyNames;var gO=Object.getPrototypeOf,vO=Object.prototype.hasOwnProperty;var vu=(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 be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wO=(e,t)=>{for(var r in t)Yv(e,r,{get:t[r],enumerable:!0})},yO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mO(t))!vO.call(e,i)&&i!==r&&Yv(e,i,{get:()=>t[i],enumerable:!(n=pO(t,i))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?dO(gO(e)):{},yO(t||!e||!e.__esModule?Yv(r,"default",{value:e,enumerable:!0}):r,e));var xs=be((Xv,k5)=>{"use strict";var ute=B(x()),Vh=function(e){return e&&e.Math===Math&&e};k5.exports=Vh(typeof globalThis=="object"&&globalThis)||Vh(typeof window=="object"&&window)||Vh(typeof self=="object"&&self)||Vh(typeof global=="object"&&global)||Vh(typeof Xv=="object"&&Xv)||(function(){return this})()||Function("return this")()});var na=be((cte,R5)=>{"use strict";var lte=B(x());R5.exports=function(e){try{return!!e()}catch{return!0}}});var wu=be((fte,T5)=>{"use strict";var hte=B(x()),EO=na();T5.exports=!EO(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Zv=be((dte,O5)=>{"use strict";var pte=B(x()),bO=na();O5.exports=!bO(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")})});var M0=be((mte,N5)=>{"use strict";var gte=B(x()),AO=Zv(),H0=Function.prototype.call;N5.exports=AO?H0.bind(H0):function(){return H0.apply(H0,arguments)}});var M5=be(H5=>{"use strict";var wte=B(x()),L5={}.propertyIsEnumerable,U5=Object.getOwnPropertyDescriptor,SO=U5&&!L5.call({1:2},1);H5.f=SO?function(t){var r=U5(this,t);return!!r&&r.enumerable}:L5});var Jv=be((yte,q5)=>{"use strict";var Ete=B(x());q5.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}});var so=be((bte,V5)=>{"use strict";var Ate=B(x()),j5=Zv(),K5=Function.prototype,Qv=K5.call,_O=j5&&K5.bind.bind(Qv,Qv);V5.exports=j5?_O:function(e){return function(){return Qv.apply(e,arguments)}}});var W5=be((Ste,G5)=>{"use strict";var _te=B(x()),z5=so(),CO=z5({}.toString),DO=z5("".slice);G5.exports=function(e){return DO(CO(e),8,-1)}});var X5=be((Cte,Y5)=>{"use strict";var Dte=B(x()),FO=so(),BO=na(),IO=W5(),ew=Object,xO=FO("".split);Y5.exports=BO(function(){return!ew("z").propertyIsEnumerable(0)})?function(e){return IO(e)==="String"?xO(e,""):ew(e)}:ew});var tw=be((Fte,Z5)=>{"use strict";var Bte=B(x());Z5.exports=function(e){return e==null}});var rw=be((Ite,J5)=>{"use strict";var xte=B(x()),$O=tw(),PO=TypeError;J5.exports=function(e){if($O(e))throw new PO("Can't call method on "+e);return e}});var q0=be(($te,Q5)=>{"use strict";var Pte=B(x()),kO=X5(),RO=rw();Q5.exports=function(e){return kO(RO(e))}});var Si=be((kte,e4)=>{"use strict";var Rte=B(x()),nw=typeof document=="object"&&document.all;e4.exports=typeof nw>"u"&&nw!==void 0?function(e){return typeof e=="function"||e===nw}:function(e){return typeof e=="function"}});var ql=be((Tte,t4)=>{"use strict";var Ote=B(x()),TO=Si();t4.exports=function(e){return typeof e=="object"?e!==null:TO(e)}});var iw=be((Nte,r4)=>{"use strict";var Lte=B(x()),sw=xs(),OO=Si(),NO=function(e){return OO(e)?e:void 0};r4.exports=function(e,t){return arguments.length<2?NO(sw[e]):sw[e]&&sw[e][t]}});var s4=be((Ute,n4)=>{"use strict";var Hte=B(x()),LO=so();n4.exports=LO({}.isPrototypeOf)});var u4=be((Mte,a4)=>{"use strict";var qte=B(x()),UO=xs(),i4=UO.navigator,o4=i4&&i4.userAgent;a4.exports=o4?String(o4):""});var m4=be((jte,p4)=>{"use strict";var Kte=B(x()),d4=xs(),ow=u4(),c4=d4.process,l4=d4.Deno,f4=c4&&c4.versions||l4&&l4.version,h4=f4&&f4.v8,_i,j0;h4&&(_i=h4.split("."),j0=_i[0]>0&&_i[0]<4?1:+(_i[0]+_i[1]));!j0&&ow&&(_i=ow.match(/Edge\/(\d+)/),(!_i||_i[1]>=74)&&(_i=ow.match(/Chrome\/(\d+)/),_i&&(j0=+_i[1])));p4.exports=j0});var aw=be((Vte,v4)=>{"use strict";var zte=B(x()),g4=m4(),HO=na(),MO=xs(),qO=MO.String;v4.exports=!!Object.getOwnPropertySymbols&&!HO(function(){var e=Symbol("symbol detection");return!qO(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&g4&&g4<41})});var uw=be((Gte,w4)=>{"use strict";var Wte=B(x()),jO=aw();w4.exports=jO&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var cw=be((Yte,y4)=>{"use strict";var Xte=B(x()),KO=iw(),VO=Si(),zO=s4(),GO=uw(),WO=Object;y4.exports=GO?function(e){return typeof e=="symbol"}:function(e){var t=KO("Symbol");return VO(t)&&zO(t.prototype,WO(e))}});var b4=be((Zte,E4)=>{"use strict";var Jte=B(x()),YO=String;E4.exports=function(e){try{return YO(e)}catch{return"Object"}}});var S4=be((Qte,A4)=>{"use strict";var ere=B(x()),XO=Si(),ZO=b4(),JO=TypeError;A4.exports=function(e){if(XO(e))return e;throw new JO(ZO(e)+" is not a function")}});var C4=be((tre,_4)=>{"use strict";var rre=B(x()),QO=S4(),eN=tw();_4.exports=function(e,t){var r=e[t];return eN(r)?void 0:QO(r)}});var F4=be((nre,D4)=>{"use strict";var sre=B(x()),lw=M0(),fw=Si(),hw=ql(),tN=TypeError;D4.exports=function(e,t){var r,n;if(t==="string"&&fw(r=e.toString)&&!hw(n=lw(r,e))||fw(r=e.valueOf)&&!hw(n=lw(r,e))||t!=="string"&&fw(r=e.toString)&&!hw(n=lw(r,e)))return n;throw new tN("Can't convert object to primitive value")}});var I4=be((ire,B4)=>{"use strict";var ore=B(x());B4.exports=!1});var K0=be((are,$4)=>{"use strict";var ure=B(x()),x4=xs(),rN=Object.defineProperty;$4.exports=function(e,t){try{rN(x4,e,{value:t,configurable:!0,writable:!0})}catch{x4[e]=t}return t}});var V0=be((cre,R4)=>{"use strict";var lre=B(x()),nN=I4(),sN=xs(),iN=K0(),P4="__core-js_shared__",k4=R4.exports=sN[P4]||iN(P4,{});(k4.versions||(k4.versions=[])).push({version:"3.49.0",mode:nN?"pure":"global",copyright:"\xA9 2013\u20132025 Denis Pushkarev (zloirock.ru), 2025\u20132026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var dw=be((fre,O4)=>{"use strict";var hre=B(x()),T4=V0();O4.exports=function(e,t){return T4[e]||(T4[e]=t||{})}});var L4=be((dre,N4)=>{"use strict";var pre=B(x()),oN=rw(),aN=Object;N4.exports=function(e){return aN(oN(e))}});var sa=be((mre,U4)=>{"use strict";var gre=B(x()),uN=so(),cN=L4(),lN=uN({}.hasOwnProperty);U4.exports=Object.hasOwn||function(t,r){return lN(cN(t),r)}});var pw=be((vre,H4)=>{"use strict";var wre=B(x()),fN=so(),hN=0,dN=Math.random(),pN=fN(1.1.toString);H4.exports=function(e){return"Symbol("+(e===void 0?"":e)+")_"+pN(++hN+dN,36)}});var j4=be((yre,q4)=>{"use strict";var Ere=B(x()),mN=xs(),gN=dw(),M4=sa(),vN=pw(),wN=aw(),yN=uw(),jl=mN.Symbol,mw=gN("wks"),EN=yN?jl.for||jl:jl&&jl.withoutSetter||vN;q4.exports=function(e){return M4(mw,e)||(mw[e]=wN&&M4(jl,e)?jl[e]:EN("Symbol."+e)),mw[e]}});var G4=be((bre,z4)=>{"use strict";var Are=B(x()),bN=M0(),K4=ql(),V4=cw(),AN=C4(),SN=F4(),_N=j4(),CN=TypeError,DN=_N("toPrimitive");z4.exports=function(e,t){if(!K4(e)||V4(e))return e;var r=AN(e,DN),n;if(r){if(t===void 0&&(t="default"),n=bN(r,e,t),!K4(n)||V4(n))return n;throw new CN("Can't convert object to primitive value")}return t===void 0&&(t="number"),SN(e,t)}});var gw=be((Sre,W4)=>{"use strict";var _re=B(x()),FN=G4(),BN=cw();W4.exports=function(e){var t=FN(e,"string");return BN(t)?t:t+""}});var Z4=be((Cre,X4)=>{"use strict";var Dre=B(x()),IN=xs(),Y4=ql(),vw=IN.document,xN=Y4(vw)&&Y4(vw.createElement);X4.exports=function(e){return xN?vw.createElement(e):{}}});var ww=be((Fre,J4)=>{"use strict";var Bre=B(x()),$N=wu(),PN=na(),kN=Z4();J4.exports=!$N&&!PN(function(){return Object.defineProperty(kN("div"),"a",{get:function(){return 7}}).a!==7})});var yw=be(e3=>{"use strict";var xre=B(x()),RN=wu(),TN=M0(),ON=M5(),NN=Jv(),LN=q0(),UN=gw(),HN=sa(),MN=ww(),Q4=Object.getOwnPropertyDescriptor;e3.f=RN?Q4:function(t,r){if(t=LN(t),r=UN(r),MN)try{return Q4(t,r)}catch{}if(HN(t,r))return NN(!TN(ON.f,t,r),t[r])}});var r3=be(($re,t3)=>{"use strict";var Pre=B(x()),qN=wu(),jN=na();t3.exports=qN&&jN(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Ew=be((kre,n3)=>{"use strict";var Rre=B(x()),KN=ql(),VN=String,zN=TypeError;n3.exports=function(e){if(KN(e))return e;throw new zN(VN(e)+" is not an object")}});var G0=be(i3=>{"use strict";var Ore=B(x()),GN=wu(),WN=ww(),YN=r3(),z0=Ew(),s3=gw(),XN=TypeError,bw=Object.defineProperty,ZN=Object.getOwnPropertyDescriptor,Aw="enumerable",Sw="configurable",_w="writable";i3.f=GN?YN?function(t,r,n){if(z0(t),r=s3(r),z0(n),typeof t=="function"&&r==="prototype"&&"value"in n&&_w in n&&!n[_w]){var i=ZN(t,r);i&&i[_w]&&(t[r]=n.value,n={configurable:Sw in n?n[Sw]:i[Sw],enumerable:Aw in n?n[Aw]:i[Aw],writable:!1})}return bw(t,r,n)}:bw:function(t,r,n){if(z0(t),r=s3(r),z0(n),WN)try{return bw(t,r,n)}catch{}if("get"in n||"set"in n)throw new XN("Accessors not supported");return"value"in n&&(t[r]=n.value),t}});var Cw=be((Nre,o3)=>{"use strict";var Lre=B(x()),JN=wu(),QN=G0(),eL=Jv();o3.exports=JN?function(e,t,r){return QN.f(e,t,eL(1,r))}:function(e,t,r){return e[t]=r,e}});var c3=be((Ure,u3)=>{"use strict";var Hre=B(x()),Dw=wu(),tL=sa(),a3=Function.prototype,rL=Dw&&Object.getOwnPropertyDescriptor,Fw=tL(a3,"name"),nL=Fw&&function(){}.name==="something",sL=Fw&&(!Dw||Dw&&rL(a3,"name").configurable);u3.exports={EXISTS:Fw,PROPER:nL,CONFIGURABLE:sL}});var f3=be((Mre,l3)=>{"use strict";var qre=B(x()),iL=so(),oL=Si(),Bw=V0(),aL=iL(Function.toString);oL(Bw.inspectSource)||(Bw.inspectSource=function(e){return aL(e)});l3.exports=Bw.inspectSource});var p3=be((jre,d3)=>{"use strict";var Kre=B(x()),uL=xs(),cL=Si(),h3=uL.WeakMap;d3.exports=cL(h3)&&/native code/.test(String(h3))});var v3=be((Vre,g3)=>{"use strict";var zre=B(x()),lL=dw(),fL=pw(),m3=lL("keys");g3.exports=function(e){return m3[e]||(m3[e]=fL(e))}});var Iw=be((Gre,w3)=>{"use strict";var Wre=B(x());w3.exports={}});var A3=be((Yre,b3)=>{"use strict";var Xre=B(x()),hL=p3(),E3=xs(),dL=ql(),pL=Cw(),xw=sa(),$w=V0(),mL=v3(),gL=Iw(),y3="Object already initialized",Pw=E3.TypeError,vL=E3.WeakMap,W0,zh,Y0,wL=function(e){return Y0(e)?zh(e):W0(e,{})},yL=function(e){return function(t){var r;if(!dL(t)||(r=zh(t)).type!==e)throw new Pw("Incompatible receiver, "+e+" required");return r}};hL||$w.state?(Ci=$w.state||($w.state=new vL),Ci.get=Ci.get,Ci.has=Ci.has,Ci.set=Ci.set,W0=function(e,t){if(Ci.has(e))throw new Pw(y3);return t.facade=e,Ci.set(e,t),t},zh=function(e){return Ci.get(e)||{}},Y0=function(e){return Ci.has(e)}):(bc=mL("state"),gL[bc]=!0,W0=function(e,t){if(xw(e,bc))throw new Pw(y3);return t.facade=e,pL(e,bc,t),t},zh=function(e){return xw(e,bc)?e[bc]:{}},Y0=function(e){return xw(e,bc)});var Ci,bc;b3.exports={set:W0,get:zh,has:Y0,enforce:wL,getterFor:yL}});var D3=be((Zre,C3)=>{"use strict";var Jre=B(x()),Rw=so(),EL=na(),bL=Si(),X0=sa(),kw=wu(),AL=c3().CONFIGURABLE,SL=f3(),_3=A3(),_L=_3.enforce,CL=_3.get,S3=String,Z0=Object.defineProperty,DL=Rw("".slice),FL=Rw("".replace),BL=Rw([].join),IL=kw&&!EL(function(){return Z0(function(){},"length",{value:8}).length!==8}),xL=String(String).split("String"),$L=C3.exports=function(e,t,r){DL(S3(t),0,7)==="Symbol("&&(t="["+FL(S3(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!X0(e,"name")||AL&&e.name!==t)&&(kw?Z0(e,"name",{value:t,configurable:!0}):e.name=t),IL&&r&&X0(r,"arity")&&e.length!==r.arity&&Z0(e,"length",{value:r.arity});try{r&&X0(r,"constructor")&&r.constructor?kw&&Z0(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=_L(e);return X0(n,"source")||(n.source=BL(xL,typeof t=="string"?t:"")),e};Function.prototype.toString=$L(function(){return bL(this)&&CL(this).source||SL(this)},"toString")});var B3=be((Qre,F3)=>{"use strict";var ene=B(x()),PL=Si(),kL=G0(),RL=D3(),TL=K0();F3.exports=function(e,t,r,n){n||(n={});var i=n.enumerable,o=n.name!==void 0?n.name:t;if(PL(r)&&RL(r,o,n),n.global)i?e[t]=r:TL(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch{}i?e[t]=r:kL.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e}});var x3=be((tne,I3)=>{"use strict";var rne=B(x()),OL=Math.ceil,NL=Math.floor;I3.exports=Math.trunc||function(t){var r=+t;return(r>0?NL:OL)(r)}});var Tw=be((nne,$3)=>{"use strict";var sne=B(x()),LL=x3();$3.exports=function(e){var t=+e;return t!==t||t===0?0:LL(t)}});var k3=be((ine,P3)=>{"use strict";var one=B(x()),UL=Tw(),HL=Math.max,ML=Math.min;P3.exports=function(e,t){var r=UL(e);return r<0?HL(r+t,0):ML(r,t)}});var T3=be((ane,R3)=>{"use strict";var une=B(x()),qL=Tw(),jL=Math.min;R3.exports=function(e){var t=qL(e);return t>0?jL(t,9007199254740991):0}});var N3=be((cne,O3)=>{"use strict";var lne=B(x()),KL=T3();O3.exports=function(e){return KL(e.length)}});var H3=be((fne,U3)=>{"use strict";var hne=B(x()),VL=q0(),zL=k3(),GL=N3(),L3=function(e){return function(t,r,n){var i=VL(t),o=GL(i);if(o===0)return!e&&-1;var s=zL(n,o),a;if(e&&r!==r){for(;o>s;)if(a=i[s++],a!==a)return!0}else for(;o>s;s++)if((e||s in i)&&i[s]===r)return e||s||0;return!e&&-1}};U3.exports={includes:L3(!0),indexOf:L3(!1)}});var j3=be((dne,q3)=>{"use strict";var pne=B(x()),WL=so(),Ow=sa(),YL=q0(),XL=H3().indexOf,ZL=Iw(),M3=WL([].push);q3.exports=function(e,t){var r=YL(e),n=0,i=[],o;for(o in r)!Ow(ZL,o)&&Ow(r,o)&&M3(i,o);for(;t.length>n;)Ow(r,o=t[n++])&&(~XL(i,o)||M3(i,o));return i}});var V3=be((mne,K3)=>{"use strict";var gne=B(x());K3.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var G3=be(z3=>{"use strict";var wne=B(x()),JL=j3(),QL=V3(),eU=QL.concat("length","prototype");z3.f=Object.getOwnPropertyNames||function(t){return JL(t,eU)}});var Y3=be(W3=>{"use strict";var Ene=B(x());W3.f=Object.getOwnPropertySymbols});var Z3=be((bne,X3)=>{"use strict";var Ane=B(x()),tU=iw(),rU=so(),nU=G3(),sU=Y3(),iU=Ew(),oU=rU([].concat);X3.exports=tU("Reflect","ownKeys")||function(t){var r=nU.f(iU(t)),n=sU.f;return n?oU(r,n(t)):r}});var e_=be((Sne,Q3)=>{"use strict";var _ne=B(x()),J3=sa(),aU=Z3(),uU=yw(),cU=G0();Q3.exports=function(e,t,r){for(var n=aU(t),i=cU.f,o=uU.f,s=0;s<n.length;s++){var a=n[s];!J3(e,a)&&!(r&&J3(r,a))&&i(e,a,o(t,a))}}});var r_=be((Cne,t_)=>{"use strict";var Dne=B(x()),lU=na(),fU=Si(),hU=/#|\.prototype\./,Gh=function(e,t){var r=pU[dU(e)];return r===gU?!0:r===mU?!1:fU(t)?lU(t):!!t},dU=Gh.normalize=function(e){return String(e).replace(hU,".").toLowerCase()},pU=Gh.data={},mU=Gh.NATIVE="N",gU=Gh.POLYFILL="P";t_.exports=Gh});var s_=be((Fne,n_)=>{"use strict";var Bne=B(x()),J0=xs(),vU=yw().f,wU=Cw(),yU=B3(),EU=K0(),bU=e_(),AU=r_();n_.exports=function(e,t){var r=e.target,n=e.global,i=e.stat,o,s,a,u,l,h;if(n?s=J0:i?s=J0[r]||EU(r,{}):s=J0[r]&&J0[r].prototype,s)for(a in t){if(l=t[a],e.dontCallGetSet?(h=vU(s,a),u=h&&h.value):u=s[a],o=AU(n?a:r+(i?".":"#")+a,e.forced),!o&&u!==void 0){if(typeof l==typeof u)continue;bU(l,u)}(e.sham||u&&u.sham)&&wU(l,"sham",!0),yU(s,a,l,e)}}});var i_=be(()=>{"use strict";var $ne=B(x()),SU=s_(),_U=sa();SU({target:"Object",stat:!0},{hasOwn:_U})});var a_=be((Pne,o_)=>{"use strict";var kne=B(x()),CU=xs();o_.exports=CU});var c_=be((Rne,u_)=>{"use strict";var Tne=B(x());i_();var DU=a_();u_.exports=DU.Object.hasOwn});var f_=be((One,l_)=>{"use strict";var Nne=B(x()),FU=c_();l_.exports=FU});var x=be((Lne,h_)=>{"use strict";var BU=f_();h_.exports=BU});var k_=be(t1=>{"use strict";var qne=B(x());t1.byteLength=HU;t1.toByteArray=qU;t1.fromByteArray=VU;var io=[],Xs=[],UU=typeof Uint8Array<"u"?Uint8Array:Array,Mw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ac=0,$_=Mw.length;Ac<$_;++Ac)io[Ac]=Mw[Ac],Xs[Mw.charCodeAt(Ac)]=Ac;var Ac,$_;Xs[45]=62;Xs[95]=63;function P_(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 HU(e){var t=P_(e),r=t[0],n=t[1];return(r+n)*3/4-n}function MU(e,t,r){return(t+r)*3/4-r}function qU(e){var t,r=P_(e),n=r[0],i=r[1],o=new UU(MU(e,n,i)),s=0,a=i>0?n-4:n,u;for(u=0;u<a;u+=4)t=Xs[e.charCodeAt(u)]<<18|Xs[e.charCodeAt(u+1)]<<12|Xs[e.charCodeAt(u+2)]<<6|Xs[e.charCodeAt(u+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=Xs[e.charCodeAt(u)]<<2|Xs[e.charCodeAt(u+1)]>>4,o[s++]=t&255),i===1&&(t=Xs[e.charCodeAt(u)]<<10|Xs[e.charCodeAt(u+1)]<<4|Xs[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function jU(e){return io[e>>18&63]+io[e>>12&63]+io[e>>6&63]+io[e&63]}function KU(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(jU(n));return i.join("")}function VU(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(KU(e,s,s+o>a?a:s+o));return n===1?(t=e[r-1],i.push(io[t>>2]+io[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(io[t>>10]+io[t>>4&63]+io[t<<2&63]+"=")),i.join("")}});var R_=be(qw=>{var Kne=B(x());qw.read=function(e,t,r,n,i){var o,s,a=i*8-n-1,u=(1<<a)-1,l=u>>1,h=-7,m=r?i-1:0,p=r?-1:1,d=e[t+m];for(m+=p,o=d&(1<<-h)-1,d>>=-h,h+=a;h>0;o=o*256+e[t+m],m+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=s*256+e[t+m],m+=p,h-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-l}return(d?-1:1)*s*Math.pow(2,o-n)};qw.write=function(e,t,r,n,i,o){var s,a,u,l=o*8-i-1,h=(1<<l)-1,m=h>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,v=n?1:-1,g=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+m>=1?t+=p/u:t+=p*Math.pow(2,1-m),t*u>=2&&(s++,u/=2),s+m>=h?(a=0,s=h):s+m>=1?(a=(t*u-1)*Math.pow(2,i),s=s+m):(a=t*Math.pow(2,m-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=a&255,d+=v,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[r+d]=s&255,d+=v,s/=256,l-=8);e[r+d-v]|=g*128}});var oa=be(Yl=>{"use strict";var Gne=B(x());var jw=k_(),Gl=R_(),T_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Yl.Buffer=ve;Yl.SlowBuffer=ZU;Yl.INSPECT_MAX_BYTES=50;var r1=2147483647;Yl.kMaxLength=r1;ve.TYPED_ARRAY_SUPPORT=zU();!ve.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 zU(){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(ve.prototype,"parent",{enumerable:!0,get:function(){if(ve.isBuffer(this))return this.buffer}});Object.defineProperty(ve.prototype,"offset",{enumerable:!0,get:function(){if(ve.isBuffer(this))return this.byteOffset}});function ia(e){if(e>r1)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,ve.prototype),t}function ve(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 Gw(e)}return U_(e,t,r)}ve.poolSize=8192;function U_(e,t,r){if(typeof e=="string")return WU(e,t);if(ArrayBuffer.isView(e))return YU(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(oo(e,ArrayBuffer)||e&&oo(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(oo(e,SharedArrayBuffer)||e&&oo(e.buffer,SharedArrayBuffer)))return Vw(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 ve.from(n,t,r);let i=XU(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return ve.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)}ve.from=function(e,t,r){return U_(e,t,r)};Object.setPrototypeOf(ve.prototype,Uint8Array.prototype);Object.setPrototypeOf(ve,Uint8Array);function H_(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 GU(e,t,r){return H_(e),e<=0?ia(e):t!==void 0?typeof r=="string"?ia(e).fill(t,r):ia(e).fill(t):ia(e)}ve.alloc=function(e,t,r){return GU(e,t,r)};function Gw(e){return H_(e),ia(e<0?0:Ww(e)|0)}ve.allocUnsafe=function(e){return Gw(e)};ve.allocUnsafeSlow=function(e){return Gw(e)};function WU(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!ve.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=M_(e,t)|0,n=ia(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function Kw(e){let t=e.length<0?0:Ww(e.length)|0,r=ia(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function YU(e){if(oo(e,Uint8Array)){let t=new Uint8Array(e);return Vw(t.buffer,t.byteOffset,t.byteLength)}return Kw(e)}function Vw(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,ve.prototype),n}function XU(e){if(ve.isBuffer(e)){let t=Ww(e.length)|0,r=ia(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||Xw(e.length)?ia(0):Kw(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Kw(e.data)}function Ww(e){if(e>=r1)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r1.toString(16)+" bytes");return e|0}function ZU(e){return+e!=e&&(e=0),ve.alloc(+e)}ve.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==ve.prototype};ve.compare=function(t,r){if(oo(t,Uint8Array)&&(t=ve.from(t,t.offset,t.byteLength)),oo(r,Uint8Array)&&(r=ve.from(r,r.offset,r.byteLength)),!ve.isBuffer(t)||!ve.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 o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==r[o]){n=t[o],i=r[o];break}return n<i?-1:i<n?1:0};ve.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}};ve.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return ve.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let i=ve.allocUnsafe(r),o=0;for(n=0;n<t.length;++n){let s=t[n];if(oo(s,Uint8Array))o+s.length>i.length?(ve.isBuffer(s)||(s=ve.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(ve.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function M_(e,t){if(ve.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||oo(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 zw(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return X_(e).length;default:if(i)return n?-1:zw(e).length;t=(""+t).toLowerCase(),i=!0}}ve.byteLength=M_;function JU(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 uH(this,t,r);case"utf8":case"utf-8":return j_(this,t,r);case"ascii":return oH(this,t,r);case"latin1":case"binary":return aH(this,t,r);case"base64":return sH(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cH(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}ve.prototype._isBuffer=!0;function Sc(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}ve.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)Sc(this,r,r+1);return this};ve.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)Sc(this,r,r+3),Sc(this,r+1,r+2);return this};ve.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)Sc(this,r,r+7),Sc(this,r+1,r+6),Sc(this,r+2,r+5),Sc(this,r+3,r+4);return this};ve.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?j_(this,0,t):JU.apply(this,arguments)};ve.prototype.toLocaleString=ve.prototype.toString;ve.prototype.equals=function(t){if(!ve.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:ve.compare(this,t)===0};ve.prototype.inspect=function(){let t="",r=Yl.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};T_&&(ve.prototype[T_]=ve.prototype.inspect);ve.prototype.compare=function(t,r,n,i,o){if(oo(t,Uint8Array)&&(t=ve.from(t,t.offset,t.byteLength)),!ve.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),o===void 0&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;let s=o-i,a=n-r,u=Math.min(s,a),l=this.slice(i,o),h=t.slice(r,n);for(let m=0;m<u;++m)if(l[m]!==h[m]){s=l[m],a=h[m];break}return s<a?-1:a<s?1:0};function q_(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,Xw(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=ve.from(t,n)),ve.isBuffer(t))return t.length===0?-1:O_(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):O_(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function O_(e,t,r,n,i){let o=1,s=e.length,a=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;o=2,s/=2,a/=2,r/=2}function u(h,m){return o===1?h[m]:h.readUInt16BE(m*o)}let l;if(i){let h=-1;for(l=r;l<s;l++)if(u(e,l)===u(t,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===a)return h*o}else h!==-1&&(l-=l-h),h=-1}else for(r+a>s&&(r=s-a),l=r;l>=0;l--){let h=!0;for(let m=0;m<a;m++)if(u(e,l+m)!==u(t,m)){h=!1;break}if(h)return l}return-1}ve.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};ve.prototype.indexOf=function(t,r,n){return q_(this,t,r,n,!0)};ve.prototype.lastIndexOf=function(t,r,n){return q_(this,t,r,n,!1)};function QU(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let o=t.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let a=parseInt(t.substr(s*2,2),16);if(Xw(a))return s;e[r+s]=a}return s}function eH(e,t,r,n){return n1(zw(t,e.length-r),e,r,n)}function tH(e,t,r,n){return n1(dH(t),e,r,n)}function rH(e,t,r,n){return n1(X_(t),e,r,n)}function nH(e,t,r,n){return n1(pH(t,e.length-r),e,r,n)}ve.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 o=this.length-r;if((n===void 0||n>o)&&(n=o),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 QU(this,t,r,n);case"utf8":case"utf-8":return eH(this,t,r,n);case"ascii":case"latin1":case"binary":return tH(this,t,r,n);case"base64":return rH(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nH(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};ve.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function sH(e,t,r){return t===0&&r===e.length?jw.fromByteArray(e):jw.fromByteArray(e.slice(t,r))}function j_(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){let u,l,h,m;switch(a){case 1:o<128&&(s=o);break;case 2:u=e[i+1],(u&192)===128&&(m=(o&31)<<6|u&63,m>127&&(s=m));break;case 3:u=e[i+1],l=e[i+2],(u&192)===128&&(l&192)===128&&(m=(o&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(s=m));break;case 4:u=e[i+1],l=e[i+2],h=e[i+3],(u&192)===128&&(l&192)===128&&(h&192)===128&&(m=(o&15)<<18|(u&63)<<12|(l&63)<<6|h&63,m>65535&&m<1114112&&(s=m))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return iH(n)}var N_=4096;function iH(e){let t=e.length;if(t<=N_)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=N_));return r}function oH(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 aH(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 uH(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=t;o<r;++o)i+=mH[e[o]];return i}function cH(e,t,r){let n=e.slice(t,r),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}ve.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,ve.prototype),i};function Wr(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")}ve.prototype.readUintLE=ve.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Wr(t,r,this.length);let i=this[t],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[t+s]*o;return i};ve.prototype.readUintBE=ve.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Wr(t,r,this.length);let i=this[t+--r],o=1;for(;r>0&&(o*=256);)i+=this[t+--r]*o;return i};ve.prototype.readUint8=ve.prototype.readUInt8=function(t,r){return t=t>>>0,r||Wr(t,1,this.length),this[t]};ve.prototype.readUint16LE=ve.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Wr(t,2,this.length),this[t]|this[t+1]<<8};ve.prototype.readUint16BE=ve.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Wr(t,2,this.length),this[t]<<8|this[t+1]};ve.prototype.readUint32LE=ve.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};ve.prototype.readUint32BE=ve.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};ve.prototype.readBigUInt64LE=yu(function(t){t=t>>>0,Wl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Yh(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});ve.prototype.readBigUInt64BE=yu(function(t){t=t>>>0,Wl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Yh(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});ve.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Wr(t,r,this.length);let i=this[t],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};ve.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Wr(t,r,this.length);let i=r,o=1,s=this[t+--i];for(;i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};ve.prototype.readInt8=function(t,r){return t=t>>>0,r||Wr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};ve.prototype.readInt16LE=function(t,r){t=t>>>0,r||Wr(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};ve.prototype.readInt16BE=function(t,r){t=t>>>0,r||Wr(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};ve.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};ve.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};ve.prototype.readBigInt64LE=yu(function(t){t=t>>>0,Wl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Yh(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)});ve.prototype.readBigInt64BE=yu(function(t){t=t>>>0,Wl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Yh(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)});ve.prototype.readFloatLE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),Gl.read(this,t,!0,23,4)};ve.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),Gl.read(this,t,!1,23,4)};ve.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Wr(t,8,this.length),Gl.read(this,t,!0,52,8)};ve.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Wr(t,8,this.length),Gl.read(this,t,!1,52,8)};function us(e,t,r,n,i,o){if(!ve.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}ve.prototype.writeUintLE=ve.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;us(this,t,r,n,a,0)}let o=1,s=0;for(this[r]=t&255;++s<n&&(o*=256);)this[r+s]=t/o&255;return r+n};ve.prototype.writeUintBE=ve.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;us(this,t,r,n,a,0)}let o=n-1,s=1;for(this[r+o]=t&255;--o>=0&&(s*=256);)this[r+o]=t/s&255;return r+n};ve.prototype.writeUint8=ve.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||us(this,t,r,1,255,0),this[r]=t&255,r+1};ve.prototype.writeUint16LE=ve.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||us(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};ve.prototype.writeUint16BE=ve.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||us(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};ve.prototype.writeUint32LE=ve.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||us(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};ve.prototype.writeUint32BE=ve.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||us(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 K_(e,t,r,n,i){Y_(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;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 V_(e,t,r,n,i){Y_(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;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}ve.prototype.writeBigUInt64LE=yu(function(t,r=0){return K_(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});ve.prototype.writeBigUInt64BE=yu(function(t,r=0){return V_(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});ve.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let u=Math.pow(2,8*n-1);us(this,t,r,n,u-1,-u)}let o=0,s=1,a=0;for(this[r]=t&255;++o<n&&(s*=256);)t<0&&a===0&&this[r+o-1]!==0&&(a=1),this[r+o]=(t/s>>0)-a&255;return r+n};ve.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let u=Math.pow(2,8*n-1);us(this,t,r,n,u-1,-u)}let o=n-1,s=1,a=0;for(this[r+o]=t&255;--o>=0&&(s*=256);)t<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(t/s>>0)-a&255;return r+n};ve.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||us(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};ve.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||us(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};ve.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||us(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};ve.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||us(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};ve.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||us(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};ve.prototype.writeBigInt64LE=yu(function(t,r=0){return K_(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ve.prototype.writeBigInt64BE=yu(function(t,r=0){return V_(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function z_(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function G_(e,t,r,n,i){return t=+t,r=r>>>0,i||z_(e,t,r,4,34028234663852886e22,-34028234663852886e22),Gl.write(e,t,r,n,23,4),r+4}ve.prototype.writeFloatLE=function(t,r,n){return G_(this,t,r,!0,n)};ve.prototype.writeFloatBE=function(t,r,n){return G_(this,t,r,!1,n)};function W_(e,t,r,n,i){return t=+t,r=r>>>0,i||z_(e,t,r,8,17976931348623157e292,-17976931348623157e292),Gl.write(e,t,r,n,52,8),r+8}ve.prototype.writeDoubleLE=function(t,r,n){return W_(this,t,r,!0,n)};ve.prototype.writeDoubleBE=function(t,r,n){return W_(this,t,r,!1,n)};ve.prototype.copy=function(t,r,n,i){if(!ve.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 o=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),o};ve.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"&&!ve.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 o;if(typeof t=="number")for(o=r;o<n;++o)this[o]=t;else{let s=ve.isBuffer(t)?t:ve.from(t,i),a=s.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=s[o%a]}return this};var zl={};function Yw(e,t,r){zl[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}`}}}Yw("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Yw("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);Yw("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=L_(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=L_(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function L_(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 lH(e,t,r){Wl(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Yh(t,e.length-(r+1))}function Y_(e,t,r,n,i,o){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${t}${s} and <= ${r}${s}`,new zl.ERR_OUT_OF_RANGE("value",a,e)}lH(n,i,o)}function Wl(e,t){if(typeof e!="number")throw new zl.ERR_INVALID_ARG_TYPE(t,"number",e)}function Yh(e,t,r){throw Math.floor(e)!==e?(Wl(e,r),new zl.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new zl.ERR_BUFFER_OUT_OF_BOUNDS:new zl.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var fH=/[^+/0-9A-Za-z-_]/g;function hH(e){if(e=e.split("=")[0],e=e.trim().replace(fH,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function zw(e,t){t=t||1/0;let r,n=e.length,i=null,o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function dH(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function pH(e,t){let r,n,i,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function X_(e){return jw.toByteArray(hH(e))}function n1(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 oo(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Xw(e){return e!==e}var mH=(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 yu(e){return typeof BigInt>"u"?gH:e}function gH(){throw new Error("BigInt not supported")}});var AC=be($e=>{var Xne=B(x()),Zh={};Zh.userAgent=!1;var Xl={},vH="11.1.3",wH="jsrsasign(all) 11.1.3 (2026-04-18) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var ke=ke||(function(e,t){var r={},n=r.lib={},i=n.Base=(function(){function d(){}return{extend:function(v){d.prototype=this;var g=new d;return v&&g.mixIn(v),g.hasOwnProperty("init")||(g.init=function(){g.$super.init.apply(this,arguments)}),g.init.prototype=g,g.$super=this,g},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var g in v)v.hasOwnProperty(g)&&(this[g]=v[g]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),o=n.WordArray=i.extend({init:function(d,v){d=this.words=d||[],v!=t?this.sigBytes=v:this.sigBytes=d.length*4},toString:function(d){return(d||a).stringify(this)},concat:function(d){var v=this.words,g=d.words,y=this.sigBytes,w=d.sigBytes;if(this.clamp(),y%4)for(var E=0;E<w;E++){var _=g[E>>>2]>>>24-E%4*8&255;v[y+E>>>2]|=_<<24-(y+E)%4*8}else for(var E=0;E<w;E+=4)v[y+E>>>2]=g[E>>>2];return this.sigBytes+=w,this},clamp:function(){var d=this.words,v=this.sigBytes;d[v>>>2]&=4294967295<<32-v%4*8,d.length=e.ceil(v/4)},clone:function(){var d=i.clone.call(this);return d.words=this.words.slice(0),d},random:function(d){for(var v=[],g=0;g<d;g+=4)v.push(e.random()*4294967296|0);return new o.init(v,d)}}),s=r.enc={},a=s.Hex={stringify:function(d){for(var v=d.words,g=d.sigBytes,y=[],w=0;w<g;w++){var E=v[w>>>2]>>>24-w%4*8&255;y.push((E>>>4).toString(16)),y.push((E&15).toString(16))}return y.join("")},parse:function(d){for(var v=d.length,g=[],y=0;y<v;y+=2)g[y>>>3]|=parseInt(d.substr(y,2),16)<<24-y%8*4;return new o.init(g,v/2)}},u=s.Latin1={stringify:function(d){for(var v=d.words,g=d.sigBytes,y=[],w=0;w<g;w++){var E=v[w>>>2]>>>24-w%4*8&255;y.push(String.fromCharCode(E))}return y.join("")},parse:function(d){for(var v=d.length,g=[],y=0;y<v;y++)g[y>>>2]|=(d.charCodeAt(y)&255)<<24-y%4*8;return new o.init(g,v)}},l=s.Utf8={stringify:function(d){try{return decodeURIComponent(escape(u.stringify(d)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(d){return u.parse(unescape(encodeURIComponent(d)))}},h=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(d){typeof d=="string"&&(d=l.parse(d)),this._data.concat(d),this._nDataBytes+=d.sigBytes},_process:function(d){var v=this._data,g=v.words,y=v.sigBytes,w=this.blockSize,E=w*4,_=y/E;d?_=e.ceil(_):_=e.max((_|0)-this._minBufferSize,0);var C=_*w,F=e.min(C*4,y);if(C){for(var H=0;H<C;H+=w)this._doProcessBlock(g,H);var K=g.splice(0,C);v.sigBytes-=F}return new o.init(K,F)},clone:function(){var d=i.clone.call(this);return d._data=this._data.clone(),d},_minBufferSize:0}),m=n.Hasher=h.extend({cfg:i.extend(),init:function(d){this.cfg=this.cfg.extend(d),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(d){return this._append(d),this._process(),this},finalize:function(d){d&&this._append(d);var v=this._doFinalize();return v},blockSize:512/32,_createHelper:function(d){return function(v,g){return new d.init(g).finalize(v)}},_createHmacHelper:function(d){return function(v,g){return new p.HMAC.init(d,g).finalize(v)}}}),p=r.algo={};return r})(Math);(function(e){var i=ke,t=i.lib,r=t.Base,n=t.WordArray,i=i.x64={};i.Word=r.extend({init:function(o,s){this.high=o,this.low=s}}),i.WordArray=r.extend({init:function(o,s){o=this.words=o||[],this.sigBytes=s!=e?s:8*o.length},toX32:function(){for(var o=this.words,s=o.length,a=[],u=0;u<s;u++){var l=o[u];a.push(l.high),a.push(l.low)}return n.create(a,this.sigBytes)},clone:function(){for(var o=r.clone.call(this),s=o.words=this.words.slice(0),a=s.length,u=0;u<a;u++)s[u]=s[u].clone();return o}})})();ke.lib.Cipher||(function(e){var d=ke,t=d.lib,r=t.Base,n=t.WordArray,i=t.BufferedBlockAlgorithm,o=d.enc.Base64,s=d.algo.EvpKDF,a=t.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(g,y){return this.create(this._ENC_XFORM_MODE,g,y)},createDecryptor:function(g,y){return this.create(this._DEC_XFORM_MODE,g,y)},init:function(g,y,w){this.cfg=this.cfg.extend(w),this._xformMode=g,this._key=y,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(g){return this._append(g),this._process()},finalize:function(g){return g&&this._append(g),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(g){return{encrypt:function(y,w,E){return(typeof w=="string"?v:p).encrypt(g,y,w,E)},decrypt:function(y,w,E){return(typeof w=="string"?v:p).decrypt(g,y,w,E)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var m=d.mode={},u=function(g,y,w){var E=this._iv;E?this._iv=e:E=this._prevBlock;for(var _=0;_<w;_++)g[y+_]^=E[_]},l=(t.BlockCipherMode=r.extend({createEncryptor:function(g,y){return this.Encryptor.create(g,y)},createDecryptor:function(g,y){return this.Decryptor.create(g,y)},init:function(g,y){this._cipher=g,this._iv=y}})).extend();l.Encryptor=l.extend({processBlock:function(g,y){var w=this._cipher,E=w.blockSize;u.call(this,g,y,E),w.encryptBlock(g,y),this._prevBlock=g.slice(y,y+E)}}),l.Decryptor=l.extend({processBlock:function(g,y){var w=this._cipher,E=w.blockSize,_=g.slice(y,y+E);w.decryptBlock(g,y),u.call(this,g,y,E),this._prevBlock=_}}),m=m.CBC=l,l=(d.pad={}).Pkcs7={pad:function(g,y){for(var w=4*y,w=w-g.sigBytes%w,E=w<<24|w<<16|w<<8|w,_=[],C=0;C<w;C+=4)_.push(E);w=n.create(_,w),g.concat(w)},unpad:function(g){g.sigBytes-=g.words[g.sigBytes-1>>>2]&255}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:m,padding:l}),reset:function(){a.reset.call(this);var y=this.cfg,g=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var w=y.createEncryptor;else w=y.createDecryptor,this._minBufferSize=1;this._mode=w.call(y,this,g&&g.words)},_doProcessBlock:function(g,y){this._mode.processBlock(g,y)},_doFinalize:function(){var g=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){g.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),g.unpad(y);return y},blockSize:4});var h=t.CipherParams=r.extend({init:function(g){this.mixIn(g)},toString:function(g){return(g||this.formatter).stringify(this)}}),m=(d.format={}).OpenSSL={stringify:function(g){var y=g.ciphertext;return g=g.salt,(g?n.create([1398893684,1701076831]).concat(g).concat(y):y).toString(o)},parse:function(g){g=o.parse(g);var y=g.words;if(y[0]==1398893684&&y[1]==1701076831){var w=n.create(y.slice(2,4));y.splice(0,4),g.sigBytes-=16}return h.create({ciphertext:g,salt:w})}},p=t.SerializableCipher=r.extend({cfg:r.extend({format:m}),encrypt:function(g,y,w,E){E=this.cfg.extend(E);var _=g.createEncryptor(w,E);return y=_.finalize(y),_=_.cfg,h.create({ciphertext:y,key:w,iv:_.iv,algorithm:g,mode:_.mode,padding:_.padding,blockSize:g.blockSize,formatter:E.format})},decrypt:function(g,y,w,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),g.createDecryptor(w,E).finalize(y.ciphertext)},_parse:function(g,y){return typeof g=="string"?y.parse(g,this):g}}),d=(d.kdf={}).OpenSSL={execute:function(g,y,w,E){return E||(E=n.random(8)),g=s.create({keySize:y+w}).compute(g,E),w=n.create(g.words.slice(y),4*w),g.sigBytes=4*y,h.create({key:g,iv:w,salt:E})}},v=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:d}),encrypt:function(g,y,w,E){return E=this.cfg.extend(E),w=E.kdf.execute(w,g.keySize,g.ivSize),E.iv=w.iv,g=p.encrypt.call(this,g,y,w.key,E),g.mixIn(w),g},decrypt:function(g,y,w,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),w=E.kdf.execute(w,g.keySize,g.ivSize,y.salt),E.iv=w.iv,p.decrypt.call(this,g,y,w.key,E)}})})();(function(){for(var e=ke,t=e.lib.BlockCipher,H=e.algo,r=[],n=[],i=[],o=[],s=[],a=[],u=[],l=[],h=[],m=[],p=[],d=0;256>d;d++)p[d]=128>d?d<<1:d<<1^283;for(var v=0,g=0,d=0;256>d;d++){var y=g^g<<1^g<<2^g<<3^g<<4,y=y>>>8^y&255^99;r[v]=y,n[y]=v;var w=p[v],E=p[w],_=p[E],C=257*p[y]^16843008*y;i[v]=C<<24|C>>>8,o[v]=C<<16|C>>>16,s[v]=C<<8|C>>>24,a[v]=C,C=16843009*_^65537*E^257*w^16843008*v,u[y]=C<<24|C>>>8,l[y]=C<<16|C>>>16,h[y]=C<<8|C>>>24,m[y]=C,v?(v=w^p[p[p[_^w]]],g^=p[p[g]]):v=g=1}var F=[0,1,2,4,8,16,32,64,128,27,54],H=H.AES=t.extend({_doReset:function(){for(var I=this._key,K=I.words,S=I.sigBytes/4,I=4*((this._nRounds=S+6)+1),q=this._keySchedule=[],L=0;L<I;L++)if(L<S)q[L]=K[L];else{var R=q[L-1];L%S?6<S&&L%S==4&&(R=r[R>>>24]<<24|r[R>>>16&255]<<16|r[R>>>8&255]<<8|r[R&255]):(R=R<<8|R>>>24,R=r[R>>>24]<<24|r[R>>>16&255]<<16|r[R>>>8&255]<<8|r[R&255],R^=F[L/S|0]<<24),q[L]=q[L-S]^R}for(K=this._invKeySchedule=[],S=0;S<I;S++)L=I-S,R=S%4?q[L]:q[L-4],K[S]=4>S||4>=L?R:u[r[R>>>24]]^l[r[R>>>16&255]]^h[r[R>>>8&255]]^m[r[R&255]]},encryptBlock:function(K,S){this._doCryptBlock(K,S,this._keySchedule,i,o,s,a,r)},decryptBlock:function(K,S){var I=K[S+1];K[S+1]=K[S+3],K[S+3]=I,this._doCryptBlock(K,S,this._invKeySchedule,u,l,h,m,n),I=K[S+1],K[S+1]=K[S+3],K[S+3]=I},_doCryptBlock:function(K,S,I,q,L,R,O,T){for(var N=this._nRounds,ae=K[S]^I[0],me=K[S+1]^I[1],he=K[S+2]^I[2],te=K[S+3]^I[3],P=4,M=1;M<N;M++)var Y=q[ae>>>24]^L[me>>>16&255]^R[he>>>8&255]^O[te&255]^I[P++],V=q[me>>>24]^L[he>>>16&255]^R[te>>>8&255]^O[ae&255]^I[P++],X=q[he>>>24]^L[te>>>16&255]^R[ae>>>8&255]^O[me&255]^I[P++],te=q[te>>>24]^L[ae>>>16&255]^R[me>>>8&255]^O[he&255]^I[P++],ae=Y,me=V,he=X;Y=(T[ae>>>24]<<24|T[me>>>16&255]<<16|T[he>>>8&255]<<8|T[te&255])^I[P++],V=(T[me>>>24]<<24|T[he>>>16&255]<<16|T[te>>>8&255]<<8|T[ae&255])^I[P++],X=(T[he>>>24]<<24|T[te>>>16&255]<<16|T[ae>>>8&255]<<8|T[me&255])^I[P++],te=(T[te>>>24]<<24|T[ae>>>16&255]<<16|T[me>>>8&255]<<8|T[he&255])^I[P++],K[S]=Y,K[S+1]=V,K[S+2]=X,K[S+3]=te},keySize:8});e.AES=t._createHelper(H)})();(function(){function e(p,d){var v=(this._lBlock>>>p^this._rBlock)&d;this._rBlock^=v,this._lBlock^=v<<p}function t(p,d){var v=(this._rBlock>>>p^this._lBlock)&d;this._lBlock^=v,this._rBlock^=v<<p}var r=ke,i=r.lib,n=i.WordArray,i=i.BlockCipher,o=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],a=[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],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{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}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],m=o.DES=i.extend({_doReset:function(){for(var p=this._key.words,d=[],v=0;56>v;v++){var g=s[v]-1;d[v]=p[g>>>5]>>>31-g%32&1}for(p=this._subKeys=[],g=0;16>g;g++){for(var y=p[g]=[],w=u[g],v=0;24>v;v++)y[v/6|0]|=d[(a[v]-1+w)%28]<<31-v%6,y[4+(v/6|0)]|=d[28+(a[v+24]-1+w)%28]<<31-v%6;for(y[0]=y[0]<<1|y[0]>>>31,v=1;7>v;v++)y[v]>>>=4*(v-1)+3;y[7]=y[7]<<5|y[7]>>>27}for(d=this._invSubKeys=[],v=0;16>v;v++)d[v]=p[15-v]},encryptBlock:function(p,d){this._doCryptBlock(p,d,this._subKeys)},decryptBlock:function(p,d){this._doCryptBlock(p,d,this._invSubKeys)},_doCryptBlock:function(p,d,v){this._lBlock=p[d],this._rBlock=p[d+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 g=0;16>g;g++){for(var y=v[g],w=this._lBlock,E=this._rBlock,_=0,C=0;8>C;C++)_|=l[C][((E^y[C])&h[C])>>>0];this._lBlock=E,this._rBlock=w^_}v=this._lBlock,this._lBlock=this._rBlock,this._rBlock=v,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[d]=this._lBlock,p[d+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(m),o=o.TripleDES=i.extend({_doReset:function(){var p=this._key.words;this._des1=m.createEncryptor(n.create(p.slice(0,2))),this._des2=m.createEncryptor(n.create(p.slice(2,4))),this._des3=m.createEncryptor(n.create(p.slice(4,6)))},encryptBlock:function(p,d){this._des1.encryptBlock(p,d),this._des2.decryptBlock(p,d),this._des3.encryptBlock(p,d)},decryptBlock:function(p,d){this._des3.decryptBlock(p,d),this._des2.encryptBlock(p,d),this._des1.decryptBlock(p,d)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(o)})();(function(){var e=ke,t=e.lib.WordArray;e.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,o=this._map;r.clamp(),r=[];for(var s=0;s<i;s+=3)for(var a=(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,u=0;4>u&&s+.75*u<i;u++)r.push(o.charAt(a>>>6*(3-u)&63));if(n=o.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,o=i.charAt(64);o&&(o=r.indexOf(o),o!=-1&&(n=o));for(var o=[],s=0,a=0;a<n;a++)if(a%4){var u=i.indexOf(r.charAt(a-1))<<2*(a%4),l=i.indexOf(r.charAt(a))>>>6-2*(a%4);o[s>>>2]|=(u|l)<<24-8*(s%4),s++}return t.create(o,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(e){function t(m,p,d,v,g,y,w){return m=m+(p&d|~p&v)+g+w,(m<<y|m>>>32-y)+p}function r(m,p,d,v,g,y,w){return m=m+(p&v|d&~v)+g+w,(m<<y|m>>>32-y)+p}function n(m,p,d,v,g,y,w){return m=m+(p^d^v)+g+w,(m<<y|m>>>32-y)+p}function i(m,p,d,v,g,y,w){return m=m+(d^(p|~v))+g+w,(m<<y|m>>>32-y)+p}for(var o=ke,u=o.lib,s=u.WordArray,a=u.Hasher,u=o.algo,l=[],h=0;64>h;h++)l[h]=4294967296*e.abs(e.sin(h+1))|0;u=u.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,p){for(var d=0;16>d;d++){var v=p+d,g=m[v];m[v]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var d=this._hash.words,v=m[p+0],g=m[p+1],y=m[p+2],w=m[p+3],E=m[p+4],_=m[p+5],C=m[p+6],F=m[p+7],H=m[p+8],K=m[p+9],S=m[p+10],I=m[p+11],q=m[p+12],L=m[p+13],R=m[p+14],O=m[p+15],T=d[0],M=d[1],P=d[2],N=d[3],T=t(T,M,P,N,v,7,l[0]),N=t(N,T,M,P,g,12,l[1]),P=t(P,N,T,M,y,17,l[2]),M=t(M,P,N,T,w,22,l[3]),T=t(T,M,P,N,E,7,l[4]),N=t(N,T,M,P,_,12,l[5]),P=t(P,N,T,M,C,17,l[6]),M=t(M,P,N,T,F,22,l[7]),T=t(T,M,P,N,H,7,l[8]),N=t(N,T,M,P,K,12,l[9]),P=t(P,N,T,M,S,17,l[10]),M=t(M,P,N,T,I,22,l[11]),T=t(T,M,P,N,q,7,l[12]),N=t(N,T,M,P,L,12,l[13]),P=t(P,N,T,M,R,17,l[14]),M=t(M,P,N,T,O,22,l[15]),T=r(T,M,P,N,g,5,l[16]),N=r(N,T,M,P,C,9,l[17]),P=r(P,N,T,M,I,14,l[18]),M=r(M,P,N,T,v,20,l[19]),T=r(T,M,P,N,_,5,l[20]),N=r(N,T,M,P,S,9,l[21]),P=r(P,N,T,M,O,14,l[22]),M=r(M,P,N,T,E,20,l[23]),T=r(T,M,P,N,K,5,l[24]),N=r(N,T,M,P,R,9,l[25]),P=r(P,N,T,M,w,14,l[26]),M=r(M,P,N,T,H,20,l[27]),T=r(T,M,P,N,L,5,l[28]),N=r(N,T,M,P,y,9,l[29]),P=r(P,N,T,M,F,14,l[30]),M=r(M,P,N,T,q,20,l[31]),T=n(T,M,P,N,_,4,l[32]),N=n(N,T,M,P,H,11,l[33]),P=n(P,N,T,M,I,16,l[34]),M=n(M,P,N,T,R,23,l[35]),T=n(T,M,P,N,g,4,l[36]),N=n(N,T,M,P,E,11,l[37]),P=n(P,N,T,M,F,16,l[38]),M=n(M,P,N,T,S,23,l[39]),T=n(T,M,P,N,L,4,l[40]),N=n(N,T,M,P,v,11,l[41]),P=n(P,N,T,M,w,16,l[42]),M=n(M,P,N,T,C,23,l[43]),T=n(T,M,P,N,K,4,l[44]),N=n(N,T,M,P,q,11,l[45]),P=n(P,N,T,M,O,16,l[46]),M=n(M,P,N,T,y,23,l[47]),T=i(T,M,P,N,v,6,l[48]),N=i(N,T,M,P,F,10,l[49]),P=i(P,N,T,M,R,15,l[50]),M=i(M,P,N,T,_,21,l[51]),T=i(T,M,P,N,q,6,l[52]),N=i(N,T,M,P,w,10,l[53]),P=i(P,N,T,M,S,15,l[54]),M=i(M,P,N,T,g,21,l[55]),T=i(T,M,P,N,H,6,l[56]),N=i(N,T,M,P,O,10,l[57]),P=i(P,N,T,M,C,15,l[58]),M=i(M,P,N,T,L,21,l[59]),T=i(T,M,P,N,E,6,l[60]),N=i(N,T,M,P,I,10,l[61]),P=i(P,N,T,M,y,15,l[62]),M=i(M,P,N,T,K,21,l[63]);d[0]=d[0]+T|0,d[1]=d[1]+M|0,d[2]=d[2]+P|0,d[3]=d[3]+N|0},_doFinalize:function(){var m=this._data,p=m.words,d=8*this._nDataBytes,v=8*m.sigBytes;p[v>>>5]|=128<<24-v%32;var g=e.floor(d/4294967296);for(p[(v+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,p[(v+64>>>9<<4)+14]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360,m.sigBytes=4*(p.length+1),this._process(),m=this._hash,p=m.words,d=0;4>d;d++)v=p[d],p[d]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360;return m},clone:function(){var m=a.clone.call(this);return m._hash=this._hash.clone(),m}}),o.MD5=a._createHelper(u),o.HmacMD5=a._createHmacHelper(u)})(Math);(function(){var e=ke,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(o,s){for(var a=this._hash.words,u=a[0],l=a[1],h=a[2],m=a[3],p=a[4],d=0;80>d;d++){if(16>d)n[d]=o[s+d]|0;else{var v=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=v<<1|v>>>31}v=(u<<5|u>>>27)+p+n[d],v=20>d?v+((l&h|~l&m)+1518500249):40>d?v+((l^h^m)+1859775393):60>d?v+((l&h|l&m|h&m)-1894007588):v+((l^h^m)-899497514),p=m,m=h,h=l<<30|l>>>2,l=u,u=v}a[0]=a[0]+u|0,a[1]=a[1]+l|0,a[2]=a[2]+h|0,a[3]=a[3]+m|0,a[4]=a[4]+p|0},_doFinalize:function(){var o=this._data,s=o.words,a=8*this._nDataBytes,u=8*o.sigBytes;return s[u>>>5]|=128<<24-u%32,s[(u+64>>>9<<4)+14]=Math.floor(a/4294967296),s[(u+64>>>9<<4)+15]=a,o.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var o=r.clone.call(this);return o._hash=this._hash.clone(),o}});e.SHA1=r._createHelper(i),e.HmacSHA1=r._createHmacHelper(i)})();(function(e){for(var t=ke,d=t.lib,r=d.WordArray,n=d.Hasher,d=t.algo,i=[],o=[],s=function(g){return 4294967296*(g-(g|0))|0},a=2,u=0;64>u;){var l;e:{l=a;for(var h=e.sqrt(l),m=2;m<=h;m++)if(!(l%m)){l=!1;break e}l=!0}l&&(8>u&&(i[u]=s(e.pow(a,.5))),o[u]=s(e.pow(a,1/3)),u++),a++}var p=[],d=d.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(v,g){for(var y=this._hash.words,w=y[0],E=y[1],_=y[2],C=y[3],F=y[4],H=y[5],K=y[6],S=y[7],I=0;64>I;I++){if(16>I)p[I]=v[g+I]|0;else{var q=p[I-15],L=p[I-2];p[I]=((q<<25|q>>>7)^(q<<14|q>>>18)^q>>>3)+p[I-7]+((L<<15|L>>>17)^(L<<13|L>>>19)^L>>>10)+p[I-16]}q=S+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&H^~F&K)+o[I]+p[I],L=((w<<30|w>>>2)^(w<<19|w>>>13)^(w<<10|w>>>22))+(w&E^w&_^E&_),S=K,K=H,H=F,F=C+q|0,C=_,_=E,E=w,w=q+L|0}y[0]=y[0]+w|0,y[1]=y[1]+E|0,y[2]=y[2]+_|0,y[3]=y[3]+C|0,y[4]=y[4]+F|0,y[5]=y[5]+H|0,y[6]=y[6]+K|0,y[7]=y[7]+S|0},_doFinalize:function(){var v=this._data,g=v.words,y=8*this._nDataBytes,w=8*v.sigBytes;return g[w>>>5]|=128<<24-w%32,g[(w+64>>>9<<4)+14]=e.floor(y/4294967296),g[(w+64>>>9<<4)+15]=y,v.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var v=n.clone.call(this);return v._hash=this._hash.clone(),v}});t.SHA256=n._createHelper(d),t.HmacSHA256=n._createHmacHelper(d)})(Math);(function(){var e=ke,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=ke,r=t.lib.Hasher,o=t.x64,n=o.Word,i=o.WordArray,o=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)],a=[],u=0;80>u;u++)a[u]=e();o=o.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(l,h){for(var E=this._hash.words,m=E[0],p=E[1],d=E[2],v=E[3],g=E[4],y=E[5],w=E[6],E=E[7],_=m.high,C=m.low,F=p.high,H=p.low,K=d.high,S=d.low,I=v.high,q=v.low,L=g.high,R=g.low,O=y.high,T=y.low,N=w.high,P=w.low,M=E.high,Y=E.low,V=_,X=C,te=F,ae=H,me=K,he=S,De=I,Pe=q,Ie=L,se=R,pe=O,Fe=T,Te=N,Ve=P,Oe=M,pt=Y,Qe=0;80>Qe;Qe++){var or=a[Qe];if(16>Qe)var ct=or.high=l[h+2*Qe]|0,Re=or.low=l[h+2*Qe+1]|0;else{var ct=a[Qe-15],Re=ct.high,lt=ct.low,ct=(Re>>>1|lt<<31)^(Re>>>8|lt<<24)^Re>>>7,lt=(lt>>>1|Re<<31)^(lt>>>8|Re<<24)^(lt>>>7|Re<<25),Pr=a[Qe-2],Re=Pr.high,Dt=Pr.low,Pr=(Re>>>19|Dt<<13)^(Re<<3|Dt>>>29)^Re>>>6,Dt=(Dt>>>19|Re<<13)^(Dt<<3|Re>>>29)^(Dt>>>6|Re<<26),Re=a[Qe-7],mn=Re.high,gr=a[Qe-16],Ze=gr.high,gr=gr.low,Re=lt+Re.low,ct=ct+mn+(Re>>>0<lt>>>0?1:0),Re=Re+Dt,ct=ct+Pr+(Re>>>0<Dt>>>0?1:0),Re=Re+gr,ct=ct+Ze+(Re>>>0<gr>>>0?1:0);or.high=ct,or.low=Re}var mn=Ie&pe^~Ie&Te,gr=se&Fe^~se&Ve,or=V&te^V&me^te&me,vr=X&ae^X&he^ae&he,lt=(V>>>28|X<<4)^(V<<30|X>>>2)^(V<<25|X>>>7),Pr=(X>>>28|V<<4)^(X<<30|V>>>2)^(X<<25|V>>>7),Dt=s[Qe],Qn=Dt.high,mi=Dt.low,Dt=pt+((se>>>14|Ie<<18)^(se>>>18|Ie<<14)^(se<<23|Ie>>>9)),Ze=Oe+((Ie>>>14|se<<18)^(Ie>>>18|se<<14)^(Ie<<23|se>>>9))+(Dt>>>0<pt>>>0?1:0),Dt=Dt+gr,Ze=Ze+mn+(Dt>>>0<gr>>>0?1:0),Dt=Dt+mi,Ze=Ze+Qn+(Dt>>>0<mi>>>0?1:0),Dt=Dt+Re,Ze=Ze+ct+(Dt>>>0<Re>>>0?1:0),Re=Pr+vr,or=lt+or+(Re>>>0<Pr>>>0?1:0),Oe=Te,pt=Ve,Te=pe,Ve=Fe,pe=Ie,Fe=se,se=Pe+Dt|0,Ie=De+Ze+(se>>>0<Pe>>>0?1:0)|0,De=me,Pe=he,me=te,he=ae,te=V,ae=X,X=Dt+Re|0,V=Ze+or+(X>>>0<Dt>>>0?1:0)|0}C=m.low=C+X,m.high=_+V+(C>>>0<X>>>0?1:0),H=p.low=H+ae,p.high=F+te+(H>>>0<ae>>>0?1:0),S=d.low=S+he,d.high=K+me+(S>>>0<he>>>0?1:0),q=v.low=q+Pe,v.high=I+De+(q>>>0<Pe>>>0?1:0),R=g.low=R+se,g.high=L+Ie+(R>>>0<se>>>0?1:0),T=y.low=T+Fe,y.high=O+pe+(T>>>0<Fe>>>0?1:0),P=w.low=P+Ve,w.high=N+Te+(P>>>0<Ve>>>0?1:0),Y=E.low=Y+pt,E.high=M+Oe+(Y>>>0<pt>>>0?1:0)},_doFinalize:function(){var l=this._data,h=l.words,m=8*this._nDataBytes,p=8*l.sigBytes;return h[p>>>5]|=128<<24-p%32,h[(p+128>>>10<<5)+30]=Math.floor(m/4294967296),h[(p+128>>>10<<5)+31]=m,l.sigBytes=4*h.length,this._process(),this._hash.toX32()},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l},blockSize:32}),t.SHA512=r._createHelper(o),t.HmacSHA512=r._createHmacHelper(o)})();(function(){var e=ke,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 o=n._doFinalize.call(this);return o.sigBytes-=16,o}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)})();(function(){var e=ke,l=e.lib,t=l.WordArray,r=l.Hasher,l=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]),o=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]),a=t.create([0,1518500249,1859775393,2400959708,2840853838]),u=t.create([1352829926,1548603684,1836072691,2053994217,0]),l=l.RIPEMD160=r.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,m){for(var p=0;16>p;p++){var d=m+p,v=h[d];h[d]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var d=this._hash.words,v=a.words,g=u.words,y=n.words,w=i.words,E=o.words,_=s.words,C,F,H,K,S,I,q,L,R,O;I=C=d[0],q=F=d[1],L=H=d[2],R=K=d[3],O=S=d[4];for(var T,p=0;80>p;p+=1)T=C+h[m+y[p]]|0,T=16>p?T+((F^H^K)+v[0]):32>p?T+((F&H|~F&K)+v[1]):48>p?T+(((F|~H)^K)+v[2]):64>p?T+((F&K|H&~K)+v[3]):T+((F^(H|~K))+v[4]),T|=0,T=T<<E[p]|T>>>32-E[p],T=T+S|0,C=S,S=K,K=H<<10|H>>>22,H=F,F=T,T=I+h[m+w[p]]|0,T=16>p?T+((q^(L|~R))+g[0]):32>p?T+((q&R|L&~R)+g[1]):48>p?T+(((q|~L)^R)+g[2]):64>p?T+((q&L|~q&R)+g[3]):T+((q^L^R)+g[4]),T|=0,T=T<<_[p]|T>>>32-_[p],T=T+O|0,I=O,O=R,R=L<<10|L>>>22,L=q,q=T;T=d[1]+H+R|0,d[1]=d[2]+K+O|0,d[2]=d[3]+S+I|0,d[3]=d[4]+C+q|0,d[4]=d[0]+F+L|0,d[0]=T},_doFinalize:function(){var h=this._data,m=h.words,p=8*this._nDataBytes,d=8*h.sigBytes;for(m[d>>>5]|=128<<24-d%32,m[(d+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,h.sigBytes=4*(m.length+1),this._process(),h=this._hash,m=h.words,p=0;5>p;p++)d=m[p],m[p]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;return h},clone:function(){var h=r.clone.call(this);return h._hash=this._hash.clone(),h}});e.RIPEMD160=r._createHelper(l),e.HmacRIPEMD160=r._createHmacHelper(l)})(Math);(function(){var e=ke,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,o=4*i;n.sigBytes>o&&(n=r.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),a=this._iKey=n.clone(),u=s.words,l=a.words,h=0;h<i;h++)u[h]^=1549556828,l[h]^=909522486;s.sigBytes=a.sigBytes=o,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=ke,n=e.lib,t=n.Base,r=n.WordArray,n=e.algo,i=n.HMAC,o=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,a){for(var v=this.cfg,u=i.create(v.hasher,s),l=r.create(),h=r.create([1]),m=l.words,p=h.words,d=v.keySize,v=v.iterations;m.length<d;){var g=u.update(a).finalize(h);u.reset();for(var y=g.words,w=y.length,E=g,_=1;_<v;_++){E=u.finalize(E),u.reset();for(var C=E.words,F=0;F<w;F++)y[F]^=C[F]}l.concat(g),p[0]++}return l.sigBytes=4*d,l}});e.PBKDF2=function(s,a,u){return o.create(u).compute(s,a)}})();var Zl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qw="=";function la(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=Zl.charAt(r>>6)+Zl.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Zl.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Zl.charAt(r>>2)+Zl.charAt((r&3)<<4)),Qw)for(;(n.length&3)>0;)n+=Qw;return n}function Ql(e){var t="",r,n=0,i,o;for(r=0;r<e.length&&e.charAt(r)!=Qw;++r)o=Zl.indexOf(e.charAt(r)),!(o<0)&&(n==0?(t+=aa(o>>2),i=o&3,n=1):n==1?(t+=aa(i<<2|o>>4),i=o&15,n=2):n==2?(t+=aa(i),t+=aa(o>>2),i=o&3,n=3):(t+=aa(i<<2|o>>4),t+=aa(o&15),n=0));return n==1&&(t+=aa(i<<2)),t}function eC(e){var t=Ql(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 bu,yH=0xdeadbeefcafe,Z_=(yH&16777215)==15715070;function ne(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 Pt(){return new ne(null)}function EH(e,t,r,n,i,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=s&67108863}return i}function bH(e,t,r,n,i,o){for(var s=t&32767,a=t>>15;--o>=0;){var u=this[e]&32767,l=this[e++]>>15,h=a*u+l*s;u=s*u+((h&32767)<<15)+r[n]+(i&1073741823),i=(u>>>30)+(h>>>15)+a*l+(i>>>30),r[n++]=u&1073741823}return i}function AH(e,t,r,n,i,o){for(var s=t&16383,a=t>>14;--o>=0;){var u=this[e]&16383,l=this[e++]>>14,h=a*u+l*s;u=s*u+((h&16383)<<14)+r[n]+i,i=(u>>28)+(h>>14)+a*l,r[n++]=u&268435455}return i}Z_&&Zh.appName=="Microsoft Internet Explorer"?(ne.prototype.am=bH,bu=30):Z_&&Zh.appName!="Netscape"?(ne.prototype.am=EH,bu=26):(ne.prototype.am=AH,bu=28);ne.prototype.DB=bu;ne.prototype.DM=(1<<bu)-1;ne.prototype.DV=1<<bu;var ny=52;ne.prototype.FV=Math.pow(2,ny);ne.prototype.F1=ny-bu;ne.prototype.F2=2*bu-ny;var SH="0123456789abcdefghijklmnopqrstuvwxyz",c1=new Array,ef,Zs;ef=48;for(Zs=0;Zs<=9;++Zs)c1[ef++]=Zs;ef=97;for(Zs=10;Zs<36;++Zs)c1[ef++]=Zs;ef=65;for(Zs=10;Zs<36;++Zs)c1[ef++]=Zs;function aa(e){return SH.charAt(e)}function tC(e,t){var r=c1[e.charCodeAt(t)];return r??-1}function _H(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function CH(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 Eu(e){var t=Pt();return t.fromInt(e),t}function DH(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,o=0;--n>=0;){var s=r==8?e[n]&255:tC(e,n);if(s<0){e.charAt(n)=="-"&&(i=!0);continue}i=!1,o==0?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&(e[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&ne.ZERO.subTo(this,this)}function FH(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function BH(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,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=aa(n));s>=0;)a<t?(n=(this[s]&(1<<a)-1)<<t-a,n|=this[--s]>>(a+=this.DB-t)):(n=this[s]>>(a-=t)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=aa(n));return i?o:"0"}function IH(){var e=Pt();return ne.ZERO.subTo(this,e),e}function xH(){return this.s<0?this.negate():this}function $H(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 l1(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 PH(){return this.t<=0?0:this.DB*(this.t-1)+l1(this[this.t-1]^this.s&this.DM)}function kH(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 RH(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 TH(e,t){var r=e%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(e/this.DB),s=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)t[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)t[a]=0;t[o]=s,t.t=this.t+o+1,t.s=this.s,t.clamp()}function OH(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,o=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&o)<<i,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}function NH(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 LH(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&&ne.ZERO.subTo(t,t)}function UH(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 HH(e,t,r){var n=e.abs();if(n.t<=0)throw"BigInteger divide by zero";var i=this.abs();if(i.t<n.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=Pt());var o=Pt(),s=this.s,a=e.s,u=this.DB-l1(n[n.t-1]);u>0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var l=o.t,h=o[l-1];if(h!=0){var m=h*(1<<this.F1)+(l>1?o[l-2]>>this.F2:0),p=this.FV/m,d=(1<<this.F1)/m,v=1<<this.F2,g=r.t,y=g-l,w=t??Pt();for(o.dlShiftTo(y,w),r.compareTo(w)>=0&&(r[r.t++]=1,r.subTo(w,r)),ne.ONE.dlShiftTo(l,w),w.subTo(o,o);o.t<l;)o[o.t++]=0;for(;--y>=0;){var E=r[--g]==h?this.DM:Math.floor(r[g]*p+(r[g-1]+v)*d);if((r[g]+=o.am(0,E,r,y,0,l))<E)for(o.dlShiftTo(y,w),r.subTo(w,r);r[g]<--E;)r.subTo(w,r)}t!=null&&(r.drShiftTo(l,t),s!=a&&ne.ZERO.subTo(t,t)),r.t=l,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&ne.ZERO.subTo(r,r)}}function MH(e){var t=Pt();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(ne.ZERO)>0&&e.subTo(t,t),t}function _c(e){this.m=e}function qH(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function jH(e){return e}function KH(e){e.divRemTo(this.m,null,e)}function VH(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function zH(e,t){e.squareTo(t),this.reduce(t)}_c.prototype.convert=qH;_c.prototype.revert=jH;_c.prototype.reduce=KH;_c.prototype.mulTo=VH;_c.prototype.sqrTo=zH;function GH(){if(this.t<1)return 0;var e=this[0];if((e&1)==0)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 Cc(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 WH(e){var t=Pt();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(ne.ZERO)>0&&this.m.subTo(t,t),t}function YH(e){var t=Pt();return e.copyTo(t),this.reduce(t),t}function XH(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 ZH(e,t){e.squareTo(t),this.reduce(t)}function JH(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Cc.prototype.convert=WH;Cc.prototype.revert=YH;Cc.prototype.reduce=XH;Cc.prototype.mulTo=JH;Cc.prototype.sqrTo=ZH;function QH(){return(this.t>0?this[0]&1:this.s)==0}function eM(e,t){if(e>4294967295||e<1)return ne.ONE;var r=Pt(),n=Pt(),i=t.convert(this),o=l1(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<<o)>0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)}function tM(e,t){var r;return e<256||t.isEven()?r=new _c(t):r=new Cc(t),this.exp(e,r)}ne.prototype.copyTo=_H;ne.prototype.fromInt=CH;ne.prototype.fromString=DH;ne.prototype.clamp=FH;ne.prototype.dlShiftTo=kH;ne.prototype.drShiftTo=RH;ne.prototype.lShiftTo=TH;ne.prototype.rShiftTo=OH;ne.prototype.subTo=NH;ne.prototype.multiplyTo=LH;ne.prototype.squareTo=UH;ne.prototype.divRemTo=HH;ne.prototype.invDigit=GH;ne.prototype.isEven=QH;ne.prototype.exp=eM;ne.prototype.toString=BH;ne.prototype.negate=IH;ne.prototype.abs=xH;ne.prototype.compareTo=$H;ne.prototype.bitLength=PH;ne.prototype.mod=MH;ne.prototype.modPowInt=tM;ne.ZERO=Eu(0);ne.ONE=Eu(1);function rM(){var e=Pt();return this.copyTo(e),e}function nM(){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 sM(){return this.t==0?this.s:this[0]<<24>>24}function iM(){return this.t==0?this.s:this[0]<<16>>16}function oM(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function aM(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function uM(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=Eu(r),i=Pt(),o=Pt(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(e)+s}function cM(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,s=0,a=0;a<e.length;++a){var u=tC(e,a);if(u<0){e.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}s=t*s+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&ne.ZERO.subTo(this,this)}function lM(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(ne.ONE.shiftLeft(e-1),sy,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(ne.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 fM(){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)!=0&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t}function hM(e){return this.compareTo(e)==0}function dM(e){return this.compareTo(e)<0?this:e}function pM(e){return this.compareTo(e)>0?this:e}function mM(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function gM(e,t){return e&t}function vM(e){var t=Pt();return this.bitwiseTo(e,gM,t),t}function sy(e,t){return e|t}function wM(e){var t=Pt();return this.bitwiseTo(e,sy,t),t}function rC(e,t){return e^t}function yM(e){var t=Pt();return this.bitwiseTo(e,rC,t),t}function nC(e,t){return e&~t}function EM(e){var t=Pt();return this.bitwiseTo(e,nC,t),t}function bM(){for(var e=Pt(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}function AM(e){var t=Pt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function SM(e){var t=Pt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function _M(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function CM(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+_M(this[e]);return this.s<0?this.t*this.DB:-1}function DM(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function FM(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=DM(this[r]^t);return e}function BM(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function IM(e,t){var r=ne.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function xM(e){return this.changeBit(e,sy)}function $M(e){return this.changeBit(e,nC)}function PM(e){return this.changeBit(e,rC)}function kM(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 RM(e){var t=Pt();return this.addTo(e,t),t}function TM(e){var t=Pt();return this.subTo(e,t),t}function OM(e){var t=Pt();return this.multiplyTo(e,t),t}function NM(){var e=Pt();return this.squareTo(e),e}function LM(e){var t=Pt();return this.divRemTo(e,t,null),t}function UM(e){var t=Pt();return this.divRemTo(e,null,t),t}function HM(e){var t=Pt(),r=Pt();return this.divRemTo(e,t,r),new Array(t,r)}function MM(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function qM(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 Qh(){}function sC(e){return e}function jM(e,t,r){e.multiplyTo(t,r)}function KM(e,t){e.squareTo(t)}Qh.prototype.convert=sC;Qh.prototype.revert=sC;Qh.prototype.mulTo=jM;Qh.prototype.sqrTo=KM;function VM(e){return this.exp(e,new Qh)}function zM(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 GM(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 tf(e){this.r2=Pt(),this.q3=Pt(),ne.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function WM(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=Pt();return e.copyTo(t),this.reduce(t),t}function YM(e){return e}function XM(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 ZM(e,t){e.squareTo(t),this.reduce(t)}function JM(e,t,r){e.multiplyTo(t,r),this.reduce(r)}tf.prototype.convert=WM;tf.prototype.revert=YM;tf.prototype.reduce=XM;tf.prototype.mulTo=JM;tf.prototype.sqrTo=ZM;function QM(e,t){if(e.signum()<0)return this.modInverse(t).modPow(e.negate(),t);var r=e.bitLength(),n,i=Eu(1),o;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?o=new _c(t):t.isEven()?o=new tf(t):o=new Cc(t);var s=new Array,a=3,u=n-1,l=(1<<n)-1;if(s[1]=o.convert(this),n>1){var h=Pt();for(o.sqrTo(s[1],h);a<=l;)s[a]=Pt(),o.mulTo(h,s[a-2],s[a]),a+=2}var m=e.t-1,p,d=!0,v=Pt(),g;for(r=l1(e[m])-1;m>=0;){for(r>=u?p=e[m]>>r-u&l:(p=(e[m]&(1<<r+1)-1)<<u-r,m>0&&(p|=e[m-1]>>this.DB+r-u)),a=n;(p&1)==0;)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--m),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,v),o.sqrTo(v,i),a-=2;a>0?o.sqrTo(i,v):(g=i,i=v,v=g),o.mulTo(v,s[p],i)}for(;m>=0&&(e[m]&1<<r)==0;)o.sqrTo(i,v),g=i,i=v,v=g,--r<0&&(r=this.DB-1,--m)}return o.revert(i)}function eq(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(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,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 o>0&&r.lShiftTo(o,r),r}function tq(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 rq(e){if(e.signum()==0)return ne.ZERO;var t=this.mod(e),r=e.isEven();if(t.isEven()&&r||t.signum()==0)return ne.ZERO;for(var n=e.clone(),i=t.clone(),o=Eu(1),s=Eu(0),a=Eu(0),u=Eu(1);n.signum()!=0;){for(;n.isEven();)n.rShiftTo(1,n),r?((!o.isEven()||!s.isEven())&&(o.addTo(t,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),r?((!a.isEven()||!u.isEven())&&(a.addTo(t,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),r&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(n,i),r&&a.subTo(o,a),u.subTo(s,u))}if(i.compareTo(ne.ONE)!=0)return ne.ZERO;if(u.compareTo(e)>=0)return u.subtract(e);if(u.signum()<0)u.addTo(e,u);else return u;return u.signum()<0?u.add(e):u}var Kn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],nq=(1<<26)/Kn[Kn.length-1];function sq(e){if(this.signum()<=0)return!1;var t,r=this.abs();if(r.t==1&&r[0]<=Kn[Kn.length-1]){for(t=0;t<Kn.length;++t)if(r[0]==Kn[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Kn.length;){for(var n=Kn[t],i=t+1;i<Kn.length&&n<nq;)n*=Kn[i++];for(n=r.modInt(n);t<i;)if(n%Kn[t++]==0)return!1}return r.millerRabin(e)}function iq(e){if(this.signum()<=0)return!1;var t=this.subtract(ne.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);e=e+1>>1,e>Kn.length&&(e=Kn.length);for(var i=Pt(),o=0;o<e;++o){i.fromInt(Kn[Math.floor(Math.random()*Kn.length)]);var s=i.modPow(n,this);if(s.compareTo(ne.ONE)!=0&&s.compareTo(t)!=0){for(var a=1;a++<r&&s.compareTo(t)!=0;)if(s=s.modPowInt(2,this),s.compareTo(ne.ONE)==0)return!1;if(s.compareTo(t)!=0)return!1}}return!0}ne.prototype.chunkSize=oM;ne.prototype.toRadix=uM;ne.prototype.fromRadix=cM;ne.prototype.fromNumber=lM;ne.prototype.bitwiseTo=mM;ne.prototype.changeBit=IM;ne.prototype.addTo=kM;ne.prototype.dMultiply=MM;ne.prototype.dAddOffset=qM;ne.prototype.multiplyLowerTo=zM;ne.prototype.multiplyUpperTo=GM;ne.prototype.modInt=tq;ne.prototype.millerRabin=iq;ne.prototype.clone=rM;ne.prototype.intValue=nM;ne.prototype.byteValue=sM;ne.prototype.shortValue=iM;ne.prototype.signum=aM;ne.prototype.toByteArray=fM;ne.prototype.equals=hM;ne.prototype.min=dM;ne.prototype.max=pM;ne.prototype.and=vM;ne.prototype.or=wM;ne.prototype.xor=yM;ne.prototype.andNot=EM;ne.prototype.not=bM;ne.prototype.shiftLeft=AM;ne.prototype.shiftRight=SM;ne.prototype.getLowestSetBit=CM;ne.prototype.bitCount=FM;ne.prototype.testBit=BM;ne.prototype.setBit=xM;ne.prototype.clearBit=$M;ne.prototype.flipBit=PM;ne.prototype.add=RM;ne.prototype.subtract=TM;ne.prototype.multiply=OM;ne.prototype.divide=LM;ne.prototype.remainder=UM;ne.prototype.divideAndRemainder=HM;ne.prototype.modPow=QM;ne.prototype.modInverse=rq;ne.prototype.pow=VM;ne.prototype.gcd=eq;ne.prototype.isProbablePrime=sq;ne.prototype.square=NM;ne.prototype.sqrt=function(){for(var e=ne.ZERO.setBit(this.bitLength()/2),t=e;;){var r=e.add(this.divide(e)).shiftRight(1);if(r.equals(e)||r.equals(t))return r;t=e,e=r}};function iy(){this.i=0,this.j=0,this.S=new Array}function oq(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 aq(){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]}iy.prototype.init=oq;iy.prototype.next=aq;function uq(){return new iy}var Xh=256;var s1,cs,Ar;function cq(e){cs[Ar++]^=e&255,cs[Ar++]^=e>>8&255,cs[Ar++]^=e>>16&255,cs[Ar++]^=e>>24&255,Ar>=Xh&&(Ar-=Xh)}function oy(){cq(new Date().getTime())}if(cs==null){if(cs=new Array,Ar=0,typeof Xl<"u"&&(Xl.crypto!==void 0||Xl.msCrypto!==void 0)){if(ca=Xl.crypto||Xl.msCrypto,ca.getRandomValues)for(Zw=new Uint8Array(32),ca.getRandomValues(Zw),bn=0;bn<32;++bn)cs[Ar++]=Zw[bn];else if(Zh.appName=="Netscape"&&Zh.appVersion<"5")for(Jw=Xl.crypto.random(32),bn=0;bn<Jw.length;++bn)cs[Ar++]=Jw.charCodeAt(bn)&255}if(Ar<Xh&&typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)for(i1=new Uint8Array(Xh-Ar),globalThis.crypto.getRandomValues(i1),bn=0;bn<i1.length;++bn)cs[Ar++]=i1[bn];for(;Ar<Xh;)bn=Math.floor(65536*Math.random()),cs[Ar++]=bn>>>8,cs[Ar++]=bn&255;Ar=0,oy()}var bn,ca,Zw,Jw,i1;function lq(){if(s1==null){for(oy(),s1=uq(),s1.init(cs),Ar=0;Ar<cs.length;++Ar)cs[Ar]=0;Ar=0}return s1.next()}function fq(e){var t;for(t=0;t<e.length;++t)e[t]=lq()}function rf(){}rf.prototype.nextBytes=fq;function ls(e,t){return new ne(e,t)}function at(){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 hq(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=ls(e,16),this.e=parseInt(t,16);else throw"Invalid RSA public key";if(this.n==null||typeof this.n.compareTo!="function"||this.n.compareTo(ne.ONE)<=0||this.e==null||isNaN(this.e)||this.e<=0)throw"Invalid RSA public key"}function dq(e){return e.modPowInt(this.e,this.n)}at.prototype.doPublic=dq;at.prototype.setPublic=hq;at.prototype.type="RSA";function pq(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=ls(e,16),this.e=parseInt(t,16),this.d=ls(r,16);else throw"Invalid RSA private key"}function mq(e,t,r,n,i,o,s,a){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=ls(e,16),this.e=parseInt(t,16),this.d=ls(r,16),this.p=ls(n,16),this.q=ls(i,16),this.dmp1=ls(o,16),this.dmq1=ls(s,16),this.coeff=ls(a,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function gq(e,t){var r=new rf,n=e>>1;this.e=parseInt(t,16);for(var i=new ne(t,16),o=e/2-100,s=ne.ONE.shiftLeft(o);;){for(;this.p=new ne(e-n,1,r),!(this.p.subtract(ne.ONE).gcd(i).compareTo(ne.ONE)==0&&this.p.isProbablePrime(10)););for(;this.q=new ne(n,1,r),!(this.q.subtract(ne.ONE).gcd(i).compareTo(ne.ONE)==0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var u=this.q.subtract(this.p).abs();if(!(u.bitLength()<o||u.compareTo(s)<=0)){var l=this.p.subtract(ne.ONE),h=this.q.subtract(ne.ONE),m=l.multiply(h);if(m.gcd(i).compareTo(ne.ONE)==0&&(this.n=this.p.multiply(this.q),this.n.bitLength()==e)){this.d=i.modInverse(m),this.dmp1=this.d.mod(l),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0}function vq(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)}at.prototype.doPrivate=vq;at.prototype.setPrivate=pq;at.prototype.setPrivateEx=mq;at.prototype.generate=gq;function Nr(e,t){this.x=t,this.q=e}function wq(e){return e==this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function yq(){return this.x}function Eq(){return new Nr(this.q,this.x.negate().mod(this.q))}function bq(e){return new Nr(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function Aq(e){return new Nr(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function Sq(e){return new Nr(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function _q(){return new Nr(this.q,this.x.square().mod(this.q))}function Cq(e){return new Nr(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}Nr.prototype.equals=wq;Nr.prototype.toBigInteger=yq;Nr.prototype.negate=Eq;Nr.prototype.add=bq;Nr.prototype.subtract=Aq;Nr.prototype.multiply=Sq;Nr.prototype.square=_q;Nr.prototype.divide=Cq;Nr.prototype.sqrt=function(){return new Nr(this.q,this.x.sqrt().mod(this.q))};function Nt(e,t,r,n){this.curve=e,this.x=t,this.y=r,n==null?this.z=ne.ONE:this.z=n,this.zinv=null}function Dq(){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 Fq(){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 Bq(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(ne.ZERO)?(r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q),r.equals(ne.ZERO)):!1}function Iq(){return this.x==null&&this.y==null?!0:this.z.equals(ne.ZERO)&&!this.y.toBigInteger().equals(ne.ZERO)}function xq(){return new Nt(this.curve,this.x,this.y.negate(),this.z)}function $q(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(ne.ZERO.equals(r))return ne.ZERO.equals(t)?this.twice():this.curve.getInfinity();var n=new ne("3"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=e.x.toBigInteger(),a=e.y.toBigInteger(),u=r.square(),l=u.multiply(r),h=i.multiply(u),m=t.square().multiply(this.z),p=m.subtract(h.shiftLeft(1)).multiply(e.z).subtract(l).multiply(r).mod(this.curve.q),d=h.multiply(n).multiply(t).subtract(o.multiply(l)).subtract(m.multiply(t)).multiply(e.z).add(t.multiply(l)).mod(this.curve.q),v=l.multiply(this.z).multiply(e.z).mod(this.curve.q);return new Nt(this.curve,this.curve.fromBigInteger(p),this.curve.fromBigInteger(d),v)}function Pq(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=new ne("3"),t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=t.square().multiply(e);ne.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o))),s=s.mod(this.curve.q);var a=s.square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=s.multiply(e).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),l=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Nt(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),l)}function kq(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new ne("3")),n=this.negate(),i=this,o=this.curve.q.subtract(e),s=o.multiply(new ne("3")),a=new Nt(this.curve,this.x,this.y),u=a.negate(),l;for(l=r.bitLength()-2;l>0;--l){i=i.twice();var h=r.testBit(l),m=t.testBit(l);h!=m&&(i=i.add(h?this:n))}for(l=s.bitLength()-2;l>0;--l){a=a.twice();var p=s.testBit(l),d=o.testBit(l);p!=d&&(a=a.add(p?a:u))}return i}function Rq(e,t,r){var n;e.bitLength()>r.bitLength()?n=e.bitLength()-1:n=r.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);n>=0;)i=i.twice(),e.testBit(n)?r.testBit(n)?i=i.add(o):i=i.add(this):r.testBit(n)&&(i=i.add(t)),--n;return i}Nt.prototype.getX=Dq;Nt.prototype.getY=Fq;Nt.prototype.equals=Bq;Nt.prototype.isInfinity=Iq;Nt.prototype.negate=xq;Nt.prototype.add=$q;Nt.prototype.twice=Pq;Nt.prototype.multiply=kq;Nt.prototype.multiplyTwo=Rq;function fa(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new Nt(this,null,null)}function Tq(){return this.q}function Oq(){return this.a}function Nq(){return this.b}function Lq(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function Uq(){return this.infinity}function Hq(e){return new Nr(this.q,e)}function Mq(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 ne(l,16)),i=this.getA(),o=this.getB(),s=n.square().add(i).multiply(n).add(o),a=s.sqrt();return t=="03"&&(a=a.negate()),new Nt(this,n,a);case 4:case 6:case 7:var u=(e.length-2)/2,l=e.substr(2,u),h=e.substr(u+2,u);return new Nt(this,this.fromBigInteger(new ne(l,16)),this.fromBigInteger(new ne(h,16)));default:return null}}fa.prototype.getQ=Tq;fa.prototype.getA=Oq;fa.prototype.getB=Nq;fa.prototype.equals=Lq;fa.prototype.getInfinity=Uq;fa.prototype.fromBigInteger=Hq;fa.prototype.decodePointHex=Mq;Nr.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Nt.prototype.getEncoded=function(e){var t=function(o,s){var a=o.toByteArrayUnsigned();if(s<a.length)a=a.slice(a.length-s);else for(;s>a.length;)a.unshift(0);return a},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};Nt.decodeFrom=function(e,t){var r=t[0],n=t.length-1,i=t.slice(1,1+n/2),o=t.slice(1+n/2,1+n);i.unshift(0),o.unshift(0);var s=new ne(i),a=new ne(o);return new Nt(e,e.fromBigInteger(s),e.fromBigInteger(a))};Nt.decodeFromHex=function(e,t){var r=t.substr(0,2),n=t.length-2,i=t.substr(2,n/2),o=t.substr(2+n/2,n/2),s=new ne(i,16),a=new ne(o,16);return new Nt(e,e.fromBigInteger(s),e.fromBigInteger(a))};Nt.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),o=n.multiply(this.x.subtract(i)).subtract(this.y);return new Nt(this.curve,i,o)};Nt.prototype.twice2D=function(){if(this.isInfinity())return this;if(this.y.toBigInteger().signum()==0)return this.curve.getInfinity();var e=this.curve.fromBigInteger(ne.valueOf(2)),t=this.curve.fromBigInteger(ne.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 Nt(this.curve,n,i)};Nt.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(e.signum()==0)return this.curve.getInfinity();var t=e,r=t.multiply(new ne("3")),n=this.negate(),i=this,o;for(o=r.bitLength()-2;o>0;--o){i=i.twice();var s=r.testBit(o),a=t.testBit(o);s!=a&&(i=i.add2D(s?this:n))}return i};Nt.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(),o=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return o.equals(s)};Nt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Nt.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(ne.ONE)<0||t.compareTo(e.subtract(ne.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(ne.ONE)<0||r.compareTo(e.subtract(ne.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 iC=(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"),o={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
|
||
`,r:"\r",t:" "};function s(m,p,d){return p?o[p]:String.fromCharCode(parseInt(d,16))}var a=new String(""),u="\\",l={"{":Object,"[":Array},h=Object.hasOwnProperty;return function(m,p){var d=m.match(n),v,g=d[0],y=!1;g==="{"?v={}:g==="["?v=[]:(v=[],y=!0);for(var w,E=[v],_=1-y,C=d.length;_<C;++_){g=d[_];var F;switch(g.charCodeAt(0)){default:F=E[0],F[w||F.length]=+g,w=void 0;break;case 34:if(g=g.substring(1,g.length-1),g.indexOf(u)!==-1&&(g=g.replace(i,s)),F=E[0],!w)if(F instanceof Array)w=F.length;else{w=g||a;break}F[w]=g,w=void 0;break;case 91:F=E[0],E.unshift(F[w||F.length]=[]),w=void 0;break;case 93:E.shift();break;case 102:F=E[0],F[w||F.length]=!1,w=void 0;break;case 110:F=E[0],F[w||F.length]=null,w=void 0;break;case 116:F=E[0],F[w||F.length]=!0,w=void 0;break;case 123:F=E[0],E.unshift(F[w||F.length]={}),w=void 0;break;case 125:E.shift();break}}if(y){if(E.length!==1)throw new Error;v=v[0]}else if(E.length)throw new Error;if(p){var H=function(K,S){var I=K[S];if(I&&typeof I=="object"){var q=null;for(var L in I)if(h.call(I,L)&&I!==K){var R=H(I,L);R!==void 0?I[L]=R:(q||(q=[]),q.push(L))}if(q)for(var O=q.length;--O>=0;)delete I[q[O]]}return p.call(K,S,I)};v=H({"":v},"")}return v}})();(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});A.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){return td(e)},this.getPEMStringFromHex=function(e,t){return An(e,t)},this.newObject=function(e){var t=A,r=t.asn1,n=r.ASN1Object,i=r.DERBoolean,o=r.DERInteger,s=r.DERBitString,a=r.DEROctetString,u=r.DERNull,l=r.DERObjectIdentifier,h=r.DEREnumerated,m=r.DERUTF8String,p=r.DERNumericString,d=r.DERPrintableString,v=r.DERTeletexString,g=r.DERIA5String,y=r.DERUTCTime,w=r.DERGeneralizedTime,E=r.DERVisibleString,_=r.DERBMPString,C=r.DERSequence,F=r.DERSet,H=r.DERTaggedObject,K=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var S=Object.keys(e);if(S.length!=1)throw new Error("key of param shall be only one.");var I=S[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+I+":")==-1)throw new Error("undefined key: "+I);if(I=="bool")return new i(e[I]);if(I=="int")return new o(e[I]);if(I=="bitstr")return new s(e[I]);if(I=="octstr")return new a(e[I]);if(I=="null")return new u(e[I]);if(I=="oid")return new l(e[I]);if(I=="enum")return new h(e[I]);if(I=="utf8str")return new m(e[I]);if(I=="numstr")return new p(e[I]);if(I=="prnstr")return new d(e[I]);if(I=="telstr")return new v(e[I]);if(I=="ia5str")return new g(e[I]);if(I=="utctime")return new y(e[I]);if(I=="gentime")return new w(e[I]);if(I=="visstr")return new E(e[I]);if(I=="bmpstr")return new _(e[I]);if(I=="asn1")return new n(e[I]);if(I=="seq"){for(var q=e[I],L=[],R=0;R<q.length;R++){var O=K(q[R]);L.push(O)}return new C({array:L})}if(I=="set"){for(var q=e[I],L=[],R=0;R<q.length;R++){var O=K(q[R]);L.push(O)}return new F({array:L})}if(I=="tag"){var T=e[I];if(Object.prototype.toString.call(T)==="[object Array]"&&T.length==3){var N=K(T[2]);return new H({tag:T[0],explicit:T[1],obj:N})}else return new H(T)}},this.jsonToASN1HEX=function(e){var t=this.newObject(e);return t.tohex()}};A.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,o="",s=2;s<e.length;s+=2){var a=parseInt(e.substr(s,2),16),u=("00000000"+a.toString(2)).slice(-8);if(o=o+u.substr(1,7),u.substr(0,1)=="0"){var l=new ne(o,2);i=i+"."+l.toString(10),o=""}}return i};A.asn1.ASN1Util.oidIntToHex=function(e){var t=function(a){var u=a.toString(16);return u.length==1&&(u="0"+u),u},r=function(a){var u="",l=new ne(a,10),h=l.toString(2),m=7-h.length%7;m==7&&(m=0);for(var p="",d=0;d<m;d++)p+="0";h=p+h;for(var d=0;d<h.length-1;d+=7){var v=h.substr(d,7);d!=h.length-7&&(v="1"+v),u+=t(parseInt(v,2))}return u};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),o=parseInt(i[0])*40+parseInt(i[1]);n+=t(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n};A.asn1.ASN1Object=function(e){var t=!0,r=null,n="00",i="00",o="";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="+o.length+",v="+this.hV);var s=this.hV.length/2,a=s.toString(16);if(a.length%2==1&&(a="0"+a),s<128)return a;var u=a.length/2;if(u>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+s.toString(16));var l=128+u;return l.toString(16)+a},this.tohex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(s){this.params=s},e!=null&&e.tlv!=null&&(this.hTLV=e.tlv,this.isModified=!1)};A.asn1.DERAbstractString=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null,r=null;this.getString=function(){return this.s},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.s=n,this.hV=h1(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))};Ee(A.asn1.DERAbstractString,A.asn1.ASN1Object);A.asn1.DERAbstractTime=function(e){A.asn1.DERAbstractTime.superclass.constructor.call(this);var t=null,r=null;this.localDateToUTC=function(n){var i=n.getTime()+n.getTimezoneOffset()*6e4,o=new Date(i);return o},this.formatDate=function(n,i,o){var s=this.zeroPadding,a=this.localDateToUTC(n),u=String(a.getFullYear());i=="utc"&&(u=u.substr(2,2));var l=s(String(a.getMonth()+1),2),h=s(String(a.getDate()),2),m=s(String(a.getHours()),2),p=s(String(a.getMinutes()),2),d=s(String(a.getSeconds()),2),v=u+l+h+m+p+d;if(o===!0){var g=a.getMilliseconds();if(g!=0){var y=s(String(g),3);y=y.replace(/[0]+$/,""),v=v+"."+y}}return v+"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,o,s,a,u){var l=new Date(Date.UTC(n,i-1,o,s,a,u,0));this.setByDate(l)},this.getFreshValueHex=function(){return this.hV}};Ee(A.asn1.DERAbstractTime,A.asn1.ASN1Object);A.asn1.DERAbstractStructured=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null;this.setByASN1ObjectArray=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array=r},this.appendASN1Object=function(r){this.hTLV=null,this.isModified=!0,this.asn1Array.push(r)},this.asn1Array=new Array,typeof e<"u"&&typeof e.array<"u"&&(this.asn1Array=e.array)};Ee(A.asn1.DERAbstractStructured,A.asn1.ASN1Object);A.asn1.DERBoolean=function(e){A.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",e==!1?this.hTLV="010100":this.hTLV="0101ff"};Ee(A.asn1.DERBoolean,A.asn1.ASN1Object);A.asn1.DERInteger=function(e){A.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var t=td;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 ne(String(r),10);else if(r.int!=null)n=new ne(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)};Ee(A.asn1.DERInteger,A.asn1.ASN1Object);A.asn1.DERBitString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=A.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.tohex()}A.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(r){this.hTLV=null,this.isModified=!0,this.hV=r},this.setUnusedBitsAndHexValue=function(r,n){if(r<0||7<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="",o=0;o<r.length-1;o+=8){var s=r.substr(o,8),a=parseInt(s,2).toString(16);a.length==1&&(a="0"+a),i+=a}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))};Ee(A.asn1.DERBitString,A.asn1.ASN1Object);A.asn1.DEROctetString=function(e){if(e!==void 0&&typeof e.obj<"u"){var t=A.asn1.ASN1Util.newObject(e.obj);e.hex=t.tohex()}A.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"};Ee(A.asn1.DEROctetString,A.asn1.DERAbstractString);A.asn1.DERNull=function(){A.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"};Ee(A.asn1.DERNull,A.asn1.ASN1Object);A.asn1.DERObjectIdentifier=function(e){A.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=pC(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=A.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)};Ee(A.asn1.DERObjectIdentifier,A.asn1.ASN1Object);A.asn1.DEREnumerated=function(e){A.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=td(t)},this.setByInteger=function(t){var r=new ne(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))};Ee(A.asn1.DEREnumerated,A.asn1.ASN1Object);A.asn1.DERUTF8String=function(e){A.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"};Ee(A.asn1.DERUTF8String,A.asn1.DERAbstractString);A.asn1.DERNumericString=function(e){A.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"};Ee(A.asn1.DERNumericString,A.asn1.DERAbstractString);A.asn1.DERPrintableString=function(e){A.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"};Ee(A.asn1.DERPrintableString,A.asn1.DERAbstractString);A.asn1.DERTeletexString=function(e){A.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"};Ee(A.asn1.DERTeletexString,A.asn1.DERAbstractString);A.asn1.DERIA5String=function(e){A.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"};Ee(A.asn1.DERIA5String,A.asn1.DERAbstractString);A.asn1.DERVisibleString=function(e){A.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"};Ee(A.asn1.DERVisibleString,A.asn1.DERAbstractString);A.asn1.DERBMPString=function(e){A.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"};Ee(A.asn1.DERBMPString,A.asn1.DERAbstractString);A.asn1.DERUTCTime=function(e){A.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=hs(t);else throw new Error("malformed string for UTCTime: "+t);else if(t.str!=null)this.hV=hs(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=hs(this.formatDate(r,"utc",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=hs(this.formatDate(t.date,"utc",n))}else t instanceof Date&&(this.hV=hs(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)};Ee(A.asn1.DERUTCTime,A.asn1.DERAbstractTime);A.asn1.DERGeneralizedTime=function(e){A.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=hs(t);else throw new Error("malformed string for GeneralizedTime: "+t);else if(t.str!=null)this.hV=hs(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=hs(this.formatDate(r,"gen",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=hs(this.formatDate(t.date,"gen",n))}else t instanceof Date&&(this.hV=hs(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)};Ee(A.asn1.DERGeneralizedTime,A.asn1.DERAbstractTime);A.asn1.DERSequence=function(e){A.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}};Ee(A.asn1.DERSequence,A.asn1.DERAbstractStructured);A.asn1.DERSet=function(e){A.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)};Ee(A.asn1.DERSet,A.asn1.DERAbstractStructured);A.asn1.DERTaggedObject=function(e){A.asn1.DERTaggedObject.superclass.constructor.call(this);var t=A.asn1,r=xe,n=r.getV,i=r.isASN1HEX,o=t.ASN1Util.newObject;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(s,a,u){this.params={tag:a,explicit:s,obj:u}},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=h1(s.str);else if(s.hex!=null)this.hV=s.hex;else if(s.obj!=null){var a;s.obj instanceof t.ASN1Object?a=s.obj.tohex():typeof s.obj=="object"&&(a=o(s.obj).tohex()),s.explicit?this.hV=a:this.hV=n(a,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)};Ee(A.asn1.DERTaggedObject,A.asn1.ASN1Object);var xe=new function(){};xe.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};xe.getL=function(e,t){var r=xe.getLblen(e,t);return r<1?"":e.substr(t+2,r*2)};xe.getVblen=function(e,t){var r,n;return r=xe.getL(e,t),r==""?-1:(r.substr(0,1)==="8"?n=new ne(r.substr(2),16):n=new ne(r,16),n.intValue())};xe.getVidx=function(e,t){var r=xe.getLblen(e,t);return r<0?r:t+(r+1)*2};xe.getV=function(e,t){var r=xe.getVidx(e,t),n=xe.getVblen(e,t);return e.substr(r,n*2)};xe.getTLV=function(e,t){return e.substr(t,2)+xe.getL(e,t)+xe.getV(e,t)};xe.getTLVblen=function(e,t){return 2+xe.getLblen(e,t)*2+xe.getVblen(e,t)*2};xe.getNextSiblingIdx=function(e,t){var r=xe.getVidx(e,t),n=xe.getVblen(e,t);return r+n*2};xe.getChildIdx=function(e,t){var r=xe,n=[],i,o,s;if(i=r.getVidx(e,t),o=r.getVblen(e,t)*2,i+o>e.length)throw new Error("too short ASN.1 value");e.substr(t,2)=="03"&&(i+=2,o-=2),s=0;for(var a=i;s<=o;){var u=r.getTLVblen(e,a);if(u<=0)throw new Error("malformed ASN.1: invalid TLV length");if(s+=u,s<=o&&n.push(a),a+=u,s>=o)break}return n};xe.getNthChildIdx=function(e,t,r){var n=xe.getChildIdx(e,t);return n[r]};xe.getIdxbyList=function(e,t,r,n){var i=xe,o,s;return r.length==0?n!==void 0&&e.substr(t,2)!==n?-1:t:(o=r.shift(),s=i.getChildIdx(e,t),o>=s.length?-1:i.getIdxbyList(e,s[o],r,n))};xe.getIdxbyListEx=function(e,t,r,n){var i=xe,o,s;if(r.length==0)return n!==void 0&&e.substr(t,2)!==n?-1:t;o=r.shift(),s=i.getChildIdx(e,t);for(var a=0,u=0;u<s.length;u++){var l=e.substr(s[u],2);if(typeof o=="number"&&!i.isContextTag(l)&&a==o||typeof o=="string"&&i.isContextTag(l,o))return i.getIdxbyListEx(e,s[u],r,n);i.isContextTag(l)||a++}return-1};xe.getTLVbyList=function(e,t,r,n){var i=xe,o=i.getIdxbyList(e,t,r,n);return o==-1||o>=e.length?null:i.getTLV(e,o)};xe.getTLVbyListEx=function(e,t,r,n){var i=xe,o=i.getIdxbyListEx(e,t,r,n);return o==-1?null:i.getTLV(e,o)};xe.getVbyList=function(e,t,r,n,i){var o=xe,s,a;return s=o.getIdxbyList(e,t,r,n),s==-1||s>=e.length?null:(a=o.getV(e,s),i===!0&&(a=a.substr(2)),a)};xe.getVbyListEx=function(e,t,r,n,i){var o=xe,s,a,u;return s=o.getIdxbyListEx(e,t,r,n),s==-1?null:(u=o.getV(e,s),e.substr(s,2)=="03"&&i!==!1&&(u=u.substr(2)),u)};xe.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=xe.getV(e,t);return n=="02"?parseInt(i,16):gC(i)}catch{return r}};xe.getOID=function(e,t,r){r==null&&(r=null);try{if(e.substr(t,2)!="06")return r;var n=xe.getV(e,t);return v1(n)}catch{return r}};xe.getOIDName=function(e,t,r){r==null&&(r=null);try{var n=xe.getOID(e,t,r);if(n==r)return r;var i=A.asn1.x509.OID.oid2name(n);return i==""?n:i}catch{return r}};xe.getString=function(e,t,r){r==null&&(r=null);try{var n=xe.getV(e,t);return ds(n)}catch{return r}};xe.hextooidstr=function(e){var t=function(m,p){return m.length>=p?m:new Array(p-m.length+1).join("0")+m},r=[],n=e.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=e.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(a*2,2),16));for(var u=[],l="",a=0;a<s.length;a++)s[a]&128?l=l+t((s[a]&127).toString(2),7):(l=l+t((s[a]&127).toString(2),7),u.push(new String(parseInt(l,2))),l="");var h=r.join(".");return u.length>0&&(h=h+"."+u.join(".")),h};xe.dump=function(e,t,r,n){var i=xe,o=i.getV,s=i.dump,a=i.getChildIdx,u=e;e instanceof A.asn1.ASN1Object&&(u=e.tohex());var l=function(K,S){if(K.length<=S*2)return K;var I=K.substr(0,S)+"..(total "+K.length/2+"bytes).."+K.substr(K.length-S,S);return I};t===void 0&&(t={ommit_long_octet:32}),r===void 0&&(r=0),n===void 0&&(n="");var h=t.ommit_long_octet,F=u.substr(r,2);if(F=="01"){var m=o(u,r);return m=="00"?n+`BOOLEAN FALSE
|
||
`:n+`BOOLEAN TRUE
|
||
`}if(F=="02"){var m=o(u,r);return n+"INTEGER "+l(m,h)+`
|
||
`}if(F=="03"){var m=o(u,r);if(i.isASN1HEX(m.substr(2))){var p=n+`BITSTRING, encapsulates
|
||
`;return p=p+s(m.substr(2),t,0,n+" "),p}else return n+"BITSTRING "+l(m,h)+`
|
||
`}if(F=="04"){var m=o(u,r);if(i.isASN1HEX(m)){var p=n+`OCTETSTRING, encapsulates
|
||
`;return p=p+s(m,t,0,n+" "),p}else return n+"OCTETSTRING "+l(m,h)+`
|
||
`}if(F=="05")return n+`NULL
|
||
`;if(F=="06"){var d=o(u,r),v=A.asn1.ASN1Util.oidHexToInt(d),g=A.asn1.x509.OID.oid2name(v),y=v.replace(/\./g," ");return g!=""?n+"ObjectIdentifier "+g+" ("+y+`)
|
||
`:n+"ObjectIdentifier ("+y+`)
|
||
`}if(F=="0a")return n+"ENUMERATED "+parseInt(o(u,r))+`
|
||
`;if(F=="0c")return n+"UTF8String '"+Gt(o(u,r))+`'
|
||
`;if(F=="13")return n+"PrintableString '"+Gt(o(u,r))+`'
|
||
`;if(F=="14")return n+"TeletexString '"+Gt(o(u,r))+`'
|
||
`;if(F=="16")return n+"IA5String '"+Gt(o(u,r))+`'
|
||
`;if(F=="17")return n+"UTCTime "+Gt(o(u,r))+`
|
||
`;if(F=="18")return n+"GeneralizedTime "+Gt(o(u,r))+`
|
||
`;if(F=="1a")return n+"VisualString '"+Gt(o(u,r))+`'
|
||
`;if(F=="1e")return n+"BMPString '"+ly(o(u,r))+`'
|
||
`;if(F=="30"){if(u.substr(r,4)=="3000")return n+`SEQUENCE {}
|
||
`;var p=n+`SEQUENCE
|
||
`,w=a(u,r),E=t;if((w.length==2||w.length==3)&&u.substr(w[0],2)=="06"&&u.substr(w[w.length-1],2)=="04"){var g=i.oidname(o(u,w[0])),_=JSON.parse(JSON.stringify(t));_.x509ExtName=g,E=_}for(var C=0;C<w.length;C++)p=p+s(u,E,w[C],n+" ");return p}if(F=="31"){for(var p=n+`SET
|
||
`,w=a(u,r),C=0;C<w.length;C++)p=p+s(u,t,w[C],n+" ");return p}var F=parseInt(F,16);if((F&128)!=0){var H=F&31;if((F&32)!=0){for(var p=n+"["+H+`]
|
||
`,w=a(u,r),C=0;C<w.length;C++)p=p+s(u,t,w[C],n+" ");return p}else{var m=o(u,r);if(xe.isASN1HEX(m)){var p=n+"["+H+`]
|
||
`;return p=p+s(m,t,0,n+" "),p}else(m.substr(0,8)=="68747470"||t.x509ExtName==="subjectAltName"&&H==2)&&(m=Gt(m));var p=n+"["+H+"] "+m+`
|
||
`;return p}}return n+"UNKNOWN("+F+") "+o(u,r)+`
|
||
`};xe.parse=function(e){var t=xe,r=t.parse,n=t.isASN1HEX,i=t.getV,o=t.getTLV,s=t.getChildIdx,a=A.asn1,u=a.ASN1Util.oidHexToInt,l=a.x509.OID.oid2name,h=Gt,m=ly,p=Gq,d={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},v=function(I){for(var q=[],L=s(I,0),R=0;R<L.length;R++){var O=L[R],T=o(I,O),N=r(T);q.push(N)}return q},g=e.substr(0,2),y={},w=i(e,0);if(g=="01")return e=="0101ff"?{bool:!0}:{bool:!1};if(g=="02")return{int:{hex:w}};if(g=="03")try{if(w.substr(0,2)!="00")throw"not encap";var E=w.substr(2);if(!n(E))throw"not encap";return{bitstr:{obj:r(E)}}}catch{var _=null;return w.length<=10&&(_=wC(w)),_==null?{bitstr:{hex:w}}:{bitstr:{bin:_}}}else if(g=="04")try{if(!n(w))throw"not encap";return{octstr:{obj:r(w)}}}catch{return{octstr:{hex:w}}}else{if(g=="05")return{null:""};if(g=="06"){var C=u(w),F=l(C);return F==""?{oid:C}:{oid:F}}else{if(g=="0a")return w.length>4?{enum:{hex:w}}:{enum:parseInt(w,16)};if(g=="30"||g=="31")return y[d[g]]=v(e),y;if(g=="14"){var H=p(w);return y[d[g]]={str:H},y}else if(g=="1e"){var H=m(w);return y[d[g]]={str:H},y}else if(":0c:12:13:16:17:18:1a:".indexOf(g)!=-1){var H=h(w);return y[d[g]]={str:H},y}else if(g.match(/^8[0-9]$/)){var H=h(w);return H==null|H==""?{tag:{tag:g,explicit:!1,hex:w}}:H.match(/[\x00-\x1F\x7F-\x9F]/)!=null||H.match(/[\u0000-\u001F\u0080–\u009F]/)!=null?{tag:{tag:g,explicit:!1,hex:w}}:{tag:{tag:g,explicit:!1,str:H}}}else if(g.match(/^a[0-9]$/))try{if(!n(w))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:r(w)}}}catch{return{tag:{tag:g,explicit:!0,hex:w}}}else{var K=new A.asn1.ASN1Object;K.hV=w;var S=K.getLengthHexFromValue();return{asn1:{tlv:g+S+w}}}}}};xe.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}};xe.isASN1HEX=function(e){var t=xe;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),i=t.getL(e,0),o=e.length-n.length-i.length;return o==r*2};xe.checkStrictDER=function(e,t,r,n,i){var o=xe;if(r===void 0){if(typeof e!="string")throw new Error("not hex string");if(e=e.toLowerCase(),!A.lang.String.isHex(e))throw new Error("not hex string");r=e.length,n=e.length/2,n<128?i=1:i=Math.ceil(n.toString(16))+1}var s=o.getL(e,t);if(s.length>i*2)throw new Error("L of TLV too long: idx="+t);var a=o.getVblen(e,t);if(a>n)throw new Error("value of L too long than hex: idx="+t);var u=o.getTLV(e,t),l=u.length-2-o.getL(e,t).length;if(l!==a*2)throw new Error("V string length and L's value not the same:"+l+"/"+a*2);if(t===0&&e.length!=u.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+u.length);var h=e.substr(t,2);if(h==="02"){var m=o.getVidx(e,t);if(e.substr(m,2)=="00"&&e.charCodeAt(m+2)<56)throw new Error("not least zeros for DER INTEGER")}if(parseInt(h,16)&32){for(var p=o.getVblen(e,t),d=0,v=o.getChildIdx(e,t),g=0;g<v.length;g++){var y=o.getTLV(e,v[g]);d+=y.length,o.checkStrictDER(e,v[g],r,n,i)}if(p*2!=d)throw new Error("sum of children's TLV length and L unmatch: "+p*2+"!="+d)}};xe.oidname=function(e){var t=A.asn1;A.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var r=t.x509.OID.oid2name(e);return r===""&&(r=e),r};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.x509>"u"||!A.asn1.x509)&&(A.asn1.x509={});A.asn1.x509.Certificate=function(e){A.asn1.x509.Certificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,o=r.x509,s=o.TBSCertificate,a=o.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(u){this.params=u},this.sign=function(){var u=this.params,l=u.sigalg;u.sigalg.name!=null&&(l=u.sigalg.name);var h=u.tbsobj.tohex(),m=new A.crypto.Signature({alg:l});m.init(u.cakey),m.updateHex(h),u.sighex=m.sign()},this.getPEM=function(){return An(this.tohex(),"CERTIFICATE")},this.tohex=function(){var u=this.params;if((u.tbsobj==null||u.tbsobj==null)&&(u.tbsobj=new s(u)),u.sighex==null&&u.cakey!=null&&this.sign(),u.sighex==null)throw new Error("sighex or cakey parameter not defined");var l=[];l.push(u.tbsobj),l.push(new a({name:u.sigalg})),l.push(new n({hex:"00"+u.sighex}));var h=new i({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};Ee(A.asn1.x509.Certificate,A.asn1.ASN1Object);A.asn1.x509.TBSCertificate=function(e){A.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.x509,i=r.DERTaggedObject,o=r.DERInteger,s=r.DERSequence,a=n.AlgorithmIdentifier,u=n.Time,l=n.X500Name,h=n.Extensions,m=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(p){this.params=p},this.tohex=function(){var p=[],d=this.params;if(d.version!=null||d.version!=1){var v=2;d.version!=null&&(v=d.version-1);var g=new i({obj:new o({int:v})});p.push(g)}p.push(new o(d.serial)),p.push(new a({name:d.sigalg})),p.push(new l(d.issuer)),p.push(new s({array:[new u(d.notbefore),new u(d.notafter)]})),p.push(new l(d.subject)),p.push(new m(_t.getKey(d.sbjpubkey))),d.ext!==void 0&&d.ext.length>0&&p.push(new i({tag:"a3",obj:new h(d.ext)}));var y=new A.asn1.DERSequence({array:p});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.TBSCertificate,A.asn1.ASN1Object);A.asn1.x509.Extensions=function(e){A.asn1.x509.Extensions.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERSequence,i=r.x509;this.aParam=[],this.setByParam=function(o){this.aParam=o},this.tohex=function(){for(var o=[],s=0;s<this.aParam.length;s++){var a=this.aParam[s],u=a.extname,l=null;if(a.extn!=null)l=new i.PrivateExtension(a);else if(u=="subjectKeyIdentifier")l=new i.SubjectKeyIdentifier(a);else if(u=="keyUsage")l=new i.KeyUsage(a);else if(u=="subjectAltName")l=new i.SubjectAltName(a);else if(u=="issuerAltName")l=new i.IssuerAltName(a);else if(u=="basicConstraints")l=new i.BasicConstraints(a);else if(u=="nameConstraints")l=new i.NameConstraints(a);else if(u=="cRLDistributionPoints")l=new i.CRLDistributionPoints(a);else if(u=="certificatePolicies")l=new i.CertificatePolicies(a);else if(u=="policyMappings")l=new i.PolicyMappings(a);else if(u=="policyConstraints")l=new i.PolicyConstraints(a);else if(u=="inhibitAnyPolicy")l=new i.InhibitAnyPolicy(a);else if(u=="authorityKeyIdentifier")l=new i.AuthorityKeyIdentifier(a);else if(u=="extKeyUsage")l=new i.ExtKeyUsage(a);else if(u=="authorityInfoAccess")l=new i.AuthorityInfoAccess(a);else if(u=="cRLNumber")l=new i.CRLNumber(a);else if(u=="cRLReason")l=new i.CRLReason(a);else if(u=="ocspNonce")l=new i.OCSPNonce(a);else if(u=="ocspNoCheck")l=new i.OCSPNoCheck(a);else if(u=="adobeTimeStamp")l=new i.AdobeTimeStamp(a);else if(u=="subjectDirectoryAttributes")l=new i.SubjectDirectoryAttributes(a);else throw new Error("extension not supported:"+JSON.stringify(a));l!=null&&o.push(l)}var h=new n({array:o});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.x509.Extensions,A.asn1.ASN1Object);A.asn1.x509.Extension=function(e){A.asn1.x509.Extension.superclass.constructor.call(this);var t=null,r=A,n=r.asn1,i=n.DERObjectIdentifier,o=n.DEROctetString,s=n.DERBitString,a=n.DERBoolean,u=n.DERSequence;this.tohex=function(){var l=new i({oid:this.oid}),h=new o({hex:this.getExtnValueHex()}),m=new Array;m.push(l),this.critical&&m.push(new a),m.push(h);var p=new u({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,e!==void 0&&e.critical!==void 0&&(this.critical=e.critical)};Ee(A.asn1.x509.Extension,A.asn1.ASN1Object);A.asn1.x509.KeyUsage=function(e){A.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 A.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 u1(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)};Ee(A.asn1.x509.KeyUsage,A.asn1.x509.Extension);A.asn1.x509.BasicConstraints=function(e){A.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERBoolean,n=t.DERInteger,i=t.DERSequence,o=!1,s=-1;this.getExtnValueHex=function(){var a=new Array;this.cA&&a.push(new r),this.pathLen>-1&&a.push(new n({int:this.pathLen}));var u=new i({array:a});return this.asn1ExtnValue=u,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))};Ee(A.asn1.x509.BasicConstraints,A.asn1.x509.Extension);A.asn1.x509.CRLDistributionPoints=function(e){A.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(i){for(var o=[],s=0;s<i.length;s++)if(i[s]instanceof A.asn1.ASN1Object)o.push(i[s]);else{var a=new n.DistributionPoint(i[s]);o.push(a)}this.asn1ExtnValue=new r.DERSequence({array:o})},this.setByOneURI=function(i){var o=new n.DistributionPoint({fulluri:i});this.setByDPArray([o])},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))};Ee(A.asn1.x509.CRLDistributionPoints,A.asn1.x509.Extension);A.asn1.x509.DistributionPoint=function(e){A.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=null,r=A,n=r.asn1,i=n.x509.DistributionPointName;this.tohex=function(){var o=new n.DERSequence;if(this.asn1DP!=null){var s=new n.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});o.appendASN1Object(s)}return this.hTLV=o.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}]})))};Ee(A.asn1.x509.DistributionPoint,A.asn1.ASN1Object);A.asn1.x509.DistributionPointName=function(e){A.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=null,r=null,n=null,i=null,o=A,s=o.asn1,a=s.DERTaggedObject;if(this.tohex=function(){if(this.type!="full")throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new a({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")};Ee(A.asn1.x509.DistributionPointName,A.asn1.ASN1Object);A.asn1.x509.CertificatePolicies=function(e){A.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,i=r.DERSequence,o=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var s=[],a=0;a<this.params.array.length;a++)s.push(new o(this.params.array[a]));var u=new i({array:s});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",e!==void 0&&(this.params=e)};Ee(A.asn1.x509.CertificatePolicies,A.asn1.x509.Extension);A.asn1.x509.PolicyInformation=function(e){A.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=A.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 o=[new n(this.params.policyoid)];if(this.params.array!==void 0){for(var s=[],a=0;a<this.params.array.length;a++)s.push(new i(this.params.array[a]));s.length>0&&o.push(new r({array:s}))}var u=new r({array:o});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(A.asn1.x509.PolicyInformation,A.asn1.ASN1Object);A.asn1.x509.PolicyQualifierInfo=function(e){A.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERSequence,n=t.DERIA5String,i=t.DERObjectIdentifier,o=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 o(this.params.unotice)]});return s.tohex()}},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(A.asn1.x509.PolicyQualifierInfo,A.asn1.ASN1Object);A.asn1.x509.UserNotice=function(e){A.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText,i=A.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var o=[];this.params.noticeref!==void 0&&o.push(new i(this.params.noticeref)),this.params.exptext!==void 0&&o.push(new n(this.params.exptext));var s=new t({array:o});return s.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(A.asn1.x509.UserNotice,A.asn1.ASN1Object);A.asn1.x509.NoticeReference=function(e){A.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=A.asn1.DERSequence,r=A.asn1.DERInteger,n=A.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var i=[];if(this.params.org!==void 0&&i.push(new n(this.params.org)),this.params.noticenum!==void 0){for(var o=[],s=this.params.noticenum,a=0;a<s.length;a++)o.push(new r(s[a]));i.push(new t({array:o}))}if(i.length==0)throw new Error("parameter is empty");var u=new t({array:i});return u.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&(this.params=e)};Ee(A.asn1.x509.NoticeReference,A.asn1.ASN1Object);A.asn1.x509.DisplayText=function(e){A.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"))};Ee(A.asn1.x509.DisplayText,A.asn1.DERAbstractString);A.asn1.x509.PolicyMappings=function(e){A.asn1.x509.PolicyMappings.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){for(var o=this.params,s=[],a=0;a<o.array.length;a++){var u=o.array[a];s.push({seq:[{oid:u[0]},{oid:u[1]}]})}return this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",e!==void 0&&(this.params=e)};Ee(A.asn1.x509.PolicyMappings,A.asn1.x509.Extension);A.asn1.x509.PolicyConstraints=function(e){A.asn1.x509.PolicyConstraints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){var o=this.params,s=[];return o.reqexp!=null&&s.push({tag:{tagi:"80",obj:{int:o.reqexp}}}),o.inhibit!=null&&s.push({tag:{tagi:"81",obj:{int:o.inhibit}}}),this.asn1ExtnValue=i({seq:s}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",e!==void 0&&(this.params=e)};Ee(A.asn1.x509.PolicyConstraints,A.asn1.x509.Extension);A.asn1.x509.InhibitAnyPolicy=function(e){A.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,e);var t=A,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)};Ee(A.asn1.x509.InhibitAnyPolicy,A.asn1.x509.Extension);A.asn1.x509.NameConstraints=function(e){A.asn1.x509.NameConstraints.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.x509,i=r.ASN1Util.newObject,o=n.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var s=this.params,a=[];if(s.permit!=null&&s.permit.length!=null){for(var u=[],l=0;l<s.permit.length;l++)u.push(new o(s.permit[l]));a.push({tag:{tagi:"a0",obj:{seq:u}}})}if(s.exclude!=null&&s.exclude.length!=null){for(var h=[],l=0;l<s.exclude.length;l++)h.push(new o(s.exclude[l]));a.push({tag:{tagi:"a1",obj:{seq:h}}})}return this.asn1ExtnValue=i({seq:a}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",e!==void 0&&(this.params=e)};Ee(A.asn1.x509.NameConstraints,A.asn1.x509.Extension);A.asn1.x509.GeneralSubtree=function(e){A.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var t=A.asn1,r=t.x509,n=r.GeneralName,i=t.ASN1Util.newObject;this.params=null,this.setByParam=function(o){this.params=o},this.tohex=function(){var o=this.params,s=[new n(o)];o.min!=null&&s.push({tag:{tagi:"80",obj:{int:o.min}}}),o.max!=null&&s.push({tag:{tagi:"81",obj:{int:o.max}}});var a=i({seq:s});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.GeneralSubtree,A.asn1.ASN1Object);A.asn1.x509.ExtKeyUsage=function(e){A.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=A,r=t.asn1;this.setPurposeArray=function(n){this.asn1ExtnValue=new r.DERSequence;for(var i=0;i<n.length;i++){var o=new r.DERObjectIdentifier(n[i]);this.asn1ExtnValue.appendASN1Object(o)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",e!==void 0&&e.array!==void 0&&this.setPurposeArray(e.array)};Ee(A.asn1.x509.ExtKeyUsage,A.asn1.x509.Extension);A.asn1.x509.AuthorityKeyIdentifier=function(e){A.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.DERTaggedObject,i=r.x509.GeneralNames,o=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 a=new r.DERSequence({array:s});return this.asn1ExtnValue=a,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(s){if(s.str!==void 0||s.hex!==void 0)this.asn1KID=new A.asn1.DEROctetString(s);else if(typeof s=="object"&&A.crypto.Util.isKey(s)||typeof s=="string"&&s.indexOf("BEGIN ")!=-1){var a=s;typeof s=="string"&&(a=_t.getKey(s));var u=_t.getKeyID(a);this.asn1KID=new A.asn1.DEROctetString({hex:u})}},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 A.asn1.x509.X500Name(s):typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")!=-1&&(this.asn1CertIssuer=new A.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 A.asn1.DERInteger(s);else if(typeof s=="string"&&s.indexOf("BEGIN ")!=-1&&s.indexOf("CERTIFICATE")){var a=new tt;a.readCertPEM(s);var u=a.getSerialNumberHex();this.asn1CertSN=new A.asn1.DERInteger({hex:u})}},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)))};Ee(A.asn1.x509.AuthorityKeyIdentifier,A.asn1.x509.Extension);A.asn1.x509.SubjectKeyIdentifier=function(e){A.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=A,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"&&A.crypto.Util.isKey(i)||typeof i=="string"&&i.indexOf("BEGIN")!=-1){var o=i;typeof i=="string"&&(o=_t.getKey(i));var s=_t.getKeyID(o);this.asn1KID=new A.asn1.DEROctetString({hex:s})}},this.oid="2.5.29.14",e!==void 0&&e.kid!==void 0&&this.setKIDByParam(e.kid)};Ee(A.asn1.x509.SubjectKeyIdentifier,A.asn1.x509.Extension);A.asn1.x509.AuthorityInfoAccess=function(e){A.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(t){for(var r=new Array,n=A,i=n.asn1,o=i.DERSequence,s=i.DERObjectIdentifier,a=i.x509.GeneralName,u=0;u<t.length;u++){var l,h=t[u];if(h.ocsp!==void 0)l=new o({array:[new s({oid:"1.3.6.1.5.5.7.48.1"}),new a({uri:h.ocsp})]});else if(h.caissuer!==void 0)l=new o({array:[new s({oid:"1.3.6.1.5.5.7.48.2"}),new a({uri:h.caissuer})]});else throw new Error("unknown AccessMethod parameter: "+JSON.stringify(h));r.push(l)}this.asn1ExtnValue=new o({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)};Ee(A.asn1.x509.AuthorityInfoAccess,A.asn1.x509.Extension);A.asn1.x509.SubjectAltName=function(e){A.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new A.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)};Ee(A.asn1.x509.SubjectAltName,A.asn1.x509.Extension);A.asn1.x509.IssuerAltName=function(e){A.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(t){this.asn1ExtnValue=new A.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)};Ee(A.asn1.x509.IssuerAltName,A.asn1.x509.Extension);A.asn1.x509.SubjectDirectoryAttributes=function(e){A.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=A.asn1,r=t.DERSequence,n=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var o=[],s=0;s<this.params.array.length;s++){var a=this.params.array[s];if(a.attr!=null&&a.array!=null){var u={seq:[{oid:a.attr},{set:a.array}]};o.push(n(u));continue}var l={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if(a.attr=="dateOfBirth")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={gentime:a.str};else if(a.attr=="placeOfBirth")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={utf8str:a.str};else if(a.attr=="gender")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={prnstr:a.str};else if(a.attr=="countryOfCitizenship")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={prnstr:a.str};else if(a.attr=="countryOfResidence")l.seq[0].oid=i(a.attr),l.seq[1].set[0]={prnstr:a.str};else throw new Error("unsupported attribute: "+a.attr);o.push(new n(l))}var h=new r({array:o});return this.asn1ExtnValue=h,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",e!==void 0&&(this.params=e)};Ee(A.asn1.x509.SubjectDirectoryAttributes,A.asn1.x509.Extension);A.asn1.x509.PrivateExtension=function(e){A.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=A,r=t.lang.String.isHex,n=t.asn1,i=n.x509.OID.name2oid,o=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 o(s).tohex()}catch{}throw new Error("unsupported extn value")},e!=null&&this.setByParam(e)};Ee(A.asn1.x509.PrivateExtension,A.asn1.x509.Extension);A.asn1.x509.CRL=function(e){A.asn1.x509.CRL.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERSequence,i=r.DERBitString,o=r.x509,s=o.AlgorithmIdentifier,a=o.TBSCertList;this.params=void 0,this.setByParam=function(u){this.params=u},this.sign=function(){var u=new a(this.params).tohex(),l=new A.crypto.Signature({alg:this.params.sigalg});l.init(this.params.cakey),l.updateHex(u);var h=l.sign();this.params.sighex=h},this.getPEM=function(){return An(this.tohex(),"X509 CRL")},this.tohex=function(){var u=this.params;if(u.tbsobj==null&&(u.tbsobj=new a(u)),u.sighex==null&&u.cakey!=null&&this.sign(),u.sighex==null)throw new Error("sighex or cakey parameter not defined");var l=[];l.push(u.tbsobj),l.push(new s({name:u.sigalg})),l.push(new i({hex:"00"+u.sighex}));var h=new n({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&(this.params=e)};Ee(A.asn1.x509.CRL,A.asn1.ASN1Object);A.asn1.x509.TBSCertList=function(e){A.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.DERInteger,i=r.DERSequence,o=r.DERTaggedObject,s=r.DERObjectIdentifier,a=r.x509,u=a.AlgorithmIdentifier,l=a.Time,h=a.Extensions,m=a.X500Name;this.params=null,this.setByParam=function(p){this.params=p},this.getRevCertSequence=function(){for(var p=[],d=this.params.revcert,v=0;v<d.length;v++){var g=[new n(d[v].sn),new l(d[v].date)];d[v].ext!=null&&g.push(new h(d[v].ext)),p.push(new i({array:g}))}return new i({array:p})},this.tohex=function(){var p=[],d=this.params;if(d.version!=null){var v=d.version-1,g=new n({int:v});p.push(g)}if(p.push(new u({name:d.sigalg})),p.push(new m(d.issuer)),p.push(new l(d.thisupdate)),d.nextupdate!=null&&p.push(new l(d.nextupdate)),d.revcert!=null&&p.push(this.getRevCertSequence()),d.ext!=null){var y=new h(d.ext);p.push(new o({tag:"a0",explicit:!0,obj:y}))}var w=new i({array:p});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.TBSCertList,A.asn1.ASN1Object);A.asn1.x509.CRLEntry=function(e){A.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1;this.setCertSerial=function(o){this.sn=new i.DERInteger(o)},this.setRevocationDate=function(o){this.time=new i.x509.Time(o)},this.tohex=function(){var o=new i.DERSequence({array:[this.sn,this.time]});return this.TLV=o.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))};Ee(A.asn1.x509.CRLEntry,A.asn1.ASN1Object);A.asn1.x509.CRLNumber=function(e){A.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",e!=null&&(this.params=e)};Ee(A.asn1.x509.CRLNumber,A.asn1.x509.Extension);A.asn1.x509.CRLReason=function(e){A.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",e!=null&&(this.params=e)};Ee(A.asn1.x509.CRLReason,A.asn1.x509.Extension);A.asn1.x509.OCSPNonce=function(e){A.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",e!=null&&(this.params=e)};Ee(A.asn1.x509.OCSPNonce,A.asn1.x509.Extension);A.asn1.x509.OCSPNoCheck=function(e){A.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new A.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",e!=null&&(this.params=e)};Ee(A.asn1.x509.OCSPNoCheck,A.asn1.x509.Extension);A.asn1.x509.AdobeTimeStamp=function(e){A.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=A,r=t.asn1,n=r.DERInteger,i=r.DERBoolean,o=r.DERSequence,s=r.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var a=this.params,u=[new n(1)];return u.push(new s({uri:a.uri})),a.reqauth!=null&&u.push(new i(a.reqauth)),this.asn1ExtnValue=new o({array:u}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.AdobeTimeStamp,A.asn1.x509.Extension);A.asn1.x509.X500Name=function(e){A.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=A,r=t.asn1,n=r.x509,i=n.RDN,o=lr;this.setByString=function(s,a){a!==void 0&&(this.sRule=a);var u=s.split("/");u.shift();for(var l=[],h=0;h<u.length;h++)if(u[h].match(/^[^=]+=.+$/))l.push(u[h]);else{var m=l.length-1;l[m]=l[m]+"/"+u[h]}for(var h=0;h<l.length;h++)this.asn1Array.push(new i({str:l[h],rule:this.sRule}))},this.setByLdapString=function(s,a){a!==void 0&&(this.sRule=a);var u=n.X500Name.ldapToCompat(s);this.setByString(u,a)},this.setByObject=function(s,a){a!==void 0&&(this.sRule=a);for(var u in s)if(s.hasOwnProperty(u)){var l=new i({str:u+"="+s[u],rule:this.sRule});this.asn1Array?this.asn1Array.push(l):this.asn1Array=[l]}},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 a=new tt;a.readCertPEM(s.certissuer),this.hTLV=a.getIssuerHex()}else if(s.certsubject!==void 0){var a=new tt;a.readCertPEM(s.certsubject),this.hTLV=a.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 a={array:this.paramArray[s]};this.sRule!="utf8"&&(a.rule=this.sRule);var u=new i(a);this.asn1Array.push(u)}var l=new r.DERSequence({array:this.asn1Array});return this.hTLV=l.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.X500Name,A.asn1.ASN1Object);A.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(",")};A.asn1.x509.X500Name.onelineToLDAP=function(e){return A.asn1.x509.X500Name.compatToLDAP(e)};A.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),r=!1,n=[],i=0;t.length>0;i++){var o=t.shift();if(r===!0){var s=n.pop(),a=(s+","+o).replace(/\\,/g,",");n.push(a),r=!1}else n.push(o);o.substr(-1,1)==="\\"&&(r=!0)}return n=n.map(function(u){return u.replace("/","\\/")}),n.reverse(),"/"+n.join("/")};A.asn1.x509.X500Name.ldapToOneline=function(e){return A.asn1.x509.X500Name.ldapToCompat(e)};A.asn1.x509.RDN=function(e){A.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=A.asn1.x509.AttributeTypeAndValue;this.setByParam=function(r){r.rule!==void 0&&(this.sRule=r.rule),r.str!==void 0&&this.addByMultiValuedString(r.str),r.array!==void 0&&(this.paramArray=r.array)},this.addByString=function(r){this.asn1Array.push(new A.asn1.x509.AttributeTypeAndValue({str:r,rule:this.sRule}))},this.addByMultiValuedString=function(r){for(var n=A.asn1.x509.RDN.parseString(r),i=0;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 o=new A.asn1.DERSet({array:this.asn1Array});return this.TLV=o.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.RDN,A.asn1.ASN1Object);A.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),r=!1,n=[],i=0;t.length>0;i++){var o=t.shift();if(r===!0){var s=n.pop(),a=(s+"+"+o).replace(/\\\+/g,"+");n.push(a),r=!1}else n.push(o);o.substr(-1,1)==="\\"&&(r=!0)}for(var u=!1,l=[],i=0;n.length>0;i++){var o=n.shift();if(u===!0){var h=l.pop();if(o.match(/"$/)){var a=(h+"+"+o).replace(/^([^=]+)="(.*)"$/,"$1=$2");l.push(a),u=!1}else l.push(h+"+"+o)}else l.push(o);o.match(/^[^=]+="/)&&(u=!0)}return l};A.asn1.x509.AttributeTypeAndValue=function(e){A.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=A,r=t.asn1,n=r.DERSequence,i=r.DERUTF8String,o=r.DERPrintableString,s=r.DERTeletexString,a=r.DERIA5String,u=r.DERVisibleString,l=r.DERBMPString,h=t.lang.String.isMail,m=t.lang.String.isPrintable;this.setByParam=function(p){if(p.rule!==void 0&&(this.sRule=p.rule),p.ds!==void 0&&(this.dsType=p.ds),p.value===void 0&&p.str!==void 0){var d=p.str,v=d.match(/^([^=]+)=(.+)$/);if(v)this.sType=v[1],this.sValue=v[2];else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)}else this.sType=p.type,this.sValue=p.value},this.setByString=function(p,d){d!==void 0&&(this.sRule=d);var v=p.match(/^([^=]+)=(.+)$/);if(v)this.setByAttrTypeAndValueStr(v[1],v[2]);else throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr)},this._getDsType=function(){var p=this.sType,d=this.sValue,v=this.sRule;return v==="prn"?p=="CN"&&h(d)?"ia5":m(d)?"prn":"utf8":v==="utf8"?p=="CN"&&h(d)?"ia5":p=="C"?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(p,d,v){v!==void 0&&(this.sRule=v),this.sType=p,this.sValue=d},this.getValueObj=function(p,d){if(p=="utf8")return new i({str:d});if(p=="prn")return new o({str:d});if(p=="tel")return new s({str:d});if(p=="ia5")return new a({str:d});if(p=="vis")return new u({str:d});if(p=="bmp")return new l({str:d});throw new Error("unsupported directory string type: type="+p+" value="+d)},this.tohex=function(){this.dsType==null&&(this.dsType=this._getDsType());var p=A.asn1.x509.OID.atype2obj(this.sType),d=this.getValueObj(this.dsType,this.sValue),v=new n({array:[p,d]});return this.TLV=v.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.AttributeTypeAndValue,A.asn1.ASN1Object);A.asn1.x509.SubjectPublicKeyInfo=function(e){A.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,o=i.DERInteger,s=i.DERBitString,a=i.DERObjectIdentifier,u=i.DERSequence,l=i.ASN1Util.newObject,h=i.x509,m=h.AlgorithmIdentifier,p=n.crypto,d=p.ECDSA,v=p.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null)throw"algId and/or subjPubKey not set";var g=new u({array:[this.asn1AlgId,this.asn1SubjPKey]});return g},this.tohex=function(){var g=this.getASN1Object();return this.hTLV=g.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(g){try{if(g instanceof at){var y=l({seq:[{int:{bigint:g.n}},{int:{int:g.e}}]}),w=y.tohex();this.asn1AlgId=new m({name:"rsaEncryption"}),this.asn1SubjPKey=new s({hex:"00"+w})}}catch{}try{if(g instanceof A.crypto.ECDSA){var E=new a({name:g.curveName});this.asn1AlgId=new m({name:"ecPublicKey",asn1params:E}),this.asn1SubjPKey=new s({hex:"00"+g.pubKeyHex})}}catch{}try{if(g instanceof A.crypto.DSA){var E=new l({seq:[{int:{bigint:g.p}},{int:{bigint:g.q}},{int:{bigint:g.g}}]});this.asn1AlgId=new m({name:"dsa",asn1params:E});var _=new o({bigint:g.y});this.asn1SubjPKey=new s({hex:"00"+_.tohex()})}}catch{}},e!==void 0&&this.setPubKey(e)};Ee(A.asn1.x509.SubjectPublicKeyInfo,A.asn1.ASN1Object);A.asn1.x509.Time=function(e){A.asn1.x509.Time.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,o=i.DERUTCTime,s=i.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(a){this.timeParams=a},this.setByParam=function(a){this.params=a},this.getType=function(a){return a.match(/^[0-9]{12}Z$/)?"utc":a.match(/^[0-9]{14}Z$/)?"gen":a.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":a.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var a=this.params,u=null;if(typeof a=="string"&&(a={str:a}),a!=null&&a.str&&(a.type==null||a.type==null)&&(a.type=this.getType(a.str)),a!=null&&a.str?(a.type=="utc"&&(u=new o(a.str)),a.type=="gen"&&(u=new s(a.str))):this.type=="gen"?u=new s:u=new o,u==null)throw new Error("wrong setting for Time");return this.TLV=u.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};A.asn1.x509.Time_bak=function(e){A.asn1.x509.Time_bak.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,o=i.DERUTCTime,s=i.DERGeneralizedTime;this.setTimeParams=function(a){this.timeParams=a},this.tohex=function(){var a=null;return this.timeParams!=null?this.type=="utc"?a=new o(this.timeParams):a=new s(this.timeParams):this.type=="utc"?a=new o:a=new s,this.TLV=a.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)};Ee(A.asn1.x509.Time,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier=function(e){A.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=A,r=t.asn1,n=r.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(this.nameAlg===null&&this.asn1Alg===null)throw new Error("algorithm not specified");if(this.nameAlg!==null){var o=null;for(var s in n)s===this.nameAlg&&(o=n[s]);if(o!==null)return this.hTLV=o,this.hTLV}this.nameAlg!==null&&this.asn1Alg===null&&(this.asn1Alg=r.x509.OID.name2obj(this.nameAlg));var a=[this.asn1Alg];this.asn1Params!==null&&a.push(this.asn1Params);var u=new r.DERSequence({array:a});return this.hTLV=u.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)}};Ee(A.asn1.x509.AlgorithmIdentifier,A.asn1.ASN1Object);A.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"};A.asn1.x509.GeneralName=function(e){A.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87",otherName:"a0"},r=A,n=r.asn1,i=n.x509,o=i.X500Name,s=i.OtherName,a=n.DERIA5String,u=n.DERPrintableString,l=n.DEROctetString,h=n.DERTaggedObject,m=n.ASN1Object,p=Error;this.params=null,this.setByParam=function(d){this.params=d},this.tohex=function(){var d=this.params,v,y,g,y=!1;if(d.other!==void 0)v="a0",g=new s(d.other);else if(d.rfc822!==void 0)v="81",g=new a({str:d.rfc822});else if(d.dns!==void 0)v="82",g=new a({str:d.dns});else if(d.dn!==void 0)v="a4",y=!0,typeof d.dn=="string"?g=new o({str:d.dn}):d.dn instanceof A.asn1.x509.X500Name?g=d.dn:g=new o(d.dn);else if(d.ldapdn!==void 0)v="a4",y=!0,g=new o({ldapstr:d.ldapdn});else if(d.certissuer!==void 0||d.certsubj!==void 0){v="a4",y=!0;var w,E,_=null;if(d.certsubj!==void 0?(w=!1,E=d.certsubj):(w=!0,E=d.certissuer),E.match(/^[0-9A-Fa-f]+$/)&&_==E,E.indexOf("-----BEGIN ")!=-1&&(_=lr(E)),_==null)throw new Error("certsubj/certissuer not cert");var C=new tt;C.hex=_;var F;w?F=C.getIssuerHex():F=C.getSubjectHex(),g=new m,g.hTLV=F}else if(d.uri!==void 0)v="86",g=new a({str:d.uri});else if(d.ip!==void 0){v="87";var H,K=d.ip;try{if(K.match(/^[0-9a-f]+$/)){var S=K.length;if(S==8||S==16||S==32||S==64)H=K;else throw"err"}else H=cy(K)}catch(q){throw new p("malformed IP address: "+d.ip+":"+q.message)}g=new l({hex:H})}else throw new p("improper params");var I=new h({tag:v,explicit:y,obj:g});return I.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.GeneralName,A.asn1.ASN1Object);A.asn1.x509.GeneralNames=function(e){A.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=A,n=r.asn1;this.setByParamArray=function(i){for(var o=0;o<i.length;o++){var s=new n.x509.GeneralName(i[o]);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)};Ee(A.asn1.x509.GeneralNames,A.asn1.ASN1Object);A.asn1.x509.OtherName=function(e){A.asn1.x509.OtherName.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,o=i.DERObjectIdentifier,s=i.DERSequence,a=i.ASN1Util.newObject;this.params=null,this.setByParam=function(u){this.params=u},this.tohex=function(){var u=this.params;if(u.oid==null||u.value==null)throw new Error("oid or value not specified");var l=new o({oid:u.oid}),h=a({tag:{tag:"a0",explicit:!0,obj:u.value}}),m=new s({array:[l,h]});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.OtherName,A.asn1.ASN1Object);A.asn1.x509.OID=new function(){var e=A.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,o){var s=this[n];if(!s.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch{return!1}}};A.asn1.x509.OID.oid2name=function(e){var t=A.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};A.asn1.x509.OID.oid2atype=function(e){var t=A.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};A.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=A.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};A.asn1.x509.X509Util={};A.asn1.x509.X509Util.newCertPEM=function(e){var t=A.asn1.x509,r=t.TBSCertificate,n=t.Certificate,i=new n(e);return i.getPEM()};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cms>"u"||!A.asn1.cms)&&(A.asn1.cms={});A.asn1.cms.Attribute=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.DERSet,s=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(a){this.params=a},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var a=new s({oid:this.typeOid}),u=new o({array:this.getValueArray()}),l=new i({array:[a,u]});return l.tohex()},this.getEncodedHex=function(){return this.tohex()}};Ee(A.asn1.cms.Attribute,A.asn1.ASN1Object);A.asn1.cms.ContentType=function(e){var t=A,r=t.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ContentType,A.asn1.cms.Attribute);A.asn1.cms.MessageDigest=function(e){var t=A,r=t.asn1,n=r.DEROctetString,i=r.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var o=new n(this.params);return[o]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.MessageDigest,A.asn1.cms.Attribute);A.asn1.cms.SigningTime=function(e){var t=A,r=t.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SigningTime,A.asn1.cms.Attribute);A.asn1.cms.SigningCertificate=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.cms,s=o.ESSCertID,a=r.crypto;o.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 u=this.params.array,l=[],h=0;h<u.length;h++){var m=u[h];e.hasis==!1&&typeof m=="string"&&(m.indexOf("-----BEGIN")!=-1||xe.isASN1HEX(m))&&(m={cert:m}),m.hasis!=!1&&e.hasis==!1&&(m.hasis=!1),l.push(new s(m))}var p=new i({array:l}),d=new i({array:[p]});return[d]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SigningCertificate,A.asn1.cms.Attribute);A.asn1.cms.ESSCertID=function(e){A.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,i=n.DEROctetString,o=n.DERSequence,s=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(a,u){if(a.hash!=null)return a.hash;if(typeof a=="string"&&a.indexOf("-----BEGIN")==-1&&!xe.isASN1HEX(a))return a;var l;if(typeof a=="string")l=a;else if(a.cert!=null)l=a.cert;else throw new t("hash nor cert unspecified");var h;l.indexOf("-----BEGIN")!=-1?h=lr(l):h=l,typeof a=="string"&&(a.indexOf("-----BEGIN")!=-1?h=lr(a):xe.isASN1HEX(a)&&(h=a));var m;if(a.alg!=null)m=a.alg;else if(u!=null)m=u;else throw new t("hash alg unspecified");return r.crypto.Util.hashHex(h,m)},this.tohex=function(){var a=this.params,u=this.getCertHash(a,"sha1"),l=[];l.push(new i({hex:u})),(typeof a=="string"&&a.indexOf("-----BEGIN")!=-1||a.cert!=null&&a.hasis!=!1||a.issuer!=null&&a.serial!=null)&&l.push(new s(a));var h=new o({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ESSCertID,A.asn1.ASN1Object);A.asn1.cms.SigningCertificateV2=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.x509,s=n.cms,a=s.ESSCertIDv2,u=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 l=this.params.array,h=[],m=0;m<l.length;m++){var p=l[m];(e.alg!=null||e.hasis==!1)&&typeof p=="string"&&(p.indexOf("-----BEGIN")!=-1||xe.isASN1HEX(p))&&(p={cert:p}),p.alg==null&&e.alg!=null&&(p.alg=e.alg),p.hasis!=!1&&e.hasis==!1&&(p.hasis=!1),h.push(new a(p))}var d=new i({array:h}),v=new i({array:[d]});return[v]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SigningCertificateV2,A.asn1.cms.Attribute);A.asn1.cms.ESSCertIDv2=function(e){A.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,i=n.DEROctetString,o=n.DERSequence,s=n.cms.IssuerSerial,a=n.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var u=this.params,l=this.getCertHash(u,"sha256"),h=[];u.alg!=null&&u.alg!="sha256"&&h.push(new a({name:u.alg})),h.push(new i({hex:l})),(typeof u=="string"&&u.indexOf("-----BEGIN")!=-1||u.cert!=null&&u.hasis!=!1||u.issuer!=null&&u.serial!=null)&&h.push(new s(u));var m=new o({array:h});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ESSCertIDv2,A.asn1.cms.ESSCertID);A.asn1.cms.IssuerSerial=function(e){var t=Error,r=A,n=r.asn1,i=n.DERInteger,o=n.DERSequence,s=n.cms,a=n.x509,u=a.GeneralNames,l=tt;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,m,p;if(typeof h=="string"&&h.indexOf("-----BEGIN")!=-1||h.cert!=null){var d;h.cert!=null?d=h.cert:d=h;var v=new l;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(h.issuer!=null&&h.serial)m=h.issuer,p=h.serial;else throw new t("cert or issuer and serial parameter not specified");var g=new u([{dn:m}]),y=new i(p),w=new o({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.IssuerSerial,A.asn1.ASN1Object);A.asn1.cms.SignerIdentifier=function(e){var t=A,r=t.asn1,n=r.DERInteger,i=r.DERSequence,o=r.cms,s=o.IssuerAndSerialNumber,a=o.SubjectKeyIdentifier,u=r.x509,l=u.X500Name,h=tt,m=Error;o.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params;if(p.type=="isssn"){var d=new s(p);return d.tohex()}else if(p.type=="skid"){var v=new a(p);return v.tohex()}else throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SignerIdentifier,A.asn1.ASN1Object);A.asn1.cms.IssuerAndSerialNumber=function(e){var t=A,r=t.asn1,n=r.DERInteger,i=r.DERSequence,o=r.cms,s=r.x509,a=s.X500Name,u=tt,l=Error;o.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params,m,p;if(typeof h=="string"&&h.indexOf("-----BEGIN")!=-1||h.cert!=null){var d;h.cert!=null?d=h.cert:d=h;var v=new u;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(h.issuer!=null&&h.serial)m=h.issuer,p=h.serial;else throw new l("cert or issuer and serial parameter not specified");var g=new a(m),y=new n(p),w=new i({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(h){this.params=h},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.IssuerAndSerialNumber,A.asn1.ASN1Object);A.asn1.cms.SubjectKeyIdentifier=function(e){var t=A,r=t.asn1,n=r.DERInteger,i=r.DERSequence,o=r.ASN1Util.newObject,s=r.cms,a=s.IssuerAndSerialName,u=s.SubjectKeyIdentifier,l=r.x509,h=l.X500Name,m=tt,p=Error;s.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var d=this.params;if(d.cert==null&&d.skid==null)throw new p("property cert nor skid undefined");var v;if(d.cert!=null){var g=new m(d.cert),y=g.getExtSubjectKeyIdentifier();v=y.kid.hex}else d.skid!=null&&(v=d.skid);var w=o({tag:{tage:"a0",obj:{octstr:{hex:v}}}});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SubjectKeyIdentifier,A.asn1.ASN1Object);A.asn1.cms.AttributeList=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSet,o=n.cms;o.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 a=!0;s.sortflag!=null&&(a=s.sortflag);for(var u=s.array,l=[],h=0;h<u.length;h++){var m=u[h],p=m.attr;if(p=="contentType")l.push(new o.ContentType(m));else if(p=="messageDigest")l.push(new o.MessageDigest(m));else if(p=="signingTime")l.push(new o.SigningTime(m));else if(p=="signingCertificate")l.push(new o.SigningCertificate(m));else if(p=="signingCertificateV2")l.push(new o.SigningCertificateV2(m));else if(p=="signaturePolicyIdentifier")l.push(new A.asn1.cades.SignaturePolicyIdentifier(m));else if(p=="signatureTimeStamp"||p=="timeStampToken")l.push(new A.asn1.cades.SignatureTimeStamp(m));else throw new t("unknown attr: "+p)}var d=new i({array:l,sortflag:a});return this.hTLV=d.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.AttributeList,A.asn1.ASN1Object);A.asn1.cms.SignerInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERInteger,o=n.DEROctetString,s=n.DERSequence,a=n.DERTaggedObject,u=n.cms,l=u.SignerIdentifier,h=u.AttributeList,m=u.ContentType,p=u.EncapsulatedContentInfo,d=u.MessageDigest,v=u.SignedData,g=n.x509,y=g.AlgorithmIdentifier,w=r.crypto,E=_t;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var _=this.params,C=_.sigalg,F=new h(_.sattrs).tohex(),H=E.getKey(_.signkey),K=new w.Signature({alg:C});K.init(H),K.updateHex(F);var S=K.sign();_.sighex=S},this.tohex=function(){var _=this.params,C=[];if(C.push(new i({int:_.version})),C.push(new l(_.id)),C.push(new y({name:_.hashalg})),_.sattrs!=null){var F=new h(_.sattrs);try{C.push(new a({tag:"a0",explicit:!1,obj:F}))}catch(K){throw new t("si sattr error: "+K)}}if(_.sigalgfield!=null?C.push(new y({name:_.sigalgfield})):C.push(new y({name:_.sigalg})),_.sighex==null&&_.signkey!=null&&this.sign(),C.push(new o({hex:_.sighex})),_.uattrs!=null){var F=new h(_.uattrs);try{C.push(new a({tag:"a1",explicit:!1,obj:F}))}catch(S){throw new t("si uattr error: "+S)}}var H=new s({array:C});return H.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SignerInfo,A.asn1.ASN1Object);A.asn1.cms.EncapsulatedContentInfo=function(e){var t=A,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,o=r.DERObjectIdentifier,s=r.DEROctetString,a=r.cms;a.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];if(l.push(new o(u.type)),u.content!=null&&(u.content.hex!=null||u.content.str!=null)&&u.isDetached!=!0){var h=new s(u.content),m=new n({tag:"a0",explicit:!0,obj:h});l.push(m)}var p=new i({array:l});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.EncapsulatedContentInfo,A.asn1.ASN1Object);A.asn1.cms.ContentInfo=function(e){var t=A,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,o=r.DERObjectIdentifier,s=r.x509,a=s.OID.name2obj;A.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];l.push(new o(u.type));var h=new n({tag:"a0",explicit:!0,obj:u.obj});l.push(h);var m=new i({array:l});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ContentInfo,A.asn1.ASN1Object);A.asn1.cms.SignedData=function(e){var t=Error,r=A,n=r.asn1,i=n.ASN1Object,o=n.DERInteger,s=n.DERSet,a=n.DERSequence,u=n.DERTaggedObject,l=n.cms,h=l.EncapsulatedContentInfo,m=l.SignerInfo,p=l.ContentInfo,d=l.CertificateSet,v=l.RevocationInfoChoices,g=n.x509,y=g.AlgorithmIdentifier;A.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 E={},_=w.sinfos,C=0;C<_.length;C++){var F=_[C];E[F.hashalg]=1}w.hashalgs=Object.keys(E).sort()},this._setContentTypeByEContent=function(w){for(var E=w.econtent.type,_=w.sinfos,C=0;C<_.length;C++){var F=_[C],H=this._getAttrParamByName(F,"contentType");H.type=E}},this._setMessageDigestByEContent=function(w){var E=w.econtent,_=w.econtent.type,C=E.content.hex;C==null&&E.type=="data"&&E.content.str!=null&&(C=ao(E.content.str));for(var F=w.sinfos,H=0;H<F.length;H++){var K=F[H],S=K.hashalg,I=this._getAttrParamByName(K,"messageDigest"),q=A.crypto.Util.hashHex(C,S);I.hex=q}},this._getAttrParamByName=function(w,E){for(var _=w.sattrs.array,C=0;C<_.length;C++)if(_[C].attr==E)return _[C]},this._setSignerInfoVersion=function(w){for(var E=w.sinfos,_=0;_<E.length;_++){var C=E[_],F=1;C.id.type=="skid"&&(F=3),C.version=F}},this._setSignedDataVersion=function(w){var E=this._getSignedDataVersion(w);w.version=E},this._getSignedDataVersion=function(w){if(w.revinfos!=null)for(var E=w.revinfos,_=0;_<E.length;_++){var C=E[_];if(C.ocsp!=null)return 5}for(var F=w.sinfos,_=0;_<F.length;_++){var H=w.sinfos[_];if(H.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 E=[];E.push(new o({int:w.version}));for(var _=[],C=0;C<w.hashalgs.length;C++){var F=w.hashalgs[C];_.push(new y({name:F}))}E.push(new s({array:_})),E.push(new h(w.econtent)),w.certs!=null&&E.push(new d(w.certs)),w.revinfos!=null&&E.push(new v(w.revinfos));for(var H=[],C=0;C<w.sinfos.length;C++){var K=w.sinfos[C];H.push(new m(K))}E.push(new s({array:H}));var S=new a({array:E});return S.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)};Ee(A.asn1.cms.SignedData,A.asn1.ASN1Object);A.asn1.cms.CertificateSet=function(e){A.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.DERTaggedObject,i=r.DERSet,o=r.ASN1Object;this.params=null,this.tohex=function(){var s=this.params,a=[],u;if(s instanceof Array)u=s;else if(s.array!=null)u=s.array;else throw new t("cert array not specified");for(var l=0;l<u.length;l++){var h=u[l],m=lr(h),p=new o;p.hTLV=m,a.push(p)}var d={array:a};s.sortflag==!1&&(d.sortflag=!1);var v=new i(d),g=new n({tag:"a0",explicit:!1,obj:v});return g.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.CertificateSet,A.asn1.ASN1Object);A.asn1.cms.RevocationInfoChoices=function(e){A.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 A.asn1.cms.RevocationInfoChoice(t[n]));var i=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:r}}});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.RevocationInfoChoices,A.asn1.ASN1Object);A.asn1.cms.RevocationInfoChoice=function(e){A.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=lr(t.crl)),r}else if(t.ocsp!=null){var n=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new A.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)};Ee(A.asn1.cms.RevocationInfoChoice,A.asn1.ASN1Object);A.asn1.cms.OtherRevocationFormat=function(e){A.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,i=n.ASN1Util.newObject,o=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(!o(s.ocsp)||!xe.isASN1HEX(s.ocsp))throw new t("ocsp value not ASN.1 hex string");var a=i({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:s.ocsp}}]});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.OtherRevocationFormat,A.asn1.ASN1Object);A.asn1.cms.CMSUtil=new function(){};A.asn1.cms.CMSUtil.newSignedData=function(e){return new A.asn1.cms.SignedData(e)};A.asn1.cms.CMSUtil.verifySignedData=function(e){var t=A,r=t.asn1,n=r.cms,i=n.SignerInfo,o=n.SignedData,s=n.SigningTime,a=n.SigningCertificate,u=n.SigningCertificateV2,l=r.cades,h=l.SignaturePolicyIdentifier,m=t.lang.String.isHex,p=xe,d=p.getVbyList,v=p.getTLVbyList,g=p.getIdxbyList,y=p.getChildIdx,w=p.getTLV,E=p.oidname,_=t.crypto.Util.hashHex;e.cms===void 0&&m(e.cms);var C=e.cms,F=function(N,P){for(var M,Y=3;Y<6;Y++)if(M=g(N,0,[1,0,Y]),M!==void 0){var V=N.substr(M,2);V==="a0"&&(P.certsIdx=M),V==="a1"&&(P.revinfosIdx=M),V==="31"&&(P.signerinfosIdx=M)}},H=function(N,P){var M=P.signerinfosIdx;if(M!==void 0){var Y=y(N,M);P.signerInfoIdxList=Y;for(var V=0;V<Y.length;V++){var X=Y[V],te={idx:X};K(N,te),P.signerInfos.push(te)}}},K=function(N,P){var M=P.idx;P.signerid_issuer1=v(N,M,[1,0],"30"),P.signerid_serial1=d(N,M,[1,1],"02"),P.hashalg=E(d(N,M,[2,0],"06"));var Y=g(N,M,[3],"a0");P.idxSignedAttrs=Y,S(N,P,Y);var V=y(N,M),X=V.length;if(X<6)throw"malformed SignerInfo";P.sigalg=E(d(N,M,[X-2,0],"06")),P.sigval=d(N,M,[X-1],"04")},S=function(N,P,M){var Y=y(N,M);P.signedAttrIdxList=Y;for(var V=0;V<Y.length;V++){var X=Y[V],te=d(N,X,[0],"06"),ae;te==="2a864886f70d010905"?(ae=Gt(d(N,X,[1,0])),P.saSigningTime=ae):te==="2a864886f70d010904"&&(ae=d(N,X,[1,0],"04"),P.saMessageDigest=ae)}},I=function(N,P){if(d(N,0,[0],"06")!=="2a864886f70d010702")return P;P.cmsType="signedData",P.econtent=d(N,0,[1,0,2,1,0]),F(N,P),P.signerInfos=[],H(N,P)},q=function(N,P){for(var M=P.parse.signerInfos,Y=M.length,V=!0,X=0;X<Y;X++){var te=M[X];R(N,P,te,X),te.isValid||(V=!1)}P.isValid=V},L=function(N,P,M,Y){var V=P.parse.certsIdx,X;if(P.certs===void 0){X=[],P.certkeys=[];for(var te=y(N,V),ae=0;ae<te.length;ae++){var me=w(N,te[ae]),he=new tt;he.readCertHex(me),X[ae]=he,P.certkeys[ae]=he.getPublicKey()}P.certs=X}else X=P.certs;P.cccc=X.length,P.cccci=te.length;for(var ae=0;ae<X.length;ae++){var De=he.getIssuerHex(),Pe=he.getSerialNumberHex();M.signerid_issuer1===De&&M.signerid_serial1===Pe&&(M.certkey_idx=ae)}},R=function(N,P,M,Y){M.verifyDetail={};var V=M.verifyDetail,X=P.parse.econtent,te=M.hashalg,ae=M.saMessageDigest;V.validMessageDigest=!1,_(X,te)===ae&&(V.validMessageDigest=!0),L(N,P,M,Y),V.validSignatureValue=!1;var me=M.sigalg,he="31"+w(N,M.idxSignedAttrs).substr(2);M.signedattrshex=he;var De=P.certs[M.certkey_idx].getPublicKey(),Pe=new A.crypto.Signature({alg:me});Pe.init(De),Pe.updateHex(he);var Ie=Pe.verify(M.sigval);V.validSignatureValue_isValid=Ie,Ie===!0&&(V.validSignatureValue=!0),M.isValid=!1,V.validMessageDigest&&V.validSignatureValue&&(M.isValid=!0)},O=function(){},T={isValid:!1,parse:{}};return I(C,T.parse),q(C,T),T};A.asn1.cms.CMSParser=function(){var e=Error,t=tt,r=new t,n=xe,i=n.getV,o=n.getTLV,s=n.getIdxbyList,a=n.getTLVbyList,u=n.getTLVbyListEx,l=n.getVbyList,h=n.getVbyListEx,m=n.getChildIdx;this.getCMSSignedData=function(p){var d=a(p,0,[1,0]),v=this.getSignedData(d);return v},this.getSignedData=function(p){var d=m(p,0),v={},g=i(p,d[0]),y=parseInt(g,16);v.version=y;var w=o(p,d[1]);v.hashalgs=this.getHashAlgArray(w);var E=o(p,d[2]);v.econtent=this.getEContent(E);var _=u(p,0,["[0]"]);_!=null&&(v.certs=this.getCertificateSet(_));var C=u(p,0,["[1]"]);C!=null;var F=u(p,0,[3]);return v.sinfos=this.getSignerInfos(F),v},this.getHashAlgArray=function(p){for(var d=m(p,0),v=new t,g=[],y=0;y<d.length;y++){var w=o(p,d[y]),E=v.getAlgorithmIdentifierName(w);g.push(E)}return g},this.getEContent=function(p){var d={},v=l(p,0,[0]),g=l(p,0,[1,0]);return d.type=A.asn1.x509.OID.oid2name(xe.hextooidstr(v)),d.content={hex:g},d},this.getSignerInfos=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var y=o(p,v[g]),w=this.getSignerInfo(y);d.push(w)}return d},this.getSignerInfo=function(p){var d={},v=m(p,0),g=n.getInt(p,v[0],-1);g!=-1&&(d.version=g);var y=o(p,v[1]),w=this.getIssuerAndSerialNumber(y);d.id=w;var E=o(p,v[2]),_=r.getAlgorithmIdentifierName(E);d.hashalg=_;var C=u(p,0,["[0]"]);if(C!=null){var F=this.getAttributeList(C);d.sattrs=F}var H=u(p,0,[3]),K=r.getAlgorithmIdentifierName(H);d.sigalg=K;var S=h(p,0,[4]);d.sighex=S;var I=u(p,0,["[1]"]);if(I!=null){var q=this.getAttributeList(I);d.uattrs=q}return d},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 d={type:"isssn"},v=m(p,0),g=o(p,v[0]);d.issuer=r.getX500Name(g);var y=i(p,v[1]);return d.serial={hex:y},d},this.getAttributeList=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var y=o(p,v[g]),w=this.getAttribute(y);d.push(w)}return{array:d}},this.getAttribute=function(p){var d={},v=m(p,0),g=n.getOID(p,v[0]),y=A.asn1.x509.OID.oid2name(g);d.attr=y;var w=o(p,v[1]),E=m(w,0);if(E.length==1)d.valhex=o(w,E[0]);else{for(var _=[],C=0;C<E.length;C++)_.push(o(w,E[C]));d.valhex=_}return y=="contentType"?this.setContentType(d):y=="messageDigest"?this.setMessageDigest(d):y=="signingTime"?this.setSigningTime(d):y=="signingCertificate"?this.setSigningCertificate(d):y=="signingCertificateV2"?this.setSigningCertificateV2(d):y=="signaturePolicyIdentifier"&&this.setSignaturePolicyIdentifier(d),d},this.setContentType=function(p){var d=n.getOIDName(p.valhex,0,null);d!=null&&(p.type=d,delete p.valhex)},this.setSigningTime=function(p){var d=i(p.valhex,0),v=Gt(d);p.str=v,delete p.valhex},this.setMessageDigest=function(p){var d=i(p.valhex,0);p.hex=d,delete p.valhex},this.setSigningCertificate=function(p){var d=m(p.valhex,0);if(d.length>0){for(var v=o(p.valhex,d[0]),g=m(v,0),y=[],w=0;w<g.length;w++){var E=o(v,g[w]),_=this.getESSCertID(E);y.push(_)}p.array=y}if(d.length>1){var C=o(p.valhex,d[1]);p.polhex=C}delete p.valhex},this.setSignaturePolicyIdentifier=function(p){var d=m(p.valhex,0);if(d.length>0){var v=n.getOID(p.valhex,d[0]);p.oid=v}if(d.length>1){var g=new t,y=m(p.valhex,d[1]),w=o(p.valhex,y[0]),E=g.getAlgorithmIdentifierName(w);p.alg=E;var _=i(p.valhex,y[1]);p.hash=_}delete p.valhex},this.setSigningCertificateV2=function(p){var d=m(p.valhex,0);if(d.length>0){for(var v=o(p.valhex,d[0]),g=m(v,0),y=[],w=0;w<g.length;w++){var E=o(v,g[w]),_=this.getESSCertIDv2(E);y.push(_)}p.array=y}if(d.length>1){var C=o(p.valhex,d[1]);p.polhex=C}delete p.valhex},this.getESSCertID=function(p){var d={},v=m(p,0);if(v.length>0){var g=i(p,v[0]);d.hash=g}if(v.length>1){var y=o(p,v[1]),w=this.getIssuerSerial(y);w.serial!=null&&(d.serial=w.serial),w.issuer!=null&&(d.issuer=w.issuer)}return d},this.getESSCertIDv2=function(p){var d={},v=m(p,0);if(v.length<1||3<v.length)throw new e("wrong number of elements");var g=0;if(p.substr(v[0],2)=="30"){var y=o(p,v[0]);d.alg=r.getAlgorithmIdentifierName(y),g++}else d.alg="sha256";var w=i(p,v[g]);if(d.hash=w,v.length>g+1){var E=o(p,v[g+1]),_=this.getIssuerSerial(E);d.issuer=_.issuer,d.serial=_.serial}return d},this.getIssuerSerial=function(p){var d={},v=m(p,0),g=o(p,v[0]),y=r.getGeneralNames(g),w=y[0].dn;d.issuer=w;var E=i(p,v[1]);return d.serial={hex:E},d},this.getCertificateSet=function(p){for(var d=m(p,0),v=[],g=0;g<d.length;g++){var y=o(p,d[g]);if(y.substr(0,2)=="30"){var w=An(y,"CERTIFICATE");v.push(w)}}return{array:v,sortflag:!1}}};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.tsp>"u"||!A.asn1.tsp)&&(A.asn1.tsp={});A.asn1.tsp.TimeStampToken=function(e){var t=A,r=t.asn1,n=r.tsp;n.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var i=new n.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=i.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.TimeStampToken,A.asn1.cms.SignedData);A.asn1.tsp.TSTInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.DERInteger,s=n.DERBoolean,a=n.DERGeneralizedTime,u=n.DERObjectIdentifier,l=n.DERTaggedObject,h=n.tsp,m=h.MessageImprint,p=h.Accuracy,d=n.x509.X500Name,v=n.x509.GeneralName;if(h.TSTInfo.superclass.constructor.call(this),this.dVersion=new o({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 g=[this.dVersion];if(this.dPolicy==null)throw new Error("policy shall be specified.");if(g.push(this.dPolicy),this.dMessageImprint==null)throw new Error("messageImprint shall be specified.");if(g.push(this.dMessageImprint),this.dSerial==null)throw new Error("serialNumber shall be specified.");if(g.push(this.dSerial),this.dGenTime==null)throw new Error("genTime shall be specified.");g.push(this.dGenTime),this.dAccuracy!=null&&g.push(this.dAccuracy),this.dOrdering!=null&&g.push(this.dOrdering),this.dNonce!=null&&g.push(this.dNonce),this.dTsa!=null&&g.push(this.dTsa);var y=new i({array:g});return this.hTLV=y.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0){if(typeof e.policy=="string"){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new u({oid:e.policy})}e.messageImprint!==void 0&&(this.dMessageImprint=new m(e.messageImprint)),e.serial!==void 0&&(this.dSerial=new o(e.serial)),e.genTime!==void 0&&(this.dGenTime=new a(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 o(e.nonce)),e.tsa!==void 0&&(this.dTsa=new l({tag:"a0",explicit:!0,obj:new v({dn:e.tsa})}))}};Ee(A.asn1.tsp.TSTInfo,A.asn1.ASN1Object);A.asn1.tsp.Accuracy=function(e){var t=A,r=t.asn1,n=r.ASN1Util.newObject;r.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var i=this.params,o=[];return i.seconds!=null&&typeof i.seconds=="number"&&o.push({int:i.seconds}),i.millis!=null&&typeof i.millis=="number"&&o.push({tag:{tagi:"80",obj:{int:i.millis}}}),i.micros!=null&&typeof i.micros=="number"&&o.push({tag:{tagi:"81",obj:{int:i.micros}}}),n({seq:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.Accuracy,A.asn1.ASN1Object);A.asn1.tsp.MessageImprint=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DEROctetString,o=r.x509,s=o.AlgorithmIdentifier;r.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params,u=new s({name:a.alg}),l=new i({hex:a.hash}),h=new n({array:[u,l]});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.tsp.MessageImprint,A.asn1.ASN1Object);A.asn1.tsp.TimeStampReq=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DERInteger,o=r.DERBoolean,s=r.ASN1Object,a=r.DERObjectIdentifier,u=r.tsp,l=u.MessageImprint;u.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params,m=[];m.push(new i({int:1})),h.messageImprint instanceof A.asn1.ASN1Object?m.push(h.messageImprint):m.push(new l(h.messageImprint)),h.policy!=null&&m.push(new a(h.policy)),h.nonce!=null&&m.push(new i(h.nonce)),h.certreq==!0&&m.push(new o);var p=new n({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.TimeStampReq,A.asn1.ASN1Object);A.asn1.tsp.TimeStampResp=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.ASN1Object,o=r.tsp,s=o.PKIStatusInfo;o.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params,u=[];if(a.econtent!=null||a.tst!=null)if(a.statusinfo!=null?u.push(new s(a.statusinfo)):u.push(new s("granted")),a.econtent!=null)u.push(new o.TimeStampToken(a).getContentInfo());else if(a.tst instanceof r.ASN1Object)u.push(a.tst);else throw new Error("improper member tst value");else if(a.statusinfo!=null)u.push(new s(a.statusinfo));else throw new Error("parameter for token nor statusinfo not specified");var l=new n({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.TimeStampResp,A.asn1.ASN1Object);A.asn1.tsp.PKIStatusInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.tsp,s=o.PKIStatus,a=o.PKIFreeText,u=o.PKIFailureInfo;o.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var l=this.params,h=[];if(typeof l=="string")h.push(new s(l));else{if(l.status==null)throw new t("property 'status' unspecified");h.push(new s(l.status)),l.statusstr!=null&&h.push(new a(l.statusstr)),l.failinfo!=null&&h.push(new u(l.failinfo))}var m=new i({array:h});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIStatusInfo,A.asn1.ASN1Object);A.asn1.tsp.PKIStatus=function(e){var t=Error,r=A,n=r.asn1,i=n.DERInteger,o=n.tsp;o.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 a=this.params,u,l;if(typeof a=="string")try{l=s[a]}catch{throw new t("undefined name: "+a)}else if(typeof a=="number")l=a;else throw new t("unsupported params");return new i({int:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIStatus,A.asn1.ASN1Object);A.asn1.tsp.PKIFreeText=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.DERUTF8String,s=n.tsp;s.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var a=this.params;if(!(a instanceof Array))throw new t("wrong params: not array");for(var u=[],l=0;l<a.length;l++)u.push(new o({str:a[l]}));var h=new i({array:u});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIFreeText,A.asn1.ASN1Object);A.asn1.tsp.PKIFailureInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERBitString,o=n.tsp,s=o.PKIFailureInfo,a={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 u=this.params,l=0;if(typeof u=="number"&&0<=u&&u<=25){l|=1<<u;for(var h=l.toString(2),m="",p=h.length-1;p>=0;p--)m+=h[p];return m}else{if(typeof u=="string"&&a[u]!=null)return u1([u],a);if(typeof u=="object"&&u.length!=null)return u1(u,a);throw new t("wrong params")}},this.tohex=function(){var u=this.params,l=this.getBinValue();return new i({bin:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.tsp.PKIFailureInfo,A.asn1.ASN1Object);A.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(t,r){throw"not implemented yet"}};A.asn1.tsp.SimpleTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(o,s){var a=i(o,s);this.params.econtent.content.messageImprint={alg:s,hash:a},this.params.econtent.content.serial={int:this.serial++};var u=Math.floor(Math.random()*1e9);this.params.econtent.content.nonce={int:u};var l=new n.TimeStampToken(this.params);return l.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};Ee(A.asn1.tsp.SimpleTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.FixedTSAAdapter=function(e){var t=A,r=t.asn1,n=r.tsp,i=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(o,s){var a=i(o,s);this.params.econtent.content.messageImprint={alg:s,hash:a};var u=new n.TimeStampToken(this.params);return u.getContentInfoEncodedHex()},e!==void 0&&(this.params=e)};Ee(A.asn1.tsp.FixedTSAAdapter,A.asn1.tsp.AbstractTSAAdapter);A.asn1.tsp.TSPUtil=new function(){};A.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new A.asn1.tsp.TimeStampToken(e)};A.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=new A.asn1.tsp.TSPParser;return t.getTimeStampReq(e)};A.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=new A.asn1.tsp.TSPParser;return t.getMessageImprint(e)};A.asn1.tsp.TSPParser=function(){var e=Error,t=tt,r=new t,n=xe,i=n.getV,o=n.getTLV,s=n.getIdxbyList,a=n.getTLVbyListEx,u=n.getChildIdx,l=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],h={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(m){var p=u(m,0);if(p.length==1)return this.getPKIStatusInfo(o(m,p[0]));if(p.length>1){var d=this.getPKIStatusInfo(o(m,p[0])),v=o(m,p[1]),g=this.getToken(v);return g.statusinfo=d,g}},this.getToken=function(m){var p=new A.asn1.cms.CMSParser,d=p.getCMSSignedData(m);return this.setTSTInfo(d),d},this.setTSTInfo=function(m){var p=m.econtent;if(p.type=="tstinfo"){var d=p.content.hex,v=this.getTSTInfo(d);p.content=v}},this.getTSTInfo=function(m){var p={},d=u(m,0),v=i(m,d[1]);p.policy=v1(v);var g=o(m,d[2]);p.messageImprint=this.getMessageImprint(g);var y=i(m,d[3]);p.serial={hex:y};var w=i(m,d[4]);p.genTime={str:Gt(w)};var E=0;if(d.length>5&&m.substr(d[5],2)=="30"){var _=o(m,d[5]);p.accuracy=this.getAccuracy(_),E++}if(d.length>5+E&&m.substr(d[5+E],2)=="01"){var C=i(m,d[5+E]);C=="ff"&&(p.ordering=!0),E++}if(d.length>5+E&&m.substr(d[5+E],2)=="02"){var F=i(m,d[5+E]);p.nonce={hex:F},E++}if(d.length>5+E&&m.substr(d[5+E],2)=="a0"){var H=o(m,d[5+E]);H="30"+H.substr(2),pGeneralNames=r.getGeneralNames(H);var K=pGeneralNames[0].dn;p.tsa=K,E++}if(d.length>5+E&&m.substr(d[5+E],2)=="a1"){var S=o(m,d[5+E]);S="30"+S.substr(2);var I=r.getExtParamArray(S);p.ext=I,E++}return p},this.getAccuracy=function(m){for(var p={},d=u(m,0),v=0;v<d.length;v++){var g=m.substr(d[v],2),y=i(m,d[v]),w=parseInt(y,16);g=="02"?p.seconds=w:g=="80"?p.millis=w:g=="81"&&(p.micros=w)}return p},this.getMessageImprint=function(m){if(m.substr(0,2)!="30")throw new Error("head of messageImprint hex shall be x30");var p={},d=u(m,0),v=s(m,0,[0,0]),g=i(m,v),y=n.hextooidstr(g),w=A.asn1.x509.OID.oid2name(y);if(w=="")throw new Error("hashAlg name undefined: "+y);var E=w,_=s(m,0,[1]);return p.alg=E,p.hash=i(m,_),p},this.getPKIStatusInfo=function(m){var p={},d=u(m,0),v=0;try{var g=i(m,d[0]),y=parseInt(g,16);p.status=l[y]}catch{}if(d.length>1&&m.substr(d[1],2)=="30"){var w=o(m,d[1]);p.statusstr=this.getPKIFreeText(w),v++}if(d.length>v&&m.substr(d[1+v],2)=="03"){var E=o(m,d[1+v]);p.failinfo=this.getPKIFailureInfo(E)}return p},this.getPKIFreeText=function(m){for(var p=[],d=u(m,0),v=0;v<d.length;v++)p.push(n.getString(m,d[v]));return p},this.getPKIFailureInfo=function(m){var p=n.getInt(m,0);return h[p]!=null?h[p]:p},this.getTimeStampReq=function(m){var p={};p.certreq=!1;var d=u(m,0);if(d.length<2)throw new Error("TimeStampReq must have at least 2 items");var v=o(m,d[1]);p.messageImprint=A.asn1.tsp.TSPUtil.parseMessageImprint(v);for(var g=2;g<d.length;g++){var y=d[g],w=m.substr(y,2);if(w=="06"){var E=i(m,y);p.policy=n.hextooidstr(E)}w=="02"&&(p.nonce=i(m,y)),w=="01"&&(p.certreq=!0)}return p}};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cades>"u"||!A.asn1.cades)&&(A.asn1.cades={});A.asn1.cades.SignaturePolicyIdentifier=function(e){var t=A,r=t.asn1,n=r.cades,i=n.SignaturePolicyId;n.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new i(this.params)]},this.setByParam=function(o){this.params=o},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.SignaturePolicyIdentifier,A.asn1.cms.Attribute);A.asn1.cades.SignaturePolicyId=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,o=r.x509,s=o.AlgorithmIdentifier,a=r.cades,u=a.SignaturePolicyId,l=a.OtherHashAlgAndValue;u.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params,m=[];m.push(new i(h.oid)),m.push(new l(h));var p=new n({array:m});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(h){this.params=h},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.SignaturePolicyId,A.asn1.ASN1Object);A.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.DEROctetString,s=n.x509,a=s.AlgorithmIdentifier,u=n.cades,l=u.OtherHashAlgAndValue;l.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params;if(h.alg==null)throw new t("property 'alg' not specified");if(h.hash==null&&h.cert==null)throw new t("property 'hash' nor 'cert' not specified");var m=null;if(h.hash!=null)m=h.hash;else if(h.cert!=null){if(typeof h.cert!="string")throw new t("cert not string");var p=h.cert;h.cert.indexOf("-----BEGIN")!=-1&&(p=lr(h.cert)),m=A.crypto.Util.hashHex(p,h.alg)}var d=[];d.push(new a({name:h.alg})),d.push(new o({hex:m}));var v=new i({array:d});return v.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.OtherHashAlgAndValue,A.asn1.ASN1Object);A.asn1.cades.OtherHashValue=function(e){A.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,r=A,n=r.lang.String.isHex,i=r.asn1,o=i.DEROctetString,s=r.crypto.Util.hashHex;this.params=null,this.tohex=function(){var a=this.params;if(a.hash==null&&a.cert==null)throw new t("hash or cert not specified");var u=null;if(a.hash!=null)u=a.hash;else if(a.cert!=null){if(typeof a.cert!="string")throw new t("cert not string");var l=a.cert;a.cert.indexOf("-----BEGIN")!=-1&&(l=lr(a.cert)),u=A.crypto.Util.hashHex(l,"sha1")}return new o({hex:u}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.OtherHashValue,A.asn1.ASN1Object);A.asn1.cades.SignatureTimeStamp=function(e){var t=Error,r=A,n=r.lang.String.isHex,i=r.asn1,o=i.ASN1Object,s=i.x509,a=i.cades;a.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var u=this.params;if(u.tst!=null)if(n(u.tst)){var l=new o;return l.hTLV=u.tst,[l]}else{if(u.tst instanceof o)return[u.tst];throw new t("params.tst has wrong value")}else if(u.res!=null){var h=u.res;if(h instanceof o&&(h=h.tohex()),typeof h!="string"||!n(h))throw new t("params.res has wrong value");var m=xe.getTLVbyList(h,0,[1]),l=new o;return l.hTLV=u.tst,[l]}},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.SignatureTimeStamp,A.asn1.cms.Attribute);A.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.cades,s=o.OtherCertID,a=r.lang.String.isHex;o.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var u=this.params,l=[],h=0;h<u.array.length;h++){var m=u.array[h];if(typeof m=="string")if(m.indexOf("-----BEGIN")!=-1)m={cert:m};else if(a(m))m={hash:m};else throw new t("unsupported value: "+m);u.alg!=null&&m.alg==null&&(m.alg=u.alg),u.hasis!=null&&m.hasis==null&&(m.hasis=u.hasis);var p=new s(m);l.push(p)}var d=new i({array:l});return[d]},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.CompleteCertificateRefs,A.asn1.cms.Attribute);A.asn1.cades.OtherCertID=function(e){var t=A,r=t.asn1,n=r.DERSequence,i=r.cms,o=i.IssuerSerial,s=r.cades,a=s.OtherHashValue,u=s.OtherHashAlgAndValue;s.OtherCertID.superclass.constructor.call(this),this.params=e,this.tohex=function(){var l=this.params;typeof l=="string"&&(l.indexOf("-----BEGIN")!=-1?l={cert:l}:_isHex(l)&&(l={hash:l}));var h=[],m=null;if(l.alg!=null?m=new u(l):m=new a(l),h.push(m),l.cert!=null&&l.hasis==!0||l.issuer!=null&&l.serial!=null){var p=new o(l);h.push(p)}var d=new n({array:h});return d.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.OtherCertID,A.asn1.ASN1Object);A.asn1.cades.OtherHash=function(e){var t=Error,r=A,n=r.asn1,i=n.cms,o=n.cades,s=o.OtherHashAlgAndValue,a=o.OtherHashValue,u=r.crypto.Util.hashHex,l=r.lang.String.isHex;o.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params;typeof h=="string"&&(h.indexOf("-----BEGIN")!=-1?h={cert:h}:l(h)&&(h={hash:h}));var m=null;return h.alg!=null?m=new s(h):m=new a(h),m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cades.OtherHash,A.asn1.ASN1Object);A.asn1.cades.CAdESUtil=new function(){};A.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){var t=new A.asn1.cms.CMSParser,r=t.getCMSSignedData(e);return r};A.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,r){var n=xe,i=n.getChildIdx,o=n.getTLV,s=n.getV,a=A,u=a.asn1,l=u.ASN1Object,h=u.cms,m=h.AttributeList,p=h.SignerInfo,d={},v=i(e,t);if(v.length!=6)throw"not supported items for SignerInfo (!=6)";var g=v.shift();d.version=o(e,g);var y=v.shift();d.si=o(e,y);var w=v.shift();d.digalg=o(e,w);var E=v.shift();d.sattrs=o(e,E);var _=v.shift();d.sigalg=o(e,_);var C=v.shift();d.sig=o(e,C),d.sigval=s(e,C);var F=null;return d.obj=new p,F=new l,F.hTLV=d.version,d.obj.dCMSVersion=F,F=new l,F.hTLV=d.si,d.obj.dSignerIdentifier=F,F=new l,F.hTLV=d.digalg,d.obj.dDigestAlgorithm=F,F=new l,F.hTLV=d.sattrs,d.obj.dSignedAttrs=F,F=new l,F.hTLV=d.sigalg,d.obj.dSigAlg=F,F=new l,F.hTLV=d.sig,d.obj.dSig=F,d.obj.dUnsignedAttrs=new m,d};(typeof A.asn1.csr>"u"||!A.asn1.csr)&&(A.asn1.csr={});A.asn1.csr.CertificationRequest=function(e){var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,o=r.csr,s=r.x509,a=o.CertificationRequestInfo;o.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(u){this.params=u},this.sign=function(){var u=new a(this.params).tohex(),l=new A.crypto.Signature({alg:this.params.sigalg});l.init(this.params.sbjprvkey),l.updateHex(u);var h=l.sign();this.params.sighex=h},this.getPEM=function(){return An(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var u=this.params,l=new A.asn1.csr.CertificationRequestInfo(this.params),h=new A.asn1.x509.AlgorithmIdentifier({name:u.sigalg});if(u.sighex==null&&u.sbjprvkey!=null&&this.sign(),u.sighex==null)throw new Error("sighex or sbjprvkey parameter not defined");var m=new n({hex:"00"+u.sighex}),p=new i({array:[l,h,m]});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.csr.CertificationRequest,A.asn1.ASN1Object);A.asn1.csr.CertificationRequestInfo=function(e){var t=A,r=t.asn1,n=r.DERBitString,i=r.DERSequence,o=r.DERInteger,s=r.DERUTF8String,a=r.DERTaggedObject,u=r.ASN1Util.newObject,l=r.csr,h=r.x509,m=h.X500Name,p=h.Extensions,d=h.SubjectPublicKeyInfo,v=l.AttributeList;l.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(y){y!=null&&(this.params=y)},this.tohex=function(){var y=this.params,w=[];if(w.push(new o({int:0})),w.push(new m(y.subject)),w.push(new d(_t.getKey(y.sbjpubkey))),y.attrs!=null){var E=g(y.attrs),_=u({tag:{tage:"a0",obj:E}});w.push(_)}else if(y.extreq!=null){var C=new p(y.extreq),_=u({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[C]}]}}});w.push(_)}else w.push(new a({tag:"a0",explicit:!1,obj:new s({str:""})}));var F=new i({array:w});return F.tohex()},this.getEncodedHex=function(){return this.tohex()};function g(y){for(var w=Error,E=A.asn1.x509.Extensions,_=[],C=0;C<y.length;C++){var F=y[C],H=F.attr;if(H=="extensionRequest"){var K=new E(F.ext),S={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[K]}]};_.push(S)}else if(H=="unstructuredName"){var S={seq:[{oid:"1.2.840.113549.1.9.2"},{set:F.names}]};_.push(S)}else if(H=="challengePassword"){var S={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:F.password}]}]};_.push(S)}else throw new w("unknown CSR attribute")}return{set:_}}e!=null&&this.setByParam(e)};Ee(A.asn1.csr.CertificationRequestInfo,A.asn1.ASN1Object);A.asn1.csr.AttributeList=function(e){function t(r){}};Ee(A.asn1.csr.AttributeList,A.asn1.ASN1Object);A.asn1.csr.CSRUtil=new function(){};A.asn1.csr.CSRUtil.newCSRPEM=function(e){var t=_t,r=A.asn1.csr,n=new r.CertificationRequest(e),i=n.getPEM();return i};A.asn1.csr.CSRUtil.getParam=function(e,t){var r=xe,n=r.getV,i=r.getIdxbyList,o=r.getTLVbyList,s=r.getTLVbyListEx,a=r.getVbyListEx,u=function(E){var _=i(E,0,[0,3,0,0],"06");return n(E,_)!="2a864886f70d01090e"?null:o(E,0,[0,3,0,1,0],"30")},l={};if(e.indexOf("-----BEGIN CERTIFICATE REQUEST")==-1)throw new Error("argument is not PEM file");var h=lr(e,"CERTIFICATE REQUEST");t&&(l.tbs=o(h,0,[0]));try{var m=s(h,0,[0,1]);if(m=="3000")l.subject={};else{var g=new tt;l.subject=g.getX500Name(m)}}catch{}var p=s(h,0,[0,2]),d=_t.getKey(p,null,"pkcs8pub");l.sbjpubkey=_t.getPEM(d,"PKCS8PUB");var v=u(h),g=new tt;v!=null&&(l.extreq=g.getExtParamArray(v));try{var y=s(h,0,[1],"30"),g=new tt;l.sigalg=g.getAlgorithmIdentifierName(y)}catch{}try{var w=a(h,0,[2]);l.sighex=w}catch{}return l};A.asn1.csr.CSRUtil.verifySignature=function(e){try{var t=null;if(typeof e=="string"&&e.indexOf("-----BEGIN CERTIFICATE REQUEST")!=-1?t=A.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 A.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 A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.ocsp>"u"||!A.asn1.ocsp)&&(A.asn1.ocsp={});A.asn1.ocsp.DEFAULT_HASH="sha1";A.asn1.ocsp.OCSPResponse=function(e){A.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var t=A.asn1.DEREnumerated,r=A.asn1.ASN1Util.newObject,n=A.asn1.ocsp.ResponseBytes,i=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var o=this.params.resstatus;return typeof o=="number"?o:typeof o!="string"?-1:i.indexOf(o)},this.setByParam=function(o){this.params=o},this.tohex=function(){var o=this.params,s=this._getStatusCode();if(s==-1)throw new Error("responseStatus not supported: "+o.resstatus);if(s!=0)return r({seq:[{enum:{int:s}}]}).tohex();var a=new n(o);return r({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:a}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.OCSPResponse,A.asn1.ASN1Object);A.asn1.ocsp.ResponseBytes=function(e){A.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=A.asn1,r=t.DERSequence,n=t.DERObjectIdentifier,i=t.DEROctetString,o=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 a=new o(s),u=[];u.push(new n({name:"ocspBasic"})),u.push(new i({hex:a.tohex()}));var l=new r({array:u});return l.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.ResponseBytes,A.asn1.ASN1Object);A.asn1.ocsp.BasicOCSPResponse=function(e){A.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.ASN1Object,i=r.DERSequence,o=r.DERGeneralizedTime,s=r.DERTaggedObject,a=r.DERBitString,u=r.x509.Extensions,l=r.x509.AlgorithmIdentifier,h=r.ocsp,m=h.ResponderID;_SingleResponseList=h.SingleResponseList,_ResponseData=h.ResponseData,this.params=null,this.setByParam=function(p){this.params=p},this.sign=function(){var p=this.params,d=p.tbsresp.tohex(),v=new A.crypto.Signature({alg:p.sigalg});v.init(p.reskey),v.updateHex(d),p.sighex=v.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 d=[];if(d.push(p.tbsresp),d.push(new l({name:p.sigalg})),d.push(new a({hex:"00"+p.sighex})),p.certs!=null&&p.certs.length!=null){for(var v=[],g=0;g<p.certs.length;g++){var y=p.certs[g],w=null;if(xe.isASN1HEX(y))w=y;else if(y.match(/-----BEGIN/))w=lr(y);else throw new t("certs["+g+"] not hex or PEM");v.push(new n({tlv:w}))}var E=new i({array:v});d.push(new s({tag:"a0",explicit:!0,obj:E}))}var _=new i({array:d});return _.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.BasicOCSPResponse,A.asn1.ASN1Object);A.asn1.ocsp.ResponseData=function(e){A.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,o=r.DERTaggedObject,s=r.x509.Extensions,a=r.ocsp,u=a.ResponderID;_SingleResponseList=a.SingleResponseList,this.params=null,this.tohex=function(){var l=this.params;l.respid!=null&&new t("respid not specified"),l.prodat!=null&&new t("prodat not specified"),l.array!=null&&new t("array not specified");var h=[];if(h.push(new u(l.respid)),h.push(new i(l.prodat)),h.push(new _SingleResponseList(l.array)),l.ext!=null){var m=new s(l.ext);h.push(new o({tag:"a1",explicit:!0,obj:m}))}var p=new n({array:h});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(l){this.params=l},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.ResponseData,A.asn1.ASN1Object);A.asn1.ocsp.ResponderID=function(e){A.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=A,r=t.asn1,n=r.ASN1Util.newObject,i=r.x509.X500Name,o=t.lang.String.isHex,s=Error;this.params=null,this.tohex=function(){var a=this.params;if(a.key!=null){var u=null;if(typeof a.key=="string"){if(o(a.key)&&(u=a.key),a.key.match(/-----BEGIN CERTIFICATE/)){var l=new tt(a.key),h=l.getExtSubjectKeyIdentifier();h!=null&&(u=h.kid.hex)}}else if(a.key instanceof tt){var h=a.key.getExtSubjectKeyIdentifier();h!=null&&(u=h.kid.hex)}if(u==null)throw new s("wrong key member value");var m=n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:u}}}});return m.tohex()}else if(a.name!=null){var p=null;if(typeof a.name=="string"&&a.name.match(/-----BEGIN CERTIFICATE/)){var l=new tt(a.name);p=l.getSubject()}else a.name instanceof tt?p=a.name.getSubject():typeof a.name=="object"&&(a.name.array!=null||a.name.str!=null)&&(p=a.name);if(p==null)throw new s("wrong name member value");var m=n({tag:{tag:"a1",explicit:!0,obj:new i(p)}});return m.tohex()}throw new s("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(a){this.params=a},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.ResponderID,A.asn1.ASN1Object);A.asn1.ocsp.SingleResponseList=function(e){A.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=A.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 o=[],s=0;s<i.length;s++)o.push(new n(i[s]));var a=new r({array:o});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(i){this.params=i},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.SingleResponseList,A.asn1.ASN1Object);A.asn1.ocsp.SingleResponse=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.DERGeneralizedTime,s=n.DERTaggedObject,a=n.ocsp,u=a.CertID,l=a.CertStatus,h=n.x509,m=h.Extensions;a.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params,d=[];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(d.push(new u(p.certid)),d.push(new l(p.status)),d.push(new o(p.thisupdate)),p.nextupdate!=null){var v=new o(p.nextupdate);d.push(new s({tag:"a0",explicit:!0,obj:v}))}if(p.ext!=null){var g=new m(p.ext);d.push(new s({tag:"a1",explicit:!0,obj:g}))}var y=new i({array:d});return y.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(p){this.params=p},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.SingleResponse,A.asn1.ASN1Object);A.asn1.ocsp.CertID=function(e){var t=A,r=t.asn1,n=r.DEROctetString,i=r.DERInteger,o=r.DERSequence,s=r.x509,a=s.AlgorithmIdentifier,u=r.ocsp,l=u.DEFAULT_HASH,h=t.crypto,m=h.Util.hashHex,p=tt,d=xe,v=d.getVbyList;u.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(g,y,w,E){E==null&&(E=this.DEFAULT_HASH),this.params={alg:E,issname:g,isskey:y,sbjsn:w}},this.setByCert=function(g,y,w){w==null&&(w=this.DEFAULT_HASH),this.params={alg:w,issuerCert:g,subjectCert:y}},this.getParamByCerts=function(g,y,w){w==null&&(w=this.DEFAULT_HASH);var E=new p(g),_=new p(y),C=m(E.getSubjectHex(),w),F=E.getPublicKeyHex(),H=m(v(F,0,[1],"03",!0),w),K=_.getSerialNumberHex(),S={alg:w,issname:C,isskey:H,sbjsn:K};return S},this.tohex=function(){if(typeof this.params!="object")throw new Error("params not set");var g=this.params,y,w,E,_;if(g.alg==null?_=this.DEFAULT_HASH:_=g.alg,g.issuerCert!=null&&g.subjectCert!=null){var C=this.getParamByCerts(g.issuerCert,g.subjectCert,_);y=C.issname,w=C.isskey,E=C.sbjsn}else if(g.issname!=null&&g.isskey!=null&&g.sbjsn!=null)y=g.issname,w=g.isskey,E=g.sbjsn;else throw new Error("required param members not defined");var F=new a({name:_}),H=new n({hex:y}),K=new n({hex:w}),S=new i({hex:E}),I=new o({array:[F,H,K,S]});return this.hTLV=I.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.ocsp.CertID,A.asn1.ASN1Object);A.asn1.ocsp.CertStatus=function(e){A.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 A.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)};Ee(A.asn1.ocsp.CertStatus,A.asn1.ASN1Object);A.asn1.ocsp.Request=function(e){var t=A,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 a=new n({array:s});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},typeof e<"u"){var o=new i.CertID(e);this.dReqCert=o}};Ee(A.asn1.ocsp.Request,A.asn1.ASN1Object);A.asn1.ocsp.TBSRequest=function(e){var t=A,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(o){for(var s=[],a=0;a<o.length;a++){var u=new i.Request(o[0]);s.push(u)}this.dRequestList=s},this.tohex=function(){var o=[];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(o.push(s),this.dRequestExt!==null)throw"requestExtensions not supported";var a=new n({array:o});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0&&this.setRequestListByParam(e.reqList)};Ee(A.asn1.ocsp.TBSRequest,A.asn1.ASN1Object);A.asn1.ocsp.OCSPRequest=function(e){var t=A,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 a=new n({array:s});return this.hTLV=a.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&e.reqList!==void 0){var o=new i.TBSRequest(e);this.dTbsRequest=o}};Ee(A.asn1.ocsp.OCSPRequest,A.asn1.ASN1Object);A.asn1.ocsp.OCSPUtil={};A.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,r){var n=A,i=n.asn1,o=i.ocsp;r===void 0&&(r=o.DEFAULT_HASH);var s={alg:r,issuerCert:e,subjectCert:t},a=new o.OCSPRequest({reqList:[s]});return a.tohex()};A.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=xe,r=t.getVbyList,n=t.getVbyListEx,i=t.getIdxbyList,o=t.getIdxbyListEx,s=t.getV,a={};try{var u=n(e,0,[0],"0a");a.responseStatus=parseInt(u,16)}catch{}if(a.responseStatus!==0)return a;try{var l=i(e,0,[1,0,1,0,0,2,0,1]);e.substr(l,2)==="80"?a.certStatus="good":e.substr(l,2)==="a1"?(a.certStatus="revoked",a.revocationTime=Gt(r(e,l,[0]))):e.substr(l,2)==="82"&&(a.certStatus="unknown")}catch{}try{var h=i(e,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=Gt(s(e,h))}catch{}try{var m=i(e,0,[1,0,1,0,0,2,0,3]);e.substr(m,2)==="a0"&&(a.nextUpdate=Gt(r(e,m,[0])))}catch{}return a};A.asn1.ocsp.OCSPParser=function(){var e=Error,t=tt,r=new t,n=xe,i=n.getV,o=n.getTLV,s=n.getIdxbyList,a=n.getVbyList,u=n.getTLVbyList,l=n.getVbyListEx,h=n.getTLVbyListEx,m=n.getChildIdx;this.getOCSPRequest=function(p){var d=m(p,0);if(d.length!=1&&d.length!=2)throw new e("wrong number elements: "+d.length);var v=this.getTBSRequest(o(p,d[0]));return v},this.getTBSRequest=function(p){var d={},v=h(p,0,[0],"30");d.array=this.getRequestList(v);var g=h(p,0,["[2]",0],"30");return g!=null&&(d.ext=r.getExtParamArray(g)),d},this.getRequestList=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var p=o(p,v[g]);d.push(this.getRequest(p))}return d},this.getRequest=function(p){var d=m(p,0);if(d.length!=1&&d.length!=2)throw new e("wrong number elements: "+d.length);var v=this.getCertID(o(p,d[0]));if(d.length==2){var g=s(p,0,[1,0]);v.ext=r.getExtParamArray(o(p,g))}return v},this.getCertID=function(p){var d=m(p,0);if(d.length!=4)throw new e("wrong number elements: "+d.length);var v=new t,g={};return g.alg=v.getAlgorithmIdentifierName(o(p,d[0])),g.issname=i(p,d[1]),g.isskey=i(p,d[2]),g.sbjsn=i(p,d[3]),g},this.getOCSPResponse=function(p){var d=m(p,0),v,g=i(p,d[0]),y=parseInt(g);if(d.length==1)return{resstatus:y};var w=u(p,0,[1,0]);return v=this.getResponseBytes(w),v.resstatus=y,v},this.getResponseBytes=function(p){var d=m(p,0),v,g=u(p,0,[1,0]);v=this.getBasicOCSPResponse(g);var y=i(p,d[0]);return v.restype=A.asn1.x509.OID.oid2name(v1(y)),v},this.getBasicOCSPResponse=function(p){var d=m(p,0),v;v=this.getResponseData(o(p,d[0]));var g=new tt;v.alg=g.getAlgorithmIdentifierName(o(p,d[1]));var y=i(p,d[2]);v.sighex=y.substr(2);var w=l(p,0,["[0]"]);if(w!=null){for(var E=m(w,0),_=[],C=0;C<E.length;C++){var F=o(w,E[C]);_.push(F)}v.certs=_}return v},this.getResponseData=function(p){var d=m(p,0),v=d.length,g={},y=0;p.substr(d[0],2)=="a0"&&y++,g.respid=this.getResponderID(o(p,d[y++]));var w=i(p,d[y++]);if(g.prodat=Gt(w),g.array=this.getSingleResponseList(o(p,d[y++])),p.substr(d[v-1],2)=="a1"){var E=u(p,d[v-1],[0]),_=new tt;g.ext=_.getExtParamArray(E)}return g},this.getResponderID=function(p){var d={};if(p.substr(0,2)=="a2"){var v=a(p,0,[0]);d.key=v}if(p.substr(0,2)=="a1"){var g=u(p,0,[0]),y=new tt;d.name=y.getX500Name(g)}return d},this.getSingleResponseList=function(p){for(var d=m(p,0),v=[],g=0;g<d.length;g++){var y=this.getSingleResponse(o(p,d[g]));v.push(y)}return v},this.getSingleResponse=function(p){var d=m(p,0),v={},g=this.getCertID(o(p,d[0]));v.certid=g;var y=this.getCertStatus(o(p,d[1]));if(v.status=y,p.substr(d[2],2)=="18"){var w=i(p,d[2]);v.thisupdate=Gt(w)}for(var E=3;E<d.length;E++){if(p.substr(d[E],2)=="a0"){var _=a(p,d[E],[0],"18");v.nextupdate=Gt(_)}if(p.substr(d[E],2)=="a1"){var C=new tt,F=u(p,0,[E,0]);v.ext=C.getExtParamArray(F)}}return v},this.getCertStatus=function(p){var d={};if(p=="8000")return{status:"good"};if(p=="8200")return{status:"unknown"};if(p.substr(0,2)=="a1"){d.status="revoked";var v=a(p,0,[0]),g=Gt(v);d.time=g}return d}};var A;(typeof A>"u"||!A)&&(A={});(typeof A.lang>"u"||!A.lang)&&(A.lang={});A.lang.String=function(){};function oC(e){for(var t=new Array,r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function aC(e){for(var t="",r=0;r<e.length;r++)t=t+String.fromCharCode(e[r]);return t}function f1(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 hs(e){return f1(oC(e))}function qq(e){return la(hs(e))}function jq(e){return Jl(la(hs(e)))}function Kq(e){return aC(eC(ed(e)))}function Jl(e){return e=e.replace(/\=/g,""),e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}function ed(e){return e.length%4==2?e=e+"==":e.length%4==3&&(e=e+"="),e=e.replace(/-/g,"+"),e=e.replace(/_/g,"/"),e}function Or(e){return e.length%2==1&&(e="0"+e),Jl(la(e))}function rr(e){return Ql(ed(e))}var Jh,Di;typeof Buffer=="function"?(Jh=function(e){return Jl(Buffer.from(e,"utf8").toString("base64"))},Di=function(e){return Buffer.from(ed(e),"base64").toString("utf8")}):(Jh=function(e){return Or(p1(g1(e)))},Di=function(e){return decodeURIComponent(m1(rr(e)))});function Vq(e){return la(p1(g1(e)))}function zq(e){return decodeURIComponent(m1(Ql(e)))}function h1(e){return p1(g1(e)).toLowerCase()}function Gt(e){try{return decodeURIComponent(m1(e))}catch{return null}}function Gq(e){return Gt(Wq(e))}function Wq(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 ds(e){for(var t="",r=0;r<e.length-1;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t}function ao(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function ay(e){return la(e)}function Yq(e){return d1(ay(e),64)}function d1(e,t){return e=e.replace(new RegExp("(.{"+t+"})","g"),`$1\r
|
||
`),e=e.replace(/\s+$/,""),e}function uC(e){var t=e.replace(/[^0-9A-Za-z\/+=]*/g,""),r=Ql(t);return r}function Xq(e,t){return"-----BEGIN "+t+`-----\r
|
||
`+d1(e,64)+`\r
|
||
-----END `+t+`-----\r
|
||
`}function An(e,t){return"-----BEGIN "+t+`-----\r
|
||
`+d1(ay(e),64)+`\r
|
||
-----END `+t+`-----\r
|
||
`}function lr(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 [^-]+-----[^]*$/,"")),uC(e)}function Zq(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 Jq(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 Qq(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 uy(e){var t,r,n,i,o,s,a,u,l,h,m,p;if(e=lC(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]),o=parseInt(p[5]),s=parseInt(p[6]),a=0,h=p[7],h!==""&&(m=(h.substr(1)+"00").substr(0,3),a=parseInt(m)),Date.UTC(t,r,n,i,o,s,a);throw new Error("unsupported zulu format: "+e)}function ej(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),o=("00"+t.getUTCHours()).slice(-2),s=("00"+t.getUTCMinutes()).slice(-2),a=("00"+t.getUTCSeconds()).slice(-2),u=("000"+t.getUTCMilliseconds()).slice(-3);return u=u.replace(/0+$/,""),u=u!=""?"."+u:u,r+n+i+o+s+a+u+"Z"}function cC(e){return Math.round(uy(e)/1e3)}function tj(e){return new Date(uy(e))}function rj(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 o=e.getUTCMilliseconds();o!==0&&(o=("00"+o).slice(-3),o=o.replace(/0+$/g,""),n+="."+o)}return n+="Z",n}function lC(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 p1(e){return e.replace(/%/g,"")}function m1(e){return e.replace(/(..)/g,"%$1")}function ey(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 o=0;o<8;o++)i[o]=("0000"+i[o]).slice(-4);return i.join("")}function ty(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 o1(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 o1(e.substr(0,8))+"/"+J_(e.substr(8))}catch{throw t}else{if(e.length==32)return ty(e);if(e.length==64){try{return ty(e.substr(0,32))+"/"+J_(e.substr(32))}catch{throw t}return}else return e}}function J_(e){var t=new Error("malformed mask"),r;try{r=new ne(e,16).toString(2)}catch{throw t}if(!r.match(/^1*0*$/))throw t;return r.replace(/0+$/,"").length}function cy(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 o=parseInt(r[i]);n+=("0"+o.toString(16)).slice(-2)}return n}catch{throw t}}else if(e.match(/^[0-9.]+\/[0-9]+$/)){var s=e.split("/");return cy(s[0])+Q_(parseInt(s[1]),32)}else{if(e.match(/^[0-9a-f:]+$/)&&e.indexOf(":")!==-1)return ey(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&e.indexOf(":")!==-1){var s=e.split("/");return ey(s[0])+Q_(parseInt(s[1]),128)}else throw t}}function Q_(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 ne(r,2).toString(16)}function ly(e){function t(i){var o=parseInt(i.substr(0,2),16),s=parseInt(i.substr(2),16);if(o==0&s<128)return String.fromCharCode(s);if(o<8){var a=192|(o&7)<<3|(s&192)>>6,u=128|s&63;return Gt(a.toString(16)+u.toString(16))}var a=224|(o&240)>>4,u=128|(o&15)<<2|(s&192)>>6,l=128|s&63;return Gt(a.toString(16)+u.toString(16)+l.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function g1(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+"%"+hs(t[n]);return r}function nj(e){return e=e.replace(/\r\n/mg,`
|
||
`),e}function sj(e){return e=e.replace(/\r\n/mg,`
|
||
`),e=e.replace(/\n/mg,`\r
|
||
`),e}A.lang.String.isInteger=function(e){return e.match(/^[0-9]+$/)?!0:!!e.match(/^-[0-9]+$/)};A.lang.String.isHex=function(e){return fC(e)};function fC(e){return!!(e.length%2==0&&(e.match(/^[0-9a-f]+$/)||e.match(/^[0-9A-F]+$/)))}A.lang.String.isBase64=function(e){return e=e.replace(/\s+/g,""),!!(e.match(/^[0-9A-Za-z+\/]+={0,3}$/)&&e.length%4==0)};A.lang.String.isBase64URL=function(e){return e.match(/[+/=]/)?!1:(e=ed(e),A.lang.String.isBase64(e))};function fy(e){return!!e.match(/^[0-9A-Za-z-_.]+$/)}A.lang.String.isIntegerArray=function(e){return e=e.replace(/\s+/g,""),!!e.match(/^\[[0-9,]+\]$/)};A.lang.String.isPrintable=function(e){return e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)!==null};A.lang.String.isIA5=function(e){return e.match(/^[\x20-\x21\x23-\x7f]*$/)!==null};A.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 ry(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function ij(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 o=parseInt(r);if(o<0||255<o)throw"integer not in range 0-255";var s=("00"+o.toString(16)).slice(-2);return s}).join("");return t}catch(r){throw"malformed integer array string: "+r}}var oj=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 hC(e,t){if(typeof e!="string"||typeof t!="string")throw new Error("arguments shall be string");if(e.length!==t.length)throw new Error("input strings must have the same length");if(typeof Buffer=="function"&&typeof ca<"u"){if(ca.timingSafeEqual!==void 0)return ca.timingSafeEqual(Buffer.from(e),Buffer.from(t));if(ca.subtle!==void 0&&ca.subtle.timingSafeEqual)return ca.subtle.timingSafeEqual(Buffer.from(e),Buffer.from(t))}return dC(e,t)}function dC(e,t){if(typeof e!="string"||typeof t!="string")throw new Error("arguments shall be string");if(e.length!==t.length)throw new Error("input strings must have the same length");let r=t.slice();for(var n=0,i=0;i<e.length;i++)n|=e.charCodeAt(i)^r.charCodeAt(i);return n===0}function pC(e){var t=function(a){var u=a.toString(16);return u.length==1&&(u="0"+u),u},r=function(a){var u="",l=parseInt(a,10),h=l.toString(2),m=7-h.length%7;m==7&&(m=0);for(var p="",d=0;d<m;d++)p+="0";h=p+h;for(var d=0;d<h.length-1;d+=7){var v=h.substr(d,7);d!=h.length-7&&(v="1"+v),u+=t(parseInt(v,2))}return u};try{if(!e.match(/^[0-9.]+$/))return null;var n="",i=e.split("."),o=parseInt(i[0],10)*40+parseInt(i[1],10);n+=t(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n}catch{return null}}function v1(e){if(!fC(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),o=[],s=0;s<i.length/2;s++)o.push(parseInt(i.substr(s*2,2),16));for(var a=[],u="",s=0;s<o.length;s++)o[s]&128?u=u+a1((o[s]&127).toString(2),7):(u=u+a1((o[s]&127).toString(2),7),a.push(new String(parseInt(u,2))),u="");var l=t.join(".");return a.length>0&&(l=l+"."+a.join(".")),l}catch{return null}}function mC(e){var t=new ne(String(e),10);return td(t)}function td(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="",o=0;o<n;o++)i+="f";var s=new ne(i,16),a=s.xor(e).add(ne.ONE);return t=a.toString(16).replace(/^-/,""),t}var a1=function(e,t,r){return r==null&&(r="0"),e.length>=t?e:new Array(t-e.length+1).join(r)+e};function gC(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 o=parseInt(i,2);return o==NaN?-1:o}catch{return-1}}function vC(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+a1("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function wC(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 o=r.substr(i,2),s=parseInt(o,16).toString(2);s=("0000000"+s).slice(-8),n+=s}return n.substr(0,n.length-t)}catch{return null}}function aj(e){if(typeof e!="string"||e.match(/^[01]+$/)==null)return null;try{var t=parseInt(e,2);return vC(t)}catch{return null}}function u1(e,t){for(var r=0,n=0;n<e.length;n++)r|=1<<t[e[n]];for(var i=r.toString(2),o="",n=i.length-1;n>=0;n--)o+=i[n];return o}function Jt(e,n,r){if(typeof e=="object"){for(var n=String(n).split("."),i=0;i<n.length&&e;i++){var o=n[i];o.match(/^[0-9]+$/)&&(o=parseInt(o)),e=e[o]}return e||e===!1?e:r}}function Ee(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 A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:ke.algo.MD5,sha1:ke.algo.SHA1,sha224:ke.algo.SHA224,sha256:ke.algo.SHA256,sha384:ke.algo.SHA384,sha512:ke.algo.SHA512,ripemd160:ke.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 o="0001",s="00"+n,a="",u=i-o.length-s.length,l=0;l<u;l+=2)a+="ff";var h=o+a+s;return h},this.hashString=function(e,t){var r=new A.crypto.MessageDigest({alg:t});return r.digestString(e)},this.hashHex=function(e,t){var r=new A.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 at||e instanceof A.crypto.DSA||e instanceof A.crypto.ECDSA}};A.crypto.Util.md5=function(e){var t=new A.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return t.digestString(e)};A.crypto.Util.ripemd160=function(e){var t=new A.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return t.digestString(e)};A.crypto.Util.SECURERANDOMGEN=new rf;A.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return A.crypto.Util.SECURERANDOMGEN.nextBytes(t),f1(t)};A.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new ne(A.crypto.Util.getRandomHexOfNbytes(e),16)};A.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,r=(e-t)/8,n=new Array(r+1);return A.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],f1(n)};A.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new ne(A.crypto.Util.getRandomHexOfNbits(e),16)};A.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var r=A.crypto.Util.getRandomBigIntegerOfNbits(t);if(e.compareTo(r)>=0)return r}};A.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var r=e.compareTo(t);if(r>0)throw"biMin is greater than biMax";if(r==0)return e;var n=t.subtract(e),i=A.crypto.Util.getRandomBigIntegerZeroToMax(n);return i.add(e)};A.crypto.MessageDigest=function(e){var t=null,r=null,n=null;this.setAlgAndProvider=function(i,o){if(i=A.crypto.MessageDigest.getCanonicalAlgName(i),i!==null&&o===void 0&&(o=A.crypto.Util.DEFAULTPROVIDER[i]),":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)!=-1&&o=="cryptojs"){try{this.md=A.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 a=ke.enc.Hex.parse(s);this.md.update(a)},this.digest=function(){var s=this.md.finalize();return s.toString(ke.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&&o=="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 a=sjcl.codec.hex.toBits(s);this.md.update(a)},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=A.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))};A.crypto.MessageDigest.getCanonicalAlgName=function(e){return typeof e=="string"&&(e=e.toLowerCase(),e=e.replace(/-/,"")),e};A.crypto.MessageDigest.getHashLength=function(e){var t=A.crypto.MessageDigest,r=t.getCanonicalAlgName(e);if(t.HASHLENGTH[r]===void 0)throw"not supported algorithm: "+e;return t.HASHLENGTH[r]};A.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20};A.crypto.Mac=function(e){var t=null,r=null,n=null,i=null,o=null;this.setAlgAndProvider=function(s,a){if(s=s.toLowerCase(),s==null&&(s="hmacsha1"),s=s.toLowerCase(),s.substr(0,4)!="hmac")throw"setAlgAndProvider unsupported HMAC alg: "+s;a===void 0&&(a=A.crypto.Util.DEFAULTPROVIDER[s]),this.algProv=s+"/"+a;var u=s.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(u)!=-1&&a=="cryptojs"){try{var l=A.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[u];this.mac=ke.algo.HMAC.create(l,this.pass)}catch(h){throw"setAlgAndProvider hash alg set fail hashAlg="+u+"/"+h}this.updateString=function(h){this.mac.update(h)},this.updateHex=function(h){var m=ke.enc.Hex.parse(h);this.mac.update(m)},this.doFinal=function(){var h=this.mac.finalize();return h.toString(ke.enc.Hex)},this.doFinalString=function(h){return this.updateString(h),this.doFinal()},this.doFinalHex=function(h){return this.updateHex(h),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 a=s;(s.length%2==1||!s.match(/^[0-9A-Fa-f]+$/))&&(a=ao(s)),this.pass=ke.enc.Hex.parse(a);return}if(typeof s!="object")throw"KJUR.crypto.Mac unsupported password type: "+s;var a=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;a=s.hex}if(s.utf8!==void 0&&(a=h1(s.utf8)),s.rstr!==void 0&&(a=ao(s.rstr)),s.b64!==void 0&&(a=Ql(s.b64)),s.b64u!==void 0&&(a=rr(s.b64u)),a==null)throw"KJUR.crypto.Mac unsupported password type: "+s;this.pass=ke.enc.Hex.parse(a)},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=A.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))};A.crypto.Signature=function(e){var t=null,r=null,n=null,i=null,o=null,s=null,a=null,u=null,l=null,h=null,m=-1,p=null,d=null,v=null,g=null,y=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,E){for(var _="",C=E/4-w.length,F=0;F<C;F++)_=_+"0";return _+w},this.setAlgAndProvider=function(w,E){if(this._setAlgNames(),E!="cryptojs/jsrsa")throw new Error("provider not supported: "+E);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)!=-1){try{this.md=new A.crypto.MessageDigest({alg:this.mdAlgName})}catch(_){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+_)}this.init=function(_,C){var F=null;try{C===void 0?F=_t.getKey(_):F=_t.getKey(_,C)}catch(H){throw"init failed:"+H}if(F.isPrivate===!0)this.prvKey=F,this.state="SIGN";else if(F.isPublic===!0)this.pubKey=F,this.state="VERIFY";else throw"init failed.:"+F},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&&A.crypto.ECDSA!==void 0&&(this.prvKey=new A.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof at&&this.pubkeyAlgName==="rsaandmgf1")this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof at&&this.pubkeyAlgName==="rsa")this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof A.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else if(this.prvKey instanceof A.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&&A.crypto.ECDSA!==void 0&&(this.pubKey=new A.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof at&&this.pubkeyAlgName==="rsaandmgf1")return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,_,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof at&&this.pubkeyAlgName==="rsa")return this.pubKey.verifyWithMessageHash(this.sHashHex,_);if(A.crypto.ECDSA!==void 0&&this.pubKey instanceof A.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,_);if(A.crypto.DSA!==void 0&&this.pubKey instanceof A.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,_);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(w,E){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=A.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=_t.getKey(e.prvkeypem);this.init(t)}catch(w){throw"fatal error to load pem private key: "+w}}};A.crypto.Cipher=function(e){};A.crypto.Cipher.encrypt=function(e,t,r,n){if(Jt(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var i=t,o=e;Jt(n,"key")!=null&&(i=n.key),Jt(n,"enc")!=null&&(hEnc=n.enc);var s=ke.enc.Hex.parse(i),a=ke.enc.Hex.parse(o),u=ke.enc.Hex.parse(n.iv),l;if(r=="des-EDE3-CBC")l=ke.TripleDES.encrypt(a,s,{iv:u});else if(r=="aes128-CBC"||r=="aes256-CBC")l=ke.AES.encrypt(a,s,{iv:u});else throw new Error("unsupported algorithm: "+r);return l+""}else throw new Error("Cipher.encrypt: unsupported key or algorithm")};A.crypto.Cipher.decrypt=function(e,t,r,n){if(Jt(n,"enclag")!=null&&(r=n.encalg),typeof r=="string"&&r.substr(-4)=="-CBC"){var i=t,o=e;Jt(n,"key")!=null&&(i=n.key),Jt(n,"enc")!=null&&(o=n.enc);var s=ke.enc.Hex.parse(i),a=ke.enc.Hex.parse(o),u=ke.enc.Hex.parse(n.iv),l;if(r=="des-EDE3-CBC")l=ke.TripleDES.decrypt({ciphertext:a},s,{iv:u});else if(r=="aes128-CBC"||r=="aes256-CBC")l=ke.AES.decrypt({ciphertext:a},s,{iv:u});else throw new Error("unsupported algorithm: "+r);return ke.enc.Hex.stringify(l)}else throw new Error("Cipher.decrypt: unsupported key or algorithm")};A.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 A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECDSA=function(e){var t="secp256r1",r=null,n=null,i=null,o=Error,s=ne,a=Nt,u=A.crypto.ECDSA,l=A.crypto.ECParameterDB,h=u.getName,m=xe,p=m.getVbyListEx,d=m.isASN1HEX,v=new rf,g=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function y(w,E,_,C){for(var F=Math.max(E.bitLength(),C.bitLength()),H=w.add2D(_),K=w.curve.getInfinity(),S=F-1;S>=0;--S)K=K.twice2D(),K.z=s.ONE,E.testBit(S)?C.testBit(S)?K=K.add2D(H):K=K.add2D(w):C.testBit(S)&&(K=K.add2D(_));return K}this.getBigRandom=function(w){return new s(w.bitLength(),v).mod(w.subtract(s.ONE)).add(s.ONE)},this.setNamedCurve=function(w){this.ecparams=l.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 E=this.ecparams.keycharlen;if(w.length!==2+E*2)throw"malformed public key hex length";var _={};return _.x=w.substr(2,E),_.y=w.substr(2+E),_},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,E=this.getBigRandom(w),_=this.ecparams.keycharlen,C=("0000000000"+E.toString(16)).slice(-_);this.setPrivateKeyHex(C);var F=this.generatePublicKeyHex();return{ecprvhex:C,ecpubhex:F}},this.generatePublicKeyHex=function(){var w=new s(this.prvKeyHex,16),E=this.ecparams.G.multiply(w),_=E.getX().toBigInteger(),C=E.getY().toBigInteger(),F=this.ecparams.keycharlen,H=("0000000000"+_.toString(16)).slice(-F),K=("0000000000"+C.toString(16)).slice(-F),S="04"+H+K;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(w){return this.signHex(w,this.prvKeyHex)},this.signHex=function(w,E){var _=new s(E,16),C=this.ecparams.n,F=new s(w.substring(0,this.ecparams.keycharlen),16);do var H=this.getBigRandom(C),K=this.ecparams.G,S=K.multiply(H),I=S.getX().toBigInteger().mod(C);while(I.compareTo(s.ZERO)<=0);var q=H.modInverse(C).multiply(F.add(_.multiply(I))).mod(C);return u.biRSSigToASN1Sig(I,q)},this.sign=function(w,E){var _=E,C=this.ecparams.n,F=s.fromByteArrayUnsigned(w);do var H=this.getBigRandom(C),K=this.ecparams.G,S=K.multiply(H),I=S.getX().toBigInteger().mod(C);while(I.compareTo(ne.ZERO)<=0);var q=H.modInverse(C).multiply(F.add(_.multiply(I))).mod(C);return this.serializeSig(I,q)},this.verifyWithMessageHash=function(w,E){return this.verifyHex(w,E,this.pubKeyHex)},this.verifyHex=function(w,E,_){try{var C,F,H=u.parseSigHex(E);C=H.r,F=H.s;var K=a.decodeFromHex(this.ecparams.curve,_),S=new s(w.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,C,F,K)}catch{return!1}},this.verify=function(w,E,_){var C,F;if(Bitcoin.Util.isArray(E)){var H=this.parseSig(E);C=H.r,F=H.s}else if(typeof E=="object"&&E.r&&E.s)C=E.r,F=E.s;else throw"Invalid value for signature";var K;if(_ instanceof Nt)K=_;else if(Bitcoin.Util.isArray(_))K=a.decodeFrom(this.ecparams.curve,_);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=s.fromByteArrayUnsigned(w);return this.verifyRaw(S,C,F,K)},this.verifyRaw=function(w,E,_,C){var F=this.ecparams.n,H=this.ecparams.G;if(E.compareTo(s.ONE)<0||E.compareTo(F)>=0||_.compareTo(s.ONE)<0||_.compareTo(F)>=0)return!1;var K=_.modInverse(F),S=w.multiply(K).mod(F),I=E.multiply(K).mod(F),q=H.multiply(S).add(C.multiply(I)),L=q.getX().toBigInteger().mod(F);return L.equals(E)},this.serializeSig=function(w,E){var _=w.toByteArraySigned(),C=E.toByteArraySigned(),F=[];return F.push(2),F.push(_.length),F=F.concat(_),F.push(2),F.push(C.length),F=F.concat(C),F.unshift(F.length),F.unshift(48),F},this.parseSig=function(w){var E;if(w[0]!=48)throw new Error("Signature not a valid DERSequence");if(E=2,w[E]!=2)throw new Error("First element in signature must be a DERInteger");var _=w.slice(E+2,E+2+w[E+1]);if(E+=2+w[E+1],w[E]!=2)throw new Error("Second element in signature must be a DERInteger");var C=w.slice(E+2,E+2+w[E+1]);E+=2+w[E+1];var F=s.fromByteArrayUnsigned(_),H=s.fromByteArrayUnsigned(C);return{r:F,s:H}},this.parseSigCompact=function(w){if(w.length!==65)throw"Signature has the wrong length";var E=w[0]-27;if(E<0||E>7)throw"Invalid signature type";var _=this.ecparams.n,C=s.fromByteArrayUnsigned(w.slice(1,33)).mod(_),F=s.fromByteArrayUnsigned(w.slice(33,65)).mod(_);return{r:C,s:F,i:E}},this.readPKCS5PrvKeyHex=function(w){if(d(w)===!1)throw new Error("not ASN.1 hex string");var E,_,C;try{E=p(w,0,["[0]",0],"06"),_=p(w,0,[1],"04");try{C=p(w,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=h(E),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(C),this.setPrivateKeyHex(_),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,_,C,F;try{E=p(w,0,[1,0],"06"),_=p(w,0,[1,1],"06"),C=p(w,0,[2,0,1],"04");try{F=p(w,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new o("malformed PKCS#8 plain ECC private key")}if(this.curveName=h(_),this.curveName===void 0)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(F),this.setPrivateKeyHex(C),this.isPublic=!1},this.readPKCS8PubKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,_,C;try{E=p(w,0,[0,0],"06"),_=p(w,0,[0,1],"06"),C=p(w,0,[1],"03")}catch{throw new o("malformed PKCS#8 ECC public key")}if(this.curveName=h(_),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},this.readCertPubKeyHex=function(w,E){if(d(w)===!1)throw new o("not ASN.1 hex string");var _,C;try{_=p(w,0,[0,5,0,1],"06"),C=p(w,0,[0,5,1],"03")}catch{throw new o("malformed X.509 certificate ECC public key")}if(this.curveName=h(_),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},e!==void 0&&e.curve!==void 0&&(this.curveName=e.curve),this.curveName===void 0&&(this.curveName=t),this.setNamedCurve(this.curveName),e!==void 0&&(e.prv!==void 0&&this.setPrivateKeyHex(e.prv),e.pub!==void 0&&this.setPublicKeyHex(e.pub))};A.crypto.ECDSA.parseSigHex=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=new ne(t.r,16),n=new ne(t.s,16);return{r,s:n}};A.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=xe,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 o=i[0],s=i[1];if(e.substr(o,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 a=n(e,o),u=n(e,s);return{r:a,s:u}};A.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=t.r,n=t.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var i=Math.max(r.length,n.length);return r=("000000"+r).slice(-i),n=("000000"+n).slice(-i),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};A.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),r=e.substr(e.length/2);return A.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};A.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new ne(e,16),n=new ne(t,16);return A.crypto.ECDSA.biRSSigToASN1Sig(r,n)};A.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=A.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t}),o=new r.DERSequence({array:[n,i]});return o.tohex()};A.crypto.ECDSA.getName=function(e){return e==="2b8104001f"?"secp192k1":e==="2a8648ce3d030107"?"secp256r1":e==="2b8104000a"?"secp256k1":e==="2b81040021"?"secp224r1":e==="2b81040022"?"secp384r1":e==="2b81040023"?"secp521r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)!==-1?"secp256r1":"|secp256k1|".indexOf(e)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(e)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(e)!==-1?"secp384r1":"|secp521r1|NIST P-521|P-521|".indexOf(e)!==-1?"secp521r1":null};(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECParameterDB=new function(){var e={},t={};function r(n){return new ne(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,o,s,a,u,l,h,m,p,d,v){e[n]={};var g=r(o),y=r(s),w=r(a),E=r(u),_=r(l),C=new fa(g,y,w),F=C.decodePointHex("04"+h+m);e[n].name=n,e[n].keylen=i,e[n].keycharlen=Math.ceil(i/8)*2,e[n].curve=C,e[n].G=F,e[n].n=E,e[n].h=_,e[n].oid=d,e[n].info=v;for(var H=0;H<p.length;H++)t[p[H]]=n}};A.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field");A.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field");A.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field");A.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]);A.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]);A.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]);A.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]);A.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]);A.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]);A.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.DSA=function(){var e=xe,t=e.getVbyList,r=e.getVbyListEx,n=e.isASN1HEX,i=ne,o=ne.ONE,s=function(a,u,l,h){if(a==null||u==null||l==null||h==null)throw new Error("invalid DSA public key");if(o.compareTo(u)>=0||u.compareTo(a)>=0)throw new Error("invalid DSA public key");if(o.compareTo(l)>=0||l.compareTo(a)>=0)throw new Error("invalid DSA public key");if(o.compareTo(h)>=0||h.compareTo(a)>=0)throw new Error("invalid DSA public key");if(l.modPow(u,a).compareTo(o)!=0)throw new Error("invalid DSA public key")};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,u,l,h,m){this.isPrivate=!0,this.p=a,this.q=u,this.g=l,this.y=h,this.x=m},this.setPrivateHex=function(a,u,l,h,m){var p,d,v,g,y;p=new ne(a,16),d=new ne(u,16),v=new ne(l,16),typeof h=="string"&&h.length>1?g=new ne(h,16):g=null,y=new ne(m,16),this.setPrivate(p,d,v,g,y)},this.setPublic=function(a,u,l,h){s(a,u,l,h),this.isPublic=!0,this.p=a,this.q=u,this.g=l,this.y=h,this.x=null},this.setPublicHex=function(a,u,l,h){var m,p,d,v;m=new ne(a,16),p=new ne(u,16),d=new ne(l,16),v=new ne(h,16),this.setPublic(m,p,d,v)},this.signWithMessageHash=function(a){var u=this.p,l=this.q,h=this.g,m=this.y,p=this.x,d=a.substr(0,l.bitLength()/4),v=new ne(d,16),g,y,w;do g=A.crypto.Util.getRandomBigIntegerMinToMax(ne.ONE.add(ne.ONE),l.subtract(ne.ONE)),y=h.modPow(g,u).mod(l),w=g.modInverse(l).multiply(v.add(p.multiply(y))).mod(l);while(y.compareTo(ne.ZERO)==0||w.compareTo(ne.ZERO)==0);var E=A.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:y}},{int:{bigint:w}}]});return E},this.verifyWithMessageHash=function(a,u){var l=this.p,h=this.q,m=this.g,p=this.y,d=this.parseASN1Signature(u),v=d[0],g=d[1],y=a.substr(0,h.bitLength()/4),w=new ne(y,16);if(ne.ZERO.compareTo(v)>=0||v.compareTo(h)>=0||ne.ZERO.compareTo(g)>=0||g.compareTo(h)>=0)throw"invalid DSA signature";var E=g.modInverse(h),_=w.multiply(E).mod(h),C=v.multiply(E).mod(h),F=m.modPow(_,l).multiply(p.modPow(C,l)).mod(l).mod(h);return F.compareTo(v)==0},this.parseASN1Signature=function(a){try{var u=new i(r(a,0,[0],"02"),16),l=new i(r(a,0,[1],"02"),16);return[u,l]}catch{throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(a){var u,l,h,m,p;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[1],"02"),l=r(a,0,[2],"02"),h=r(a,0,[3],"02"),m=r(a,0,[4],"02"),p=r(a,0,[5],"02")}catch{throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(u,l,h,m,p)},this.readPKCS8PrvKeyHex=function(a){var u,l,h,m;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[1,1,0],"02"),l=r(a,0,[1,1,1],"02"),h=r(a,0,[1,1,2],"02"),m=r(a,0,[2,0],"02")}catch{throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(u,l,h,null,m)},this.readPKCS8PubKeyHex=function(a){var u,l,h,m;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{u=r(a,0,[0,1,0],"02"),l=r(a,0,[0,1,1],"02"),h=r(a,0,[0,1,2],"02"),m=r(a,0,[1,0],"02")}catch{throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(u,l,h,m)},this.readCertPubKeyHex=function(a,u){var l,h,m,p;if(n(a)===!1)throw new Error("not ASN.1 hex string");try{l=r(a,0,[0,5,0,1,0],"02"),h=r(a,0,[0,5,0,1,1],"02"),m=r(a,0,[0,5,0,1,2],"02"),p=r(a,0,[0,5,1,0],"02")}catch{throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(l,h,m,p)}};var _t=(function(){var e=function(g,y,w){return n(ke.AES,g,y,w)},t=function(g,y,w){return n(ke.TripleDES,g,y,w)},r=function(g,y,w){return n(ke.DES,g,y,w)},n=function(g,y,w,E){var _=ke.enc.Hex.parse(y),C=ke.enc.Hex.parse(w),F=ke.enc.Hex.parse(E),H={};H.key=C,H.iv=F,H.ciphertext=_;var K=g.decrypt(H,C,{iv:F});return ke.enc.Hex.stringify(K)},i=function(g,y,w){return a(ke.AES,g,y,w)},o=function(g,y,w){return a(ke.TripleDES,g,y,w)},s=function(g,y,w){return a(ke.DES,g,y,w)},a=function(g,y,w,E){var _=ke.enc.Hex.parse(y),C=ke.enc.Hex.parse(w),F=ke.enc.Hex.parse(E),H=g.encrypt(_,C,{iv:F}),K=ke.enc.Hex.parse(H.toString()),S=ke.enc.Base64.stringify(K);return S},u={"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:o,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:s,keylen:8,ivlen:8}},l=function(g){return u[g].proc},h=function(g){var y=ke.lib.WordArray.random(g),w=ke.enc.Hex.stringify(y);return w},m=function(g){var y={},w=g.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));w&&(y.cipher=w[1],y.ivsalt=w[2]);var E=g.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));E&&(y.type=E[1]);var _=-1,C=0;g.indexOf(`\r
|
||
\r
|
||
`)!=-1&&(_=g.indexOf(`\r
|
||
\r
|
||
`),C=2),g.indexOf(`
|
||
|
||
`)!=-1&&(_=g.indexOf(`
|
||
|
||
`),C=1);var F=g.indexOf("-----END");if(_!=-1&&F!=-1){var H=g.substring(_+C*2,F-C);H=H.replace(/\s+/g,""),y.data=H}return y},p=function(g,y,w){for(var E=w.substring(0,16),_=ke.enc.Hex.parse(E),C=ke.enc.Utf8.parse(y),F=u[g].keylen+u[g].ivlen,H="",K=null;;){var S=ke.algo.MD5.create();if(K!=null&&S.update(K),S.update(C),S.update(_),K=S.finalize(),H=H+ke.enc.Hex.stringify(K),H.length>=F*2)break}var I={};return I.keyhex=H.substr(0,u[g].keylen*2),I.ivhex=H.substr(u[g].keylen*2,u[g].ivlen*2),I},d=function(g,y,w,E){var _=ke.enc.Base64.parse(g),C=ke.enc.Hex.stringify(_),F=u[y].proc,H=F(C,w,E);return H},v=function(g,y,w,E){var _=u[y].eproc,C=_(g,w,E);return C};return{version:"1.0.0",parsePKCS5PEM:function(g){return m(g)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(g,y,w){return p(g,y,w)},decryptKeyB64:function(g,y,w,E){return d(g,y,w,E)},getDecryptedKeyHex:function(g,y){var w=m(g),E=w.type,_=w.cipher,C=w.ivsalt,F=w.data,H=p(_,y,C),K=H.keyhex,S=d(F,_,K,C);return S},getEncryptedPKCS5PEMFromPrvKeyHex:function(g,y,w,E,_){var q="";if((typeof E>"u"||E==null)&&(E="AES-256-CBC"),typeof u[E]>"u")throw new Error("KEYUTIL unsupported algorithm: "+E);if(typeof _>"u"||_==null){var C=u[E].ivlen,F=h(C);_=F.toUpperCase()}var H=p(E,w,_),K=H.keyhex,S=v(y,E,K,_),I=S.replace(/(.{64})/g,`$1\r
|
||
`),q="-----BEGIN "+g+` PRIVATE KEY-----\r
|
||
`;return q+=`Proc-Type: 4,ENCRYPTED\r
|
||
`,q+="DEK-Info: "+E+","+_+`\r
|
||
`,q+=`\r
|
||
`,q+=I,q+=`\r
|
||
-----END `+g+` PRIVATE KEY-----\r
|
||
`,q},getEncryptedPKCS8PEM:function(g,y,w){var E=this.getEncryptedPKCS8Hex(g,y,w);return An(E,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(g,y,w){var E;w==null||w==null?E={}:E=JSON.parse(JSON.stringify(w)),E.plain=g,this.initPBES2Param(E),this.encryptPBES2Param(E,y);var _=this.generatePBES2ASN1Param(E);return A.asn1.ASN1Util.newObject(_).tohex()},initPBES2Param:function(g){if(Jt(g,"encalg")==null&&(g.encalg="aes256-CBC"),Jt(g,"iter")==null&&(g.iter=2048),Jt(g,"prf")==null&&(g.prf="hmacWithSHA256"),Jt(g,"salt")==null&&(g.salt=ke.enc.Hex.stringify(ke.lib.WordArray.random(8))),Jt(g,"enciv")==null){var y;g.encalg=="des-EDE3-CBC"&&(y=8),g.encalg=="aes128-CBC"&&(y=16),g.encalg=="aes256-CBC"&&(y=16),g.enciv=ke.enc.Hex.stringify(ke.lib.WordArray.random(y))}},encryptPBES2Param:function(g,y){var w=_t.getDKFromPBES2Param(g,y);try{var E=A.crypto.Cipher.encrypt(g.plain,w,g.encalg,{iv:g.enciv})}catch{throw new Error("encrypt error: "+g.plain+" "+w+" "+g.encalg+" "+g.enciv)}g.enc=E},generatePBES2ASN1Param:function(g){var y={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:g.salt}},{int:{hex:mC(g.iter)}}]}]},{seq:[{oid:g.encalg},{octstr:{hex:g.enciv}}]}]}]},{octstr:{hex:g.enc}}]};return g.prf!="hmacWithSHA1"&&y.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:g.prf},{null:""}]}),y},parseHexOfEncryptedPKCS8:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={},C=w(g,0);if(C.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+C.length);_.ciphertext=E(g,C[1]);var F=w(g,C[0]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+F.length);if(E(g,F[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var H=w(g,F[1]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+H.length);var K=w(g,H[1]);if(K.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+K.length);if(E(g,K[0])!="2a864886f70d0307")throw"this only supports TripleDES";_.encryptionSchemeAlg="TripleDES",_.encryptionSchemeIV=E(g,K[1]);var S=w(g,H[0]);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length);if(E(g,S[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var I=w(g,S[1]);if(I.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+I.length);_.pbkdf2Salt=E(g,I[0]);var q=E(g,I[1]);try{_.pbkdf2Iter=parseInt(q,16)}catch{throw new Error("malformed format pbkdf2Iter: "+q)}return _},getPBKDF2KeyHexFromParam:function(g,y){var w=ke.enc.Hex.parse(g.pbkdf2Salt),E=g.pbkdf2Iter,_=ke.PBKDF2(y,w,{keySize:192/32,iterations:E}),C=ke.enc.Hex.stringify(_);return C},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(g,y){var w=lr(g,"ENCRYPTED PRIVATE KEY"),E=this.parseHexOfEncryptedPKCS8(w),_=_t.getPBKDF2KeyHexFromParam(E,y),C={};C.ciphertext=ke.enc.Hex.parse(E.ciphertext);var F=ke.enc.Hex.parse(_),H=ke.enc.Hex.parse(E.encryptionSchemeIV),K=ke.TripleDES.decrypt(C,F,{iv:H}),S=ke.enc.Hex.stringify(K);return S},parsePBES2:function(g){var y=xe.parse(g);if(Jt(y,"seq.0.seq.0.oid")!="pkcs5PBES2"||Jt(y,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var w=Jt(y,"seq.0.seq.1.seq.0.seq.1.seq");if(w==null)throw new Error("PBKDF2 parameter not found");var E=Jt(w,"0.octstr.hex"),_=Jt(w,"1.int.hex"),C=Jt(w,"2.seq.0.oid","hmacWithSHA1"),F=-1;try{F=parseInt(_,16)}catch{throw new Error("iter not proper value")}var H=Jt(y,"seq.0.seq.1.seq.1.seq.0.oid"),K=Jt(y,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),S=Jt(y,"seq.1.octstr.hex");if(H==null||K==null||S==null)throw new Error("encalg, enciv or enc is undefined");var I={salt:E,iter:F,prf:C,encalg:H,enciv:K,enc:S};return I},getDKFromPBES2Param:function(g,y){var w={hmacWithSHA1:ke.algo.SHA1,hmacWithSHA224:ke.algo.SHA224,hmacWithSHA256:ke.algo.SHA256,hmacWithSHA384:ke.algo.SHA384,hmacWithSHA512:ke.algo.SHA512},E={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},_=w[g.prf];if(_==null)throw new Error("unsupported prf");var C=E[g.encalg];if(C==null)throw new Error("unsupported encalg");var F=ke.enc.Hex.parse(g.salt),H=g.iter;try{var K=ke.PBKDF2(y,F,{keySize:C,iterations:H,hasher:_});return ke.enc.Hex.stringify(K)}catch(S){throw new Error("PBKDF2 error: "+S+" "+JSON.stringify(g)+" "+y)}},getPlainHexFromEncryptedPKCS8PEM:function(g,y){if(g.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var w=lr(g),E;try{E=_t.parsePBES2(w)}catch(C){throw new Error("malformed PBES2 format: "+C.message)}var _=_t.getDKFromPBES2Param(E,y);return A.crypto.Cipher.decrypt(E.enc,_,E.encalg,{iv:E.enciv})},getKeyFromEncryptedPKCS8PEM:function(g,y){var w=this.getPlainHexFromEncryptedPKCS8PEM(g,y),E=this.getKeyFromPlainPrivatePKCS8Hex(w);return E},parsePlainPrivatePKCS8Hex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={};if(_.algparam=null,g.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var C=w(g,0);if(C.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(g.substr(C[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var F=w(g,C[1]);if(F.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(g.substr(F[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(_.algoid=E(g,F[0]),g.substr(F[1],2)=="06"&&(_.algparam=E(g,F[1])),g.substr(C[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return _.keyidx=y.getVidx(g,C[2]),_},getKeyFromPlainPrivatePKCS8PEM:function(g){var y=lr(g,"PRIVATE KEY"),w=this.getKeyFromPlainPrivatePKCS8Hex(y);return w},getKeyFromPlainPrivatePKCS8Hex:function(g){var y=this.parsePlainPrivatePKCS8Hex(g),w;if(y.algoid=="2a864886f70d010101")w=new at;else if(y.algoid=="2a8648ce380401")w=new A.crypto.DSA;else if(y.algoid=="2a8648ce3d0201")w=new A.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return w.readPKCS8PrvKeyHex(g),w},_getKeyFromPublicPKCS8Hex:function(g){var y,w=xe.getVbyList(g,0,[0,0],"06");if(w==="2a864886f70d010101")y=new at;else if(w==="2a8648ce380401")y=new A.crypto.DSA;else if(w==="2a8648ce3d0201")y=new A.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return y.readPKCS8PubKeyHex(g),y},parsePublicRawRSAKeyHex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={};if(g.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var C=w(g,0);if(C.length!=2)throw new Error("malformed RSA key(code:002)");if(g.substr(C[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(_.n=E(g,C[0]),g.substr(C[1],2)!="02")throw new Error("malformed RSA key(code:004)");return _.e=E(g,C[1]),_},parsePublicPKCS8Hex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={};_.algparam=null;var C=w(g,0);if(C.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+C.length);var F=C[0];if(g.substr(F,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var H=w(g,F);if(H.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(g.substr(H[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(_.algoid=E(g,H[0]),g.substr(H[1],2)=="06"?_.algparam=E(g,H[1]):g.substr(H[1],2)=="30"&&(_.algparam={},_.algparam.p=y.getVbyList(g,H[1],[0],"02"),_.algparam.q=y.getVbyList(g,H[1],[1],"02"),_.algparam.g=y.getVbyList(g,H[1],[2],"02")),g.substr(C[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return _.key=E(g,C[1]).substr(2),_}}})();_t.getKey=function(e,t,r){var n=xe,i=n.getChildIdx,o=n.getV,s=n.getVbyList,a=A.crypto,u=a.ECDSA,l=a.DSA,h=at,m=lr,p=_t;if(typeof h<"u"&&e instanceof h||typeof u<"u"&&e instanceof u||typeof l<"u"&&e instanceof l)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new u({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new u({prv:e.d,curve:e.curve});if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var d=new h;return d.setPublic(e.n,e.e),d}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 d=new h;return d.setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),d}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p===void 0){var d=new h;return d.setPrivate(e.n,e.e,e.d),d}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x===void 0){var d=new l;return d.setPublic(e.p,e.q,e.g,e.y),d}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x!==void 0){var d=new l;return d.setPrivate(e.p,e.q,e.g,e.y,e.x),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var d=new h;return d.setPublic(rr(e.n),rr(e.e)),d}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 d=new h;return d.setPrivateEx(rr(e.n),rr(e.e),rr(e.d),rr(e.p),rr(e.q),rr(e.dp),rr(e.dq),rr(e.qi)),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var d=new h;return d.setPrivate(rr(e.n),rr(e.e),rr(e.d)),d}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var v=new u({curve:e.crv}),g=v.ecparams.keycharlen,y=("0000000000"+rr(e.x)).slice(-g),w=("0000000000"+rr(e.y)).slice(-g),E="04"+y+w;return v.setPublicKeyHex(E),v}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var v=new u({curve:e.crv}),g=v.ecparams.keycharlen,y=("0000000000"+rr(e.x)).slice(-g),w=("0000000000"+rr(e.y)).slice(-g),E="04"+y+w,_=("0000000000"+rr(e.d)).slice(-g);return v.setPublicKeyHex(E),v.setPrivateKeyHex(_),v}if(r==="pkcs5prv"){var C=e,n=xe,F,d;if(F=i(C,0),F.length===9)d=new h,d.readPKCS5PrvKeyHex(C);else if(F.length===6)d=new l,d.readPKCS5PrvKeyHex(C);else if(F.length>2&&C.substr(F[1],2)==="04")d=new u,d.readPKCS5PrvKeyHex(C);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return d}if(r==="pkcs8prv"){var d=p.getKeyFromPlainPrivatePKCS8Hex(e);return d}if(r==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(e);if(r==="x509pub")return tt.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return tt.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var H=lr(e,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(H)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var K=m(e,"RSA PRIVATE KEY");return p.getKey(K,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var S=m(e,"DSA PRIVATE KEY"),I=s(S,0,[1],"02"),q=s(S,0,[2],"02"),L=s(S,0,[3],"02"),R=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new ne(I,16),new ne(q,16),new ne(L,16),new ne(R,16),new ne(O,16)),d}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var K=m(e,"EC PRIVATE KEY");return p.getKey(K,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 T=p.getDecryptedKeyHex(e,t),N=new at;return N.readPKCS5PrvKeyHex(T),N}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),d=s(S,0,[1],"04"),P=s(S,0,[2,0],"06"),M=s(S,0,[3,0],"03").substr(2),Y="";if(A.crypto.OID.oidhex2name[P]!==void 0)Y=A.crypto.OID.oidhex2name[P];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+P);var v=new u({curve:Y});return v.setPublicKeyHex(M),v.setPrivateKeyHex(d),v.isPublic=!1,v}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),I=s(S,0,[1],"02"),q=s(S,0,[2],"02"),L=s(S,0,[3],"02"),R=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new ne(I,16),new ne(q,16),new ne(L,16),new ne(R,16),new ne(O,16)),d}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};_t.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new at;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new at,o=n.n.toString(16),s=n.e.toString(16);i.setPublic(o,s),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}else if(e=="EC"){var u=t,l=new A.crypto.ECDSA({curve:u}),h=l.generateKeyPairHex(),n=new A.crypto.ECDSA({curve:u});n.setPublicKeyHex(h.ecpubhex),n.setPrivateKeyHex(h.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new A.crypto.ECDSA({curve:u});i.setPublicKeyHex(h.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}else throw new Error("unknown algorithm: "+e)};_t.getPEM=function(e,t,r,n,i,o){var s=A,a=s.asn1,u=a.DERObjectIdentifier,l=a.DERInteger,h=a.ASN1Util.newObject,m=a.x509,p=m.SubjectPublicKeyInfo,d=s.crypto,v=d.DSA,g=d.ECDSA,y=at;function w(N){var P=h({seq:[{int:0},{int:{bigint:N.n}},{int:N.e},{int:{bigint:N.d}},{int:{bigint:N.p}},{int:{bigint:N.q}},{int:{bigint:N.dmp1}},{int:{bigint:N.dmq1}},{int:{bigint:N.coeff}}]});return P}function E(N){var P=h({seq:[{int:1},{octstr:{hex:N.prvKeyHex}},{tag:["a0",!0,{oid:{name:N.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+N.pubKeyHex}}]}]});return P}function _(N){var P=h({seq:[{int:0},{int:{bigint:N.p}},{int:{bigint:N.q}},{int:{bigint:N.g}},{int:{bigint:N.y}},{int:{bigint:N.x}}]});return P}if((y!==void 0&&e instanceof y||v!==void 0&&e instanceof v||g!==void 0&&e instanceof g)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var C=new p(e),F=C.tohex();return An(F,"PUBLIC KEY")}if(t=="PKCS1PRV"&&y!==void 0&&e instanceof y&&(r===void 0||r==null)&&e.isPrivate==!0){var C=w(e),F=C.tohex();return An(F,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&g!==void 0&&e instanceof g&&(r===void 0||r==null)&&e.isPrivate==!0){var H=new u({name:e.curveName}),K=H.tohex(),S=E(e),I=S.tohex(),q="";return q+=An(K,"EC PARAMETERS"),q+=An(I,"EC PRIVATE KEY"),q}if(t=="PKCS1PRV"&&v!==void 0&&e instanceof v&&(r===void 0||r==null)&&e.isPrivate==!0){var C=_(e),F=C.tohex();return An(F,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&y!==void 0&&e instanceof y&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=w(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",F,r,n,o)}if(t=="PKCS5PRV"&&g!==void 0&&e instanceof g&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=E(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",F,r,n,o)}if(t=="PKCS5PRV"&&v!==void 0&&e instanceof v&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=_(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",F,r,n,o)}var L=function(N,P){if(typeof P=="string")return _t.getEncryptedPKCS8PEM(N,P);if(typeof P=="object"&&Jt(P,"passcode")!=null){var M=JSON.parse(JSON.stringify(P)),Y=M.passcode;return delete M.passcode,_t.getEncryptedPKCS8PEM(N,Y,M)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var R=w(e),O=R.tohex(),C=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:O}}]}),F=C.tohex();return r===void 0||r==null?An(F,"PRIVATE KEY"):L(F,r)}if(t=="PKCS8PRV"&&g!==void 0&&e instanceof g&&e.isPrivate==!0){var T={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&T.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var R=new h(T),O=R.tohex(),C=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:O}}]}),F=C.tohex();return r===void 0||r==null?An(F,"PRIVATE KEY"):L(F,r)}if(t=="PKCS8PRV"&&v!==void 0&&e instanceof v&&e.isPrivate==!0){var R=new l({bigint:e.x}),O=R.tohex(),C=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:O}}]}),F=C.tohex();return r===void 0||r==null?An(F,"PRIVATE KEY"):L(F,r)}throw new Error("unsupported object nor format")};_t.getKeyFromCSRPEM=function(e){var t=lr(e,"CERTIFICATE REQUEST"),r=_t.getKeyFromCSRHex(t);return r};_t.getKeyFromCSRHex=function(e){var t=_t.parseCSRHex(e),r=_t.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};_t.parseCSRHex=function(e){var t=xe,r=t.getChildIdx,n=t.getTLV,i={},o=e;if(o.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var s=r(o,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if(o.substr(s[0],2)!="30")throw new Error("malformed CSR(code:003)");var a=r(o,s[0]);if(a.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(o,a[2]),i};_t.getKeyID=function(e){var t=_t,r=xe;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=lr(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),o=r.getV(n,i).substring(2);return A.crypto.Util.hashHex(o,"sha1")};_t.getJWK=function(e,t,r,n,i){var o,s={},a,u=A.crypto.Util.hashHex;if(typeof e=="string")o=_t.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(a=lr(e));else if(typeof e=="object")e instanceof tt?(o=e.getPublicKey(),a=e.hex):o=e;else throw new Error("unsupported keyinfo type");if(o instanceof at&&o.isPrivate)s.kty="RSA",s.n=Or(o.n.toString(16)),s.e=Or(o.e.toString(16)),s.d=Or(o.d.toString(16)),s.p=Or(o.p.toString(16)),s.q=Or(o.q.toString(16)),s.dp=Or(o.dmp1.toString(16)),s.dq=Or(o.dmq1.toString(16)),s.qi=Or(o.coeff.toString(16));else if(o instanceof at&&o.isPublic)s.kty="RSA",s.n=Or(o.n.toString(16)),s.e=Or(o.e.toString(16));else if(o instanceof A.crypto.ECDSA&&o.isPrivate){var l=o.getShortNISTPCurveName();if(l!=="P-256"&&l!=="P-384"&&l!=="P-521")throw new Error("unsupported curve name for JWT: "+l);var h=o.getPublicKeyXYHex();s.kty="EC",s.crv=l,s.x=Or(h.x),s.y=Or(h.y),s.d=Or(o.prvKeyHex)}else if(o instanceof A.crypto.ECDSA&&o.isPublic){var l=o.getShortNISTPCurveName();if(l!=="P-256"&&l!=="P-384"&&l!=="P-521")throw new Error("unsupported curve name for JWT: "+l);var h=o.getPublicKeyXYHex();s.kty="EC",s.crv=l,s.x=Or(h.x),s.y=Or(h.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!o.isPrivate&&t!=!0&&(s.kid=A.jws.JWS.getJWKthumbprint(s)),a!=null&&r!=!0&&(s.x5c=[la(a)]),a!=null&&n!=!0&&(s.x5t=Jl(la(u(a,"sha1")))),a!=null&&i!=!0&&(s["x5t#S256"]=Jl(la(u(a,"sha256")))),s};_t.getJWKFromKey=function(e){return _t.getJWK(e,!0,!0,!0,!0)};at.getPosArrayOfChildrenFromHex=function(e){return xe.getChildIdx(e,0)};at.getHexValueArrayOfChildrenFromHex=function(e){var t=xe,r=t.getV,p=at.getPosArrayOfChildrenFromHex(e),n=r(e,p[0]),i=r(e,p[1]),o=r(e,p[2]),s=r(e,p[3]),a=r(e,p[4]),u=r(e,p[5]),l=r(e,p[6]),h=r(e,p[7]),m=r(e,p[8]),p=new Array;return p.push(n,i,o,s,a,u,l,h,m),p};at.prototype.readPrivateKeyFromPEMString=function(e){var t=lr(e),r=at.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])};at.prototype.readPKCS5PrvKeyHex=function(e){var t=at.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])};at.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,o,s,a,u,l=xe,h=l.getVbyListEx;if(l.isASN1HEX(e)===!1)throw new Error("not ASN.1 hex string");try{t=h(e,0,[2,0,1],"02"),r=h(e,0,[2,0,2],"02"),n=h(e,0,[2,0,3],"02"),i=h(e,0,[2,0,4],"02"),o=h(e,0,[2,0,5],"02"),s=h(e,0,[2,0,6],"02"),a=h(e,0,[2,0,7],"02"),u=h(e,0,[2,0,8],"02")}catch{throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,i,o,s,a,u)};at.prototype.readPKCS5PubKeyHex=function(e){var t=xe,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]),o=r(e,n[1]);this.setPublic(i,o)};at.prototype.readPKCS8PubKeyHex=function(e){var t=xe;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)};at.prototype.readCertPubKeyHex=function(e,t){var r,n;r=new tt,r.readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var Wne=new RegExp("[^0-9a-f]","gi");function yC(e,t){for(var r="",n=t/4-e.length,i=0;i<n;i++)r=r+"0";return r+e}at.prototype.sign=function(e,t){var r=function(i){return A.crypto.Util.hashString(i,t)},n=r(e);return this.signWithMessageHash(n,t)};at.prototype.signWithMessageHash=function(e,t){var r=A.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),n=ls(r,16),i=this.doPrivate(n),o=i.toString(16);return yC(o,this.n.bitLength())};function EC(e,t,r){for(var n="",i=0;n.length<t;)n+=ds(r(ao(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}at.prototype.signPSS=function(e,t,r){var n=function(o){return A.crypto.Util.hashHex(o,t)},i=n(ao(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,t,r)};at.prototype.signWithMessageHashPSS=function(e,t,r){var n=ds(e),i=n.length,o=this.n.bitLength()-1,s=Math.ceil(o/8),a,u=function(y){return A.crypto.Util.hashHex(y,t)};if(r===-1||r===void 0)r=i;else if(r===-2)r=s-i-2;else if(r<-2)throw new Error("invalid salt length");if(s<i+r+2)throw new Error("data too long");var l="";r>0&&(l=new Array(r),new rf().nextBytes(l),l=String.fromCharCode.apply(String,l));var h=ds(u(ao("\0\0\0\0\0\0\0\0"+n+l))),m=[];for(a=0;a<s-r-i-2;a+=1)m[a]=0;var p=String.fromCharCode.apply(String,m)+""+l,d=EC(h,p.length,u),v=[];for(a=0;a<p.length;a+=1)v[a]=p.charCodeAt(a)^d.charCodeAt(a);var g=65280>>8*s-o&255;for(v[0]&=~g,a=0;a<i;a++)v.push(h.charCodeAt(a));return v.push(188),yC(this.doPrivate(new ne(v)).toString(16),this.n.bitLength())};function bC(e){for(var t in A.crypto.Util.DIGESTINFOHEAD){var r=A.crypto.Util.DIGESTINFOHEAD[t],n=r.length;if(e.substring(0,n)==r){var i=[t,e.substring(n)];return i}}return[]}at.prototype.verify=function(e,t){if(t=t.toLowerCase(),t.match(/^[0-9a-f]+$/)==null)return!1;var r=ls(t,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r),o=i.toString(16);if(o.length+3!=n/4)return!1;var s=o.replace(/^1f+00/,""),a=bC(s);if(a.length==0)return!1;var u=a[0],l=a[1],h=function(p){return A.crypto.Util.hashString(p,u)},m=h(e);return l==m};at.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=ls(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),o=bC(i);if(o.length==0)return!1;var s=o[0],a=o[1];return a==e};at.prototype.verifyPSS=function(e,t,r,n){var i=function(s){return A.crypto.Util.hashHex(s,r)},o=i(ao(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(o,t,r,n)};at.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new ne(t,16),o=function(E){return A.crypto.Util.hashHex(E,r)},s=ds(e),a=s.length,u=this.n.bitLength()-1,l=Math.ceil(u/8),h;if(n===-1||n===void 0)n=a;else if(n===-2)n=l-a-2;else if(n<-2)throw new Error("invalid salt length");if(l<a+n+2)throw new Error("data too long");var m=this.doPublic(i).toByteArray();for(h=0;h<m.length;h+=1)m[h]&=255;for(;m.length<l;)m.unshift(0);if(m[l-1]!==188)throw new Error("encoded message does not end in 0xbc");m=String.fromCharCode.apply(String,m);var p=m.substr(0,l-a-1),d=m.substr(p.length,a),v=65280>>8*l-u&255;if((p.charCodeAt(0)&v)!==0)throw new Error("bits beyond keysize not zero");var g=EC(d,p.length,o),y=[];for(h=0;h<p.length;h+=1)y[h]=p.charCodeAt(h)^g.charCodeAt(h);y[0]&=~v;var w=l-a-n-2;for(h=0;h<w;h+=1)if(y[h]!==0)throw new Error("leftmost octets not zero");if(y[w]!==1)throw new Error("0x01 marker not found");return d===ds(o(ao("\0\0\0\0\0\0\0\0"+s+String.fromCharCode.apply(String,y.slice(-n)))))};at.SALT_LEN_HLEN=-1;at.SALT_LEN_MAX=-2;at.SALT_LEN_RECOVER=-2;function tt(e){var t=xe,r=t.getChildIdx,n=t.getV,i=t.dump,o=t.parse,s=t.getTLV,a=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,h=t.getTLVbyListEx,m=t.getIdxbyList,p=t.getIdxbyListEx,d=t.getVidx,v=t.getInt,g=t.oidname,y=t.hextooidstr,w=tt,E=lr,_,C=Error;try{_=A.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 S=l(this.hex,0,[0,0]);if(S.substr(0,2)=="a0"){var I=l(S,0,[0]),q=v(I,0);if(q<0||2<q)throw new Error("malformed version field");return this.version=q+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var S=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(S)},this.getAlgorithmIdentifierName=function(S){for(var I in _)if(S===_[I])return I;return g(u(S,0,[0],"06"))},this.getIssuer=function(S,I){return this.getX500Name(this.getIssuerHex(),S,I)},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var S=this.getIssuer();return S.str},this.getSubject=function(S,I){return this.getX500Name(this.getSubjectHex(),S,I)},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var S=this.getSubject();return S.str},this.getNotBefore=function(){var S=a(this.hex,0,[0,4+this.foffset,0]);return S=S.replace(/(..)/g,"%$1"),S=decodeURIComponent(S),S},this.getNotAfter=function(){var S=a(this.hex,0,[0,4+this.foffset,1]);return S=S.replace(/(..)/g,"%$1"),S=decodeURIComponent(S),S},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var S=this.getSPKI();return S==null?null:a(S,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return m(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var S=this.getPublicKeyIdx();return m(this.hex,S,[1,0],"30")},this.getPublicKey=function(){return _t.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var S=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(S)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(S){var I=this.getSignatureAlgorithmField(),q=this.getSignatureValueHex(),L=l(this.hex,0,[0],"30"),R=new A.crypto.Signature({alg:I});return R.init(S),R.updateHex(L),R.verify(q)},this.parseExt=function(S){var I,q,L;if(S===void 0){if(L=this.hex,this.version!==3)return-1;I=m(L,0,[0,7,0],"30"),q=r(L,I)}else{L=lr(S);var R=m(L,0,[0,3,0,0],"06");if(n(L,R)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}I=m(L,0,[0,3,0,1,0],"30"),q=r(L,I),this.hex=L}this.aExtInfo=new Array;for(var O=0;O<q.length;O++){var T={};T.critical=!1;var N=r(L,q[O]),P=0;N.length===3&&(T.critical=!0,P=1),T.oid=t.hextooidstr(a(L,q[O],[0],"06"));var M=m(L,q[O],[1+P]);T.vidx=d(L,M),this.aExtInfo.push(T)}},this.getExtInfo=function(S){var I=this.aExtInfo,q=S;if(S.match(/^[0-9.]+$/)||(q=A.asn1.x509.OID.name2oid(S)),q!==""){for(var L=0;L<I.length;L++)if(I[L].oid===q)return I[L]}},this.getCriticalExtV=function(S,I,q){if(I!=null)return[I,q];var L=this.getExtInfo(S);return L==null?[null,null]:[s(this.hex,L.vidx),L.critical]},this.getExtBasicConstraints=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("basicConstraints");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"basicConstraints"};if(I&&(L.critical=!0),S==="3000")return L;if(S==="30030101ff")return L.cA=!0,L;if(S.substr(0,12)==="30060101ff02"){var R=n(S,10),O=parseInt(R,16);return L.cA=!0,L.pathLen=O,L}throw new Error("hExtV parse error: "+S)},this.getExtNameConstraints=function(S,I){var q=this.getCriticalExtV("nameConstraints",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"nameConstraints"};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){for(var T=[],N=r(S,R[O]),P=0;P<N.length;P++){var M=s(S,N[P]),Y=this.getGeneralSubtree(M);T.push(Y)}var V=S.substr(R[O],2);V=="a0"?L.permit=T:V=="a1"&&(L.exclude=T)}return L}},this.getGeneralSubtree=function(S){var I=r(S,0),q=I.length;if(q<1||2<q)throw new Error("wrong num elements");for(var L=this.getGeneralName(s(S,I[0])),R=1;R<q;R++){var O=S.substr(I[R],2),T=n(S,I[R]),N=parseInt(T,16);O=="80"&&(L.min=N),O=="81"&&(L.max=N)}return L},this.getExtKeyUsage=function(S,I){var q=this.getCriticalExtV("keyUsage",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"keyUsage"};return I&&(L.critical=!0),L.names=this.getExtKeyUsageString(S).split(","),L}},this.getExtKeyUsageBin=function(S){if(S===void 0){var I=this.getExtInfo("keyUsage");if(I===void 0)return"";S=s(this.hex,I.vidx)}if(S.length!=8&&S.length!=10)throw new Error("malformed key usage value: "+S);var q="000000000000000"+parseInt(S.substr(6),16).toString(2);return S.length==8&&(q=q.slice(-8)),S.length==10&&(q=q.slice(-16)),q=q.replace(/0+$/,""),q==""&&(q="0"),q},this.getExtKeyUsageString=function(S){for(var I=this.getExtKeyUsageBin(S),q=new Array,L=0;L<I.length;L++)I.substr(L,1)=="1"&&q.push(tt.KEYUSAGE_NAME[L]);return q.join(",")},this.getExtSubjectKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectKeyIdentifier");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectKeyIdentifier"};I&&(L.critical=!0);var R=n(S,0);return L.kid={hex:R},L},this.getExtAuthorityKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("authorityKeyIdentifier");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"authorityKeyIdentifier"};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=S.substr(R[O],2);if(T==="80"&&(L.kid={hex:n(S,R[O])}),T==="a1"){var N=s(S,R[O]),P=this.getGeneralNames(N);L.issuer=P[0].dn}T==="82"&&(L.sn={hex:n(S,R[O])})}return L},this.getExtExtKeyUsage=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("extKeyUsage");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"extKeyUsage",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++)L.array.push(g(n(S,R[O])));return L},this.getExtExtKeyUsageName=function(){var S=this.getExtInfo("extKeyUsage");if(S===void 0)return S;var I=new Array,q=s(this.hex,S.vidx);if(q==="")return I;for(var L=r(q,0),R=0;R<L.length;R++)I.push(g(n(q,L[R])));return I},this.getExtSubjectAltName=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectAltName");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectAltName",array:[]};return I&&(L.critical=!0),L.array=this.getGeneralNames(S),L},this.getExtIssuerAltName=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("issuerAltName");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"issuerAltName",array:[]};return I&&(L.critical=!0),L.array=this.getGeneralNames(S),L},this.getGeneralNames=function(S){for(var I=r(S,0),q=[],L=0;L<I.length;L++){var R=this.getGeneralName(s(S,I[L]));R!==void 0&&q.push(R)}return q},this.getGeneralName=function(S){var I=S.substr(0,2),q=n(S,0),L=ds(q);if(I=="81")return{rfc822:L};if(I=="82")return{dns:L};if(I=="86")return{uri:L};if(I=="87")return{ip:o1(q)};if(I=="a4")return{dn:this.getX500Name(q)};if(I=="a0")return{other:this.getOtherName(S)}},this.getExtSubjectAltName2=function(){var S,I,q,L=this.getExtInfo("subjectAltName");if(L===void 0)return L;for(var R=new Array,O=s(this.hex,L.vidx),T=r(O,0),N=0;N<T.length;N++)q=O.substr(T[N],2),S=n(O,T[N]),q==="81"&&(I=Gt(S),R.push(["MAIL",I])),q==="82"&&(I=Gt(S),R.push(["DNS",I])),q==="84"&&(I=tt.hex2dn(S,0),R.push(["DN",I])),q==="86"&&(I=Gt(S),R.push(["URI",I])),q==="87"&&(I=o1(S),R.push(["IP",I]));return R},this.getExtCRLDistributionPoints=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("cRLDistributionPoints");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"cRLDistributionPoints",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=s(S,R[O]);L.array.push(this.getDistributionPoint(T))}return L},this.getDistributionPoint=function(S){for(var I={},q=r(S,0),L=0;L<q.length;L++){var R=S.substr(q[L],2),O=s(S,q[L]);R=="a0"&&(I.dpname=this.getDistributionPointName(O))}return I},this.getDistributionPointName=function(S){for(var I={},q=r(S,0),L=0;L<q.length;L++){var R=S.substr(q[L],2),O=s(S,q[L]);R=="a0"&&(I.full=this.getGeneralNames(O))}return I},this.getExtCRLDistributionPointsURI=function(){var S=this.getExtCRLDistributionPoints();if(S==null)return S;for(var I=S.array,q=[],L=0;L<I.length;L++)try{I[L].dpname.full[0].uri!=null&&q.push(I[L].dpname.full[0].uri)}catch{}return q},this.getExtAIAInfo=function(){var S=this.getExtInfo("authorityInfoAccess");if(S===void 0)return S;for(var I={ocsp:[],caissuer:[]},q=r(this.hex,S.vidx),L=0;L<q.length;L++){var R=a(this.hex,q[L],[0],"06"),O=a(this.hex,q[L],[1],"86");R==="2b06010505073001"&&I.ocsp.push(Gt(O)),R==="2b06010505073002"&&I.caissuer.push(Gt(O))}return I},this.getExtAuthorityInfoAccess=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("authorityInfoAccess");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"authorityInfoAccess",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=u(S,R[O],[0],"06"),N=a(S,R[O],[1],"86"),P=Gt(N);if(T=="2b06010505073001")L.array.push({ocsp:P});else if(T=="2b06010505073002")L.array.push({caissuer:P});else throw new Error("unknown method: "+T)}return L},this.getExtCertificatePolicies=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("certificatePolicies");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"certificatePolicies",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=s(S,R[O]),N=this.getPolicyInformation(T);L.array.push(N)}return L},this.getPolicyInformation=function(S){var I={},q=a(S,0,[0],"06");I.policyoid=g(q);var L=p(S,0,[1],"30");if(L!=-1){I.array=[];for(var R=r(S,L),O=0;O<R.length;O++){var T=s(S,R[O]),N=this.getPolicyQualifierInfo(T);I.array.push(N)}}return I},this.getOtherName=function(S){var I={},q=r(S,0),L=a(S,q[0],[],"06"),R=a(S,q[1],[]);return I.oid=g(L),I.value=o(R),I},this.getPolicyQualifierInfo=function(S){var I={},q=a(S,0,[0],"06");if(q==="2b06010505070201"){var L=u(S,0,[1],"16");I.cps=ds(L)}else if(q==="2b06010505070202"){var R=l(S,0,[1],"30");I.unotice=this.getUserNotice(R)}return I},this.getUserNotice=function(S){var I=null,q={};try{I=t.parse(S);var L=this._asn1ToUnotice(I);return L}catch{return}},this._asn1ToUnotice=function(S){try{for(var I={},q=Jt(S,"seq"),L=0;L<q.length;L++){var R=this._asn1ToNoticeRef(q[L]);R!=null&&(I.noticeref=R);var O=this.asn1ToDisplayText(q[L]);O!=null&&(I.exptext=O)}return Object.keys(I).length>0?I:void 0}catch{return}},this._asn1ToNoticeRef=function(S){try{for(var I={},q=Jt(S,"seq"),L=0;L<q.length;L++){var R=this._asn1ToNoticeNum(q[L]);R!=null&&(I.noticenum=R);var O=this.asn1ToDisplayText(q[L]);O!=null&&(I.org=O)}return Object.keys(I).length>0?I:void 0}catch{return}},this._asn1ToNoticeNum=function(S){try{for(var I=Jt(S,"seq"),q=[],L=0;L<I.length;L++){var R=I[L];q.push(parseInt(Jt(R,"int.hex"),16))}return q}catch{return}},this.getDisplayText=function(S){var I={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},q={};return q.type=I[S.substr(0,2)],q.str=ds(n(S,0)),q},this.asn1ToDisplayText=function(S){if(S.utf8str!=null)return{type:"utf8",str:S.utf8str.str};if(S.ia5str!=null)return{type:"ia5",str:S.ia5str.str};if(S.visstr!=null)return{type:"vis",str:S.visstr.str};if(S.bmpstr!=null)return{type:"bmp",str:S.bmpstr.str};if(S.prnstr!=null)return{type:"prn",str:S.prnstr.str}},this.getExtPolicyMappings=function(S,I){var q=this.getCriticalExtV("policyMappings",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"policyMappings"};I&&(L.critical=!0);try{for(var R=o(S),O=R.seq,T=[],N=0;N<O.length;N++){var P=O[N].seq;T.push([P[0].oid,P[1].oid])}L.array=T}catch{throw new C("malformed policyMappings")}return L}},this.getExtPolicyConstraints=function(S,I){var q=this.getCriticalExtV("policyConstraints",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"policyConstraints"};I&&(L.critical=!0);var R=o(S);try{for(var O=R.seq,T=0;T<O.length;T++){var N=O[T].tag;N.explicit==!1&&(N.tag=="80"&&(L.reqexp=parseInt(N.hex,16)),N.tag=="81"&&(L.inhibit=parseInt(N.hex,16)))}}catch{return new C("malformed policyConstraints value")}return L}},this.getExtInhibitAnyPolicy=function(S,I){var q=this.getCriticalExtV("inhibitAnyPolicy",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"inhibitAnyPolicy"};I&&(L.critical=!0);var R=v(S,0);return R==-1?new C("wrong value"):(L.skip=R,L)}},this.getExtCRLNumber=function(S,I){var q={extname:"cRLNumber"};if(I&&(q.critical=!0),S.substr(0,2)=="02")return q.num={hex:n(S,0)},q;throw new C("hExtV parse error: "+S)},this.getExtCRLReason=function(S,I){var q={extname:"cRLReason"};if(I&&(q.critical=!0),S.substr(0,2)=="0a")return q.code=parseInt(n(S,0),16),q;throw new Error("hExtV parse error: "+S)},this.getExtOcspNonce=function(S,I){var q={extname:"ocspNonce"};I&&(q.critical=!0);var L=n(S,0);return q.hex=L,q},this.getExtOcspNoCheck=function(S,I){var q={extname:"ocspNoCheck"};return I&&(q.critical=!0),q},this.getExtAdobeTimeStamp=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("adobeTimeStamp");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"adobeTimeStamp"};I&&(L.critical=!0);var R=r(S,0);if(R.length>1){var O=s(S,R[1]),T=this.getGeneralName(O);T.uri!=null&&(L.uri=T.uri)}if(R.length>2){var N=s(S,R[2]);N=="0101ff"&&(L.reqauth=!0),N=="010100"&&(L.reqauth=!1)}return L},this.getExtSubjectDirectoryAttributes=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectDirectoryAttributes");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectDirectoryAttributes"};I&&(L.critical=!0);try{for(var R=o(S),O=[],T=0;T<R.seq.length;T++){var N=R.seq[T],P=Jt(N,"seq.0.oid"),M=Jt(N,"seq.1.set");if(P==null||M==null)throw"error";O.push({attr:P,array:M})}return L.array=O,L}catch{throw new Error("malformed subjectDirectoryAttributes extension value")}};var F=function(S){var I={};try{var q=S.seq[0].oid,L=A.asn1.x509.OID.name2oid(q);I.type=A.asn1.x509.OID.oid2atype(L);var R=S.seq[1];if(R.utf8str!=null)I.ds="utf8",I.value=R.utf8str.str;else if(R.numstr!=null)I.ds="num",I.value=R.numstr.str;else if(R.telstr!=null)I.ds="tel",I.value=R.telstr.str;else if(R.prnstr!=null)I.ds="prn",I.value=R.prnstr.str;else if(R.ia5str!=null)I.ds="ia5",I.value=R.ia5str.str;else if(R.visstr!=null)I.ds="vis",I.value=R.visstr.str;else if(R.bmpstr!=null)I.ds="bmp",I.value=R.bmpstr.str;else throw"error";return I}catch{throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},H=function(S){try{return S.set.map(function(I){return F(I)})}catch(I){throw new Error("improper ASN.1 parsed RDN: "+I)}},K=function(S){try{return S.seq.map(function(I){return H(I)})}catch(I){throw new Error("improper ASN.1 parsed X500Name: "+I)}};this.getX500NameRule=function(S){for(var I=!0,q=!0,L=!1,R="",O="",T=null,N=[],P=0;P<S.length;P++)for(var M=S[P],Y=0;Y<M.length;Y++)N.push(M[Y]);for(var P=0;P<N.length;P++){var V=N[P],X=V.ds,te=V.value,ae=V.type;if(R+=":"+X,X!="prn"&&X!="utf8"&&X!="ia5")return"mixed";if(X=="ia5"){if(ae!="CN")return"mixed";if(A.lang.String.isMail(te))continue;return"mixed"}if(ae=="C"){if(X=="prn")continue;return"mixed"}if(O+=":"+X,T==null)T=X;else if(T!==X)return"mixed"}return T??"prn"},this.getAttrTypeAndValue=function(S){var I=o(S);return F(I)},this.getRDN=function(S){var I=o(S);return H(I)},this.getX500NameArray=function(S){var I=o(S);return K(I)},this.getX500Name=function(S,I,q){var L=this.getX500NameArray(S),R=this.dnarraytostr(L),O={str:R};return O.array=L,q==!0&&(O.hex=S),I==!0&&(O.canon=this.c14nRDNArray(L)),O},this.readCertPEM=function(S){this.readCertHex(E(S))},this.readCertHex=function(S){this.hex=S,this.getVersion();try{m(this.hex,0,[0,7],"a3"),this.parseExt()}catch{}},this.getParam=function(S){var I={};return S==null&&(S={}),I.version=this.getVersion(),I.serial={hex:this.getSerialNumberHex()},I.sigalg=this.getSignatureAlgorithmField(),I.issuer=this.getIssuer(S.dncanon,S.dnhex),I.notbefore=this.getNotBefore(),I.notafter=this.getNotAfter(),I.subject=this.getSubject(S.dncanon,S.dnhex),I.sbjpubkey=An(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo!=null&&this.aExtInfo.length>0&&(I.ext=this.getExtParamArray()),I.sighex=this.getSignatureValueHex(),S.tbshex==!0&&(I.tbshex=l(this.hex,0,[0])),S.nodnarray==!0&&(delete I.issuer.array,delete I.subject.array),I},this.getExtParamArray=function(S){if(S==null){var I=p(this.hex,0,[0,"[3]"]);I!=-1&&(S=h(this.hex,0,[0,"[3]",0],"30"))}for(var q=[],L=r(S,0),R=0;R<L.length;R++){var O=s(S,L[R]),T=this.getExtParam(O);T!=null&&q.push(T)}return q},this.getExtParam=function(S){var I={},q=r(S,0),L=q.length;if(L!=2&&L!=3)throw new Error("wrong number elements in Extension: "+L+" "+S);var R=y(a(S,0,[0],"06")),O=!1;L==3&&l(S,0,[1])=="0101ff"&&(O=!0);var T=l(S,0,[L-1,0]),N=void 0;if(R=="2.5.29.14"?N=this.getExtSubjectKeyIdentifier(T,O):R=="2.5.29.15"?N=this.getExtKeyUsage(T,O):R=="2.5.29.17"?N=this.getExtSubjectAltName(T,O):R=="2.5.29.18"?N=this.getExtIssuerAltName(T,O):R=="2.5.29.19"?N=this.getExtBasicConstraints(T,O):R=="2.5.29.30"?N=this.getExtNameConstraints(T,O):R=="2.5.29.31"?N=this.getExtCRLDistributionPoints(T,O):R=="2.5.29.32"?N=this.getExtCertificatePolicies(T,O):R=="2.5.29.33"?N=this.getExtPolicyMappings(T,O):R=="2.5.29.35"?N=this.getExtAuthorityKeyIdentifier(T,O):R=="2.5.29.36"?N=this.getExtPolicyConstraints(T,O):R=="2.5.29.37"?N=this.getExtExtKeyUsage(T,O):R=="2.5.29.54"?N=this.getExtInhibitAnyPolicy(T,O):R=="1.3.6.1.5.5.7.1.1"?N=this.getExtAuthorityInfoAccess(T,O):R=="2.5.29.20"?N=this.getExtCRLNumber(T,O):R=="2.5.29.21"?N=this.getExtCRLReason(T,O):R=="2.5.29.9"?N=this.getExtSubjectDirectoryAttributes(T,O):R=="1.3.6.1.5.5.7.48.1.2"?N=this.getExtOcspNonce(T,O):R=="1.3.6.1.5.5.7.48.1.5"?N=this.getExtOcspNoCheck(T,O):R=="1.2.840.113583.1.1.9.1"?N=this.getExtAdobeTimeStamp(T,O):tt.EXT_PARSER[R]!=null&&(N=tt.EXT_PARSER[R](R,O,T)),N!=null)return N;var P={extname:R,extn:T};try{P.extn=o(T)}catch{}return O&&(P.critical=!0),P},this.findExt=function(S,I){for(var q=0;q<S.length;q++)if(S[q].extname==I)return S[q];return null},this.updateExtCDPFullURI=function(S,I){var q=this.findExt(S,"cRLDistributionPoints");if(q!=null&&q.array!=null){for(var L=q.array,R=0;R<L.length;R++)if(L[R].dpname!=null&&L[R].dpname.full!=null)for(var O=L[R].dpname.full,T=0;T<O.length;T++){var N=O[R];N.uri!=null&&(N.uri=I)}}},this.updateExtAIAOCSP=function(S,I){var q=this.findExt(S,"authorityInfoAccess");if(q!=null&&q.array!=null)for(var L=q.array,R=0;R<L.length;R++)L[R].ocsp!=null&&(L[R].ocsp=I)},this.updateExtAIACAIssuer=function(S,I){var q=this.findExt(S,"authorityInfoAccess");if(q!=null&&q.array!=null)for(var L=q.array,R=0;R<L.length;R++)L[R].caissuer!=null&&(L[R].caissuer=I)},this.dnarraytostr=function(S){function I(L){return L.map(function(R){return q(R).replace(/\+/,"\\+")}).join("+")}function q(L){return L.type+"="+L.value}return"/"+S.map(function(L){return I(L).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(S){var I;if(S.str!=null&&S.array==null){var q=new A.asn1.x509.X500Name({str:S.str}),L=q.tohex();I=this.getX500NameArray(L)}else I=S.array;S.canon==null&&(S.canon=this.c14nRDNArray(I))},this.c14nRDNArray=function(S){for(var I=[],q=0;q<S.length;q++){for(var L=S[q],R=[],O=0;O<L.length;O++){var T=L[O],N=T.value;N=N.replace(/^\s*/,""),N=N.replace(/\s*$/,""),N=N.replace(/\s+/g," "),N=N.toLowerCase(),R.push(T.type.toLowerCase()+"="+N)}I.push(R.join("+"))}return"/"+I.join("/")},this.getInfo=function(){var S=function(pe){for(var Fe="",Te=" ",Ve=`
|
||
`,Oe=pe.array,pt=0;pt<Oe.length;pt++){var Qe=Oe[pt];if(Qe.dn!=null&&(Fe+=Te+"dn: "+Qe.dn.str+Ve),Qe.ip!=null&&(Fe+=Te+"ip: "+Qe.ip+Ve),Qe.rfc822!=null&&(Fe+=Te+"rfc822: "+Qe.rfc822+Ve),Qe.dns!=null&&(Fe+=Te+"dns: "+Qe.dns+Ve),Qe.uri!=null&&(Fe+=Te+"uri: "+Qe.uri+Ve),Qe.other!=null){var ct=Qe.other.oid,mn=JSON.stringify(Qe.other.value).replace(/\"/g,"");Fe+=Te+"other: "+ct+"="+mn+Ve}}return Fe=Fe.replace(/\n$/,""),Fe},I=function(pe){for(var Fe="",Te=pe.array,Ve=0;Ve<Te.length;Ve++){var Oe=Te[Ve];if(Fe+=" policy oid: "+Oe.policyoid+`
|
||
`,Oe.array!==void 0)for(var pt=0;pt<Oe.array.length;pt++){var Qe=Oe.array[pt];Qe.cps!==void 0&&(Fe+=" cps: "+Qe.cps+`
|
||
`)}}return Fe},q=function(pe){for(var Fe="",Te=pe.array,Ve=0;Ve<Te.length;Ve++){var Oe=Te[Ve];try{Oe.dpname.full[0].uri!==void 0&&(Fe+=" "+Oe.dpname.full[0].uri+`
|
||
`)}catch{}try{Oe.dname.full[0].dn.hex!==void 0&&(Fe+=" "+tt.hex2dn(Oe.dpname.full[0].dn.hex)+`
|
||
`)}catch{}}return Fe},L=function(pe){for(var Fe="",Te=pe.array,Ve=0;Ve<Te.length;Ve++){var Oe=Te[Ve];Oe.caissuer!==void 0&&(Fe+=" caissuer: "+Oe.caissuer+`
|
||
`),Oe.ocsp!==void 0&&(Fe+=" ocsp: "+Oe.ocsp+`
|
||
`)}return Fe},R=tt,O,T,N;if(O=`Basic Fields
|
||
`,O+=" serial number: "+this.getSerialNumberHex()+`
|
||
`,O+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
|
||
`,O+=" issuer: "+this.getIssuerString()+`
|
||
`,O+=" notBefore: "+this.getNotBefore()+`
|
||
`,O+=" notAfter: "+this.getNotAfter()+`
|
||
`,O+=" subject: "+this.getSubjectString()+`
|
||
`,O+=` subject public key info:
|
||
`,T=this.getPublicKey(),O+=" key algorithm: "+T.type+`
|
||
`,T.type==="RSA"&&(O+=" n="+ry(T.n.toString(16)).substr(0,16)+`...
|
||
`,O+=" e="+ry(T.e.toString(16))+`
|
||
`),N=this.aExtInfo,N!=null){O+=`X509v3 Extensions:
|
||
`;for(var P=0;P<N.length;P++){var M=N[P],Y=A.asn1.x509.OID.oid2name(M.oid);Y===""&&(Y=M.oid);var V="";if(M.critical===!0&&(V="CRITICAL"),O+=" "+Y+" "+V+`:
|
||
`,Y==="basicConstraints"){var X=this.getExtBasicConstraints();X.cA===void 0?O+=` {}
|
||
`:(O+=" cA=true",X.pathLen!==void 0&&(O+=", pathLen="+X.pathLen),O+=`
|
||
`)}else if(Y=="policyMappings"){var te=this.getExtPolicyMappings().array,ae=te.map(function(pe){var Fe=pe;return Fe[0]+":"+Fe[1]}).join(", ");O+=" "+ae+`
|
||
`}else if(Y=="policyConstraints"){var me=this.getExtPolicyConstraints();O+=" ",me.reqexp!=null&&(O+=" reqexp="+me.reqexp),me.inhibit!=null&&(O+=" inhibit="+me.inhibit),O+=`
|
||
`}else if(Y=="inhibitAnyPolicy"){var me=this.getExtInhibitAnyPolicy();O+=" skip="+me.skip+`
|
||
`}else if(Y=="keyUsage")O+=" "+this.getExtKeyUsageString()+`
|
||
`;else if(Y=="subjectKeyIdentifier")O+=" "+this.getExtSubjectKeyIdentifier().kid.hex+`
|
||
`;else if(Y=="authorityKeyIdentifier"){var he=this.getExtAuthorityKeyIdentifier();he.kid!==void 0&&(O+=" kid="+he.kid.hex+`
|
||
`)}else if(Y=="extKeyUsage"){var De=this.getExtExtKeyUsage().array;O+=" "+De.join(", ")+`
|
||
`}else if(Y=="subjectAltName"){var Pe=S(this.getExtSubjectAltName());O+=Pe+`
|
||
`}else if(Y=="cRLDistributionPoints"){var Ie=this.getExtCRLDistributionPoints();O+=q(Ie)}else if(Y=="authorityInfoAccess"){var se=this.getExtAuthorityInfoAccess();O+=L(se)}else Y=="certificatePolicies"&&(O+=I(this.getExtCertificatePolicies()))}}return O+="signature algorithm: "+this.getSignatureAlgorithmName()+`
|
||
`,O+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
|
||
`,O},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):A.lang.String.isHex(e)&&this.readCertHex(e))}tt.EXT_PARSER={};tt.registExtParser=function(e,t){tt.EXT_PARSER[e]=t};tt.hex2dn=function(e,t){t===void 0&&(t=0);var r=new tt,n=xe.getTLV(e,t),i=r.getX500Name(e);return i.str};tt.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=xe.getChildIdx(e,t),i=0;i<n.length;i++)r.push(tt.hex2attrTypeValue(e,n[i]));return r=r.map(function(o){return o.replace("+","\\+")}),r.join("+")};tt.hex2attrTypeValue=function(e,t){var r=xe,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 o=n(e,i[0]),s=A.asn1.ASN1Util.oidHexToInt(o),a=A.asn1.x509.OID.oid2atype(s),u=n(e,i[1]),l=ds(u);return a+"="+l};tt.getPublicKeyFromCertHex=function(e){var t=new tt;return t.readCertHex(e),t.getPublicKey()};tt.getPublicKeyFromCertPEM=function(e){var t=new tt;return t.readCertPEM(e),t.getPublicKey()};tt.getPublicKeyInfoPropOfCertPEM=function(e){var t=xe,r=t.getVbyList,n={},i,o,s;return n.algparam=null,i=new tt,i.readCertPEM(e),o=i.getPublicKeyHex(),n.keyhex=r(o,0,[1],"03").substr(2),n.algoid=r(o,0,[0,0],"06"),n.algoid==="2a8648ce3d0201"&&(n.algparam=r(o,0,[0,1],"06")),n};tt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var uj=function(e){var t=A,r=t.lang.String.isHex,n=xe,i=n.getV,o=n.getTLV,s=n.getVbyList,a=n.getTLVbyList,u=n.getTLVbyListEx,l=n.getIdxbyList,h=n.getIdxbyListEx,m=n.getChildIdx,p=new tt;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this.parsed=null,this._setPos=function(){var d=l(this.hex,0,[0,0]),v=this.hex.substr(d,2);if(v=="02")this.posSigAlg=1;else if(v=="30")this.posSigAlg=0;else throw new Error("malformed 1st item of TBSCertList: "+v);var g=l(this.hex,0,[0,this.posSigAlg+3]),y=this.hex.substr(g,2);if(y=="17"||y=="18"){var w,E;w=l(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,w!=-1&&(E=this.hex.substr(w,2),E=="30"&&(this.posRevCert=this.posSigAlg+4))}else if(y=="30")this.posRevCert=this.posSigAlg+3;else if(y=="a0")this.posRevCert=null;else throw new Error("malformed nextUpdate or revCert tag: "+y)},this.getVersion=function(){return this.posSigAlg==0?null:parseInt(s(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var d=a(this.hex,0,[0,this.posSigAlg],"30");return p.getAlgorithmIdentifierName(d)},this.getIssuer=function(){return p.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return a(this.hex,0,[0,this.posSigAlg+1],"30")},this.getThisUpdate=function(){var d=s(this.hex,0,[0,this.posSigAlg+2]);return result=ds(d)},this.getNextUpdate=function(){var d=l(this.hex,0,[0,this.posSigAlg+3]),v=this.hex.substr(d,2);return v!="17"&&v!="18"?null:ds(i(this.hex,d))},this.getRevCertArray=function(){if(this.posRevCert==null)return null;for(var d=[],v=l(this.hex,0,[0,this.posRevCert]),g=m(this.hex,v),y=0;y<g.length;y++){var w=o(this.hex,g[y]);d.push(this.getRevCert(w))}return d},this.getRevCert=function(d){var v={},g=m(d,0);return v.sn={hex:s(d,0,[0],"02")},v.date=ds(s(d,0,[1])),g.length==3&&(v.ext=p.getExtParamArray(a(d,0,[2]))),v},this.findRevCert=function(d){var v=new tt(d),g=v.getSerialNumberHex();return this.findRevCertBySN(g)},this.findRevCertBySN=function(d){if(this.parsed==null&&this.getParam(),this.parsed.revcert==null)return null;for(var v=this.parsed.revcert,g=0;g<v.length;g++)if(d==v[g].sn.hex)return v[g];return null},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(d){var v=this.getSignatureAlgorithmField(),g=this.getSignatureValueHex(),y=a(this.hex,0,[0],"30"),w=new A.crypto.Signature({alg:v});return w.init(d),w.updateHex(y),w.verify(g)},this.getParam=function(d){var v={},g=this.getVersion();g!=null&&(v.version=g),v.sigalg=this.getSignatureAlgorithmField(),v.issuer=this.getIssuer(),v.thisupdate=this.getThisUpdate();var y=this.getNextUpdate();y!=null&&(v.nextupdate=y);var w=this.getRevCertArray();w!=null&&(v.revcert=w);var E=h(this.hex,0,[0,"[0]"]);if(E!=-1){var _=u(this.hex,0,[0,"[0]",0]);v.ext=p.getExtParamArray(_)}return v.sighex=this.getSignatureValueHex(),this.parsed=v,typeof d=="object"&&(d.tbshex==!0&&(v.tbshex=a(this.hex,0,[0])),d.nodnarray==!0&&delete v.issuer.array),v},typeof e=="string"&&(r(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=lr(e)),this._setPos())};(typeof A>"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWS=function(){var e=A,t=e.jws.JWS,r=t.isSafeJSONString;this.parseJWS=function(n,i){if(!(this.parsedJWS!==void 0&&(i||this.parsedJWS.sigvalH!==void 0))){var o=n.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(o==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var s=o[1],a=o[2],u=o[3],l=s+"."+a;if(this.parsedJWS={},this.parsedJWS.headB64U=s,this.parsedJWS.payloadB64U=a,this.parsedJWS.sigvalB64U=u,this.parsedJWS.si=l,!i){var h=rr(u),m=ls(h,16);this.parsedJWS.sigvalH=h,this.parsedJWS.sigvalBI=m}var p=Di(s),d=Di(a);if(this.parsedJWS.headS=p,this.parsedJWS.payloadS=d,!r(p,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+p}}};A.jws.JWS.sign=function(e,t,r,n,i){var o=A,s=o.jws,a=s.JWS,u=a.readSafeJSONString,l=a.isSafeJSONString,h=o.crypto,m=h.ECDSA,p=h.Mac,d=h.Signature,v=JSON,g,y,w;if(typeof t!="string"&&typeof t!="object")throw"spHeader must be JSON string or object: "+t;if(typeof t=="object"&&(y=t,g=v.stringify(y)),typeof t=="string"){if(g=t,!l(g))throw"JWS Head is not safe JSON string: "+g;y=u(g)}if(w=r,typeof r=="object"&&(w=v.stringify(r)),(e==""||e==null)&&y.alg!==void 0&&(e=y.alg),e!=""&&e!=null&&y.alg===void 0&&(y.alg=e,g=v.stringify(y)),e!==y.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+y.alg;var E=null;if(a.jwsalg2sigalg[e]===void 0)throw"unsupported alg name: "+e;E=a.jwsalg2sigalg[e];var _=Jh(g),C=Jh(w),F=_+"."+C,H="";if(E.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var K=new p({alg:E,prov:"cryptojs",pass:n});K.updateString(F),H=K.doFinal()}else if(E.indexOf("withECDSA")!=-1){var S=new d({alg:E});S.init(n,i),S.updateString(F);var I=S.sign();H=A.crypto.ECDSA.asn1SigToConcatSig(I)}else if(E!="none"){var S=new d({alg:E});S.init(n,i),S.updateString(F),H=S.sign()}var q=Or(H);return F+"."+q};A.jws.JWS.verify=function(e,t,r){var n=A,i=n.jws,o=i.JWS,s=o.readSafeJSONString,a=n.crypto,u=a.ECDSA,l=a.Mac,h=a.Signature,m;if(typeof at!==void 0&&(m=at),!fy(e))return!1;var p=e.split(".");if(p.length!==3)return!1;var d=p[0],v=p[1],g=d+"."+v,y=rr(p[2]),w=s(Di(p[0])),E=null,_=null;if(w.alg===void 0)throw"algorithm not specified in header";if(E=w.alg,_=E.substr(0,2),r!=null&&Object.prototype.toString.call(r)==="[object Array]"&&r.length>0){var C=":"+r.join(":")+":";if(C.indexOf(":"+E+":")==-1)throw"algorithm '"+E+"' not accepted in the list"}if(E!="none"&&t===null)throw"key shall be specified to verify.";if(typeof t=="string"&&t.indexOf("-----BEGIN ")!=-1&&(t=_t.getKey(t)),(_=="RS"||_=="PS")&&!(t instanceof m))throw"key shall be a RSAKey obj for RS* and PS* algs";if(_=="ES"&&!(t instanceof u))throw"key shall be a ECDSA obj for ES* algs";E=="none";var F=null;if(o.jwsalg2sigalg[w.alg]===void 0)throw new Error("unsupported alg name: "+E);if(F=o.jwsalg2sigalg[E],w.crit!==void 0){if(!Array.isArray(w.crit)||w.crit.length===0)throw new Error("wrong critical header");for(var H=0;H<w.crit.length;H++){var K=w.crit[H];if(typeof K!="string"||K.length===0)throw new Error("wrong critical header");if(w[K]===void 0)throw new Error("critical header '"+K+"' missing")}}if(F=="none")throw new Error("not supported");if(F.substr(0,4)=="Hmac"){var S=null;if(t===void 0)throw new Error("hexadecimal key shall be specified for HMAC");var I=new l({alg:F,pass:t});return I.updateString(g),S=I.doFinal(),hC(y,S)}else if(F.indexOf("withECDSA")!=-1){var q=null;try{q=u.concatSigToASN1Sig(y)}catch{return!1}var L=new h({alg:F});return L.init(t),L.updateString(g),L.verify(q)}else{var L=new h({alg:F});return L.init(t),L.updateString(g),L.verify(y)}};A.jws.JWS.parse=function(e){var t=e.split("."),r={},n,i,o;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&&(o=t[2]),r.headerObj=A.jws.JWS.readSafeJSONString(Di(n)),r.payloadObj=A.jws.JWS.readSafeJSONString(Di(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=Di(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),o!==void 0&&(r.sigHex=rr(o)),r};A.jws.JWS.verifyJWT=function(e,t,r){var n=A,i=n.jws,o=i.JWS,s=o.readSafeJSONString,a=o.inArray,u=o.includedArray;if(!fy(e))return!1;var l=e.split(".");if(l.length!=3)return!1;var h=l[0],m=l[1],p=h+"."+m,d=rr(l[2]),v=s(Di(h)),g=s(Di(m));if(v.alg===void 0)return!1;if(r.alg===void 0)throw"acceptField.alg shall be specified";if(!a(v.alg,r.alg)||g.iss!==void 0&&typeof r.iss=="object"&&!a(g.iss,r.iss)||g.sub!==void 0&&typeof r.sub=="object"&&!a(g.sub,r.sub))return!1;if(g.aud!==void 0&&typeof r.aud=="object"){if(typeof g.aud=="string"){if(!a(g.aud,r.aud))return!1}else if(typeof g.aud=="object"&&!u(g.aud,r.aud))return!1}var y=i.IntDate.getNow();return r.verifyAt!==void 0&&typeof r.verifyAt=="number"&&(y=r.verifyAt),(r.gracePeriod===void 0||typeof r.gracePeriod!="number")&&(r.gracePeriod=0),!(g.exp!==void 0&&typeof g.exp=="number"&&g.exp+r.gracePeriod<y||g.nbf!==void 0&&typeof g.nbf=="number"&&y<g.nbf-r.gracePeriod||g.iat!==void 0&&typeof g.iat=="number"&&y<g.iat-r.gracePeriod||g.jti!==void 0&&r.jti!==void 0&&g.jti!==r.jti||!o.verify(e,t,r.alg))};A.jws.JWS.includedArray=function(e,t){var r=A.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};A.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};A.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"};A.jws.JWS.isSafeJSONString=function(e,t,r){var n=null;try{return n=iC(e),typeof n!="object"||n.constructor===Array?0:(t&&(t[r]=n),1)}catch{return 0}};A.jws.JWS.readSafeJSONString=function(e){var t=null;try{return t=iC(e),typeof t!="object"||t.constructor===Array?null:t}catch{return null}};A.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]};A.jws.JWS.getJWKthumbprint=function(e){if(e.kty!=="RSA"&&e.kty!=="EC"&&e.kty!=="oct")throw new Error("unsupported algorithm for JWK Thumprint");var t="{";if(e.kty==="RSA"){if(typeof e.n!="string"||typeof e.e!="string")throw new Error("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 new Error("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 new Error("wrong k value for oct(symmetric) key");t+='"k":"'+e.k+'",',t+='"kty":"'+e.kty+'"}'}var r=ao(t),n=A.crypto.Util.hashHex(r,"sha256"),i=Or(n);return i};A.jws.IntDate={};A.jws.IntDate.get=function(e){var t=A.jws.IntDate,r=t.getNow,n=t.getZulu;if(e=="now")return r();if(e=="now + 1hour")return r()+3600;if(e=="now + 1day")return r()+3600*24;if(e=="now + 1month")return r()+3600*24*30;if(e=="now + 1year")return r()+3600*24*365;if(e.match(/Z$/))return n(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e};A.jws.IntDate.getZulu=function(e){return cC(e)};A.jws.IntDate.getNow=function(){var e=~~(new Date/1e3);return e};A.jws.IntDate.intDate2UTCString=function(e){var t=new Date(e*1e3);return t.toUTCString()};A.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),o=("00"+t.getUTCHours()).slice(-2),s=("00"+t.getUTCMinutes()).slice(-2),a=("00"+t.getUTCSeconds()).slice(-2);return r+n+i+o+s+a+"Z"};(typeof A>"u"||!A)&&(A={});(typeof A.jws>"u"||!A.jws)&&(A.jws={});A.jws.JWSJS=function(){var e=A,t=e.jws,r=t.JWS,n=r.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(i){this.init();var o=i.split(".");if(o.length!=3)throw"malformed input JWS";this.aHeader.push(o[0]),this.sPayload=o[1],this.aSignature.push(o[2])},this.addSignature=function(i,o,s,a){if(this.sPayload===void 0||this.sPayload===null)throw"there's no JSON-JS signature to add.";var u=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var l=A.jws.JWS.sign(i,o,this.sPayload,s,a),h=l.split("."),m=h[0],p=h[2];this.aHeader.push(h[0]),this.aSignature.push(h[2])}catch(d){throw this.aHeader.length>u&&this.aHeader.pop(),this.aSignature.length>u&&this.aSignature.pop(),"addSignature failed: "+d}},this.verifyAll=function(i){if(this.aHeader.length!==i.length||this.aSignature.length!==i.length)return!1;for(var o=0;o<i.length;o++){var s=i[o];if(s.length!==2)return!1;var a=this.verifyNth(o,s[0],s[1]);if(a===!1)return!1}return!0},this.verifyNth=function(i,o,s){if(this.aHeader.length<=i||this.aSignature.length<=i)return!1;var a=this.aHeader[i],u=this.aSignature[i],l=a+"."+this.sPayload+"."+u,h=!1;try{h=r.verify(l,o,s)}catch{return!1}return h},this.readJWSJS=function(i){if(typeof i=="string"){var o=n(i);if(o==null)throw"argument is not safe JSON object string";this.aHeader=o.headers,this.sPayload=o.payload,this.aSignature=o.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}};$e.SecureRandom=rf;$e.rng_seed_time=oy;$e.BigInteger=ne;$e.RSAKey=at;$e.ECDSA=A.crypto.ECDSA;$e.DSA=A.crypto.DSA;$e.Signature=A.crypto.Signature;$e.MessageDigest=A.crypto.MessageDigest;$e.Mac=A.crypto.Mac;$e.KEYUTIL=_t;$e.ASN1HEX=xe;$e.X509=tt;$e.X509CRL=uj;$e.CryptoJS=ke;$e.b64tohex=Ql;$e.b64toBA=eC;$e.ECFieldElementFp=Nr;$e.ECPointFp=Nt;$e.ECCurveFp=fa;$e.stoBA=oC;$e.BAtos=aC;$e.BAtohex=f1;$e.stohex=hs;$e.stob64=qq;$e.stob64u=jq;$e.b64utos=Kq;$e.b64tob64u=Jl;$e.b64utob64=ed;$e.hex2b64=la;$e.hextob64u=Or;$e.b64utohex=rr;$e.utf8tob64u=Jh;$e.b64utoutf8=Di;$e.utf8tob64=Vq;$e.b64toutf8=zq;$e.utf8tohex=h1;$e.hextoutf8=Gt;$e.hextorstr=ds;$e.rstrtohex=ao;$e.hextob64=ay;$e.hextob64nl=Yq;$e.b64nltohex=uC;$e.hextopem=An;$e.pemtohex=lr;$e.hextoArrayBuffer=Jq;$e.ArrayBuffertohex=Qq;$e.zulutomsec=uy;$e.msectozulu=ej;$e.zulutosec=cC;$e.zulutodate=tj;$e.datetozulu=rj;$e.uricmptohex=p1;$e.hextouricmp=m1;$e.ipv6tohex=ey;$e.hextoipv6=ty;$e.hextoip=o1;$e.iptohex=cy;$e.ucs2hextoutf8=ly;$e.encodeURIComponentAll=g1;$e.newline_toUnix=nj;$e.newline_toDos=sj;$e.hextoposhex=ry;$e.intarystrtohex=ij;$e.strdiffidx=oj;$e.oidtohex=pC;$e.hextooid=v1;$e.strpad=a1;$e.bitstrtoint=gC;$e.inttobitstr=vC;$e.bitstrtobinstr=wC;$e.binstrtobitstr=aj;$e.isBase64URLDot=fy;$e.namearraytobinstr=u1;$e.extendClass=Ee;$e.foldnl=d1;$e.b64topem=Xq;$e.pemtob64=Zq;$e.timeogen=lC;$e.aryval=Jt;$e.inttohex=mC;$e.twoscompl=td;$e.timingSafeEqual=hC;$e.timingSafeEqualImpl=dC;$e.KJUR=A;$e.crypto=A.crypto;$e.asn1=A.asn1;$e.jws=A.jws;$e.lang=A.lang;$e.VERSION=vH;$e.VERSION_FULL=wH});var _d=be(am=>{"use strict";var Efe=B(x());Object.defineProperty(am,"__esModule",{value:!0});am.AddressError=void 0;var Gy=class extends Error{constructor(t,r){super(t),this.name="AddressError",this.parseMessage=r}};am.AddressError=Gy});var um=be(ei=>{"use strict";var Afe=B(x());Object.defineProperty(ei,"__esModule",{value:!0});ei.isInSubnet=SK;ei.isHostInSubnet=Wy;ei.isGloballyReachable=_K;ei.offsetBigInt=CK;ei.isCorrect=DK;ei.prefixLengthFromMask=FK;ei.assertByteArray=BK;ei.numberToPaddedHex=T8;ei.stringToPaddedHex=IK;ei.testBit=xK;var kc=_d();function SK(e){return this.subnetMask<e.subnetMask?!1:Wy.call(this,e)}function Wy(e){return this.binaryZeroPad().length!==e.binaryZeroPad().length?!1:this.mask(e.subnetMask)===e.mask()}function _K(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];n.reachable!==null&&Wy.call(this,n.subnet)&&(t===null||n.subnet.subnetMask>t.subnet.subnetMask)&&(t=n)}return t===null?!0:t.reachable}function CK(e,t,r,n){if(typeof t=="number"&&!Number.isSafeInteger(t))throw new kc.AddressError(`${n} offset must be an integer`);if(typeof t!="number"&&typeof t!="bigint")throw new kc.AddressError(`${n} offset must be an integer`);let i=e+BigInt(t);if(i<BigInt(0)||i>(BigInt(1)<<BigInt(r))-BigInt(1))throw new kc.AddressError(`${n} offset leaves the address space`);return i}function DK(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function FK(e,t){let r=e.toString(2).padStart(t,"0");if(r.length>t)throw new kc.AddressError("Invalid subnet mask.");let n=r.indexOf("0");if(n===-1)return t;if(r.slice(n).includes("1"))throw new kc.AddressError("Invalid subnet mask.");return n}function BK(e,t,r,n){if(e.length!==t)throw new kc.AddressError(`${r} addresses require exactly ${t} bytes`);for(let i=0;i<e.length;i++)if(!Number.isInteger(e[i])||e[i]<n||e[i]>255)throw new kc.AddressError(`All bytes must be integers between ${n} and 255`)}function T8(e){return e.toString(16).padStart(2,"0")}function IK(e){return T8(parseInt(e,10))}function xK(e,t){let{length:r}=e;if(t>=r)return!1;let n=r-t-1;return e.substring(n,n+1)==="1"}});var Yy=be(ti=>{"use strict";var _fe=B(x());Object.defineProperty(ti,"__esModule",{value:!0});ti.SPECIAL_PURPOSE=ti.RE_SUBNET_STRING=ti.RE_ADDRESS=ti.GROUPS=ti.BITS=void 0;ti.BITS=32;ti.GROUPS=4;ti.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g;ti.RE_SUBNET_STRING=/\/\d{1,2}$/;ti.SPECIAL_PURPOSE=[["0.0.0.0/8","This network",!1],["0.0.0.0/32","This host on this network",!1],["10.0.0.0/8","Private-Use",!1],["100.64.0.0/10","Shared Address Space",!1],["127.0.0.0/8","Loopback",!1],["169.254.0.0/16","Link Local",!1],["172.16.0.0/12","Private-Use",!1],["192.0.0.0/24","IETF Protocol Assignments",!1],["192.0.0.0/29","IPv4 Service Continuity Prefix",!1],["192.0.0.8/32","IPv4 dummy address",!1],["192.0.0.9/32","Port Control Protocol Anycast",!0],["192.0.0.10/32","Traversal Using Relays around NAT Anycast",!0],["192.0.0.170/32","NAT64/DNS64 Discovery",!1],["192.0.0.171/32","NAT64/DNS64 Discovery",!1],["192.0.2.0/24","Documentation (TEST-NET-1)",!1],["192.31.196.0/24","AS112-v4",!0],["192.52.193.0/24","AMT",!0],["192.88.99.0/24","Deprecated (6to4 Relay Anycast)",null],["192.88.99.2/32","6a44-relay anycast address",!1],["192.168.0.0/16","Private-Use",!1],["192.175.48.0/24","Direct Delegation AS112 Service",!0],["198.18.0.0/15","Benchmarking",!1],["198.51.100.0/24","Documentation (TEST-NET-2)",!1],["203.0.113.0/24","Documentation (TEST-NET-3)",!1],["240.0.0.0/4","Reserved",!1],["255.255.255.255/32","Limited Broadcast",!1]]});var Xy=be(yo=>{"use strict";var Dfe=B(x()),$K=yo&&yo.__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]})),PK=yo&&yo.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),O8=yo&&yo.__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)&&$K(t,e,r);return PK(t,e),t};Object.defineProperty(yo,"__esModule",{value:!0});yo.Address4=void 0;var Rs=O8(um()),fr=O8(Yy()),Ti=_d(),kK=Rs.isCorrect(fr.BITS),Yr=class e{constructor(t){this.addressMinusSuffix="",this.groups=fr.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=kK,this.isInSubnet=Rs.isInSubnet,this.isHostInSubnet=Rs.isHostInSubnet,this.address=t;let r=fr.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>fr.BITS)throw new Ti.AddressError("Invalid subnet mask.");t=t.replace(fr.RE_SUBNET_STRING,"")}let n=fr.GROUPS*4-1;if(t.length>n)throw new Ti.AddressError(`IPv4 addresses are at most ${n} characters.`);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(r.some(n=>/^0\d/.test(n)))throw new Ti.AddressError("IPv4 addresses can't have leading zeroes.");if(!t.match(fr.RE_ADDRESS))throw new Ti.AddressError("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromAddressAndMask(t,r){let n=Rs.prefixLengthFromMask(new e(r).bigInt(),fr.BITS);return new e(`${t}/${n}`)}static fromAddressAndWildcardMask(t,r){let n=new e(r).bigInt(),i=(BigInt(1)<<BigInt(fr.BITS))-BigInt(1),o=n^i,s=Rs.prefixLengthFromMask(o,fr.BITS);return new e(`${t}/${s}`)}static fromWildcard(t){let r=t.split(".");if(r.length!==fr.GROUPS)throw new Ti.AddressError("Wildcard pattern must have 4 octets");let n=-1;for(let a=0;a<r.length;a++)if(r[a]==="*")n===-1&&(n=a);else if(n!==-1)throw new Ti.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)");let i=n===-1?0:r.length-n,o=r.map(a=>a==="*"?"0":a),s=fr.BITS-i*8;return new e(`${o.join(".")}/${s}`)}static fromHex(t){let r=t.replace(/:/g,"");if(!/^[0-9a-fA-F]{8}$/.test(r))throw new Ti.AddressError("IPv4 hex must be exactly 8 hex digits");let n=[];for(let i=0;i<8;i+=2)n.push(parseInt(r.slice(i,i+2),16));return new e(n.join("."))}static fromInteger(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new Ti.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1");return e.fromHex(t.toString(16).padStart(8,"0"))}static fromArpa(t){let r=fr.GROUPS*4-1+3+14;if(t.length>r)throw new Ti.AddressError(`in-addr.arpa names are at most ${r} characters.`);let i=t.replace(/(\.in-addr\.arpa)?\.?$/i,"").split(".").reverse().join(".");return new e(i)}toHex(){return this.parsedAddress.map(t=>Rs.stringToPaddedHex(t)).join(":")}toArray(){return this.parsedAddress.map(t=>parseInt(t,10))}toGroup6(){let t=[],r;for(r=0;r<fr.GROUPS;r+=2)t.push(`${Rs.stringToPaddedHex(this.parsedAddress[r])}${Rs.stringToPaddedHex(this.parsedAddress[r+1])}`);return t.join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(t=>Rs.stringToPaddedHex(t)).join("")}`)}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(fr.BITS-this.subnetMask)}`)}startAddress(){return e.fromBigInt(this._startAddress())}startAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._startAddress()+t)}offset(t){return e.fromBigInt(Rs.offsetBigInt(this.bigInt(),t,fr.BITS,"IPv4")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(Rs.offsetBigInt(this._endAddress(),1,fr.BITS,"IPv4")).withSubnetMask(this.subnetMask)}withSubnetMask(t){return new e(`${this.correctForm()}/${t}`)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(fr.BITS-this.subnetMask)}`)}endAddress(){return e.fromBigInt(this._endAddress())}endAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._endAddress()-t)}subnetMaskAddress(){return e.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(fr.BITS-this.subnetMask)}`))}wildcardMask(){return e.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(fr.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}static fromBigInt(t){if(t<BigInt(0)||t>BigInt(4294967295))throw new Ti.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");return e.fromHex(t.toString(16).padStart(8,"0"))}static fromByteArray(t){return Rs.assertByteArray(t,4,"IPv4",0),this.fromUnsignedByteArray(t)}static fromUnsignedByteArray(t){if(t.length!==4)throw new Ti.AddressError("IPv4 addresses require exactly 4 bytes");let r=t.join(".");return new e(r)}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:`${r}.in-addr.arpa.`}isMulticast(){return this.isHostInSubnet(RK)}isPrivate(){return TK.some(t=>this.isHostInSubnet(t))}isLoopback(){return this.isHostInSubnet(OK)}isLinkLocal(){return this.isHostInSubnet(NK)}isUnspecified(){return this.isHostInSubnet(LK)}isBroadcast(){return this.isHostInSubnet(UK)}isCGNAT(){return this.isHostInSubnet(HK)}isDocumentation(){return MK.some(t=>this.isHostInSubnet(t))}isBenchmarking(){return this.isHostInSubnet(qK)}isReserved(){return this.isHostInSubnet(jK)}isGlobal(){return!this.isMulticast()&&Rs.isGloballyReachable.call(this,KK)}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(fr.BITS,"0")),this._binaryZeroPad}groupForV6(){let t=this.parsedAddress;return this.correctForm().replace(fr.RE_ADDRESS,`<span class="hover-group group-v4 group-6">${t.slice(0,2).join(".")}</span>.<span class="hover-group group-v4 group-7">${t.slice(2,4).join(".")}</span>`)}};yo.Address4=Yr;var RK=new Yr("224.0.0.0/4"),TK=[new Yr("10.0.0.0/8"),new Yr("172.16.0.0/12"),new Yr("192.168.0.0/16")],OK=new Yr("127.0.0.0/8"),NK=new Yr("169.254.0.0/16"),LK=new Yr("0.0.0.0/32"),UK=new Yr("255.255.255.255/32"),HK=new Yr("100.64.0.0/10"),MK=[new Yr("192.0.2.0/24"),new Yr("198.51.100.0/24"),new Yr("203.0.113.0/24")],qK=new Yr("198.18.0.0/15"),jK=new Yr("240.0.0.0/4"),KK=fr.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new Yr(e),reachable:t}))});var Zy=be(sr=>{"use strict";var Bfe=B(x());Object.defineProperty(sr,"__esModule",{value:!0});sr.SPECIAL_PURPOSE=sr.RE_URL_WITH_PORT=sr.RE_URL=sr.RE_ZONE_STRING=sr.RE_SUBNET_STRING=sr.RE_BAD_ADDRESS=sr.RE_BAD_CHARACTERS=sr.TYPES=sr.SCOPES=sr.GROUPS=sr.BITS=void 0;sr.BITS=128;sr.GROUPS=8;sr.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"};sr.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","::ffff:0:0/96":"IPv4-mapped","ff00::/8":"Multicast","fe80::/10":"Link-local unicast","fc00::/7":"Unique local","2001::/32":"Teredo","2001:2::/48":"Benchmarking","2002::/16":"6to4","2001:db8::/32":"Documentation","3fff::/20":"Documentation","100::/64":"Discard-only","fec0::/10":"Site-local unicast (deprecated)","::/96":"IPv4-compatible (deprecated)","64:ff9b::/96":"NAT64 (well-known)","64:ff9b:1::/48":"NAT64 (local-use)"};sr.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi;sr.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;sr.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/;sr.RE_ZONE_STRING=/%.*$/;sr.RE_URL=/^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;sr.RE_URL_WITH_PORT=/^\[([0-9a-f:.]+)\]:([0-9]{1,5})(?:[/?#].*)?$/i;sr.SPECIAL_PURPOSE=[["::1/128","Loopback Address",!1],["::/128","Unspecified Address",!1],["::ffff:0:0/96","IPv4-mapped Address",!1],["64:ff9b::/96","IPv4-IPv6 Translat.",!0],["64:ff9b:1::/48","IPv4-IPv6 Translat.",!1],["100::/64","Discard-Only Address Block",!1],["100:0:0:1::/64","Dummy IPv6 Prefix",!1],["2001::/23","IETF Protocol Assignments",!1],["2001::/32","TEREDO",!1],["2001:1::1/128","Port Control Protocol Anycast",!0],["2001:1::2/128","Traversal Using Relays around NAT Anycast",!0],["2001:1::3/128","DNS-SD Service Registration Protocol Anycast",!0],["2001:2::/48","Benchmarking",!1],["2001:3::/32","AMT",!0],["2001:4:112::/48","AS112-v6",!0],["2001:10::/28","Deprecated (previously ORCHID)",null],["2001:20::/28","ORCHIDv2",!0],["2001:30::/28","Drone Remote ID Protocol Entity Tags (DETs) Prefix",!0],["2001:db8::/32","Documentation",!1],["2002::/16","6to4",!1],["2620:4f:8000::/48","Direct Delegation AS112 Service",!0],["3fff::/20","Documentation",!1],["5f00::/16","Segment Routing (SRv6) SIDs",!1],["fc00::/7","Unique-Local",!1],["fe80::/10","Link-Local Unicast",!1]]});var Jy=be(Rc=>{"use strict";var xfe=B(x());Object.defineProperty(Rc,"__esModule",{value:!0});Rc.escapeHtml=cm;Rc.spanAllZeroes=N8;Rc.spanAll=VK;Rc.spanLeadingZeroes=zK;Rc.simpleGroup=GK;function cm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function N8(e){return cm(e).replace(/(0+)/g,'<span class="zero">$1</span>')}function VK(e,t=0){return e.split("").map((n,i)=>`<span class="digit value-${cm(n)} position-${i+t}">${N8(n)}</span>`).join("")}function L8(e){return cm(e).replace(/^(0+)/,'<span class="zero">$1</span>')}function zK(e){return e.split(":").map(r=>L8(r)).join(":")}function GK(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:`<span class="hover-group group-${i+t}">${L8(n)}</span>`)}});var U8=be(vs=>{"use strict";var Pfe=B(x()),WK=vs&&vs.__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]})),YK=vs&&vs.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),XK=vs&&vs.__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)&&WK(t,e,r);return YK(t,e),t};Object.defineProperty(vs,"__esModule",{value:!0});vs.ADDRESS_BOUNDARY=void 0;vs.groupPossibilities=fm;vs.padGroup=lm;vs.simpleRegularExpression=JK;vs.possibleElisions=QK;var ZK=XK(Zy());function fm(e){return`(${e.join("|")})`}function lm(e){return e.length<4?`0{0,${4-e.length}}${e}`:e}vs.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function JK(e){let t=[];e.forEach((n,i)=>{parseInt(n,16)===0&&t.push(i)});let r=t.map(n=>e.map((i,o)=>{if(o===n){let s=o===0||o===ZK.GROUPS-1?":":"";return fm([lm(i),s])}return lm(i)}).join(":"));return r.push(e.map(lm).join(":")),fm(r)}function QK(e,t,r){let n=t?"":":",i=r?"":":",o=[];!t&&!r&&o.push("::"),t&&r&&o.push(""),(r&&!t||!r&&t)&&o.push(":"),o.push(`${n}(:0{1,4}){1,${e-1}}`),o.push(`(0{1,4}:){1,${e-1}}${i}`),o.push(`(0{1,4}:){${e-1}}0{1,4}`);for(let s=1;s<e-1;s++)for(let a=1;a<e-s;a++)o.push(`(0{1,4}:){${a}}:(0{1,4}:){${e-a-s-1}}0{1,4}`);return fm(o)}});var j8=be(Ao=>{"use strict";var Rfe=B(x()),eV=Ao&&Ao.__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]})),tV=Ao&&Ao.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pm=Ao&&Ao.__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)&&eV(t,e,r);return tV(t,e),t};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.Address6=void 0;var bo=pm(um()),Qy=pm(Yy()),Ct=pm(Zy()),Tc=pm(Jy()),Eo=Xy(),Oc=U8(),Xr=_d(),hm=um(),rV=bo.isCorrect(Ct.BITS);function dm(e){if(!e)throw new Error("Assertion failed.")}function nV(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function sV(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 iV(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 H8(e){return parseInt(e,16).toString(16).padStart(4,"0")}function M8(e){return e&255}var In=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=bo.isInSubnet,this.isHostInSubnet=bo.isHostInSubnet,this.isCorrect=rV,r===void 0?this.groups=Ct.GROUPS:this.groups=r,this.address=t;let n=Ct.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>Ct.BITS)throw new Xr.AddressError("Invalid subnet mask.");t=t.replace(Ct.RE_SUBNET_STRING,"")}if(/\//.test(t))throw new Xr.AddressError("Invalid subnet mask.");let i=t.indexOf("%");i!==-1&&/^.*$/.test(t.slice(i))&&(this.zone=t.slice(i),t=t.slice(0,i));let o=this.groups*5+5;if(t.length>o)throw new Xr.AddressError(`IPv6 addresses are at most ${o} characters.`);this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInt(t){if(t<BigInt(0)||t>(BigInt(1)<<BigInt(Ct.BITS))-BigInt(1))throw new Xr.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");let r=t.toString(16).padStart(32,"0"),n=[];for(let i=0;i<Ct.GROUPS;i++)n.push(r.slice(i*4,(i+1)*4));return new e(n.join(":"))}static fromURL(t){var r;let n,i=null,o,s,a=t.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"");if(a.indexOf("[")!==-1&&a.indexOf("]:")!==-1){if(s="failed to parse address with port",o=Ct.RE_URL_WITH_PORT.exec(a),o===null)return{error:s,address:null,port:null};n=o[1],i=o[2]}else{if(s="failed to parse address from URL",o=Ct.RE_URL.exec(a),o===null)return{error:s,address:null,port:null};n=(r=o[1])!==null&&r!==void 0?r:o[2]}i?(i=parseInt(i,10),(i<0||i>65535)&&(i=null)):i=null;let u;try{u=new e(n)}catch{return{error:s,address:null,port:null}}return{address:u,port:i}}static fromAddressAndMask(t,r){let n=bo.prefixLengthFromMask(new e(r).bigInt(),Ct.BITS);return new e(`${t}/${n}`)}static fromAddressAndWildcardMask(t,r){let n=new e(r).bigInt(),i=(BigInt(1)<<BigInt(Ct.BITS))-BigInt(1),o=n^i,s=bo.prefixLengthFromMask(o,Ct.BITS);return new e(`${t}/${s}`)}static fromWildcard(t){if(t.includes("%")||t.includes("/"))throw new Xr.AddressError("Wildcard pattern must not include a zone or CIDR suffix");let r=t.split("::");if(r.length>2)throw new Xr.AddressError("Wildcard pattern cannot contain more than one '::'");let n;if(r.length===2){let u=r[0]===""?[]:r[0].split(":"),l=r[1]===""?[]:r[1].split(":"),h=Ct.GROUPS-u.length-l.length;if(h<1)throw new Xr.AddressError("Wildcard pattern with '::' has too many groups");n=[...u,...new Array(h).fill("0"),...l]}else n=t.split(":");if(n.length!==Ct.GROUPS)throw new Xr.AddressError("Wildcard pattern must have 8 groups");let i=-1;for(let u=0;u<n.length;u++)if(n[u]==="*")i===-1&&(i=u);else if(i!==-1)throw new Xr.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)");let o=i===-1?0:n.length-i,s=n.map(u=>u==="*"?"0":u),a=Ct.BITS-o*16;return new e(`${s.join(":")}/${a}`)}static fromAddress4(t){let r=new Eo.Address4(t),n=Ct.BITS-(Qy.BITS-r.subnetMask);return new e(`::ffff:${r.correctForm()}/${n}`)}static fromArpa(t){let r=t.replace(/(\.ip6\.arpa)?\.?$/i,"");if(!/^[0-9a-f](\.[0-9a-f]){0,31}$/i.test(r))throw new Xr.AddressError("Invalid 'ip6.arpa' form.");let n=r.split(".").reverse(),i=n.length*4,o=n.join("").padEnd(32,"0"),s=[];for(let a=0;a<Ct.GROUPS;a++)s.push(o.slice(a*4,(a+1)*4));return new e(`${s.join(":")}/${i}`)}microsoftTranscription(){return`${this.correctForm().replace(/:/g,"-")}.ipv6-literal.net`}mask(t=this.subnetMask){return this.getBitsBase2(0,t)}possibleSubnets(t=128){let r=Ct.BITS-this.subnetMask,n=Math.abs(t-Ct.BITS),i=r-n;return i<0?"0":nV((BigInt("2")**BigInt(i)).toString(10))}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(Ct.BITS-this.subnetMask)}`)}startAddress(){return e.fromBigInt(this._startAddress())}startAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._startAddress()+t)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(Ct.BITS-this.subnetMask)}`)}endAddress(){return e.fromBigInt(this._endAddress())}endAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._endAddress()-t)}offset(t){return e.fromBigInt(bo.offsetBigInt(this.bigInt(),t,Ct.BITS,"IPv6")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(bo.offsetBigInt(this._endAddress(),1,Ct.BITS,"IPv6")).withSubnetMask(this.subnetMask)}withSubnetMask(t){return new e(`${this.correctForm()}/${t}`)}subnetMaskAddress(){return e.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(Ct.BITS-this.subnetMask)}`))}wildcardMask(){return e.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(Ct.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}getScope(){let t=this.getType();return t==="Multicast"||t.startsWith("Multicast ")?Ct.SCOPES[parseInt(this.getBits(12,16).toString(10),10)]||"Unknown":t==="Link-local unicast"||t==="Loopback"?"Link local":t==="Unspecified"?"Unknown":"Global"}getType(){for(let t=0;t<q8.length;t++){let r=q8[t];if(this.isHostInSubnet(r[0]))return r[1]}return"Global unicast"}getBits(t,r){return BigInt(`0b${this.getBitsBase2(t,r)}`)}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,Ct.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:`${n}.ip6.arpa.`:t.omitSuffix?"":"ip6.arpa."}correctForm(){let t,r=[],n=0,i=[];for(t=0;t<this.parsedAddress.length;t++){let a=parseInt(this.parsedAddress[t],16);a===0&&n++,a!==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 o=i.map(a=>a[1]-a[0]+1);if(i.length>0){let a=o.indexOf(Math.max(...o));r=iV(this.parsedAddress,i[a])}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._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(Ct.BITS,"0")),this._binaryZeroPad}parse4in6(t){if(t.indexOf(".")===-1)return t;let r=t.split(":"),n=r.slice(-1)[0],i=n.split(".");if(i.length===Qy.GROUPS&&i.every(s=>/^\d{1,3}$/.test(s))&&i.some(s=>/^0\d/.test(s))){let s=i.map(sV).join("."),a=r.slice(0,-1).map(Tc.escapeHtml).join(":"),u=r.length>1?":":"";throw new Xr.AddressError("IPv4 addresses can't have leading zeroes.",`${a}${u}${s}`)}let o=n.match(Qy.RE_ADDRESS);if(o){this.parsedAddress4=o[0];let s=this.subnetMask>=96?`/${this.subnetMask-96}`:"";this.address4=new Eo.Address4(`${this.parsedAddress4}${s}`),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(Ct.RE_BAD_CHARACTERS);if(r)throw new Xr.AddressError(`Bad character${r.length>1?"s":""} detected in address: ${r.join("")}`,t.replace(Ct.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let n=t.match(Ct.RE_BAD_ADDRESS);if(n)throw new Xr.AddressError(`Address failed regex: ${n.join("")}`,t.replace(Ct.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let i=[],o=t.split("::");if(o.length===2){let s=o[0].split(":"),a=o[1].split(":");s.length===1&&s[0]===""&&(s=[]),a.length===1&&a[0]===""&&(a=[]);let u=this.groups-(s.length+a.length);if(!u)throw new Xr.AddressError("Error parsing groups");this.elidedGroups=u,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,i=i.concat(s);for(let l=0;l<u;l++)i.push("0");i=i.concat(a)}else if(o.length===1)i=t.split(":"),this.elidedGroups=0;else throw new Xr.AddressError("Too many :: groups found");if(i=i.map(s=>parseInt(s,16).toString(16)),i.length!==this.groups)throw new Xr.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(H8).join(":")}decimal(){return this.parsedAddress.map(t=>parseInt(t,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(H8).join("")}`)}to4(){let t=this.binaryZeroPad().split(""),r=BigInt(`0b${t.slice(96,128).join("")}`).toString(16).padStart(8,"0");if(this.subnetMask>=96){let n=this.subnetMask-96,i=[];for(let o=0;o<8;o+=2)i.push(parseInt(r.slice(o,o+2),16));return new Eo.Address4(`${i.join(".")}/${n}`)}return Eo.Address4.fromHex(r)}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.correctForm()}inspectTeredo(){let t=this.getBitsBase16(0,32),n=(this.getBits(80,96)^BigInt("0xffff")).toString(),i=Eo.Address4.fromHex(this.getBitsBase16(32,64)),o=this.getBits(96,128),s=Eo.Address4.fromHex((o^BigInt("0xffffffff")).toString(16).padStart(8,"0")),a=this.getBitsBase2(64,80),u=(0,hm.testBit)(a,15),l=(0,hm.testBit)(a,14),h=(0,hm.testBit)(a,8),m=(0,hm.testBit)(a,9),p=BigInt(`0b${a.slice(2,6)+a.slice(8,16)}`).toString(10);return{prefix:`${t.slice(0,4)}:${t.slice(4,8)}`,server4:i.address,client4:s.address,flags:a,coneNat:u,microsoft:{reserved:l,universalLocal:m,groupIndividual:h,nonce:p},udpPort:n}}inspect6to4(){let t=this.getBitsBase16(0,16),r=Eo.Address4.fromHex(this.getBitsBase16(16,48));return{prefix: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)}static fromAddress4Nat64(t,r="64:ff9b::/96"){let n=new Eo.Address4(t),i=new e(r),o=i.subnetMask;if(o!==32&&o!==40&&o!==48&&o!==56&&o!==64&&o!==96)throw new Xr.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");let s=i.binaryZeroPad(),a=n.binaryZeroPad(),u;if(o===96)u=s.slice(0,96)+a;else{let m=64-o;u=[s.slice(0,o),a.slice(0,m),"00000000",a.slice(m),"0".repeat(56-(32-m))].join("")}let l=BigInt(`0b${u}`).toString(16).padStart(32,"0"),h=[];for(let m=0;m<8;m++)h.push(l.slice(m*4,(m+1)*4));return new e(h.join(":"))}toAddress4Nat64(t="64:ff9b::/96"){let r=new e(t),n=r.subnetMask;if(n!==32&&n!==40&&n!==48&&n!==56&&n!==64&&n!==96)throw new Xr.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");if(!this.isHostInSubnet(r))return null;let i=this.binaryZeroPad(),o;if(n===96)o=i.slice(96,128);else{let a=64-n;o=i.slice(n,n+a)+i.slice(72,72+(32-a))}let s=[];for(let a=0;a<4;a++)s.push(parseInt(o.slice(a*8,(a+1)*8),2).toString());return new Eo.Address4(s.join("."))}toByteArray(){let t=this.bigInt().toString(16).padStart(Ct.BITS/4,"0"),r=[];for(let n=0,i=t.length;n<i;n+=2)r.push(parseInt(t.substring(n,n+2),16));return r}toUnsignedByteArray(){return this.toByteArray().map(M8)}static fromByteArray(t){return bo.assertByteArray(t,16,"IPv6",-128),this.fromUnsignedByteArray(t.map(M8))}static fromUnsignedByteArray(t){bo.assertByteArray(t,16,"IPv6",0);let r=BigInt("256"),n=BigInt("0"),i=BigInt("1");for(let o=t.length-1;o>=0;o--)n+=i*BigInt(t[o].toString(10)),i*=r;return e.fromBigInt(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){let t=this.embeddedIPv4();return t?t.isLinkLocal():this.isHostInSubnet(cV)}isMulticast(){let t=this.embeddedIPv4();if(t)return t.isMulticast();let r=this.getType();return r==="Multicast"||r.startsWith("Multicast ")}is4(){return this.v4}isMapped4(){return this.isHostInSubnet(pV)}embeddedIPv4(){return this.isMapped4()||this.isHostInSubnet(mV)?this.to4():null}isTeredo(){return this.isHostInSubnet(oV)}is6to4(){return this.isHostInSubnet(aV)}isLoopback(){let t=this.embeddedIPv4();return t?t.isLoopback():this.getType()==="Loopback"}isULA(){return this.isHostInSubnet(uV)}isPrivate(){let t=this.embeddedIPv4();return t?t.isPrivate():this.isULA()||this.isHostInSubnet(gV)}isCGNAT(){let t=this.embeddedIPv4();return t?t.isCGNAT():!1}isBroadcast(){let t=this.embeddedIPv4();return t?t.isBroadcast():!1}isUnspecified(){let t=this.embeddedIPv4();return t?t.isUnspecified():this.getType()==="Unspecified"}isDocumentation(){return lV.some(t=>this.isHostInSubnet(t))}isBenchmarking(){let t=this.embeddedIPv4();return t?t.isBenchmarking():this.isHostInSubnet(fV)}isGlobal(){let t=this.embeddedIPv4();return t?t.isGlobal():this.isHostInSubnet(hV)&&bo.isGloballyReachable.call(this,dV)}href(t){return t===void 0?t="":t=`:${t}`,`http://[${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;t.v4&&(r=this.to4in6);let n=r.call(this),i=Tc.escapeHtml(`${t.prefix}${n}`),o=Tc.escapeHtml(n);if(t.className){let s=Tc.escapeHtml(t.className);return`<a href="${i}" class="${s}">${o}</a>`}return`<a href="${i}">${o}</a>`}group(){if(this.elidedGroups===0)return Tc.simpleGroup(this.addressMinusSuffix).join(":");dm(typeof this.elidedGroups=="number"),dm(typeof this.elisionBegin=="number");let t=[],[r,n]=this.addressMinusSuffix.split("::");r.length?t.push(...Tc.simpleGroup(r)):t.push("");let i=["hover-group"];for(let o=this.elisionBegin;o<this.elisionBegin+this.elidedGroups;o++)i.push(`group-${o}`);return t.push(`<span class="${i.join(" ")}"></span>`),n.length?t.push(...Tc.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(dm(this.address4 instanceof Eo.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,Oc.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===Ct.GROUPS)r.push((0,Oc.possibleElisions)(Ct.GROUPS));else{let i=n.address.split("::");i[0].length&&r.push((0,Oc.simpleRegularExpression)(i[0].split(":"))),dm(typeof n.elidedGroups=="number"),r.push((0,Oc.possibleElisions)(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push((0,Oc.simpleRegularExpression)(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Oc.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Oc.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};Ao.Address6=In;var q8=Object.keys(Ct.TYPES).map(e=>[new In(e),Ct.TYPES[e]]),oV=new In("2001::/32"),aV=new In("2002::/16"),uV=new In("fc00::/7"),cV=new In("fe80::/10"),lV=[new In("2001:db8::/32"),new In("3fff::/20")],fV=new In("2001:2::/48"),hV=new In("2000::/3"),dV=Ct.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new In(e),reachable:t})),pV=new In("::ffff:0:0/96"),mV=new In("64:ff9b::/96"),gV=new In("64:ff9b:1::/48")});var K8=be(xn=>{"use strict";var Ofe=B(x()),vV=xn&&xn.__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]})),wV=xn&&xn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),yV=xn&&xn.__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)&&vV(t,e,r);return wV(t,e),t};Object.defineProperty(xn,"__esModule",{value:!0});xn.v6=xn.AddressError=xn.Address6=xn.Address4=void 0;var EV=Xy();Object.defineProperty(xn,"Address4",{enumerable:!0,get:function(){return EV.Address4}});var bV=j8();Object.defineProperty(xn,"Address6",{enumerable:!0,get:function(){return bV.Address6}});var AV=_d();Object.defineProperty(xn,"AddressError",{enumerable:!0,get:function(){return AV.AddressError}});var SV=yV(Jy());xn.v6={helpers:SV}});var W8=be(G8=>{"use strict";var Hfe=B(x());(function(e){function t(){}function r(){}var n=String.fromCharCode,i={}.toString,o=i.call(e.SharedArrayBuffer),s=i(),a=e.Uint8Array,u=a||Array,l=a?ArrayBuffer:u,h=l.isView||function(v){return v&&"length"in v},m=i.call(l.prototype);l=r.prototype;var p=e.TextEncoder,d=new(a?Uint16Array:u)(32);t.prototype.decode=function(v){if(!h(v)){var g=i.call(v);if(g!==m&&g!==o&&g!==s)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");v=a?new u(v):v||[]}for(var y=g="",w=0,E=v.length|0,_=E-32|0,C,F,H=0,K=0,S,I=0,q=-1;w<E;){for(C=w<=_?32:E-w|0;I<C;w=w+1|0,I=I+1|0){switch(F=v[w]&255,F>>4){case 15:if(S=v[w=w+1|0]&255,S>>6!==2||247<F){w=w-1|0;break}H=(F&7)<<6|S&63,K=5,F=256;case 14:S=v[w=w+1|0]&255,H<<=6,H|=(F&15)<<6|S&63,K=S>>6===2?K+4|0:24,F=F+256&768;case 13:case 12:S=v[w=w+1|0]&255,H<<=6,H|=(F&31)<<6|S&63,K=K+7|0,w<E&&S>>6===2&&H>>K&&1114112>H?(F=H,H=H-65536|0,0<=H&&(q=(H>>10)+55296|0,F=(H&1023)+56320|0,31>I?(d[I]=q,I=I+1|0,q=-1):(S=q,q=F,F=S))):(F>>=8,w=w-F-1|0,F=65533),H=K=0,C=w<=_?32:E-w|0;default:d[I]=F;continue;case 11:case 10:case 9:case 8:}d[I]=65533}if(y+=n(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15],d[16],d[17],d[18],d[19],d[20],d[21],d[22],d[23],d[24],d[25],d[26],d[27],d[28],d[29],d[30],d[31]),32>I&&(y=y.slice(0,I-32|0)),w<E){if(d[0]=q,I=~q>>>31,q=-1,y.length<g.length)continue}else q!==-1&&(y+=n(q));g+=y,y=""}return g},l.encode=function(v){v=v===void 0?"":""+v;var g=v.length|0,y=new u((g<<1)+8|0),w,E=0,_=!a;for(w=0;w<g;w=w+1|0,E=E+1|0){var C=v.charCodeAt(w)|0;if(127>=C)y[E]=C;else{if(2047>=C)y[E]=192|C>>6;else{e:{if(55296<=C)if(56319>=C){var F=v.charCodeAt(w=w+1|0)|0;if(56320<=F&&57343>=F){if(C=(C<<10)+F-56613888|0,65535<C){y[E]=240|C>>18,y[E=E+1|0]=128|C>>12&63,y[E=E+1|0]=128|C>>6&63,y[E=E+1|0]=128|C&63;continue}break e}C=65533}else 57343>=C&&(C=65533);!_&&w<<1<E&&w<<1<(E-7|0)&&(_=!0,F=new u(3*g),F.set(y),y=F)}y[E]=224|C>>12,y[E=E+1|0]=128|C>>6&63}y[E=E+1|0]=128|C&63}}return a?y.subarray(0,E):y.slice(0,E)},p||(e.TextDecoder=t,e.TextEncoder=r)})(typeof global>"u"?typeof self>"u"?G8:self:global)});var vI=be(hA=>{"use strict";var d2e=B(x());hA.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};hA.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 wI=be(dA=>{"use strict";var m2e=B(x());dA.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};dA.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 yI=be(pA=>{"use strict";var v2e=B(x());pA.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};pA.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 EI=be(mA=>{"use strict";var y2e=B(x());mA.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};mA.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 bI=be(gA=>{"use strict";var b2e=B(x());gA.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}`};gA.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 _I=be((SI,vA)=>{var A2e=B(x()),AI=(function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.decode=m,e.encode=h,e.familyOf=l,e.name=void 0,e.sizeOf=u,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,o={name:"v4",size:r,isFormat:p=>t.test(p),encode(p,d,v){v=~~v,d=d||new Uint8Array(v+r);let g=p.length,y=0;for(let w=0;w<g;){let E=p.charCodeAt(w++);E===46?(d[v++]=y,y=0):y=y*10+(E-48)}return d[v]=y,d},decode(p,d){return d=~~d,`${p[d++]}.${p[d++]}.${p[d++]}.${p[d]}`}};e.v4=o;let s={name:"v6",size:i,isFormat:p=>p.length>0&&n.test(p),encode(p,d,v){v=~~v;let g=v+i,y=-1,w=0,E=0,_=!0,C=!1;d=d||new Uint8Array(v+i);for(let F=0;F<p.length;F++){let H=p.charCodeAt(F);H===58?(_?y!==-1?(v<g&&(d[v]=0),v<g-1&&(d[v+1]=0),v+=2):v<g&&(y=v):(C===!0?(v<g&&(d[v]=E),v++):(v<g&&(d[v]=w>>8),v<g-1&&(d[v+1]=w&255),v+=2),w=0,E=0),_=!0,C=!1):H===46?(v<g&&(d[v]=E),v++,E=0,w=0,_=!1,C=!0):(_=!1,H>=97?H-=87:H>=65?H-=55:(H-=48,E=E*10+H),w=(w<<4)+H)}if(_===!1)C===!0?(v<g&&(d[v]=E),v++):(v<g&&(d[v]=w>>8),v<g-1&&(d[v+1]=w&255),v+=2);else if(y===0)v<g&&(d[v]=0),v<g-1&&(d[v+1]=0),v+=2;else if(y!==-1){v+=2;for(let F=Math.min(v-1,g-1);F>=y+2;F--)d[F]=d[F-2];d[y]=0,d[y+1]=0,y=v}if(y!==v&&y!==-1)for(v>g-2&&(v=g-2);g>y;)d[--g]=v<g&&v>y?d[--v]:0;else for(;v<g;)d[v++]=0;return d},decode(p,d){d=~~d;let v="";for(let g=0;g<i;g+=2)g!==0&&(v+=":"),v+=(p[d+g]<<8|p[d+g+1]).toString(16);return v.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};e.v6=s;let a="ip";e.name=a;function u(p){if(o.isFormat(p))return o.size;if(s.isFormat(p))return s.size;throw Error(`Invalid ip address: ${p}`)}function l(p){return u(p)===o.size?1:2}function h(p,d,v){v=~~v;let g=u(p);return typeof d=="function"&&(d=d(v+g)),g===o.size?o.encode(p,d,v):s.encode(p,d,v)}function m(p,d,v){if(d=~~d,v=v||p.length-d,v===o.size)return o.decode(p,d,v);if(v===s.size)return s.decode(p,d,v);throw Error(`Invalid buffer size needs to be ${o.size} for v4 or ${s.size} for v6.`)}return"default"in e?e.default:e})({});typeof define=="function"&&define.amd?define([],function(){return AI}):typeof vA=="object"&&typeof SI=="object"&&(vA.exports=AI)});var FI=be(Ye=>{"use strict";var _2e=B(x()),Xe=oa().Buffer,Ka=vI(),yY=wI(),EY=yI(),Og=EI(),wA=bI(),ul=_I(),bY=0,CI=32768,yA=32768,AY=~yA,DI=32768,SY=~DI,Le=Ye.name={};Le.encode=function(e,t,r,{mail:n=!1}={}){t||(t=Xe.alloc(Le.encodingLength(e))),r||(r=0);let i=r,o=e.replace(/^\.|\.$/gm,"");if(o.length){let s=[];if(n){let a="";o.split(".").forEach(u=>{u.endsWith("\\")?a+=(a.length?".":"")+u.slice(0,-1):s.length===0&&a.length?s.push(a+"."+u):s.push(u)})}else s=o.split(".");for(let a=0;a<s.length;a++){let u=t.write(s[a],r+1);t[r]=u,r+=u+1}}return t[r++]=0,Le.encode.bytes=r-i,t};Le.encode.bytes=0;Le.decode=function(e,t,{mail:r=!1}={}){t||(t=0);let n=[],i=t,o=0,s=0,a=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");let u=e[t++];if(s+=a?0:1,u===0)break;if((u&192)===0){if(t+u>e.length)throw new Error("Cannot decode name (buffer overflow)");if(o+=u+1,o>254)throw new Error("Cannot decode name (name too long)");let l=e.toString("utf-8",t,t+u);r&&(l=l.replace(/\./g,"\\.")),n.push(l),t+=u,s+=a?0:u}else if((u&192)===192){if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");let l=e.readUInt16BE(t-1)-49152;if(l>=i)throw new Error("Cannot decode name (bad pointer)");t=l,i=l,s+=a?0:1,a=!0}else throw new Error("Cannot decode name (bad label)")}return Le.decode.bytes=s,n.length===0?".":n.join(".")};Le.decode.bytes=0;Le.encodingLength=function(e){return e==="."||e===".."?1:Xe.byteLength(e.replace(/^\.|\.$/gm,""))+2};var St={};St.encode=function(e,t,r){t||(t=Xe.alloc(St.encodingLength(e))),r||(r=0);let n=t.write(e,r+1);return t[r]=n,St.encode.bytes=n+1,t};St.encode.bytes=0;St.decode=function(e,t){t||(t=0);let r=e[t],n=e.toString("utf-8",t+1,t+1+r);return St.decode.bytes=r+1,n};St.decode.bytes=0;St.encodingLength=function(e){return Xe.byteLength(e)+1};var Ki={};Ki.encode=function(e,t,r){t||(t=Ki.encodingLength(e)),r||(r=0);let n=(e.flags||0)&32767,i=e.type==="response"?CI:bY;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};Ki.encode.bytes=12;Ki.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&CI?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:EY.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:yY.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))}};Ki.decode.bytes=12;Ki.encodingLength=function(){return 12};var Ta=Ye.unknown={};Ta.encode=function(e,t,r){return t||(t=Xe.alloc(Ta.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),Ta.encode.bytes=e.length+2,t};Ta.encode.bytes=0;Ta.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return Ta.decode.bytes=r+2,n};Ta.decode.bytes=0;Ta.encodingLength=function(e){return e.length+2};var Oa=Ye.ns={};Oa.encode=function(e,t,r){return t||(t=Xe.alloc(Oa.encodingLength(e))),r||(r=0),Le.encode(e,t,r+2),t.writeUInt16BE(Le.encode.bytes,r),Oa.encode.bytes=Le.encode.bytes+2,t};Oa.encode.bytes=0;Oa.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=Le.decode(e,t+2);return Oa.decode.bytes=r+2,n};Oa.decode.bytes=0;Oa.encodingLength=function(e){return Le.encodingLength(e)+2};var Na=Ye.soa={};Na.encode=function(e,t,r){t||(t=Xe.alloc(Na.encodingLength(e))),r||(r=0);let n=r;return r+=2,Le.encode(e.mname,t,r),r+=Le.encode.bytes,Le.encode(e.rname,t,r,{mail:!0}),r+=Le.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),Na.encode.bytes=r-n,t};Na.encode.bytes=0;Na.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mname=Le.decode(e,t),t+=Le.decode.bytes,n.rname=Le.decode(e,t,{mail:!0}),t+=Le.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,Na.decode.bytes=t-r,n};Na.decode.bytes=0;Na.encodingLength=function(e){return 22+Le.encodingLength(e.mname)+Le.encodingLength(e.rname)};var La=Ye.txt={};La.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]=Xe.from(e[i])),!Xe.isBuffer(e[i]))throw new Error("Must be a Buffer");t||(t=Xe.alloc(La.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),La.encode.bytes=r-n,t};La.encode.bytes=0;La.decode=function(e,t){t||(t=0);let r=t,n=e.readUInt16BE(t);t+=2;let i=[];for(;n>0;){let o=e[t++];if(--n,n<o)throw new Error("Buffer overflow");i.push(e.slice(t,t+o)),t+=o,n-=o}return La.decode.bytes=t-r,i};La.decode.bytes=0;La.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach(function(r){typeof r=="string"?t+=Xe.byteLength(r)+1:t+=r.length+1}),t};var Ua=Ye.null={};Ua.encode=function(e,t,r){t||(t=Xe.alloc(Ua.encodingLength(e))),r||(r=0),typeof e=="string"&&(e=Xe.from(e)),e||(e=Xe.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),Ua.encode.bytes=r-n,t};Ua.encode.bytes=0;Ua.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,Ua.decode.bytes=t-r,i};Ua.decode.bytes=0;Ua.encodingLength=function(e){return e?(Xe.isBuffer(e)?e.length:Xe.byteLength(e))+2:2};var Ha=Ye.hinfo={};Ha.encode=function(e,t,r){t||(t=Xe.alloc(Ha.encodingLength(e))),r||(r=0);let n=r;return r+=2,St.encode(e.cpu,t,r),r+=St.encode.bytes,St.encode(e.os,t,r),r+=St.encode.bytes,t.writeUInt16BE(r-n-2,n),Ha.encode.bytes=r-n,t};Ha.encode.bytes=0;Ha.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.cpu=St.decode(e,t),t+=St.decode.bytes,n.os=St.decode(e,t),t+=St.decode.bytes,Ha.decode.bytes=t-r,n};Ha.decode.bytes=0;Ha.encodingLength=function(e){return St.encodingLength(e.cpu)+St.encodingLength(e.os)+2};var qi=Ye.ptr={},_Y=Ye.cname=qi,CY=Ye.dname=qi;qi.encode=function(e,t,r){return t||(t=Xe.alloc(qi.encodingLength(e))),r||(r=0),Le.encode(e,t,r+2),t.writeUInt16BE(Le.encode.bytes,r),qi.encode.bytes=Le.encode.bytes+2,t};qi.encode.bytes=0;qi.decode=function(e,t){t||(t=0);let r=Le.decode(e,t+2);return qi.decode.bytes=Le.decode.bytes+2,r};qi.decode.bytes=0;qi.encodingLength=function(e){return Le.encodingLength(e)+2};var Ma=Ye.srv={};Ma.encode=function(e,t,r){t||(t=Xe.alloc(Ma.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),Le.encode(e.target,t,r+8);let n=Le.encode.bytes+6;return t.writeUInt16BE(n,r),Ma.encode.bytes=n+2,t};Ma.encode.bytes=0;Ma.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=Le.decode(e,t+8),Ma.decode.bytes=r+2,n};Ma.decode.bytes=0;Ma.encodingLength=function(e){return 8+Le.encodingLength(e.target)};var Ts=Ye.caa={};Ts.ISSUER_CRITICAL=128;Ts.encode=function(e,t,r){let n=Ts.encodingLength(e);return t||(t=Xe.alloc(Ts.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=Ts.ISSUER_CRITICAL),t.writeUInt16BE(n-2,r),r+=2,t.writeUInt8(e.flags||0,r),r+=1,St.encode(e.tag,t,r),r+=St.encode.bytes,t.write(e.value,r),r+=Xe.byteLength(e.value),Ts.encode.bytes=n,t};Ts.encode.bytes=0;Ts.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=St.decode(e,t),t+=St.decode.bytes,i.value=e.toString("utf-8",t,n+r),i.issuerCritical=!!(i.flags&Ts.ISSUER_CRITICAL),Ts.decode.bytes=r+2,i};Ts.decode.bytes=0;Ts.encodingLength=function(e){return St.encodingLength(e.tag)+St.encodingLength(e.value)+2};var Ju=Ye.mx={};Ju.encode=function(e,t,r){t||(t=Xe.alloc(Ju.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,Le.encode(e.exchange,t,r),r+=Le.encode.bytes,t.writeUInt16BE(r-n-2,n),Ju.encode.bytes=r-n,t};Ju.encode.bytes=0;Ju.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.preference=e.readUInt16BE(t),t+=2,n.exchange=Le.decode(e,t),t+=Le.decode.bytes,Ju.decode.bytes=t-r,n};Ju.encodingLength=function(e){return 4+Le.encodingLength(e.exchange)};var qa=Ye.a={};qa.encode=function(e,t,r){return t||(t=Xe.alloc(qa.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,ul.v4.encode(e,t,r),qa.encode.bytes=6,t};qa.encode.bytes=0;qa.decode=function(e,t){t||(t=0),t+=2;let r=ul.v4.decode(e,t);return qa.decode.bytes=6,r};qa.decode.bytes=0;qa.encodingLength=function(){return 6};var ja=Ye.aaaa={};ja.encode=function(e,t,r){return t||(t=Xe.alloc(ja.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,ul.v6.encode(e,t,r),ja.encode.bytes=18,t};ja.encode.bytes=0;ja.decode=function(e,t){t||(t=0),t+=2;let r=ul.v6.decode(e,t);return ja.decode.bytes=18,r};ja.decode.bytes=0;ja.encodingLength=function(){return 18};var Es=Ye.option={};Es.encode=function(e,t,r){t||(t=Xe.alloc(Es.encodingLength(e))),r||(r=0);let n=r,i=wA.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 o=e.sourcePrefixLength||0,s=e.family||ul.familyOf(e.ip),a=ul.encode(e.ip,Xe.alloc),u=Math.ceil(o/8);t.writeUInt16BE(u+4,r),r+=2,t.writeUInt16BE(s,r),r+=2,t.writeUInt8(o,r++),t.writeUInt8(e.scopePrefixLength||0,r++),a.copy(t,r,0,u),r+=u;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 l=e.length||0;t.writeUInt16BE(l,r),r+=2,t.fill(0,r,r+l),r+=l;break;case 14:let h=e.tags.length*2;t.writeUInt16BE(h,r),r+=2;for(let m of e.tags)t.writeUInt16BE(m,r),r+=2;break;default:throw new Error(`Unknown roption code: ${e.code}`)}return Es.encode.bytes=r-n,t};Es.encode.bytes=0;Es.decode=function(e,t){t||(t=0);let r={};r.code=e.readUInt16BE(t),r.type=wA.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=Xe.alloc(r.family===1?4:16);e.copy(i,0,t,t+n-4),r.ip=ul.decode(i);break;case 11:n>0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let o=0;o<n;o+=2)r.tags.push(e.readUInt16BE(t)),t+=2}return Es.decode.bytes=n+4,r};Es.decode.bytes=0;Es.encodingLength=function(e){if(e.data)return e.data.length+4;switch(wA.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 Ns=Ye.opt={};Ns.encode=function(e,t,r){t||(t=Xe.alloc(Ns.encodingLength(e))),r||(r=0);let n=r,i=Vf(e,Es);return t.writeUInt16BE(i,r),r=gp(e,Es,t,r+2),Ns.encode.bytes=r-n,t};Ns.encode.bytes=0;Ns.decode=function(e,t){t||(t=0);let r=t,n=[],i=e.readUInt16BE(t);t+=2;let o=0;for(;i>0;)n[o++]=Es.decode(e,t),t+=Es.decode.bytes,i-=Es.decode.bytes;return Ns.decode.bytes=t-r,n};Ns.decode.bytes=0;Ns.encodingLength=function(e){return 2+Vf(e||[],Es)};var Yn=Ye.dnskey={};Yn.PROTOCOL_DNSSEC=3;Yn.ZONE_KEY=128;Yn.SECURE_ENTRYPOINT=32768;Yn.encode=function(e,t,r){t||(t=Xe.alloc(Yn.encodingLength(e))),r||(r=0);let n=r,i=e.key;if(!Xe.isBuffer(i))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(Yn.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Yn.encode.bytes=r-n,t.writeUInt16BE(Yn.encode.bytes-2,n),t};Yn.encode.bytes=0;Yn.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)!==Yn.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,Yn.decode.bytes=t-r,n};Yn.decode.bytes=0;Yn.encodingLength=function(e){return 6+Xe.byteLength(e.key)};var $o=Ye.rrsig={};$o.encode=function(e,t,r){t||(t=Xe.alloc($o.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!Xe.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(Ka.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,Le.encode(e.signersName,t,r),r+=Le.encode.bytes,i.copy(t,r,0,i.length),r+=i.length,$o.encode.bytes=r-n,t.writeUInt16BE($o.encode.bytes-2,n),t};$o.encode.bytes=0;$o.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=Ka.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=Le.decode(e,t),t+=Le.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,$o.decode.bytes=t-r,n};$o.decode.bytes=0;$o.encodingLength=function(e){return 20+Le.encodingLength(e.signersName)+Xe.byteLength(e.signature)};var Po=Ye.rp={};Po.encode=function(e,t,r){t||(t=Xe.alloc(Po.encodingLength(e))),r||(r=0);let n=r;return r+=2,Le.encode(e.mbox||".",t,r,{mail:!0}),r+=Le.encode.bytes,Le.encode(e.txt||".",t,r),r+=Le.encode.bytes,Po.encode.bytes=r-n,t.writeUInt16BE(Po.encode.bytes-2,n),t};Po.encode.bytes=0;Po.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=Le.decode(e,t,{mail:!0})||".",t+=Le.decode.bytes,n.txt=Le.decode(e,t)||".",t+=Le.decode.bytes,Po.decode.bytes=t-r,n};Po.decode.bytes=0;Po.encodingLength=function(e){return 2+Le.encodingLength(e.mbox||".")+Le.encodingLength(e.txt||".")};var Jr={};Jr.encode=function(e,t,r){t||(t=Xe.alloc(Jr.encodingLength(e))),r||(r=0);let n=r;for(var i=[],o=0;o<e.length;o++){var s=Ka.toType(e[o]);i[s>>8]===void 0&&(i[s>>8]=[]),i[s>>8][s>>3&31]|=1<<7-(s&7)}for(o=0;o<i.length;o++)if(i[o]!==void 0){var a=Xe.from(i[o]);t.writeUInt8(o,r),r+=1,t.writeUInt8(a.length,r),r+=1,a.copy(t,r),r+=a.length}return Jr.encode.bytes=r-n,t};Jr.encode.bytes=0;Jr.decode=function(e,t,r){t||(t=0);let n=t;for(var i=[];t-n<r;){var o=e.readUInt8(t);t+=1;var s=e.readUInt8(t);t+=1;for(var a=0;a<s;a++)for(var u=e.readUInt8(t+a),l=0;l<8;l++)if(u&1<<7-l){var h=Ka.toString(o<<8|a<<3|l);i.push(h)}t+=s}return Jr.decode.bytes=t-n,i};Jr.decode.bytes=0;Jr.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var n=Ka.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 ko=Ye.nsec={};ko.encode=function(e,t,r){t||(t=Xe.alloc(ko.encodingLength(e))),r||(r=0);let n=r;return r+=2,Le.encode(e.nextDomain,t,r),r+=Le.encode.bytes,Jr.encode(e.rrtypes,t,r),r+=Jr.encode.bytes,ko.encode.bytes=r-n,t.writeUInt16BE(ko.encode.bytes-2,n),t};ko.encode.bytes=0;ko.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.nextDomain=Le.decode(e,t),t+=Le.decode.bytes,n.rrtypes=Jr.decode(e,t,i-(t-r)),t+=Jr.decode.bytes,ko.decode.bytes=t-r,n};ko.decode.bytes=0;ko.encodingLength=function(e){return 2+Le.encodingLength(e.nextDomain)+Jr.encodingLength(e.rrtypes)};var Ro=Ye.nsec3={};Ro.encode=function(e,t,r){t||(t=Xe.alloc(Ro.encodingLength(e))),r||(r=0);let n=r,i=e.salt;if(!Xe.isBuffer(i))throw new Error("salt must be a Buffer");let o=e.nextDomain;if(!Xe.isBuffer(o))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(o.length,r),r+=1,o.copy(t,r,0,o.length),r+=o.length,Jr.encode(e.rrtypes,t,r),r+=Jr.encode.bytes,Ro.encode.bytes=r-n,t.writeUInt16BE(Ro.encode.bytes-2,n),t};Ro.encode.bytes=0;Ro.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 o=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+o),t+=o;let s=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=Jr.decode(e,t,i-(t-r)),t+=Jr.decode.bytes,Ro.decode.bytes=t-r,n};Ro.decode.bytes=0;Ro.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+Jr.encodingLength(e.rrtypes)};var To=Ye.ds={};To.encode=function(e,t,r){t||(t=Xe.alloc(To.encodingLength(e))),r||(r=0);let n=r,i=e.digest;if(!Xe.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,To.encode.bytes=r-n,t.writeUInt16BE(To.encode.bytes-2,n),t};To.encode.bytes=0;To.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,To.decode.bytes=t-r,n};To.decode.bytes=0;To.encodingLength=function(e){return 6+Xe.byteLength(e.digest)};var Os=Ye.sshfp={};Os.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};Os.encode=function(t,r,n){r||(r=Xe.alloc(Os.encodingLength(t))),n||(n=0);let i=n;n+=2,r[n]=t.algorithm,n+=1,r[n]=t.hash,n+=1;let o=Xe.from(t.fingerprint.toUpperCase(),"hex");if(o.length!==Os.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return o.copy(r,n),n+=o.byteLength,Os.encode.bytes=n-i,r.writeUInt16BE(Os.encode.bytes-2,i),r};Os.encode.bytes=0;Os.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 o=Os.getFingerprintLengthForHashType(i.hash);return i.fingerprint=t.slice(r,r+o).toString("hex").toUpperCase(),r+=o,Os.decode.bytes=r-n,i};Os.decode.bytes=0;Os.encodingLength=function(e){return 4+Xe.from(e.fingerprint,"hex").byteLength};var Oo=Ye.naptr={};Oo.encode=function(e,t,r){t||(t=Xe.alloc(Oo.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,St.encode(e.flags,t,r),r+=St.encode.bytes,St.encode(e.services,t,r),r+=St.encode.bytes,St.encode(e.regexp,t,r),r+=St.encode.bytes,Le.encode(e.replacement,t,r),r+=Le.encode.bytes,Oo.encode.bytes=r-n,t.writeUInt16BE(Oo.encode.bytes-2,n),t};Oo.encode.bytes=0;Oo.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=St.decode(e,t),t+=St.decode.bytes,n.services=St.decode(e,t),t+=St.decode.bytes,n.regexp=St.decode(e,t),t+=St.decode.bytes,n.replacement=Le.decode(e,t),t+=Le.decode.bytes,Oo.decode.bytes=t-r,n};Oo.decode.bytes=0;Oo.encodingLength=function(e){return St.encodingLength(e.flags)+St.encodingLength(e.services)+St.encodingLength(e.regexp)+Le.encodingLength(e.replacement)+6};var No=Ye.tlsa={};No.encode=function(e,t,r){t||(t=Xe.alloc(No.encodingLength(e))),r||(r=0);let n=r,i=e.certificate;if(!Xe.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,No.encode.bytes=r-n,t.writeUInt16BE(No.encode.bytes-2,n),t};No.encode.bytes=0;No.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,No.decode.bytes=t-r,n};No.decode.bytes=0;No.encodingLength=function(e){return 5+Xe.byteLength(e.certificate)};var EA=Ye.record=function(e){switch(e.toUpperCase()){case"A":return qa;case"PTR":return qi;case"CNAME":return _Y;case"DNAME":return CY;case"TXT":return La;case"NULL":return Ua;case"AAAA":return ja;case"SRV":return Ma;case"HINFO":return Ha;case"CAA":return Ts;case"NS":return Oa;case"SOA":return Na;case"MX":return Ju;case"OPT":return Ns;case"DNSKEY":return Yn;case"RRSIG":return $o;case"RP":return Po;case"NSEC":return ko;case"NSEC3":return Ro;case"SSHFP":return Os;case"DS":return To;case"NAPTR":return Oo;case"TLSA":return No}return Ta},ln=Ye.answer={};ln.encode=function(e,t,r){t||(t=Xe.alloc(ln.encodingLength(e))),r||(r=0);let n=r;if(Le.encode(e.name,t,r),r+=Le.encode.bytes,t.writeUInt16BE(Ka.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,Ns.encode(e.options||[],t,r),r+=Ns.encode.bytes}else{let i=Og.toClass(e.class===void 0?"IN":e.class);e.flush&&(i|=yA),t.writeUInt16BE(i,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let o=EA(e.type);o.encode(e.data,t,r),r+=o.encode.bytes}return ln.encode.bytes=r-n,t};ln.encode.bytes=0;ln.decode=function(e,t){t||(t=0);let r={},n=t;if(r.name=Le.decode(e,t),t+=Le.decode.bytes,r.type=Ka.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=Ns.decode(e,t+8),t+=8+Ns.decode.bytes;else{let i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=Og.toString(i&AY),r.flush=!!(i&yA);let o=EA(r.type);r.data=o.decode(e,t+8),t+=8+o.decode.bytes}return ln.decode.bytes=t-n,r};ln.decode.bytes=0;ln.encodingLength=function(e){let t=e.data!==null&&e.data!==void 0?e.data:e.options;return Le.encodingLength(e.name)+8+EA(e.type).encodingLength(t)};var ji=Ye.question={};ji.encode=function(e,t,r){t||(t=Xe.alloc(ji.encodingLength(e))),r||(r=0);let n=r;return Le.encode(e.name,t,r),r+=Le.encode.bytes,t.writeUInt16BE(Ka.toType(e.type),r),r+=2,t.writeUInt16BE(Og.toClass(e.class===void 0?"IN":e.class),r),r+=2,ji.encode.bytes=r-n,e};ji.encode.bytes=0;ji.decode=function(e,t){t||(t=0);let r=t,n={};return n.name=Le.decode(e,t),t+=Le.decode.bytes,n.type=Ka.toString(e.readUInt16BE(t)),t+=2,n.class=Og.toString(e.readUInt16BE(t)),t+=2,!!(n.class&DI)&&(n.class&=SY),ji.decode.bytes=t-r,n};ji.decode.bytes=0;ji.encodingLength=function(e){return Le.encodingLength(e.name)+4};Ye.AUTHORITATIVE_ANSWER=1024;Ye.TRUNCATED_RESPONSE=512;Ye.RECURSION_DESIRED=256;Ye.RECURSION_AVAILABLE=128;Ye.AUTHENTIC_DATA=32;Ye.CHECKING_DISABLED=16;Ye.DNSSEC_OK=32768;Ye.encode=function(e,t,r){let n=!t;n&&(t=Xe.alloc(Ye.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=[]),Ki.encode(e,t,r),r+=Ki.encode.bytes,r=gp(e.questions,ji,t,r),r=gp(e.answers,ln,t,r),r=gp(e.authorities,ln,t,r),r=gp(e.additionals,ln,t,r),Ye.encode.bytes=r-i,n&&Ye.encode.bytes!==t.length?t.slice(0,Ye.encode.bytes):t};Ye.encode.bytes=0;Ye.decode=function(e,t){t||(t=0);let r=t,n=Ki.decode(e,t);return t+=Ki.decode.bytes,t=Tg(n.questions,ji,e,t),t=Tg(n.answers,ln,e,t),t=Tg(n.authorities,ln,e,t),t=Tg(n.additionals,ln,e,t),Ye.decode.bytes=t-r,n};Ye.decode.bytes=0;Ye.encodingLength=function(e){return Ki.encodingLength(e)+Vf(e.questions||[],ji)+Vf(e.answers||[],ln)+Vf(e.authorities||[],ln)+Vf(e.additionals||[],ln)};Ye.streamEncode=function(e){let t=Ye.encode(e),r=Xe.alloc(2);r.writeUInt16BE(t.byteLength);let n=Xe.concat([r,t]);return Ye.streamEncode.bytes=n.byteLength,n};Ye.streamEncode.bytes=0;Ye.streamDecode=function(e){let t=e.readUInt16BE(0);if(e.byteLength<t+2)return null;let r=Ye.decode(e.slice(2));return Ye.streamDecode.bytes=Ye.decode.bytes,r};Ye.streamDecode.bytes=0;function Vf(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function gp(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 Tg(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 Va=be((Gf,wp)=>{var M2e=B(x());(function(){var e,t="4.18.1",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",o="Invalid `variable` option passed into `_.template`",s="Invalid `imports` option passed into `_.template`",a="__lodash_hash_undefined__",u=500,l="__lodash_placeholder__",h=1,m=2,p=4,d=1,v=2,g=1,y=2,w=4,E=8,_=16,C=32,F=64,H=128,K=256,S=512,I=30,q="...",L=800,R=16,O=1,T=2,N=3,P=1/0,M=9007199254740991,Y=17976931348623157e292,V=NaN,X=4294967295,te=X-1,ae=X>>>1,me=[["ary",H],["bind",g],["bindKey",y],["curry",E],["curryRight",_],["flip",S],["partial",C],["partialRight",F],["rearg",K]],he="[object Arguments]",De="[object Array]",Pe="[object AsyncFunction]",Ie="[object Boolean]",se="[object Date]",pe="[object DOMException]",Fe="[object Error]",Te="[object Function]",Ve="[object GeneratorFunction]",Oe="[object Map]",pt="[object Number]",Qe="[object Null]",ct="[object Object]",mn="[object Promise]",gr="[object Proxy]",vr="[object RegExp]",lt="[object Set]",Pr="[object String]",Qn="[object Symbol]",mi="[object Undefined]",Dt="[object WeakMap]",Ze="[object WeakSet]",Re="[object ArrayBuffer]",or="[object DataView]",Tn="[object Float32Array]",mt="[object Float64Array]",ac="[object Int8Array]",On="[object Int16Array]",Se="[object Int32Array]",eu="[object Uint8Array]",Ut="[object Uint8ClampedArray]",gn="[object Uint16Array]",Yi="[object Uint32Array]",bl=/\b__p \+= '';/g,tu=/\b(__p \+=) '' \+/g,ih=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ru=/&(?:amp|lt|gt|quot|#39);/g,Xi=/[&<>"']/g,Kt=RegExp(ru.source),qs=RegExp(Xi.source),Al=/<%-([\s\S]+?)%>/g,oh=/<%([\s\S]+?)%>/g,uc=/<%=([\s\S]+?)%>/g,nu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ah=/^\w*$/,Sl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,cc=/[\\^$.*+?()[\]{}|]/g,uh=RegExp(cc.source),ie=/^\s+/,we=/\s/,je=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Me=/\{\n\/\* \[wrapped with (.+)\] \*/,et=/,? & /,gt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,wt=/[()=,{}\[\]\/\s]/,kr=/\\(\\)?/g,ar=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,js=/\w*$/,Zi=/^[-+]0x[0-9a-f]+$/i,Nn=/^0b[01]+$/i,es=/^\[object .+?Constructor\]$/,Fr=/^0o[0-7]+$/i,Ln=/^(?:0|[1-9]\d*)$/,su=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,iu=/($^)/,ch=/['\n\r\u2028\u2029\\]/g,vn="\\ud800-\\udfff",Ht="\\u0300-\\u036f",Br="\\ufe20-\\ufe2f",ut="\\u20d0-\\u20ff",ur=Ht+Br+ut,wn="\\u2700-\\u27bf",nr="a-z\\xdf-\\xf6\\xf8-\\xff",ts="\\xac\\xb1\\xd7\\xf7",_s="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ks="\\u2000-\\u206f",gi=" \\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",Ji="A-Z\\xc0-\\xd6\\xd8-\\xde",_l="\\ufe0e\\ufe0f",Lp=ts+_s+Ks+gi,lh="['\u2019]",E2="["+vn+"]",Up="["+Lp+"]",Cl="["+ur+"]",Hp="\\d+",b2="["+wn+"]",fh="["+nr+"]",hh="[^"+vn+Lp+Hp+wn+nr+Ji+"]",dh="\\ud83c[\\udffb-\\udfff]",A2="(?:"+Cl+"|"+dh+")",Mp="[^"+vn+"]",ph="(?:\\ud83c[\\udde6-\\uddff]){2}",ou="[\\ud800-\\udbff][\\udc00-\\udfff]",au="["+Ji+"]",qp="\\u200d",jp="(?:"+fh+"|"+hh+")",S2="(?:"+au+"|"+hh+")",Kp="(?:"+lh+"(?:d|ll|m|re|s|t|ve))?",Vp="(?:"+lh+"(?:D|LL|M|RE|S|T|VE))?",zp=A2+"?",Gp="["+_l+"]?",_2="(?:"+qp+"(?:"+[Mp,ph,ou].join("|")+")"+Gp+zp+")*",C2="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",D2="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Wp=Gp+zp+_2,F2="(?:"+[b2,ph,ou].join("|")+")"+Wp,B2="(?:"+[Mp+Cl+"?",Cl,ph,ou,E2].join("|")+")",I2=RegExp(lh,"g"),x2=RegExp(Cl,"g"),mh=RegExp(dh+"(?="+dh+")|"+B2+Wp,"g"),$2=RegExp([au+"?"+fh+"+"+Kp+"(?="+[Up,au,"$"].join("|")+")",S2+"+"+Vp+"(?="+[Up,au+jp,"$"].join("|")+")",au+"?"+jp+"+"+Kp,au+"+"+Vp,D2,C2,Hp,F2].join("|"),"g"),P2=RegExp("["+qp+vn+ur+_l+"]"),k2=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,R2=["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"],T2=-1,er={};er[Tn]=er[mt]=er[ac]=er[On]=er[Se]=er[eu]=er[Ut]=er[gn]=er[Yi]=!0,er[he]=er[De]=er[Re]=er[Ie]=er[or]=er[se]=er[Fe]=er[Te]=er[Oe]=er[pt]=er[ct]=er[vr]=er[lt]=er[Pr]=er[Dt]=!1;var Zt={};Zt[he]=Zt[De]=Zt[Re]=Zt[or]=Zt[Ie]=Zt[se]=Zt[Tn]=Zt[mt]=Zt[ac]=Zt[On]=Zt[Se]=Zt[Oe]=Zt[pt]=Zt[ct]=Zt[vr]=Zt[lt]=Zt[Pr]=Zt[Qn]=Zt[eu]=Zt[Ut]=Zt[gn]=Zt[Yi]=!0,Zt[Fe]=Zt[Te]=Zt[Dt]=!1;var O2={\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"},N2={"&":"&","<":"<",">":">",'"':""","'":"'"},L2={"&":"&","<":"<",">":">",""":'"',"'":"'"},U2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},H2=parseFloat,M2=parseInt,Yp=typeof global=="object"&&global&&global.Object===Object&&global,q2=typeof self=="object"&&self&&self.Object===Object&&self,Ir=Yp||q2||Function("return this")(),gh=typeof Gf=="object"&&Gf&&!Gf.nodeType&&Gf,jo=gh&&typeof wp=="object"&&wp&&!wp.nodeType&&wp,Xp=jo&&jo.exports===gh,vh=Xp&&Yp.process,rs=(function(){try{var oe=jo&&jo.require&&jo.require("util").types;return oe||vh&&vh.binding&&vh.binding("util")}catch{}})(),Zp=rs&&rs.isArrayBuffer,Jp=rs&&rs.isDate,Qp=rs&&rs.isMap,e0=rs&&rs.isRegExp,t0=rs&&rs.isSet,r0=rs&&rs.isTypedArray;function Un(oe,ye,de){switch(de.length){case 0:return oe.call(ye);case 1:return oe.call(ye,de[0]);case 2:return oe.call(ye,de[0],de[1]);case 3:return oe.call(ye,de[0],de[1],de[2])}return oe.apply(ye,de)}function j2(oe,ye,de,He){for(var ot=-1,xt=oe==null?0:oe.length;++ot<xt;){var wr=oe[ot];ye(He,wr,de(wr),oe)}return He}function U(oe,ye){for(var de=-1,He=oe==null?0:oe.length;++de<He&&ye(oe[de],de,oe)!==!1;);return oe}function ft(oe,ye){for(var de=oe==null?0:oe.length;de--&&ye(oe[de],de,oe)!==!1;);return oe}function lc(oe,ye){for(var de=-1,He=oe==null?0:oe.length;++de<He;)if(!ye(oe[de],de,oe))return!1;return!0}function Rr(oe,ye){for(var de=-1,He=oe==null?0:oe.length,ot=0,xt=[];++de<He;){var wr=oe[de];ye(wr,de,oe)&&(xt[ot++]=wr)}return xt}function uu(oe,ye){var de=oe==null?0:oe.length;return!!de&&cu(oe,ye,0)>-1}function ce(oe,ye,de){for(var He=-1,ot=oe==null?0:oe.length;++He<ot;)if(de(ye,oe[He]))return!0;return!1}function Wt(oe,ye){for(var de=-1,He=oe==null?0:oe.length,ot=Array(He);++de<He;)ot[de]=ye(oe[de],de,oe);return ot}function Qi(oe,ye){for(var de=-1,He=ye.length,ot=oe.length;++de<He;)oe[ot+de]=ye[de];return oe}function n0(oe,ye,de,He){var ot=-1,xt=oe==null?0:oe.length;for(He&&xt&&(de=oe[++ot]);++ot<xt;)de=ye(de,oe[ot],ot,oe);return de}function zS(oe,ye,de,He){var ot=oe==null?0:oe.length;for(He&&ot&&(de=oe[--ot]);ot--;)de=ye(de,oe[ot],ot,oe);return de}function tr(oe,ye){for(var de=-1,He=oe==null?0:oe.length;++de<He;)if(ye(oe[de],de,oe))return!0;return!1}var GS=Ae("length");function wh(oe){return oe.split("")}function rt(oe){return oe.match(gt)||[]}function Vr(oe,ye,de){var He;return de(oe,function(ot,xt,wr){if(ye(ot,xt,wr))return He=xt,!1}),He}function Dl(oe,ye,de,He){for(var ot=oe.length,xt=de+(He?1:-1);He?xt--:++xt<ot;)if(ye(oe[xt],xt,oe))return xt;return-1}function cu(oe,ye,de){return ye===ye?W2(oe,ye,de):Dl(oe,yh,de)}function vi(oe,ye,de,He){for(var ot=de-1,xt=oe.length;++ot<xt;)if(He(oe[ot],ye))return ot;return-1}function yh(oe){return oe!==oe}function lu(oe,ye){var de=oe==null?0:oe.length;return de?Ah(oe,ye)/de:V}function Ae(oe){return function(ye){return ye==null?e:ye[oe]}}function Eh(oe){return function(ye){return oe==null?e:oe[ye]}}function bh(oe,ye,de,He,ot){return ot(oe,function(xt,wr,Vt){de=He?(He=!1,xt):ye(de,xt,wr,Vt)}),de}function s0(oe,ye){var de=oe.length;for(oe.sort(ye);de--;)oe[de]=oe[de].value;return oe}function Ah(oe,ye){for(var de,He=-1,ot=oe.length;++He<ot;){var xt=ye(oe[He]);xt!==e&&(de=de===e?xt:de+xt)}return de}function Sh(oe,ye){for(var de=-1,He=Array(oe);++de<oe;)He[de]=ye(de);return He}function i0(oe,ye){return Wt(ye,function(de){return[de,oe[de]]})}function _h(oe){return oe&&oe.slice(0,Bh(oe)+1).replace(ie,"")}function Qr(oe){return function(ye){return oe(ye)}}function Ch(oe,ye){return Wt(ye,function(de){return oe[de]})}function Ko(oe,ye){return oe.has(ye)}function o0(oe,ye){for(var de=-1,He=oe.length;++de<He&&cu(ye,oe[de],0)>-1;);return de}function Dh(oe,ye){for(var de=oe.length;de--&&cu(ye,oe[de],0)>-1;);return de}function Fh(oe,ye){for(var de=oe.length,He=0;de--;)oe[de]===ye&&++He;return He}var K2=Eh(O2),a0=Eh(N2);function V2(oe){return"\\"+U2[oe]}function u0(oe,ye){return oe==null?e:oe[ye]}function fu(oe){return P2.test(oe)}function z2(oe){return k2.test(oe)}function G2(oe){for(var ye,de=[];!(ye=oe.next()).done;)de.push(ye.value);return de}function zr(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He,ot){de[++ye]=[ot,He]}),de}function fc(oe,ye){return function(de){return oe(ye(de))}}function en(oe,ye){for(var de=-1,He=oe.length,ot=0,xt=[];++de<He;){var wr=oe[de];(wr===ye||wr===l)&&(oe[de]=l,xt[ot++]=de)}return xt}function Vo(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=He}),de}function c0(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=[He,He]}),de}function W2(oe,ye,de){for(var He=de-1,ot=oe.length;++He<ot;)if(oe[He]===ye)return He;return-1}function l0(oe,ye,de){for(var He=de+1;He--;)if(oe[He]===ye)return He;return He}function zo(oe){return fu(oe)?Y2(oe):GS(oe)}function Hn(oe){return fu(oe)?X2(oe):wh(oe)}function Bh(oe){for(var ye=oe.length;ye--&&we.test(oe.charAt(ye)););return ye}var f0=Eh(L2);function Y2(oe){for(var ye=mh.lastIndex=0;mh.test(oe);)++ye;return ye}function X2(oe){return oe.match(mh)||[]}function Z2(oe){return oe.match($2)||[]}var Ih=(function oe(ye){ye=ye==null?Ir:wi.defaults(Ir.Object(),ye,wi.pick(Ir,R2));var de=ye.Array,He=ye.Date,ot=ye.Error,xt=ye.Function,wr=ye.Math,Vt=ye.Object,xh=ye.RegExp,J2=ye.String,ns=ye.TypeError,hc=de.prototype,h0=xt.prototype,Cs=Vt.prototype,Fl=ye["__core-js_shared__"],Go=h0.toString,Ot=Cs.hasOwnProperty,$h=0,d0=(function(){var c=/[^.]+$/.exec(Fl&&Fl.keys&&Fl.keys.IE_PROTO||"");return c?"Symbol(src)_1."+c:""})(),Bl=Cs.toString,Q2=Go.call(Vt),ev=Ir._,tv=xh("^"+Go.call(Ot).replace(cc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Il=Xp?ye.Buffer:e,eo=ye.Symbol,xl=ye.Uint8Array,p0=Il?Il.allocUnsafe:e,$l=fc(Vt.getPrototypeOf,Vt),m0=Vt.create,Yt=Cs.propertyIsEnumerable,Pl=hc.splice,kl=eo?eo.isConcatSpreadable:e,dc=eo?eo.iterator:e,Wo=eo?eo.toStringTag:e,D=(function(){try{var c=wc(Vt,"defineProperty");return c({},"",{}),c}catch{}})(),z=ye.clearTimeout!==Ir.clearTimeout&&ye.clearTimeout,ee=He&&He.now!==Ir.Date.now&&He.now,Z=ye.setTimeout!==Ir.setTimeout&&ye.setTimeout,fe=wr.ceil,ge=wr.floor,Mt=Vt.getOwnPropertySymbols,yr=Il?Il.isBuffer:e,WS=ye.isFinite,vx=hc.join,wx=fc(Vt.keys,Vt),Tr=wr.max,yn=wr.min,yx=He.now,Ex=ye.parseInt,YS=wr.random,bx=hc.reverse,rv=wc(ye,"DataView"),Ph=wc(ye,"Map"),nv=wc(ye,"Promise"),Rl=wc(ye,"Set"),kh=wc(ye,"WeakMap"),Rh=wc(Vt,"create"),g0=kh&&new kh,Tl={},Ax=yc(rv),Sx=yc(Ph),_x=yc(nv),Cx=yc(Rl),Dx=yc(kh),v0=eo?eo.prototype:e,Th=v0?v0.valueOf:e,XS=v0?v0.toString:e;function G(c){if(hr(c)&&!ht(c)&&!(c instanceof Bt)){if(c instanceof Vs)return c;if(Ot.call(c,"__wrapped__"))return Z6(c)}return new Vs(c)}var Ol=(function(){function c(){}return function(f){if(!cr(f))return{};if(m0)return m0(f);c.prototype=f;var b=new c;return c.prototype=e,b}})();function w0(){}function Vs(c,f){this.__wrapped__=c,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=e}G.templateSettings={escape:Al,evaluate:oh,interpolate:uc,variable:"",imports:{_:G}},G.prototype=w0.prototype,G.prototype.constructor=G,Vs.prototype=Ol(w0.prototype),Vs.prototype.constructor=Vs;function Bt(c){this.__wrapped__=c,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=X,this.__views__=[]}function Fx(){var c=new Bt(this.__wrapped__);return c.__actions__=ss(this.__actions__),c.__dir__=this.__dir__,c.__filtered__=this.__filtered__,c.__iteratees__=ss(this.__iteratees__),c.__takeCount__=this.__takeCount__,c.__views__=ss(this.__views__),c}function Bx(){if(this.__filtered__){var c=new Bt(this);c.__dir__=-1,c.__filtered__=!0}else c=this.clone(),c.__dir__*=-1;return c}function Ix(){var c=this.__wrapped__.value(),f=this.__dir__,b=ht(c),k=f<0,j=b?c.length:0,W=M$(0,j,this.__views__),J=W.start,re=W.end,ue=re-J,_e=k?re:J-1,Ce=this.__iteratees__,Be=Ce.length,Ne=0,ze=yn(ue,this.__takeCount__);if(!b||!k&&j==ue&&ze==ue)return E6(c,this.__actions__);var it=[];e:for(;ue--&&Ne<ze;){_e+=f;for(var Et=-1,nt=c[_e];++Et<Be;){var Ft=Ce[Et],$t=Ft.iteratee,Bs=Ft.type,jn=$t(nt);if(Bs==T)nt=jn;else if(!jn){if(Bs==O)continue e;break e}}it[Ne++]=nt}return it}Bt.prototype=Ol(w0.prototype),Bt.prototype.constructor=Bt;function pc(c){var f=-1,b=c==null?0:c.length;for(this.clear();++f<b;){var k=c[f];this.set(k[0],k[1])}}function xx(){this.__data__=Rh?Rh(null):{},this.size=0}function $x(c){var f=this.has(c)&&delete this.__data__[c];return this.size-=f?1:0,f}function Px(c){var f=this.__data__;if(Rh){var b=f[c];return b===a?e:b}return Ot.call(f,c)?f[c]:e}function kx(c){var f=this.__data__;return Rh?f[c]!==e:Ot.call(f,c)}function Rx(c,f){var b=this.__data__;return this.size+=this.has(c)?0:1,b[c]=Rh&&f===e?a:f,this}pc.prototype.clear=xx,pc.prototype.delete=$x,pc.prototype.get=Px,pc.prototype.has=kx,pc.prototype.set=Rx;function Yo(c){var f=-1,b=c==null?0:c.length;for(this.clear();++f<b;){var k=c[f];this.set(k[0],k[1])}}function Tx(){this.__data__=[],this.size=0}function Ox(c){var f=this.__data__,b=y0(f,c);if(b<0)return!1;var k=f.length-1;return b==k?f.pop():Pl.call(f,b,1),--this.size,!0}function Nx(c){var f=this.__data__,b=y0(f,c);return b<0?e:f[b][1]}function Lx(c){return y0(this.__data__,c)>-1}function Ux(c,f){var b=this.__data__,k=y0(b,c);return k<0?(++this.size,b.push([c,f])):b[k][1]=f,this}Yo.prototype.clear=Tx,Yo.prototype.delete=Ox,Yo.prototype.get=Nx,Yo.prototype.has=Lx,Yo.prototype.set=Ux;function Xo(c){var f=-1,b=c==null?0:c.length;for(this.clear();++f<b;){var k=c[f];this.set(k[0],k[1])}}function Hx(){this.size=0,this.__data__={hash:new pc,map:new(Ph||Yo),string:new pc}}function Mx(c){var f=$0(this,c).delete(c);return this.size-=f?1:0,f}function qx(c){return $0(this,c).get(c)}function jx(c){return $0(this,c).has(c)}function Kx(c,f){var b=$0(this,c),k=b.size;return b.set(c,f),this.size+=b.size==k?0:1,this}Xo.prototype.clear=Hx,Xo.prototype.delete=Mx,Xo.prototype.get=qx,Xo.prototype.has=jx,Xo.prototype.set=Kx;function mc(c){var f=-1,b=c==null?0:c.length;for(this.__data__=new Xo;++f<b;)this.add(c[f])}function Vx(c){return this.__data__.set(c,a),this}function zx(c){return this.__data__.has(c)}mc.prototype.add=mc.prototype.push=Vx,mc.prototype.has=zx;function yi(c){var f=this.__data__=new Yo(c);this.size=f.size}function Gx(){this.__data__=new Yo,this.size=0}function Wx(c){var f=this.__data__,b=f.delete(c);return this.size=f.size,b}function Yx(c){return this.__data__.get(c)}function Xx(c){return this.__data__.has(c)}function Zx(c,f){var b=this.__data__;if(b instanceof Yo){var k=b.__data__;if(!Ph||k.length<r-1)return k.push([c,f]),this.size=++b.size,this;b=this.__data__=new Xo(k)}return b.set(c,f),this.size=b.size,this}yi.prototype.clear=Gx,yi.prototype.delete=Wx,yi.prototype.get=Yx,yi.prototype.has=Xx,yi.prototype.set=Zx;function ZS(c,f){var b=ht(c),k=!b&&Ec(c),j=!b&&!k&&gu(c),W=!b&&!k&&!j&&Hl(c),J=b||k||j||W,re=J?Sh(c.length,J2):[],ue=re.length;for(var _e in c)(f||Ot.call(c,_e))&&!(J&&(_e=="length"||j&&(_e=="offset"||_e=="parent")||W&&(_e=="buffer"||_e=="byteLength"||_e=="byteOffset")||Qo(_e,ue)))&&re.push(_e);return re}function JS(c){var f=c.length;return f?c[pv(0,f-1)]:e}function Jx(c,f){return P0(ss(c),gc(f,0,c.length))}function Qx(c){return P0(ss(c))}function sv(c,f,b){(b!==e&&!bi(c[f],b)||b===e&&!(f in c))&&to(c,f,b)}function Oh(c,f,b){var k=c[f];(!(Ot.call(c,f)&&bi(k,b))||b===e&&!(f in c))&&to(c,f,b)}function y0(c,f){for(var b=c.length;b--;)if(bi(c[b][0],f))return b;return-1}function e$(c,f,b,k){return hu(c,function(j,W,J){f(k,j,b(j),J)}),k}function QS(c,f){return c&&no(f,Gr(f),c)}function t$(c,f){return c&&no(f,os(f),c)}function to(c,f,b){f=="__proto__"&&D?D(c,f,{configurable:!0,enumerable:!0,value:b,writable:!0}):c[f]=b}function iv(c,f){for(var b=-1,k=f.length,j=de(k),W=c==null;++b<k;)j[b]=W?e:Hv(c,f[b]);return j}function gc(c,f,b){return c===c&&(b!==e&&(c=c<=b?c:b),f!==e&&(c=c>=f?c:f)),c}function zs(c,f,b,k,j,W){var J,re=f&h,ue=f&m,_e=f&p;if(b&&(J=j?b(c,k,j,W):b(c)),J!==e)return J;if(!cr(c))return c;var Ce=ht(c);if(Ce){if(J=j$(c),!re)return ss(c,J)}else{var Be=En(c),Ne=Be==Te||Be==Ve;if(gu(c))return S6(c,re);if(Be==ct||Be==he||Ne&&!j){if(J=ue||Ne?{}:q6(c),!re)return ue?P$(c,t$(J,c)):$$(c,QS(J,c))}else{if(!Zt[Be])return j?c:{};J=K$(c,Be,re)}}W||(W=new yi);var ze=W.get(c);if(ze)return ze;W.set(c,J),v5(c)?c.forEach(function(nt){J.add(zs(nt,f,b,nt,c,W))}):m5(c)&&c.forEach(function(nt,Ft){J.set(Ft,zs(nt,f,b,Ft,c,W))});var it=_e?ue?Cv:_v:ue?os:Gr,Et=Ce?e:it(c);return U(Et||c,function(nt,Ft){Et&&(Ft=nt,nt=c[Ft]),Oh(J,Ft,zs(nt,f,b,Ft,c,W))}),J}function r$(c){var f=Gr(c);return function(b){return e6(b,c,f)}}function e6(c,f,b){var k=b.length;if(c==null)return!k;for(c=Vt(c);k--;){var j=b[k],W=f[j],J=c[j];if(J===e&&!(j in c)||!W(J))return!1}return!0}function t6(c,f,b){if(typeof c!="function")throw new ns(i);return jh(function(){c.apply(e,b)},f)}function Nh(c,f,b,k){var j=-1,W=uu,J=!0,re=c.length,ue=[],_e=f.length;if(!re)return ue;b&&(f=Wt(f,Qr(b))),k?(W=ce,J=!1):f.length>=r&&(W=Ko,J=!1,f=new mc(f));e:for(;++j<re;){var Ce=c[j],Be=b==null?Ce:b(Ce);if(Ce=k||Ce!==0?Ce:0,J&&Be===Be){for(var Ne=_e;Ne--;)if(f[Ne]===Be)continue e;ue.push(Ce)}else W(f,Be,k)||ue.push(Ce)}return ue}var hu=B6(ro),r6=B6(av,!0);function n$(c,f){var b=!0;return hu(c,function(k,j,W){return b=!!f(k,j,W),b}),b}function E0(c,f,b){for(var k=-1,j=c.length;++k<j;){var W=c[k],J=f(W);if(J!=null&&(re===e?J===J&&!Fs(J):b(J,re)))var re=J,ue=W}return ue}function s$(c,f,b,k){var j=c.length;for(b=yt(b),b<0&&(b=-b>j?0:j+b),k=k===e||k>j?j:yt(k),k<0&&(k+=j),k=b>k?0:y5(k);b<k;)c[b++]=f;return c}function n6(c,f){var b=[];return hu(c,function(k,j,W){f(k,j,W)&&b.push(k)}),b}function tn(c,f,b,k,j){var W=-1,J=c.length;for(b||(b=z$),j||(j=[]);++W<J;){var re=c[W];f>0&&b(re)?f>1?tn(re,f-1,b,k,j):Qi(j,re):k||(j[j.length]=re)}return j}var ov=I6(),s6=I6(!0);function ro(c,f){return c&&ov(c,f,Gr)}function av(c,f){return c&&s6(c,f,Gr)}function b0(c,f){return Rr(f,function(b){return ea(c[b])})}function vc(c,f){f=pu(f,c);for(var b=0,k=f.length;c!=null&&b<k;)c=c[Ei(f[b++])];return b&&b==k?c:e}function i6(c,f,b){var k=f(c);return ht(c)?k:Qi(k,b(c))}function Mn(c){return c==null?c===e?mi:Qe:Wo&&Wo in Vt(c)?H$(c):Q$(c)}function uv(c,f){return c>f}function i$(c,f){return c!=null&&Ot.call(c,f)}function o$(c,f){return c!=null&&f in Vt(c)}function a$(c,f,b){return c>=yn(f,b)&&c<Tr(f,b)}function cv(c,f,b){for(var k=b?ce:uu,j=c[0].length,W=c.length,J=W,re=de(W),ue=1/0,_e=[];J--;){var Ce=c[J];J&&f&&(Ce=Wt(Ce,Qr(f))),ue=yn(Ce.length,ue),re[J]=!b&&(f||j>=120&&Ce.length>=120)?new mc(J&&Ce):e}Ce=c[0];var Be=-1,Ne=re[0];e:for(;++Be<j&&_e.length<ue;){var ze=Ce[Be],it=f?f(ze):ze;if(ze=b||ze!==0?ze:0,!(Ne?Ko(Ne,it):k(_e,it,b))){for(J=W;--J;){var Et=re[J];if(!(Et?Ko(Et,it):k(c[J],it,b)))continue e}Ne&&Ne.push(it),_e.push(ze)}}return _e}function u$(c,f,b,k){return ro(c,function(j,W,J){f(k,b(j),W,J)}),k}function Lh(c,f,b){f=pu(f,c),c=z6(c,f);var k=c==null?c:c[Ei(Ws(f))];return k==null?e:Un(k,c,b)}function o6(c){return hr(c)&&Mn(c)==he}function c$(c){return hr(c)&&Mn(c)==Re}function l$(c){return hr(c)&&Mn(c)==se}function Uh(c,f,b,k,j){return c===f?!0:c==null||f==null||!hr(c)&&!hr(f)?c!==c&&f!==f:f$(c,f,b,k,Uh,j)}function f$(c,f,b,k,j,W){var J=ht(c),re=ht(f),ue=J?De:En(c),_e=re?De:En(f);ue=ue==he?ct:ue,_e=_e==he?ct:_e;var Ce=ue==ct,Be=_e==ct,Ne=ue==_e;if(Ne&&gu(c)){if(!gu(f))return!1;J=!0,Ce=!1}if(Ne&&!Ce)return W||(W=new yi),J||Hl(c)?U6(c,f,b,k,j,W):L$(c,f,ue,b,k,j,W);if(!(b&d)){var ze=Ce&&Ot.call(c,"__wrapped__"),it=Be&&Ot.call(f,"__wrapped__");if(ze||it){var Et=ze?c.value():c,nt=it?f.value():f;return W||(W=new yi),j(Et,nt,b,k,W)}}return Ne?(W||(W=new yi),U$(c,f,b,k,j,W)):!1}function h$(c){return hr(c)&&En(c)==Oe}function lv(c,f,b,k){var j=b.length,W=j,J=!k;if(c==null)return!W;for(c=Vt(c);j--;){var re=b[j];if(J&&re[2]?re[1]!==c[re[0]]:!(re[0]in c))return!1}for(;++j<W;){re=b[j];var ue=re[0],_e=c[ue],Ce=re[1];if(J&&re[2]){if(_e===e&&!(ue in c))return!1}else{var Be=new yi;if(k)var Ne=k(_e,Ce,ue,c,f,Be);if(!(Ne===e?Uh(Ce,_e,d|v,k,Be):Ne))return!1}}return!0}function a6(c){if(!cr(c)||W$(c))return!1;var f=ea(c)?tv:es;return f.test(yc(c))}function d$(c){return hr(c)&&Mn(c)==vr}function p$(c){return hr(c)&&En(c)==lt}function m$(c){return hr(c)&&L0(c.length)&&!!er[Mn(c)]}function u6(c){return typeof c=="function"?c:c==null?as:typeof c=="object"?ht(c)?f6(c[0],c[1]):l6(c):$5(c)}function fv(c){if(!qh(c))return wx(c);var f=[];for(var b in Vt(c))Ot.call(c,b)&&b!="constructor"&&f.push(b);return f}function g$(c){if(!cr(c))return J$(c);var f=qh(c),b=[];for(var k in c)k=="constructor"&&(f||!Ot.call(c,k))||b.push(k);return b}function hv(c,f){return c<f}function c6(c,f){var b=-1,k=is(c)?de(c.length):[];return hu(c,function(j,W,J){k[++b]=f(j,W,J)}),k}function l6(c){var f=Fv(c);return f.length==1&&f[0][2]?K6(f[0][0],f[0][1]):function(b){return b===c||lv(b,c,f)}}function f6(c,f){return Iv(c)&&j6(f)?K6(Ei(c),f):function(b){var k=Hv(b,c);return k===e&&k===f?Mv(b,c):Uh(f,k,d|v)}}function A0(c,f,b,k,j){c!==f&&ov(f,function(W,J){if(j||(j=new yi),cr(W))v$(c,f,J,b,A0,k,j);else{var re=k?k($v(c,J),W,J+"",c,f,j):e;re===e&&(re=W),sv(c,J,re)}},os)}function v$(c,f,b,k,j,W,J){var re=$v(c,b),ue=$v(f,b),_e=J.get(ue);if(_e){sv(c,b,_e);return}var Ce=W?W(re,ue,b+"",c,f,J):e,Be=Ce===e;if(Be){var Ne=ht(ue),ze=!Ne&&gu(ue),it=!Ne&&!ze&&Hl(ue);Ce=ue,Ne||ze||it?ht(re)?Ce=re:Er(re)?Ce=ss(re):ze?(Be=!1,Ce=S6(ue,!0)):it?(Be=!1,Ce=_6(ue,!0)):Ce=[]:Kh(ue)||Ec(ue)?(Ce=re,Ec(re)?Ce=E5(re):(!cr(re)||ea(re))&&(Ce=q6(ue))):Be=!1}Be&&(J.set(ue,Ce),j(Ce,ue,k,W,J),J.delete(ue)),sv(c,b,Ce)}function h6(c,f){var b=c.length;if(b)return f+=f<0?b:0,Qo(f,b)?c[f]:e}function d6(c,f,b){f.length?f=Wt(f,function(W){return ht(W)?function(J){return vc(J,W.length===1?W[0]:W)}:W}):f=[as];var k=-1;f=Wt(f,Qr(st()));var j=c6(c,function(W,J,re){var ue=Wt(f,function(_e){return _e(W)});return{criteria:ue,index:++k,value:W}});return s0(j,function(W,J){return x$(W,J,b)})}function w$(c,f){return p6(c,f,function(b,k){return Mv(c,k)})}function p6(c,f,b){for(var k=-1,j=f.length,W={};++k<j;){var J=f[k],re=vc(c,J);b(re,J)&&Hh(W,pu(J,c),re)}return W}function y$(c){return function(f){return vc(f,c)}}function dv(c,f,b,k){var j=k?vi:cu,W=-1,J=f.length,re=c;for(c===f&&(f=ss(f)),b&&(re=Wt(c,Qr(b)));++W<J;)for(var ue=0,_e=f[W],Ce=b?b(_e):_e;(ue=j(re,Ce,ue,k))>-1;)re!==c&&Pl.call(re,ue,1),Pl.call(c,ue,1);return c}function m6(c,f){for(var b=c?f.length:0,k=b-1;b--;){var j=f[b];if(b==k||j!==W){var W=j;Qo(j)?Pl.call(c,j,1):vv(c,j)}}return c}function pv(c,f){return c+ge(YS()*(f-c+1))}function E$(c,f,b,k){for(var j=-1,W=Tr(fe((f-c)/(b||1)),0),J=de(W);W--;)J[k?W:++j]=c,c+=b;return J}function mv(c,f){var b="";if(!c||f<1||f>M)return b;do f%2&&(b+=c),f=ge(f/2),f&&(c+=c);while(f);return b}function At(c,f){return Pv(V6(c,f,as),c+"")}function b$(c){return JS(Ml(c))}function A$(c,f){var b=Ml(c);return P0(b,gc(f,0,b.length))}function Hh(c,f,b,k){if(!cr(c))return c;f=pu(f,c);for(var j=-1,W=f.length,J=W-1,re=c;re!=null&&++j<W;){var ue=Ei(f[j]),_e=b;if(ue==="__proto__"||ue==="constructor"||ue==="prototype")return c;if(j!=J){var Ce=re[ue];_e=k?k(Ce,ue,re):e,_e===e&&(_e=cr(Ce)?Ce:Qo(f[j+1])?[]:{})}Oh(re,ue,_e),re=re[ue]}return c}var g6=g0?function(c,f){return g0.set(c,f),c}:as,S$=D?function(c,f){return D(c,"toString",{configurable:!0,enumerable:!1,value:jv(f),writable:!0})}:as;function _$(c){return P0(Ml(c))}function Gs(c,f,b){var k=-1,j=c.length;f<0&&(f=-f>j?0:j+f),b=b>j?j:b,b<0&&(b+=j),j=f>b?0:b-f>>>0,f>>>=0;for(var W=de(j);++k<j;)W[k]=c[k+f];return W}function C$(c,f){var b;return hu(c,function(k,j,W){return b=f(k,j,W),!b}),!!b}function S0(c,f,b){var k=0,j=c==null?k:c.length;if(typeof f=="number"&&f===f&&j<=ae){for(;k<j;){var W=k+j>>>1,J=c[W];J!==null&&!Fs(J)&&(b?J<=f:J<f)?k=W+1:j=W}return j}return gv(c,f,as,b)}function gv(c,f,b,k){var j=0,W=c==null?0:c.length;if(W===0)return 0;f=b(f);for(var J=f!==f,re=f===null,ue=Fs(f),_e=f===e;j<W;){var Ce=ge((j+W)/2),Be=b(c[Ce]),Ne=Be!==e,ze=Be===null,it=Be===Be,Et=Fs(Be);if(J)var nt=k||it;else _e?nt=it&&(k||Ne):re?nt=it&&Ne&&(k||!ze):ue?nt=it&&Ne&&!ze&&(k||!Et):ze||Et?nt=!1:nt=k?Be<=f:Be<f;nt?j=Ce+1:W=Ce}return yn(W,te)}function v6(c,f){for(var b=-1,k=c.length,j=0,W=[];++b<k;){var J=c[b],re=f?f(J):J;if(!b||!bi(re,ue)){var ue=re;W[j++]=J===0?0:J}}return W}function w6(c){return typeof c=="number"?c:Fs(c)?V:+c}function Ds(c){if(typeof c=="string")return c;if(ht(c))return Wt(c,Ds)+"";if(Fs(c))return XS?XS.call(c):"";var f=c+"";return f=="0"&&1/c==-P?"-0":f}function du(c,f,b){var k=-1,j=uu,W=c.length,J=!0,re=[],ue=re;if(b)J=!1,j=ce;else if(W>=r){var _e=f?null:O$(c);if(_e)return Vo(_e);J=!1,j=Ko,ue=new mc}else ue=f?[]:re;e:for(;++k<W;){var Ce=c[k],Be=f?f(Ce):Ce;if(Ce=b||Ce!==0?Ce:0,J&&Be===Be){for(var Ne=ue.length;Ne--;)if(ue[Ne]===Be)continue e;f&&ue.push(Be),re.push(Ce)}else j(ue,Be,b)||(ue!==re&&ue.push(Be),re.push(Ce))}return re}function vv(c,f){f=pu(f,c);var b=-1,k=f.length;if(!k)return!0;for(;++b<k;){var j=Ei(f[b]);if(j==="__proto__"&&!Ot.call(c,"__proto__")||(j==="constructor"||j==="prototype")&&b<k-1)return!1}var W=z6(c,f);return W==null||delete W[Ei(Ws(f))]}function y6(c,f,b,k){return Hh(c,f,b(vc(c,f)),k)}function _0(c,f,b,k){for(var j=c.length,W=k?j:-1;(k?W--:++W<j)&&f(c[W],W,c););return b?Gs(c,k?0:W,k?W+1:j):Gs(c,k?W+1:0,k?j:W)}function E6(c,f){var b=c;return b instanceof Bt&&(b=b.value()),n0(f,function(k,j){return j.func.apply(j.thisArg,Qi([k],j.args))},b)}function wv(c,f,b){var k=c.length;if(k<2)return k?du(c[0]):[];for(var j=-1,W=de(k);++j<k;)for(var J=c[j],re=-1;++re<k;)re!=j&&(W[j]=Nh(W[j]||J,c[re],f,b));return du(tn(W,1),f,b)}function b6(c,f,b){for(var k=-1,j=c.length,W=f.length,J={};++k<j;){var re=k<W?f[k]:e;b(J,c[k],re)}return J}function yv(c){return Er(c)?c:[]}function Ev(c){return typeof c=="function"?c:as}function pu(c,f){return ht(c)?c:Iv(c,f)?[c]:X6(zt(c))}var D$=At;function mu(c,f,b){var k=c.length;return b=b===e?k:b,!f&&b>=k?c:Gs(c,f,b)}var A6=z||function(c){return Ir.clearTimeout(c)};function S6(c,f){if(f)return c.slice();var b=c.length,k=p0?p0(b):new c.constructor(b);return c.copy(k),k}function bv(c){var f=new c.constructor(c.byteLength);return new xl(f).set(new xl(c)),f}function F$(c,f){var b=f?bv(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.byteLength)}function B$(c){var f=new c.constructor(c.source,js.exec(c));return f.lastIndex=c.lastIndex,f}function I$(c){return Th?Vt(Th.call(c)):{}}function _6(c,f){var b=f?bv(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.length)}function C6(c,f){if(c!==f){var b=c!==e,k=c===null,j=c===c,W=Fs(c),J=f!==e,re=f===null,ue=f===f,_e=Fs(f);if(!re&&!_e&&!W&&c>f||W&&J&&ue&&!re&&!_e||k&&J&&ue||!b&&ue||!j)return 1;if(!k&&!W&&!_e&&c<f||_e&&b&&j&&!k&&!W||re&&b&&j||!J&&j||!ue)return-1}return 0}function x$(c,f,b){for(var k=-1,j=c.criteria,W=f.criteria,J=j.length,re=b.length;++k<J;){var ue=C6(j[k],W[k]);if(ue){if(k>=re)return ue;var _e=b[k];return ue*(_e=="desc"?-1:1)}}return c.index-f.index}function D6(c,f,b,k){for(var j=-1,W=c.length,J=b.length,re=-1,ue=f.length,_e=Tr(W-J,0),Ce=de(ue+_e),Be=!k;++re<ue;)Ce[re]=f[re];for(;++j<J;)(Be||j<W)&&(Ce[b[j]]=c[j]);for(;_e--;)Ce[re++]=c[j++];return Ce}function F6(c,f,b,k){for(var j=-1,W=c.length,J=-1,re=b.length,ue=-1,_e=f.length,Ce=Tr(W-re,0),Be=de(Ce+_e),Ne=!k;++j<Ce;)Be[j]=c[j];for(var ze=j;++ue<_e;)Be[ze+ue]=f[ue];for(;++J<re;)(Ne||j<W)&&(Be[ze+b[J]]=c[j++]);return Be}function ss(c,f){var b=-1,k=c.length;for(f||(f=de(k));++b<k;)f[b]=c[b];return f}function no(c,f,b,k){var j=!b;b||(b={});for(var W=-1,J=f.length;++W<J;){var re=f[W],ue=k?k(b[re],c[re],re,b,c):e;ue===e&&(ue=c[re]),j?to(b,re,ue):Oh(b,re,ue)}return b}function $$(c,f){return no(c,Bv(c),f)}function P$(c,f){return no(c,H6(c),f)}function C0(c,f){return function(b,k){var j=ht(b)?j2:e$,W=f?f():{};return j(b,c,st(k,2),W)}}function Nl(c){return At(function(f,b){var k=-1,j=b.length,W=j>1?b[j-1]:e,J=j>2?b[2]:e;for(W=c.length>3&&typeof W=="function"?(j--,W):e,J&&qn(b[0],b[1],J)&&(W=j<3?e:W,j=1),f=Vt(f);++k<j;){var re=b[k];re&&c(f,re,k,W)}return f})}function B6(c,f){return function(b,k){if(b==null)return b;if(!is(b))return c(b,k);for(var j=b.length,W=f?j:-1,J=Vt(b);(f?W--:++W<j)&&k(J[W],W,J)!==!1;);return b}}function I6(c){return function(f,b,k){for(var j=-1,W=Vt(f),J=k(f),re=J.length;re--;){var ue=J[c?re:++j];if(b(W[ue],ue,W)===!1)break}return f}}function k$(c,f,b){var k=f&g,j=Mh(c);function W(){var J=this&&this!==Ir&&this instanceof W?j:c;return J.apply(k?b:this,arguments)}return W}function x6(c){return function(f){f=zt(f);var b=fu(f)?Hn(f):e,k=b?b[0]:f.charAt(0),j=b?mu(b,1).join(""):f.slice(1);return k[c]()+j}}function Ll(c){return function(f){return n0(I5(B5(f).replace(I2,"")),c,"")}}function Mh(c){return function(){var f=arguments;switch(f.length){case 0:return new c;case 1:return new c(f[0]);case 2:return new c(f[0],f[1]);case 3:return new c(f[0],f[1],f[2]);case 4:return new c(f[0],f[1],f[2],f[3]);case 5:return new c(f[0],f[1],f[2],f[3],f[4]);case 6:return new c(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return new c(f[0],f[1],f[2],f[3],f[4],f[5],f[6])}var b=Ol(c.prototype),k=c.apply(b,f);return cr(k)?k:b}}function R$(c,f,b){var k=Mh(c);function j(){for(var W=arguments.length,J=de(W),re=W,ue=Ul(j);re--;)J[re]=arguments[re];var _e=W<3&&J[0]!==ue&&J[W-1]!==ue?[]:en(J,ue);if(W-=_e.length,W<b)return T6(c,f,D0,j.placeholder,e,J,_e,e,e,b-W);var Ce=this&&this!==Ir&&this instanceof j?k:c;return Un(Ce,this,J)}return j}function $6(c){return function(f,b,k){var j=Vt(f);if(!is(f)){var W=st(b,3);f=Gr(f),b=function(re){return W(j[re],re,j)}}var J=c(f,b,k);return J>-1?j[W?f[J]:J]:e}}function P6(c){return Jo(function(f){var b=f.length,k=b,j=Vs.prototype.thru;for(c&&f.reverse();k--;){var W=f[k];if(typeof W!="function")throw new ns(i);if(j&&!J&&x0(W)=="wrapper")var J=new Vs([],!0)}for(k=J?k:b;++k<b;){W=f[k];var re=x0(W),ue=re=="wrapper"?Dv(W):e;ue&&xv(ue[0])&&ue[1]==(H|E|C|K)&&!ue[4].length&&ue[9]==1?J=J[x0(ue[0])].apply(J,ue[3]):J=W.length==1&&xv(W)?J[re]():J.thru(W)}return function(){var _e=arguments,Ce=_e[0];if(J&&_e.length==1&&ht(Ce))return J.plant(Ce).value();for(var Be=0,Ne=b?f[Be].apply(this,_e):Ce;++Be<b;)Ne=f[Be].call(this,Ne);return Ne}})}function D0(c,f,b,k,j,W,J,re,ue,_e){var Ce=f&H,Be=f&g,Ne=f&y,ze=f&(E|_),it=f&S,Et=Ne?e:Mh(c);function nt(){for(var Ft=arguments.length,$t=de(Ft),Bs=Ft;Bs--;)$t[Bs]=arguments[Bs];if(ze)var jn=Ul(nt),Is=Fh($t,jn);if(k&&($t=D6($t,k,j,ze)),W&&($t=F6($t,W,J,ze)),Ft-=Is,ze&&Ft<_e){var br=en($t,jn);return T6(c,f,D0,nt.placeholder,b,$t,br,re,ue,_e-Ft)}var Ai=Be?b:this,ra=Ne?Ai[c]:c;return Ft=$t.length,re?$t=eP($t,re):it&&Ft>1&&$t.reverse(),Ce&&ue<Ft&&($t.length=ue),this&&this!==Ir&&this instanceof nt&&(ra=Et||Mh(ra)),ra.apply(Ai,$t)}return nt}function k6(c,f){return function(b,k){return u$(b,c,f(k),{})}}function F0(c,f){return function(b,k){var j;if(b===e&&k===e)return f;if(b!==e&&(j=b),k!==e){if(j===e)return k;typeof b=="string"||typeof k=="string"?(b=Ds(b),k=Ds(k)):(b=w6(b),k=w6(k)),j=c(b,k)}return j}}function Av(c){return Jo(function(f){return f=Wt(f,Qr(st())),At(function(b){var k=this;return c(f,function(j){return Un(j,k,b)})})})}function B0(c,f){f=f===e?" ":Ds(f);var b=f.length;if(b<2)return b?mv(f,c):f;var k=mv(f,fe(c/zo(f)));return fu(f)?mu(Hn(k),0,c).join(""):k.slice(0,c)}function T$(c,f,b,k){var j=f&g,W=Mh(c);function J(){for(var re=-1,ue=arguments.length,_e=-1,Ce=k.length,Be=de(Ce+ue),Ne=this&&this!==Ir&&this instanceof J?W:c;++_e<Ce;)Be[_e]=k[_e];for(;ue--;)Be[_e++]=arguments[++re];return Un(Ne,j?b:this,Be)}return J}function R6(c){return function(f,b,k){return k&&typeof k!="number"&&qn(f,b,k)&&(b=k=e),f=ta(f),b===e?(b=f,f=0):b=ta(b),k=k===e?f<b?1:-1:ta(k),E$(f,b,k,c)}}function I0(c){return function(f,b){return typeof f=="string"&&typeof b=="string"||(f=Ys(f),b=Ys(b)),c(f,b)}}function T6(c,f,b,k,j,W,J,re,ue,_e){var Ce=f&E,Be=Ce?J:e,Ne=Ce?e:J,ze=Ce?W:e,it=Ce?e:W;f|=Ce?C:F,f&=~(Ce?F:C),f&w||(f&=~(g|y));var Et=[c,f,j,ze,Be,it,Ne,re,ue,_e],nt=b.apply(e,Et);return xv(c)&&G6(nt,Et),nt.placeholder=k,W6(nt,c,f)}function Sv(c){var f=wr[c];return function(b,k){if(b=Ys(b),k=k==null?0:yn(yt(k),292),k&&WS(b)){var j=(zt(b)+"e").split("e"),W=f(j[0]+"e"+(+j[1]+k));return j=(zt(W)+"e").split("e"),+(j[0]+"e"+(+j[1]-k))}return f(b)}}var O$=Rl&&1/Vo(new Rl([,-0]))[1]==P?function(c){return new Rl(c)}:zv;function O6(c){return function(f){var b=En(f);return b==Oe?zr(f):b==lt?c0(f):i0(f,c(f))}}function Zo(c,f,b,k,j,W,J,re){var ue=f&y;if(!ue&&typeof c!="function")throw new ns(i);var _e=k?k.length:0;if(_e||(f&=~(C|F),k=j=e),J=J===e?J:Tr(yt(J),0),re=re===e?re:yt(re),_e-=j?j.length:0,f&F){var Ce=k,Be=j;k=j=e}var Ne=ue?e:Dv(c),ze=[c,f,b,k,j,Ce,Be,W,J,re];if(Ne&&Z$(ze,Ne),c=ze[0],f=ze[1],b=ze[2],k=ze[3],j=ze[4],re=ze[9]=ze[9]===e?ue?0:c.length:Tr(ze[9]-_e,0),!re&&f&(E|_)&&(f&=~(E|_)),!f||f==g)var it=k$(c,f,b);else f==E||f==_?it=R$(c,f,re):(f==C||f==(g|C))&&!j.length?it=T$(c,f,b,k):it=D0.apply(e,ze);var Et=Ne?g6:G6;return W6(Et(it,ze),c,f)}function N6(c,f,b,k){return c===e||bi(c,Cs[b])&&!Ot.call(k,b)?f:c}function L6(c,f,b,k,j,W){return cr(c)&&cr(f)&&(W.set(f,c),A0(c,f,e,L6,W),W.delete(f)),c}function N$(c){return Kh(c)?e:c}function U6(c,f,b,k,j,W){var J=b&d,re=c.length,ue=f.length;if(re!=ue&&!(J&&ue>re))return!1;var _e=W.get(c),Ce=W.get(f);if(_e&&Ce)return _e==f&&Ce==c;var Be=-1,Ne=!0,ze=b&v?new mc:e;for(W.set(c,f),W.set(f,c);++Be<re;){var it=c[Be],Et=f[Be];if(k)var nt=J?k(Et,it,Be,f,c,W):k(it,Et,Be,c,f,W);if(nt!==e){if(nt)continue;Ne=!1;break}if(ze){if(!tr(f,function(Ft,$t){if(!Ko(ze,$t)&&(it===Ft||j(it,Ft,b,k,W)))return ze.push($t)})){Ne=!1;break}}else if(!(it===Et||j(it,Et,b,k,W))){Ne=!1;break}}return W.delete(c),W.delete(f),Ne}function L$(c,f,b,k,j,W,J){switch(b){case or:if(c.byteLength!=f.byteLength||c.byteOffset!=f.byteOffset)return!1;c=c.buffer,f=f.buffer;case Re:return!(c.byteLength!=f.byteLength||!W(new xl(c),new xl(f)));case Ie:case se:case pt:return bi(+c,+f);case Fe:return c.name==f.name&&c.message==f.message;case vr:case Pr:return c==f+"";case Oe:var re=zr;case lt:var ue=k&d;if(re||(re=Vo),c.size!=f.size&&!ue)return!1;var _e=J.get(c);if(_e)return _e==f;k|=v,J.set(c,f);var Ce=U6(re(c),re(f),k,j,W,J);return J.delete(c),Ce;case Qn:if(Th)return Th.call(c)==Th.call(f)}return!1}function U$(c,f,b,k,j,W){var J=b&d,re=_v(c),ue=re.length,_e=_v(f),Ce=_e.length;if(ue!=Ce&&!J)return!1;for(var Be=ue;Be--;){var Ne=re[Be];if(!(J?Ne in f:Ot.call(f,Ne)))return!1}var ze=W.get(c),it=W.get(f);if(ze&&it)return ze==f&&it==c;var Et=!0;W.set(c,f),W.set(f,c);for(var nt=J;++Be<ue;){Ne=re[Be];var Ft=c[Ne],$t=f[Ne];if(k)var Bs=J?k($t,Ft,Ne,f,c,W):k(Ft,$t,Ne,c,f,W);if(!(Bs===e?Ft===$t||j(Ft,$t,b,k,W):Bs)){Et=!1;break}nt||(nt=Ne=="constructor")}if(Et&&!nt){var jn=c.constructor,Is=f.constructor;jn!=Is&&"constructor"in c&&"constructor"in f&&!(typeof jn=="function"&&jn instanceof jn&&typeof Is=="function"&&Is instanceof Is)&&(Et=!1)}return W.delete(c),W.delete(f),Et}function Jo(c){return Pv(V6(c,e,e5),c+"")}function _v(c){return i6(c,Gr,Bv)}function Cv(c){return i6(c,os,H6)}var Dv=g0?function(c){return g0.get(c)}:zv;function x0(c){for(var f=c.name+"",b=Tl[f],k=Ot.call(Tl,f)?b.length:0;k--;){var j=b[k],W=j.func;if(W==null||W==c)return j.name}return f}function Ul(c){var f=Ot.call(G,"placeholder")?G:c;return f.placeholder}function st(){var c=G.iteratee||Kv;return c=c===Kv?u6:c,arguments.length?c(arguments[0],arguments[1]):c}function $0(c,f){var b=c.__data__;return G$(f)?b[typeof f=="string"?"string":"hash"]:b.map}function Fv(c){for(var f=Gr(c),b=f.length;b--;){var k=f[b],j=c[k];f[b]=[k,j,j6(j)]}return f}function wc(c,f){var b=u0(c,f);return a6(b)?b:e}function H$(c){var f=Ot.call(c,Wo),b=c[Wo];try{c[Wo]=e;var k=!0}catch{}var j=Bl.call(c);return k&&(f?c[Wo]=b:delete c[Wo]),j}var Bv=Mt?function(c){return c==null?[]:(c=Vt(c),Rr(Mt(c),function(f){return Yt.call(c,f)}))}:Gv,H6=Mt?function(c){for(var f=[];c;)Qi(f,Bv(c)),c=$l(c);return f}:Gv,En=Mn;(rv&&En(new rv(new ArrayBuffer(1)))!=or||Ph&&En(new Ph)!=Oe||nv&&En(nv.resolve())!=mn||Rl&&En(new Rl)!=lt||kh&&En(new kh)!=Dt)&&(En=function(c){var f=Mn(c),b=f==ct?c.constructor:e,k=b?yc(b):"";if(k)switch(k){case Ax:return or;case Sx:return Oe;case _x:return mn;case Cx:return lt;case Dx:return Dt}return f});function M$(c,f,b){for(var k=-1,j=b.length;++k<j;){var W=b[k],J=W.size;switch(W.type){case"drop":c+=J;break;case"dropRight":f-=J;break;case"take":f=yn(f,c+J);break;case"takeRight":c=Tr(c,f-J);break}}return{start:c,end:f}}function q$(c){var f=c.match(Me);return f?f[1].split(et):[]}function M6(c,f,b){f=pu(f,c);for(var k=-1,j=f.length,W=!1;++k<j;){var J=Ei(f[k]);if(!(W=c!=null&&b(c,J)))break;c=c[J]}return W||++k!=j?W:(j=c==null?0:c.length,!!j&&L0(j)&&Qo(J,j)&&(ht(c)||Ec(c)))}function j$(c){var f=c.length,b=new c.constructor(f);return f&&typeof c[0]=="string"&&Ot.call(c,"index")&&(b.index=c.index,b.input=c.input),b}function q6(c){return typeof c.constructor=="function"&&!qh(c)?Ol($l(c)):{}}function K$(c,f,b){var k=c.constructor;switch(f){case Re:return bv(c);case Ie:case se:return new k(+c);case or:return F$(c,b);case Tn:case mt:case ac:case On:case Se:case eu:case Ut:case gn:case Yi:return _6(c,b);case Oe:return new k;case pt:case Pr:return new k(c);case vr:return B$(c);case lt:return new k;case Qn:return I$(c)}}function V$(c,f){var b=f.length;if(!b)return c;var k=b-1;return f[k]=(b>1?"& ":"")+f[k],f=f.join(b>2?", ":" "),c.replace(je,`{
|
||
/* [wrapped with `+f+`] */
|
||
`)}function z$(c){return ht(c)||Ec(c)||!!(kl&&c&&c[kl])}function Qo(c,f){var b=typeof c;return f=f??M,!!f&&(b=="number"||b!="symbol"&&Ln.test(c))&&c>-1&&c%1==0&&c<f}function qn(c,f,b){if(!cr(b))return!1;var k=typeof f;return(k=="number"?is(b)&&Qo(f,b.length):k=="string"&&f in b)?bi(b[f],c):!1}function Iv(c,f){if(ht(c))return!1;var b=typeof c;return b=="number"||b=="symbol"||b=="boolean"||c==null||Fs(c)?!0:ah.test(c)||!nu.test(c)||f!=null&&c in Vt(f)}function G$(c){var f=typeof c;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?c!=="__proto__":c===null}function xv(c){var f=x0(c),b=G[f];if(typeof b!="function"||!(f in Bt.prototype))return!1;if(c===b)return!0;var k=Dv(b);return!!k&&c===k[0]}function W$(c){return!!d0&&d0 in c}var Y$=Fl?ea:Wv;function qh(c){var f=c&&c.constructor,b=typeof f=="function"&&f.prototype||Cs;return c===b}function j6(c){return c===c&&!cr(c)}function K6(c,f){return function(b){return b==null?!1:b[c]===f&&(f!==e||c in Vt(b))}}function X$(c){var f=O0(c,function(k){return b.size===u&&b.clear(),k}),b=f.cache;return f}function Z$(c,f){var b=c[1],k=f[1],j=b|k,W=j<(g|y|H),J=k==H&&b==E||k==H&&b==K&&c[7].length<=f[8]||k==(H|K)&&f[7].length<=f[8]&&b==E;if(!(W||J))return c;k&g&&(c[2]=f[2],j|=b&g?0:w);var re=f[3];if(re){var ue=c[3];c[3]=ue?D6(ue,re,f[4]):re,c[4]=ue?en(c[3],l):f[4]}return re=f[5],re&&(ue=c[5],c[5]=ue?F6(ue,re,f[6]):re,c[6]=ue?en(c[5],l):f[6]),re=f[7],re&&(c[7]=re),k&H&&(c[8]=c[8]==null?f[8]:yn(c[8],f[8])),c[9]==null&&(c[9]=f[9]),c[0]=f[0],c[1]=j,c}function J$(c){var f=[];if(c!=null)for(var b in Vt(c))f.push(b);return f}function Q$(c){return Bl.call(c)}function V6(c,f,b){return f=Tr(f===e?c.length-1:f,0),function(){for(var k=arguments,j=-1,W=Tr(k.length-f,0),J=de(W);++j<W;)J[j]=k[f+j];j=-1;for(var re=de(f+1);++j<f;)re[j]=k[j];return re[f]=b(J),Un(c,this,re)}}function z6(c,f){return f.length<2?c:vc(c,Gs(f,0,-1))}function eP(c,f){for(var b=c.length,k=yn(f.length,b),j=ss(c);k--;){var W=f[k];c[k]=Qo(W,b)?j[W]:e}return c}function $v(c,f){if(!(f==="constructor"&&typeof c[f]=="function")&&f!="__proto__")return c[f]}var G6=Y6(g6),jh=Z||function(c,f){return Ir.setTimeout(c,f)},Pv=Y6(S$);function W6(c,f,b){var k=f+"";return Pv(c,V$(k,tP(q$(k),b)))}function Y6(c){var f=0,b=0;return function(){var k=yx(),j=R-(k-b);if(b=k,j>0){if(++f>=L)return arguments[0]}else f=0;return c.apply(e,arguments)}}function P0(c,f){var b=-1,k=c.length,j=k-1;for(f=f===e?k:f;++b<f;){var W=pv(b,j),J=c[W];c[W]=c[b],c[b]=J}return c.length=f,c}var X6=X$(function(c){var f=[];return c.charCodeAt(0)===46&&f.push(""),c.replace(Sl,function(b,k,j,W){f.push(j?W.replace(kr,"$1"):k||b)}),f});function Ei(c){if(typeof c=="string"||Fs(c))return c;var f=c+"";return f=="0"&&1/c==-P?"-0":f}function yc(c){if(c!=null){try{return Go.call(c)}catch{}try{return c+""}catch{}}return""}function tP(c,f){return U(me,function(b){var k="_."+b[0];f&b[1]&&!uu(c,k)&&c.push(k)}),c.sort()}function Z6(c){if(c instanceof Bt)return c.clone();var f=new Vs(c.__wrapped__,c.__chain__);return f.__actions__=ss(c.__actions__),f.__index__=c.__index__,f.__values__=c.__values__,f}function rP(c,f,b){(b?qn(c,f,b):f===e)?f=1:f=Tr(yt(f),0);var k=c==null?0:c.length;if(!k||f<1)return[];for(var j=0,W=0,J=de(fe(k/f));j<k;)J[W++]=Gs(c,j,j+=f);return J}function nP(c){for(var f=-1,b=c==null?0:c.length,k=0,j=[];++f<b;){var W=c[f];W&&(j[k++]=W)}return j}function sP(){var c=arguments.length;if(!c)return[];for(var f=de(c-1),b=arguments[0],k=c;k--;)f[k-1]=arguments[k];return Qi(ht(b)?ss(b):[b],tn(f,1))}var iP=At(function(c,f){return Er(c)?Nh(c,tn(f,1,Er,!0)):[]}),oP=At(function(c,f){var b=Ws(f);return Er(b)&&(b=e),Er(c)?Nh(c,tn(f,1,Er,!0),st(b,2)):[]}),aP=At(function(c,f){var b=Ws(f);return Er(b)&&(b=e),Er(c)?Nh(c,tn(f,1,Er,!0),e,b):[]});function uP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),Gs(c,f<0?0:f,k)):[]}function cP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),f=k-f,Gs(c,0,f<0?0:f)):[]}function lP(c,f){return c&&c.length?_0(c,st(f,3),!0,!0):[]}function fP(c,f){return c&&c.length?_0(c,st(f,3),!0):[]}function hP(c,f,b,k){var j=c==null?0:c.length;return j?(b&&typeof b!="number"&&qn(c,f,b)&&(b=0,k=j),s$(c,f,b,k)):[]}function J6(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=b==null?0:yt(b);return j<0&&(j=Tr(k+j,0)),Dl(c,st(f,3),j)}function Q6(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=k-1;return b!==e&&(j=yt(b),j=b<0?Tr(k+j,0):yn(j,k-1)),Dl(c,st(f,3),j,!0)}function e5(c){var f=c==null?0:c.length;return f?tn(c,1):[]}function dP(c){var f=c==null?0:c.length;return f?tn(c,P):[]}function pP(c,f){var b=c==null?0:c.length;return b?(f=f===e?1:yt(f),tn(c,f)):[]}function mP(c){for(var f=-1,b=c==null?0:c.length,k={};++f<b;){var j=c[f];to(k,j[0],j[1])}return k}function t5(c){return c&&c.length?c[0]:e}function gP(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=b==null?0:yt(b);return j<0&&(j=Tr(k+j,0)),cu(c,f,j)}function vP(c){var f=c==null?0:c.length;return f?Gs(c,0,-1):[]}var wP=At(function(c){var f=Wt(c,yv);return f.length&&f[0]===c[0]?cv(f):[]}),yP=At(function(c){var f=Ws(c),b=Wt(c,yv);return f===Ws(b)?f=e:b.pop(),b.length&&b[0]===c[0]?cv(b,st(f,2)):[]}),EP=At(function(c){var f=Ws(c),b=Wt(c,yv);return f=typeof f=="function"?f:e,f&&b.pop(),b.length&&b[0]===c[0]?cv(b,e,f):[]});function bP(c,f){return c==null?"":vx.call(c,f)}function Ws(c){var f=c==null?0:c.length;return f?c[f-1]:e}function AP(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=k;return b!==e&&(j=yt(b),j=j<0?Tr(k+j,0):yn(j,k-1)),f===f?l0(c,f,j):Dl(c,yh,j,!0)}function SP(c,f){return c&&c.length?h6(c,yt(f)):e}var _P=At(r5);function r5(c,f){return c&&c.length&&f&&f.length?dv(c,f):c}function CP(c,f,b){return c&&c.length&&f&&f.length?dv(c,f,st(b,2)):c}function DP(c,f,b){return c&&c.length&&f&&f.length?dv(c,f,e,b):c}var FP=Jo(function(c,f){var b=c==null?0:c.length,k=iv(c,f);return m6(c,Wt(f,function(j){return Qo(j,b)?+j:j}).sort(C6)),k});function BP(c,f){var b=[];if(!(c&&c.length))return b;var k=-1,j=[],W=c.length;for(f=st(f,3);++k<W;){var J=c[k];f(J,k,c)&&(b.push(J),j.push(k))}return m6(c,j),b}function kv(c){return c==null?c:bx.call(c)}function IP(c,f,b){var k=c==null?0:c.length;return k?(b&&typeof b!="number"&&qn(c,f,b)?(f=0,b=k):(f=f==null?0:yt(f),b=b===e?k:yt(b)),Gs(c,f,b)):[]}function xP(c,f){return S0(c,f)}function $P(c,f,b){return gv(c,f,st(b,2))}function PP(c,f){var b=c==null?0:c.length;if(b){var k=S0(c,f);if(k<b&&bi(c[k],f))return k}return-1}function kP(c,f){return S0(c,f,!0)}function RP(c,f,b){return gv(c,f,st(b,2),!0)}function TP(c,f){var b=c==null?0:c.length;if(b){var k=S0(c,f,!0)-1;if(bi(c[k],f))return k}return-1}function OP(c){return c&&c.length?v6(c):[]}function NP(c,f){return c&&c.length?v6(c,st(f,2)):[]}function LP(c){var f=c==null?0:c.length;return f?Gs(c,1,f):[]}function UP(c,f,b){return c&&c.length?(f=b||f===e?1:yt(f),Gs(c,0,f<0?0:f)):[]}function HP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),f=k-f,Gs(c,f<0?0:f,k)):[]}function MP(c,f){return c&&c.length?_0(c,st(f,3),!1,!0):[]}function qP(c,f){return c&&c.length?_0(c,st(f,3)):[]}var jP=At(function(c){return du(tn(c,1,Er,!0))}),KP=At(function(c){var f=Ws(c);return Er(f)&&(f=e),du(tn(c,1,Er,!0),st(f,2))}),VP=At(function(c){var f=Ws(c);return f=typeof f=="function"?f:e,du(tn(c,1,Er,!0),e,f)});function zP(c){return c&&c.length?du(c):[]}function GP(c,f){return c&&c.length?du(c,st(f,2)):[]}function WP(c,f){return f=typeof f=="function"?f:e,c&&c.length?du(c,e,f):[]}function Rv(c){if(!(c&&c.length))return[];var f=0;return c=Rr(c,function(b){if(Er(b))return f=Tr(b.length,f),!0}),Sh(f,function(b){return Wt(c,Ae(b))})}function n5(c,f){if(!(c&&c.length))return[];var b=Rv(c);return f==null?b:Wt(b,function(k){return Un(f,e,k)})}var YP=At(function(c,f){return Er(c)?Nh(c,f):[]}),XP=At(function(c){return wv(Rr(c,Er))}),ZP=At(function(c){var f=Ws(c);return Er(f)&&(f=e),wv(Rr(c,Er),st(f,2))}),JP=At(function(c){var f=Ws(c);return f=typeof f=="function"?f:e,wv(Rr(c,Er),e,f)}),QP=At(Rv);function ek(c,f){return b6(c||[],f||[],Oh)}function tk(c,f){return b6(c||[],f||[],Hh)}var rk=At(function(c){var f=c.length,b=f>1?c[f-1]:e;return b=typeof b=="function"?(c.pop(),b):e,n5(c,b)});function s5(c){var f=G(c);return f.__chain__=!0,f}function nk(c,f){return f(c),c}function k0(c,f){return f(c)}var sk=Jo(function(c){var f=c.length,b=f?c[0]:0,k=this.__wrapped__,j=function(W){return iv(W,c)};return f>1||this.__actions__.length||!(k instanceof Bt)||!Qo(b)?this.thru(j):(k=k.slice(b,+b+(f?1:0)),k.__actions__.push({func:k0,args:[j],thisArg:e}),new Vs(k,this.__chain__).thru(function(W){return f&&!W.length&&W.push(e),W}))});function ik(){return s5(this)}function ok(){return new Vs(this.value(),this.__chain__)}function ak(){this.__values__===e&&(this.__values__=w5(this.value()));var c=this.__index__>=this.__values__.length,f=c?e:this.__values__[this.__index__++];return{done:c,value:f}}function uk(){return this}function ck(c){for(var f,b=this;b instanceof w0;){var k=Z6(b);k.__index__=0,k.__values__=e,f?j.__wrapped__=k:f=k;var j=k;b=b.__wrapped__}return j.__wrapped__=c,f}function lk(){var c=this.__wrapped__;if(c instanceof Bt){var f=c;return this.__actions__.length&&(f=new Bt(this)),f=f.reverse(),f.__actions__.push({func:k0,args:[kv],thisArg:e}),new Vs(f,this.__chain__)}return this.thru(kv)}function fk(){return E6(this.__wrapped__,this.__actions__)}var hk=C0(function(c,f,b){Ot.call(c,b)?++c[b]:to(c,b,1)});function dk(c,f,b){var k=ht(c)?lc:n$;return b&&qn(c,f,b)&&(f=e),k(c,st(f,3))}function pk(c,f){var b=ht(c)?Rr:n6;return b(c,st(f,3))}var mk=$6(J6),gk=$6(Q6);function vk(c,f){return tn(R0(c,f),1)}function wk(c,f){return tn(R0(c,f),P)}function yk(c,f,b){return b=b===e?1:yt(b),tn(R0(c,f),b)}function i5(c,f){var b=ht(c)?U:hu;return b(c,st(f,3))}function o5(c,f){var b=ht(c)?ft:r6;return b(c,st(f,3))}var Ek=C0(function(c,f,b){Ot.call(c,b)?c[b].push(f):to(c,b,[f])});function bk(c,f,b,k){c=is(c)?c:Ml(c),b=b&&!k?yt(b):0;var j=c.length;return b<0&&(b=Tr(j+b,0)),U0(c)?b<=j&&c.indexOf(f,b)>-1:!!j&&cu(c,f,b)>-1}var Ak=At(function(c,f,b){var k=-1,j=typeof f=="function",W=is(c)?de(c.length):[];return hu(c,function(J){W[++k]=j?Un(f,J,b):Lh(J,f,b)}),W}),Sk=C0(function(c,f,b){to(c,b,f)});function R0(c,f){var b=ht(c)?Wt:c6;return b(c,st(f,3))}function _k(c,f,b,k){return c==null?[]:(ht(f)||(f=f==null?[]:[f]),b=k?e:b,ht(b)||(b=b==null?[]:[b]),d6(c,f,b))}var Ck=C0(function(c,f,b){c[b?0:1].push(f)},function(){return[[],[]]});function Dk(c,f,b){var k=ht(c)?n0:bh,j=arguments.length<3;return k(c,st(f,4),b,j,hu)}function Fk(c,f,b){var k=ht(c)?zS:bh,j=arguments.length<3;return k(c,st(f,4),b,j,r6)}function Bk(c,f){var b=ht(c)?Rr:n6;return b(c,N0(st(f,3)))}function Ik(c){var f=ht(c)?JS:b$;return f(c)}function xk(c,f,b){(b?qn(c,f,b):f===e)?f=1:f=yt(f);var k=ht(c)?Jx:A$;return k(c,f)}function $k(c){var f=ht(c)?Qx:_$;return f(c)}function Pk(c){if(c==null)return 0;if(is(c))return U0(c)?zo(c):c.length;var f=En(c);return f==Oe||f==lt?c.size:fv(c).length}function kk(c,f,b){var k=ht(c)?tr:C$;return b&&qn(c,f,b)&&(f=e),k(c,st(f,3))}var Rk=At(function(c,f){if(c==null)return[];var b=f.length;return b>1&&qn(c,f[0],f[1])?f=[]:b>2&&qn(f[0],f[1],f[2])&&(f=[f[0]]),d6(c,tn(f,1),[])}),T0=ee||function(){return Ir.Date.now()};function Tk(c,f){if(typeof f!="function")throw new ns(i);return c=yt(c),function(){if(--c<1)return f.apply(this,arguments)}}function a5(c,f,b){return f=b?e:f,f=c&&f==null?c.length:f,Zo(c,H,e,e,e,e,f)}function u5(c,f){var b;if(typeof f!="function")throw new ns(i);return c=yt(c),function(){return--c>0&&(b=f.apply(this,arguments)),c<=1&&(f=e),b}}var Tv=At(function(c,f,b){var k=g;if(b.length){var j=en(b,Ul(Tv));k|=C}return Zo(c,k,f,b,j)}),c5=At(function(c,f,b){var k=g|y;if(b.length){var j=en(b,Ul(c5));k|=C}return Zo(f,k,c,b,j)});function l5(c,f,b){f=b?e:f;var k=Zo(c,E,e,e,e,e,e,f);return k.placeholder=l5.placeholder,k}function f5(c,f,b){f=b?e:f;var k=Zo(c,_,e,e,e,e,e,f);return k.placeholder=f5.placeholder,k}function h5(c,f,b){var k,j,W,J,re,ue,_e=0,Ce=!1,Be=!1,Ne=!0;if(typeof c!="function")throw new ns(i);f=Ys(f)||0,cr(b)&&(Ce=!!b.leading,Be="maxWait"in b,W=Be?Tr(Ys(b.maxWait)||0,f):W,Ne="trailing"in b?!!b.trailing:Ne);function ze(br){var Ai=k,ra=j;return k=j=e,_e=br,J=c.apply(ra,Ai),J}function it(br){return _e=br,re=jh(Ft,f),Ce?ze(br):J}function Et(br){var Ai=br-ue,ra=br-_e,P5=f-Ai;return Be?yn(P5,W-ra):P5}function nt(br){var Ai=br-ue,ra=br-_e;return ue===e||Ai>=f||Ai<0||Be&&ra>=W}function Ft(){var br=T0();if(nt(br))return $t(br);re=jh(Ft,Et(br))}function $t(br){return re=e,Ne&&k?ze(br):(k=j=e,J)}function Bs(){re!==e&&A6(re),_e=0,k=ue=j=re=e}function jn(){return re===e?J:$t(T0())}function Is(){var br=T0(),Ai=nt(br);if(k=arguments,j=this,ue=br,Ai){if(re===e)return it(ue);if(Be)return A6(re),re=jh(Ft,f),ze(ue)}return re===e&&(re=jh(Ft,f)),J}return Is.cancel=Bs,Is.flush=jn,Is}var Ok=At(function(c,f){return t6(c,1,f)}),Nk=At(function(c,f,b){return t6(c,Ys(f)||0,b)});function Lk(c){return Zo(c,S)}function O0(c,f){if(typeof c!="function"||f!=null&&typeof f!="function")throw new ns(i);var b=function(){var k=arguments,j=f?f.apply(this,k):k[0],W=b.cache;if(W.has(j))return W.get(j);var J=c.apply(this,k);return b.cache=W.set(j,J)||W,J};return b.cache=new(O0.Cache||Xo),b}O0.Cache=Xo;function N0(c){if(typeof c!="function")throw new ns(i);return function(){var f=arguments;switch(f.length){case 0:return!c.call(this);case 1:return!c.call(this,f[0]);case 2:return!c.call(this,f[0],f[1]);case 3:return!c.call(this,f[0],f[1],f[2])}return!c.apply(this,f)}}function Uk(c){return u5(2,c)}var Hk=D$(function(c,f){f=f.length==1&&ht(f[0])?Wt(f[0],Qr(st())):Wt(tn(f,1),Qr(st()));var b=f.length;return At(function(k){for(var j=-1,W=yn(k.length,b);++j<W;)k[j]=f[j].call(this,k[j]);return Un(c,this,k)})}),Ov=At(function(c,f){var b=en(f,Ul(Ov));return Zo(c,C,e,f,b)}),d5=At(function(c,f){var b=en(f,Ul(d5));return Zo(c,F,e,f,b)}),Mk=Jo(function(c,f){return Zo(c,K,e,e,e,f)});function qk(c,f){if(typeof c!="function")throw new ns(i);return f=f===e?f:yt(f),At(c,f)}function jk(c,f){if(typeof c!="function")throw new ns(i);return f=f==null?0:Tr(yt(f),0),At(function(b){var k=b[f],j=mu(b,0,f);return k&&Qi(j,k),Un(c,this,j)})}function Kk(c,f,b){var k=!0,j=!0;if(typeof c!="function")throw new ns(i);return cr(b)&&(k="leading"in b?!!b.leading:k,j="trailing"in b?!!b.trailing:j),h5(c,f,{leading:k,maxWait:f,trailing:j})}function Vk(c){return a5(c,1)}function zk(c,f){return Ov(Ev(f),c)}function Gk(){if(!arguments.length)return[];var c=arguments[0];return ht(c)?c:[c]}function Wk(c){return zs(c,p)}function Yk(c,f){return f=typeof f=="function"?f:e,zs(c,p,f)}function Xk(c){return zs(c,h|p)}function Zk(c,f){return f=typeof f=="function"?f:e,zs(c,h|p,f)}function Jk(c,f){return f==null||e6(c,f,Gr(f))}function bi(c,f){return c===f||c!==c&&f!==f}var Qk=I0(uv),eR=I0(function(c,f){return c>=f}),Ec=o6((function(){return arguments})())?o6:function(c){return hr(c)&&Ot.call(c,"callee")&&!Yt.call(c,"callee")},ht=de.isArray,tR=Zp?Qr(Zp):c$;function is(c){return c!=null&&L0(c.length)&&!ea(c)}function Er(c){return hr(c)&&is(c)}function rR(c){return c===!0||c===!1||hr(c)&&Mn(c)==Ie}var gu=yr||Wv,nR=Jp?Qr(Jp):l$;function sR(c){return hr(c)&&c.nodeType===1&&!Kh(c)}function iR(c){if(c==null)return!0;if(is(c)&&(ht(c)||typeof c=="string"||typeof c.splice=="function"||gu(c)||Hl(c)||Ec(c)))return!c.length;var f=En(c);if(f==Oe||f==lt)return!c.size;if(qh(c))return!fv(c).length;for(var b in c)if(Ot.call(c,b))return!1;return!0}function oR(c,f){return Uh(c,f)}function aR(c,f,b){b=typeof b=="function"?b:e;var k=b?b(c,f):e;return k===e?Uh(c,f,e,b):!!k}function Nv(c){if(!hr(c))return!1;var f=Mn(c);return f==Fe||f==pe||typeof c.message=="string"&&typeof c.name=="string"&&!Kh(c)}function uR(c){return typeof c=="number"&&WS(c)}function ea(c){if(!cr(c))return!1;var f=Mn(c);return f==Te||f==Ve||f==Pe||f==gr}function p5(c){return typeof c=="number"&&c==yt(c)}function L0(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=M}function cr(c){var f=typeof c;return c!=null&&(f=="object"||f=="function")}function hr(c){return c!=null&&typeof c=="object"}var m5=Qp?Qr(Qp):h$;function cR(c,f){return c===f||lv(c,f,Fv(f))}function lR(c,f,b){return b=typeof b=="function"?b:e,lv(c,f,Fv(f),b)}function fR(c){return g5(c)&&c!=+c}function hR(c){if(Y$(c))throw new ot(n);return a6(c)}function dR(c){return c===null}function pR(c){return c==null}function g5(c){return typeof c=="number"||hr(c)&&Mn(c)==pt}function Kh(c){if(!hr(c)||Mn(c)!=ct)return!1;var f=$l(c);if(f===null)return!0;var b=Ot.call(f,"constructor")&&f.constructor;return typeof b=="function"&&b instanceof b&&Go.call(b)==Q2}var Lv=e0?Qr(e0):d$;function mR(c){return p5(c)&&c>=-M&&c<=M}var v5=t0?Qr(t0):p$;function U0(c){return typeof c=="string"||!ht(c)&&hr(c)&&Mn(c)==Pr}function Fs(c){return typeof c=="symbol"||hr(c)&&Mn(c)==Qn}var Hl=r0?Qr(r0):m$;function gR(c){return c===e}function vR(c){return hr(c)&&En(c)==Dt}function wR(c){return hr(c)&&Mn(c)==Ze}var yR=I0(hv),ER=I0(function(c,f){return c<=f});function w5(c){if(!c)return[];if(is(c))return U0(c)?Hn(c):ss(c);if(dc&&c[dc])return G2(c[dc]());var f=En(c),b=f==Oe?zr:f==lt?Vo:Ml;return b(c)}function ta(c){if(!c)return c===0?c:0;if(c=Ys(c),c===P||c===-P){var f=c<0?-1:1;return f*Y}return c===c?c:0}function yt(c){var f=ta(c),b=f%1;return f===f?b?f-b:f:0}function y5(c){return c?gc(yt(c),0,X):0}function Ys(c){if(typeof c=="number")return c;if(Fs(c))return V;if(cr(c)){var f=typeof c.valueOf=="function"?c.valueOf():c;c=cr(f)?f+"":f}if(typeof c!="string")return c===0?c:+c;c=_h(c);var b=Nn.test(c);return b||Fr.test(c)?M2(c.slice(2),b?2:8):Zi.test(c)?V:+c}function E5(c){return no(c,os(c))}function bR(c){return c?gc(yt(c),-M,M):c===0?c:0}function zt(c){return c==null?"":Ds(c)}var AR=Nl(function(c,f){if(qh(f)||is(f)){no(f,Gr(f),c);return}for(var b in f)Ot.call(f,b)&&Oh(c,b,f[b])}),b5=Nl(function(c,f){no(f,os(f),c)}),A5=Nl(function(c,f,b,k){no(f,os(f),c,k)}),Uv=Nl(function(c,f,b,k){no(f,Gr(f),c,k)}),SR=Jo(iv);function _R(c,f){var b=Ol(c);return f==null?b:QS(b,f)}var CR=At(function(c,f){c=Vt(c);var b=-1,k=f.length,j=k>2?f[2]:e;for(j&&qn(f[0],f[1],j)&&(k=1);++b<k;)for(var W=f[b],J=os(W),re=-1,ue=J.length;++re<ue;){var _e=J[re],Ce=c[_e];(Ce===e||bi(Ce,Cs[_e])&&!Ot.call(c,_e))&&(c[_e]=W[_e])}return c}),DR=At(function(c){return c.push(e,L6),Un(S5,e,c)});function FR(c,f){return Vr(c,st(f,3),ro)}function BR(c,f){return Vr(c,st(f,3),av)}function IR(c,f){return c==null?c:ov(c,st(f,3),os)}function xR(c,f){return c==null?c:s6(c,st(f,3),os)}function $R(c,f){return c&&ro(c,st(f,3))}function PR(c,f){return c&&av(c,st(f,3))}function kR(c){return c==null?[]:b0(c,Gr(c))}function RR(c){return c==null?[]:b0(c,os(c))}function Hv(c,f,b){var k=c==null?e:vc(c,f);return k===e?b:k}function TR(c,f){return c!=null&&M6(c,f,i$)}function Mv(c,f){return c!=null&&M6(c,f,o$)}var OR=k6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=Bl.call(f)),c[f]=b},jv(as)),NR=k6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=Bl.call(f)),Ot.call(c,f)?c[f].push(b):c[f]=[b]},st),LR=At(Lh);function Gr(c){return is(c)?ZS(c):fv(c)}function os(c){return is(c)?ZS(c,!0):g$(c)}function UR(c,f){var b={};return f=st(f,3),ro(c,function(k,j,W){to(b,f(k,j,W),k)}),b}function HR(c,f){var b={};return f=st(f,3),ro(c,function(k,j,W){to(b,j,f(k,j,W))}),b}var MR=Nl(function(c,f,b){A0(c,f,b)}),S5=Nl(function(c,f,b,k){A0(c,f,b,k)}),qR=Jo(function(c,f){var b={};if(c==null)return b;var k=!1;f=Wt(f,function(W){return W=pu(W,c),k||(k=W.length>1),W}),no(c,Cv(c),b),k&&(b=zs(b,h|m|p,N$));for(var j=f.length;j--;)vv(b,f[j]);return b});function jR(c,f){return _5(c,N0(st(f)))}var KR=Jo(function(c,f){return c==null?{}:w$(c,f)});function _5(c,f){if(c==null)return{};var b=Wt(Cv(c),function(k){return[k]});return f=st(f),p6(c,b,function(k,j){return f(k,j[0])})}function VR(c,f,b){f=pu(f,c);var k=-1,j=f.length;for(j||(j=1,c=e);++k<j;){var W=c==null?e:c[Ei(f[k])];W===e&&(k=j,W=b),c=ea(W)?W.call(c):W}return c}function zR(c,f,b){return c==null?c:Hh(c,f,b)}function GR(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:Hh(c,f,b,k)}var C5=O6(Gr),D5=O6(os);function WR(c,f,b){var k=ht(c),j=k||gu(c)||Hl(c);if(f=st(f,4),b==null){var W=c&&c.constructor;j?b=k?new W:[]:cr(c)?b=ea(W)?Ol($l(c)):{}:b={}}return(j?U:ro)(c,function(J,re,ue){return f(b,J,re,ue)}),b}function YR(c,f){return c==null?!0:vv(c,f)}function XR(c,f,b){return c==null?c:y6(c,f,Ev(b))}function ZR(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:y6(c,f,Ev(b),k)}function Ml(c){return c==null?[]:Ch(c,Gr(c))}function JR(c){return c==null?[]:Ch(c,os(c))}function QR(c,f,b){return b===e&&(b=f,f=e),b!==e&&(b=Ys(b),b=b===b?b:0),f!==e&&(f=Ys(f),f=f===f?f:0),gc(Ys(c),f,b)}function eT(c,f,b){return f=ta(f),b===e?(b=f,f=0):b=ta(b),c=Ys(c),a$(c,f,b)}function tT(c,f,b){if(b&&typeof b!="boolean"&&qn(c,f,b)&&(f=b=e),b===e&&(typeof f=="boolean"?(b=f,f=e):typeof c=="boolean"&&(b=c,c=e)),c===e&&f===e?(c=0,f=1):(c=ta(c),f===e?(f=c,c=0):f=ta(f)),c>f){var k=c;c=f,f=k}if(b||c%1||f%1){var j=YS();return yn(c+j*(f-c+H2("1e-"+((j+"").length-1))),f)}return pv(c,f)}var rT=Ll(function(c,f,b){return f=f.toLowerCase(),c+(b?F5(f):f)});function F5(c){return qv(zt(c).toLowerCase())}function B5(c){return c=zt(c),c&&c.replace(su,K2).replace(x2,"")}function nT(c,f,b){c=zt(c),f=Ds(f);var k=c.length;b=b===e?k:gc(yt(b),0,k);var j=b;return b-=f.length,b>=0&&c.slice(b,j)==f}function sT(c){return c=zt(c),c&&qs.test(c)?c.replace(Xi,a0):c}function iT(c){return c=zt(c),c&&uh.test(c)?c.replace(cc,"\\$&"):c}var oT=Ll(function(c,f,b){return c+(b?"-":"")+f.toLowerCase()}),aT=Ll(function(c,f,b){return c+(b?" ":"")+f.toLowerCase()}),uT=x6("toLowerCase");function cT(c,f,b){c=zt(c),f=yt(f);var k=f?zo(c):0;if(!f||k>=f)return c;var j=(f-k)/2;return B0(ge(j),b)+c+B0(fe(j),b)}function lT(c,f,b){c=zt(c),f=yt(f);var k=f?zo(c):0;return f&&k<f?c+B0(f-k,b):c}function fT(c,f,b){c=zt(c),f=yt(f);var k=f?zo(c):0;return f&&k<f?B0(f-k,b)+c:c}function hT(c,f,b){return b||f==null?f=0:f&&(f=+f),Ex(zt(c).replace(ie,""),f||0)}function dT(c,f,b){return(b?qn(c,f,b):f===e)?f=1:f=yt(f),mv(zt(c),f)}function pT(){var c=arguments,f=zt(c[0]);return c.length<3?f:f.replace(c[1],c[2])}var mT=Ll(function(c,f,b){return c+(b?"_":"")+f.toLowerCase()});function gT(c,f,b){return b&&typeof b!="number"&&qn(c,f,b)&&(f=b=e),b=b===e?X:b>>>0,b?(c=zt(c),c&&(typeof f=="string"||f!=null&&!Lv(f))&&(f=Ds(f),!f&&fu(c))?mu(Hn(c),0,b):c.split(f,b)):[]}var vT=Ll(function(c,f,b){return c+(b?" ":"")+qv(f)});function wT(c,f,b){return c=zt(c),b=b==null?0:gc(yt(b),0,c.length),f=Ds(f),c.slice(b,b+f.length)==f}function yT(c,f,b){var k=G.templateSettings;b&&qn(c,f,b)&&(f=e),c=zt(c),f=Uv({},f,k,N6);var j=Uv({},f.imports,k.imports,N6),W=Gr(j),J=Ch(j,W);U(W,function(nt){if(wt.test(nt))throw new ot(s)});var re,ue,_e=0,Ce=f.interpolate||iu,Be="__p += '",Ne=xh((f.escape||iu).source+"|"+Ce.source+"|"+(Ce===uc?ar:iu).source+"|"+(f.evaluate||iu).source+"|$","g"),ze="//# sourceURL="+(Ot.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++T2+"]")+`
|
||
`;c.replace(Ne,function(nt,Ft,$t,Bs,jn,Is){return $t||($t=Bs),Be+=c.slice(_e,Is).replace(ch,V2),Ft&&(re=!0,Be+=`' +
|
||
__e(`+Ft+`) +
|
||
'`),jn&&(ue=!0,Be+=`';
|
||
`+jn+`;
|
||
__p += '`),$t&&(Be+=`' +
|
||
((__t = (`+$t+`)) == null ? '' : __t) +
|
||
'`),_e=Is+nt.length,nt}),Be+=`';
|
||
`;var it=Ot.call(f,"variable")&&f.variable;if(!it)Be=`with (obj) {
|
||
`+Be+`
|
||
}
|
||
`;else if(wt.test(it))throw new ot(o);Be=(ue?Be.replace(bl,""):Be).replace(tu,"$1").replace(ih,"$1;"),Be="function("+(it||"obj")+`) {
|
||
`+(it?"":`obj || (obj = {});
|
||
`)+"var __t, __p = ''"+(re?", __e = _.escape":"")+(ue?`, __j = Array.prototype.join;
|
||
function print() { __p += __j.call(arguments, '') }
|
||
`:`;
|
||
`)+Be+`return __p
|
||
}`;var Et=x5(function(){return xt(W,ze+"return "+Be).apply(e,J)});if(Et.source=Be,Nv(Et))throw Et;return Et}function ET(c){return zt(c).toLowerCase()}function bT(c){return zt(c).toUpperCase()}function AT(c,f,b){if(c=zt(c),c&&(b||f===e))return _h(c);if(!c||!(f=Ds(f)))return c;var k=Hn(c),j=Hn(f),W=o0(k,j),J=Dh(k,j)+1;return mu(k,W,J).join("")}function ST(c,f,b){if(c=zt(c),c&&(b||f===e))return c.slice(0,Bh(c)+1);if(!c||!(f=Ds(f)))return c;var k=Hn(c),j=Dh(k,Hn(f))+1;return mu(k,0,j).join("")}function _T(c,f,b){if(c=zt(c),c&&(b||f===e))return c.replace(ie,"");if(!c||!(f=Ds(f)))return c;var k=Hn(c),j=o0(k,Hn(f));return mu(k,j).join("")}function CT(c,f){var b=I,k=q;if(cr(f)){var j="separator"in f?f.separator:j;b="length"in f?yt(f.length):b,k="omission"in f?Ds(f.omission):k}c=zt(c);var W=c.length;if(fu(c)){var J=Hn(c);W=J.length}if(b>=W)return c;var re=b-zo(k);if(re<1)return k;var ue=J?mu(J,0,re).join(""):c.slice(0,re);if(j===e)return ue+k;if(J&&(re+=ue.length-re),Lv(j)){if(c.slice(re).search(j)){var _e,Ce=ue;for(j.global||(j=xh(j.source,zt(js.exec(j))+"g")),j.lastIndex=0;_e=j.exec(Ce);)var Be=_e.index;ue=ue.slice(0,Be===e?re:Be)}}else if(c.indexOf(Ds(j),re)!=re){var Ne=ue.lastIndexOf(j);Ne>-1&&(ue=ue.slice(0,Ne))}return ue+k}function DT(c){return c=zt(c),c&&Kt.test(c)?c.replace(ru,f0):c}var FT=Ll(function(c,f,b){return c+(b?" ":"")+f.toUpperCase()}),qv=x6("toUpperCase");function I5(c,f,b){return c=zt(c),f=b?e:f,f===e?z2(c)?Z2(c):rt(c):c.match(f)||[]}var x5=At(function(c,f){try{return Un(c,e,f)}catch(b){return Nv(b)?b:new ot(b)}}),BT=Jo(function(c,f){return U(f,function(b){b=Ei(b),to(c,b,Tv(c[b],c))}),c});function IT(c){var f=c==null?0:c.length,b=st();return c=f?Wt(c,function(k){if(typeof k[1]!="function")throw new ns(i);return[b(k[0]),k[1]]}):[],At(function(k){for(var j=-1;++j<f;){var W=c[j];if(Un(W[0],this,k))return Un(W[1],this,k)}})}function xT(c){return r$(zs(c,h))}function jv(c){return function(){return c}}function $T(c,f){return c==null||c!==c?f:c}var PT=P6(),kT=P6(!0);function as(c){return c}function Kv(c){return u6(typeof c=="function"?c:zs(c,h))}function RT(c){return l6(zs(c,h))}function TT(c,f){return f6(c,zs(f,h))}var OT=At(function(c,f){return function(b){return Lh(b,c,f)}}),NT=At(function(c,f){return function(b){return Lh(c,b,f)}});function Vv(c,f,b){var k=Gr(f),j=b0(f,k);b==null&&!(cr(f)&&(j.length||!k.length))&&(b=f,f=c,c=this,j=b0(f,Gr(f)));var W=!(cr(b)&&"chain"in b)||!!b.chain,J=ea(c);return U(j,function(re){var ue=f[re];c[re]=ue,J&&(c.prototype[re]=function(){var _e=this.__chain__;if(W||_e){var Ce=c(this.__wrapped__),Be=Ce.__actions__=ss(this.__actions__);return Be.push({func:ue,args:arguments,thisArg:c}),Ce.__chain__=_e,Ce}return ue.apply(c,Qi([this.value()],arguments))})}),c}function LT(){return Ir._===this&&(Ir._=ev),this}function zv(){}function UT(c){return c=yt(c),At(function(f){return h6(f,c)})}var HT=Av(Wt),MT=Av(lc),qT=Av(tr);function $5(c){return Iv(c)?Ae(Ei(c)):y$(c)}function jT(c){return function(f){return c==null?e:vc(c,f)}}var KT=R6(),VT=R6(!0);function Gv(){return[]}function Wv(){return!1}function zT(){return{}}function GT(){return""}function WT(){return!0}function YT(c,f){if(c=yt(c),c<1||c>M)return[];var b=X,k=yn(c,X);f=st(f),c-=X;for(var j=Sh(k,f);++b<c;)f(b);return j}function XT(c){return ht(c)?Wt(c,Ei):Fs(c)?[c]:ss(X6(zt(c)))}function ZT(c){var f=++$h;return zt(c)+f}var JT=F0(function(c,f){return c+f},0),QT=Sv("ceil"),eO=F0(function(c,f){return c/f},1),tO=Sv("floor");function rO(c){return c&&c.length?E0(c,as,uv):e}function nO(c,f){return c&&c.length?E0(c,st(f,2),uv):e}function sO(c){return lu(c,as)}function iO(c,f){return lu(c,st(f,2))}function oO(c){return c&&c.length?E0(c,as,hv):e}function aO(c,f){return c&&c.length?E0(c,st(f,2),hv):e}var uO=F0(function(c,f){return c*f},1),cO=Sv("round"),lO=F0(function(c,f){return c-f},0);function fO(c){return c&&c.length?Ah(c,as):0}function hO(c,f){return c&&c.length?Ah(c,st(f,2)):0}return G.after=Tk,G.ary=a5,G.assign=AR,G.assignIn=b5,G.assignInWith=A5,G.assignWith=Uv,G.at=SR,G.before=u5,G.bind=Tv,G.bindAll=BT,G.bindKey=c5,G.castArray=Gk,G.chain=s5,G.chunk=rP,G.compact=nP,G.concat=sP,G.cond=IT,G.conforms=xT,G.constant=jv,G.countBy=hk,G.create=_R,G.curry=l5,G.curryRight=f5,G.debounce=h5,G.defaults=CR,G.defaultsDeep=DR,G.defer=Ok,G.delay=Nk,G.difference=iP,G.differenceBy=oP,G.differenceWith=aP,G.drop=uP,G.dropRight=cP,G.dropRightWhile=lP,G.dropWhile=fP,G.fill=hP,G.filter=pk,G.flatMap=vk,G.flatMapDeep=wk,G.flatMapDepth=yk,G.flatten=e5,G.flattenDeep=dP,G.flattenDepth=pP,G.flip=Lk,G.flow=PT,G.flowRight=kT,G.fromPairs=mP,G.functions=kR,G.functionsIn=RR,G.groupBy=Ek,G.initial=vP,G.intersection=wP,G.intersectionBy=yP,G.intersectionWith=EP,G.invert=OR,G.invertBy=NR,G.invokeMap=Ak,G.iteratee=Kv,G.keyBy=Sk,G.keys=Gr,G.keysIn=os,G.map=R0,G.mapKeys=UR,G.mapValues=HR,G.matches=RT,G.matchesProperty=TT,G.memoize=O0,G.merge=MR,G.mergeWith=S5,G.method=OT,G.methodOf=NT,G.mixin=Vv,G.negate=N0,G.nthArg=UT,G.omit=qR,G.omitBy=jR,G.once=Uk,G.orderBy=_k,G.over=HT,G.overArgs=Hk,G.overEvery=MT,G.overSome=qT,G.partial=Ov,G.partialRight=d5,G.partition=Ck,G.pick=KR,G.pickBy=_5,G.property=$5,G.propertyOf=jT,G.pull=_P,G.pullAll=r5,G.pullAllBy=CP,G.pullAllWith=DP,G.pullAt=FP,G.range=KT,G.rangeRight=VT,G.rearg=Mk,G.reject=Bk,G.remove=BP,G.rest=qk,G.reverse=kv,G.sampleSize=xk,G.set=zR,G.setWith=GR,G.shuffle=$k,G.slice=IP,G.sortBy=Rk,G.sortedUniq=OP,G.sortedUniqBy=NP,G.split=gT,G.spread=jk,G.tail=LP,G.take=UP,G.takeRight=HP,G.takeRightWhile=MP,G.takeWhile=qP,G.tap=nk,G.throttle=Kk,G.thru=k0,G.toArray=w5,G.toPairs=C5,G.toPairsIn=D5,G.toPath=XT,G.toPlainObject=E5,G.transform=WR,G.unary=Vk,G.union=jP,G.unionBy=KP,G.unionWith=VP,G.uniq=zP,G.uniqBy=GP,G.uniqWith=WP,G.unset=YR,G.unzip=Rv,G.unzipWith=n5,G.update=XR,G.updateWith=ZR,G.values=Ml,G.valuesIn=JR,G.without=YP,G.words=I5,G.wrap=zk,G.xor=XP,G.xorBy=ZP,G.xorWith=JP,G.zip=QP,G.zipObject=ek,G.zipObjectDeep=tk,G.zipWith=rk,G.entries=C5,G.entriesIn=D5,G.extend=b5,G.extendWith=A5,Vv(G,G),G.add=JT,G.attempt=x5,G.camelCase=rT,G.capitalize=F5,G.ceil=QT,G.clamp=QR,G.clone=Wk,G.cloneDeep=Xk,G.cloneDeepWith=Zk,G.cloneWith=Yk,G.conformsTo=Jk,G.deburr=B5,G.defaultTo=$T,G.divide=eO,G.endsWith=nT,G.eq=bi,G.escape=sT,G.escapeRegExp=iT,G.every=dk,G.find=mk,G.findIndex=J6,G.findKey=FR,G.findLast=gk,G.findLastIndex=Q6,G.findLastKey=BR,G.floor=tO,G.forEach=i5,G.forEachRight=o5,G.forIn=IR,G.forInRight=xR,G.forOwn=$R,G.forOwnRight=PR,G.get=Hv,G.gt=Qk,G.gte=eR,G.has=TR,G.hasIn=Mv,G.head=t5,G.identity=as,G.includes=bk,G.indexOf=gP,G.inRange=eT,G.invoke=LR,G.isArguments=Ec,G.isArray=ht,G.isArrayBuffer=tR,G.isArrayLike=is,G.isArrayLikeObject=Er,G.isBoolean=rR,G.isBuffer=gu,G.isDate=nR,G.isElement=sR,G.isEmpty=iR,G.isEqual=oR,G.isEqualWith=aR,G.isError=Nv,G.isFinite=uR,G.isFunction=ea,G.isInteger=p5,G.isLength=L0,G.isMap=m5,G.isMatch=cR,G.isMatchWith=lR,G.isNaN=fR,G.isNative=hR,G.isNil=pR,G.isNull=dR,G.isNumber=g5,G.isObject=cr,G.isObjectLike=hr,G.isPlainObject=Kh,G.isRegExp=Lv,G.isSafeInteger=mR,G.isSet=v5,G.isString=U0,G.isSymbol=Fs,G.isTypedArray=Hl,G.isUndefined=gR,G.isWeakMap=vR,G.isWeakSet=wR,G.join=bP,G.kebabCase=oT,G.last=Ws,G.lastIndexOf=AP,G.lowerCase=aT,G.lowerFirst=uT,G.lt=yR,G.lte=ER,G.max=rO,G.maxBy=nO,G.mean=sO,G.meanBy=iO,G.min=oO,G.minBy=aO,G.stubArray=Gv,G.stubFalse=Wv,G.stubObject=zT,G.stubString=GT,G.stubTrue=WT,G.multiply=uO,G.nth=SP,G.noConflict=LT,G.noop=zv,G.now=T0,G.pad=cT,G.padEnd=lT,G.padStart=fT,G.parseInt=hT,G.random=tT,G.reduce=Dk,G.reduceRight=Fk,G.repeat=dT,G.replace=pT,G.result=VR,G.round=cO,G.runInContext=oe,G.sample=Ik,G.size=Pk,G.snakeCase=mT,G.some=kk,G.sortedIndex=xP,G.sortedIndexBy=$P,G.sortedIndexOf=PP,G.sortedLastIndex=kP,G.sortedLastIndexBy=RP,G.sortedLastIndexOf=TP,G.startCase=vT,G.startsWith=wT,G.subtract=lO,G.sum=fO,G.sumBy=hO,G.template=yT,G.times=YT,G.toFinite=ta,G.toInteger=yt,G.toLength=y5,G.toLower=ET,G.toNumber=Ys,G.toSafeInteger=bR,G.toString=zt,G.toUpper=bT,G.trim=AT,G.trimEnd=ST,G.trimStart=_T,G.truncate=CT,G.unescape=DT,G.uniqueId=ZT,G.upperCase=FT,G.upperFirst=qv,G.each=i5,G.eachRight=o5,G.first=t5,Vv(G,(function(){var c={};return ro(G,function(f,b){Ot.call(G.prototype,b)||(c[b]=f)}),c})(),{chain:!1}),G.VERSION=t,U(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){G[c].placeholder=G}),U(["drop","take"],function(c,f){Bt.prototype[c]=function(b){b=b===e?1:Tr(yt(b),0);var k=this.__filtered__&&!f?new Bt(this):this.clone();return k.__filtered__?k.__takeCount__=yn(b,k.__takeCount__):k.__views__.push({size:yn(b,X),type:c+(k.__dir__<0?"Right":"")}),k},Bt.prototype[c+"Right"]=function(b){return this.reverse()[c](b).reverse()}}),U(["filter","map","takeWhile"],function(c,f){var b=f+1,k=b==O||b==N;Bt.prototype[c]=function(j){var W=this.clone();return W.__iteratees__.push({iteratee:st(j,3),type:b}),W.__filtered__=W.__filtered__||k,W}}),U(["head","last"],function(c,f){var b="take"+(f?"Right":"");Bt.prototype[c]=function(){return this[b](1).value()[0]}}),U(["initial","tail"],function(c,f){var b="drop"+(f?"":"Right");Bt.prototype[c]=function(){return this.__filtered__?new Bt(this):this[b](1)}}),Bt.prototype.compact=function(){return this.filter(as)},Bt.prototype.find=function(c){return this.filter(c).head()},Bt.prototype.findLast=function(c){return this.reverse().find(c)},Bt.prototype.invokeMap=At(function(c,f){return typeof c=="function"?new Bt(this):this.map(function(b){return Lh(b,c,f)})}),Bt.prototype.reject=function(c){return this.filter(N0(st(c)))},Bt.prototype.slice=function(c,f){c=yt(c);var b=this;return b.__filtered__&&(c>0||f<0)?new Bt(b):(c<0?b=b.takeRight(-c):c&&(b=b.drop(c)),f!==e&&(f=yt(f),b=f<0?b.dropRight(-f):b.take(f-c)),b)},Bt.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},Bt.prototype.toArray=function(){return this.take(X)},ro(Bt.prototype,function(c,f){var b=/^(?:filter|find|map|reject)|While$/.test(f),k=/^(?:head|last)$/.test(f),j=G[k?"take"+(f=="last"?"Right":""):f],W=k||/^find/.test(f);j&&(G.prototype[f]=function(){var J=this.__wrapped__,re=k?[1]:arguments,ue=J instanceof Bt,_e=re[0],Ce=ue||ht(J),Be=function(Ft){var $t=j.apply(G,Qi([Ft],re));return k&&Ne?$t[0]:$t};Ce&&b&&typeof _e=="function"&&_e.length!=1&&(ue=Ce=!1);var Ne=this.__chain__,ze=!!this.__actions__.length,it=W&&!Ne,Et=ue&&!ze;if(!W&&Ce){J=Et?J:new Bt(this);var nt=c.apply(J,re);return nt.__actions__.push({func:k0,args:[Be],thisArg:e}),new Vs(nt,Ne)}return it&&Et?c.apply(this,re):(nt=this.thru(Be),it?k?nt.value()[0]:nt.value():nt)})}),U(["pop","push","shift","sort","splice","unshift"],function(c){var f=hc[c],b=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",k=/^(?:pop|shift)$/.test(c);G.prototype[c]=function(){var j=arguments;if(k&&!this.__chain__){var W=this.value();return f.apply(ht(W)?W:[],j)}return this[b](function(J){return f.apply(ht(J)?J:[],j)})}}),ro(Bt.prototype,function(c,f){var b=G[f];if(b){var k=b.name+"";Ot.call(Tl,k)||(Tl[k]=[]),Tl[k].push({name:f,func:b})}}),Tl[D0(e,y).name]=[{name:"wrapper",func:e}],Bt.prototype.clone=Fx,Bt.prototype.reverse=Bx,Bt.prototype.value=Ix,G.prototype.at=sk,G.prototype.chain=ik,G.prototype.commit=ok,G.prototype.next=ak,G.prototype.plant=ck,G.prototype.reverse=lk,G.prototype.toJSON=G.prototype.valueOf=G.prototype.value=fk,G.prototype.first=G.prototype.head,dc&&(G.prototype[dc]=uk),G}),wi=Ih();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ir._=wi,define(function(){return wi})):jo?((jo.exports=wi)._=wi,gh._=wi):Ir._=wi}).call(Gf)});var u2=be((Fye,J9)=>{"use strict";var Bye=B(x()),RJ=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])},lS=class e extends Error{constructor(t,r,n){super(t),RJ(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:o,text:s})=>({source:o,text:s.split(/\r\n|\n|\r/g)}));function n(o,s,a=""){let u="",l=r.find(({source:m})=>m===o.source),h=o.start;if(l){let m=o.end,p=l.text[h.line-1],v=(h.line===m.line?m.column:p.length+1)-h.column||1;a&&(u+=`
|
||
note: ${a}`),u+=`
|
||
--> ${o.source}:${h.line}:${h.column}
|
||
${"".padEnd(s)} |
|
||
${h.line.toString().padStart(s)} | ${p}
|
||
${"".padEnd(s)} | ${"".padEnd(h.column-1)}${"".padEnd(v,"^")}`}else u+=`
|
||
at ${o.source}:${h.line}:${h.column}`,a&&(u+=`: ${a}`);return u}function i(o,s,a,u=[]){let l;a?l=u.reduce((m,{location:p})=>Math.max(m,p.start.line),a.start.line):l=Math.max.apply(null,u.map(m=>m.location.start.line)),l=l.toString().length;let h=`${o}: ${s}`;a&&(h+=n(a,l));for(let m of u)h+=n(m.location,l,m.message);return h}return this.problems.filter(o=>o[0]!=="info").map(o=>i(...o)).join(`
|
||
|
||
`)}};J9.exports=lS});var hi=be((Iye,Q9)=>{"use strict";var xye=B(x()),TJ={build(e){function t(s,...a){return e[s.type](s,...a)}function r(){}function n(s,...a){return t(s.expression,...a)}function i(s){return function(a,...u){a[s].forEach(l=>t(l,...u))}}let o={grammar(s,...a){s.topLevelInitializer&&t(s.topLevelInitializer,...a),s.initializer&&t(s.initializer,...a),s.rules.forEach(u=>t(u,...a))},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(o).forEach(s=>{Object.prototype.hasOwnProperty.call(e,s)||(e[s]=o[s])}),t}};Q9.exports=TJ});var nc=be(($ye,t7)=>{"use strict";var Pye=B(x()),OJ=hi(),e7={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=OJ.build({choice(o){return o.alternatives.every(i)},sequence(o){return o.elements.some(i)},simple_and:n,simple_not:n,optional:n,zero_or_more:n,semantic_and:n,semantic_not:n,rule_ref(o){let s=e7.findRule(e,o.name);return s?i(s):void 0},literal(o){return o.value!==""},class:r,any:r});return i(t)}};t7.exports=e7});var fS=be((kye,r7)=>{"use strict";var Rye=B(x()),NJ={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};r7.exports=NJ});var hS=be((Tye,n7)=>{"use strict";var Oye=B(x()),LJ=hi(),UJ=nc(),HJ=u2(),Pp=1,El=0,kp=-1;function c2(e){function t(s){return s.match=El}function r(s){return o(s.expression),s.match=Pp}function n(s){return s.match=o(s.expression)}function i(s,a){let u=s.length,l=0,h=0;for(let m=0;m<u;++m){let p=o(s[m]);p===Pp&&++l,p===kp&&++h}return l===u?Pp:a?h===u?kp:El:h>0?kp:El}let o=LJ.build({rule(s){let a,u=0;if(typeof s.match>"u"){s.match=El;do if(a=s.match,s.match=o(s.expression),++u>6)throw new HJ("Infinity cycle detected when trying to evaluate node match result",s.location);while(a!==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=-o(s.expression)},optional:r,zero_or_more:r,one_or_more:n,group:n,semantic_and:t,semantic_not:t,rule_ref(s){let a=UJ.findRule(e,s.name);return s.match=o(a)},literal(s){let a=s.value.length===0?Pp:El;return s.match=a},class(s){let a=s.parts.length===0?kp:El;return s.match=a},any:t});o(e)}c2.ALWAYS_MATCH=Pp;c2.SOMETIMES_MATCH=El;c2.NEVER_MATCH=kp;n7.exports=c2});var i7=be((Nye,s7)=>{"use strict";var Lye=B(x()),MJ=nc(),Ue=fS(),qJ=hi(),{ALWAYS_MATCH:nh,SOMETIMES_MATCH:dS,NEVER_MATCH:pS}=hS();function jJ(e){let t=[],r=[],n=[],i=[];function o(E){let _=t.indexOf(E);return _===-1?t.push(E)-1:_}function s(E){let _={value:E.parts,inverted:E.inverted,ignoreCase:E.ignoreCase},C=JSON.stringify(_),F=r.findIndex(H=>JSON.stringify(H)===C);return F===-1?r.push(_)-1:F}function a(E){let _=JSON.stringify(E),C=n.findIndex(F=>JSON.stringify(F)===_);return C===-1?n.push(E)-1:C}function u(E,_,C){let F={predicate:E,params:_,body:C.code,location:C.codeLocation},H=JSON.stringify(F),K=i.findIndex(S=>JSON.stringify(S)===H);return K===-1?i.push(F)-1:K}function l(E){let _={};return Object.keys(E).forEach(C=>{_[C]=E[C]}),_}function h(E,..._){return E.concat(..._)}function m(E,_,C,F){return E===nh?C:E===pS?F:_.concat([C.length,F.length],C,F)}function p(E,_){return E.concat([_.length],_)}function d(E,_,C,F){let H=Object.keys(C).map(K=>F-C[K]);return[Ue.CALL,E,_,H.length].concat(H)}function v(E,_,C){let F=E.match|0;return h([Ue.PUSH_CURR_POS],[Ue.SILENT_FAILS_ON],w(E,{sp:C.sp+1,env:l(C.env),action:null}),[Ue.SILENT_FAILS_OFF],m(_?-F:F,[_?Ue.IF_ERROR:Ue.IF_NOT_ERROR],h([Ue.POP],[_?Ue.POP:Ue.POP_CURR_POS],[Ue.PUSH_UNDEFINED]),h([Ue.POP],[_?Ue.POP_CURR_POS:Ue.POP],[Ue.PUSH_FAILED])))}function g(E,_,C){let F=u(!0,Object.keys(C.env),E);return h([Ue.UPDATE_SAVED_POS],d(F,0,C.env,C.sp),m(E.match|0,[Ue.IF],h([Ue.POP],_?[Ue.PUSH_FAILED]:[Ue.PUSH_UNDEFINED]),h([Ue.POP],_?[Ue.PUSH_UNDEFINED]:[Ue.PUSH_FAILED])))}function y(E){return p([Ue.WHILE_NOT_ERROR],h([Ue.APPEND],E))}let w=qJ.build({grammar(E){E.rules.forEach(w),E.literals=t,E.classes=r,E.expectations=n,E.functions=i},rule(E){E.bytecode=w(E.expression,{sp:-1,env:{},pluck:[],action:null})},named(E,_){let C=E.match|0,F=C===pS?null:a({type:"rule",value:E.name});return h([Ue.SILENT_FAILS_ON],w(E.expression,_),[Ue.SILENT_FAILS_OFF],m(C,[Ue.IF_ERROR],[Ue.FAIL,F],[]))},choice(E,_){function C(F,H){let K=F[0].match|0,S=w(F[0],{sp:H.sp,env:l(H.env),action:null});return K===nh?S:h(S,F.length>1?m(dS,[Ue.IF_ERROR],h([Ue.POP],C(F.slice(1),H)),[]):[])}return C(E.alternatives,_)},action(E,_){let C=l(_.env),F=E.expression.type!=="sequence"||E.expression.elements.length===0,H=w(E.expression,{sp:_.sp+(F?1:0),env:C,action:E}),K=E.expression.match|0,S=F&&K!==pS?u(!1,Object.keys(C),E):null;return F?h([Ue.PUSH_CURR_POS],H,m(K,[Ue.IF_NOT_ERROR],h([Ue.LOAD_SAVED_POS,1],d(S,1,C,_.sp+2)),[]),[Ue.NIP]):H},sequence(E,_){function C(F,H){if(F.length>0){let K=E.elements.length-F.length+1;return h(w(F[0],{sp:H.sp,env:H.env,pluck:H.pluck,action:null}),m(F[0].match|0,[Ue.IF_NOT_ERROR],C(F.slice(1),{sp:H.sp+1,env:H.env,pluck:H.pluck,action:H.action}),h(K>1?[Ue.POP_N,K]:[Ue.POP],[Ue.POP_CURR_POS],[Ue.PUSH_FAILED])))}else{if(H.pluck.length>0)return h([Ue.PLUCK,E.elements.length+1,H.pluck.length],H.pluck.map(K=>H.sp-K));if(H.action){let K=u(!1,Object.keys(H.env),H.action);return h([Ue.LOAD_SAVED_POS,E.elements.length],d(K,E.elements.length+1,H.env,H.sp))}else return h([Ue.WRAP,E.elements.length],[Ue.NIP])}}return h([Ue.PUSH_CURR_POS],C(E.elements,{sp:_.sp+1,env:_.env,pluck:[],action:_.action}))},labeled(E,_){let C=_.env,F=E.label,H=_.sp+1;return F&&(C=l(_.env),_.env[E.label]=H),E.pick&&_.pluck.push(H),w(E.expression,{sp:_.sp,env:C,action:null})},text(E,_){return h([Ue.PUSH_CURR_POS],w(E.expression,{sp:_.sp+1,env:l(_.env),action:null}),m(E.match|0,[Ue.IF_NOT_ERROR],h([Ue.POP],[Ue.TEXT]),[Ue.NIP]))},simple_and(E,_){return v(E.expression,!1,_)},simple_not(E,_){return v(E.expression,!0,_)},optional(E,_){return h(w(E.expression,{sp:_.sp,env:l(_.env),action:null}),m(-(E.expression.match|0),[Ue.IF_ERROR],h([Ue.POP],[Ue.PUSH_NULL]),[]))},zero_or_more(E,_){let C=w(E.expression,{sp:_.sp+1,env:l(_.env),action:null});return h([Ue.PUSH_EMPTY_ARRAY],C,y(C),[Ue.POP])},one_or_more(E,_){let C=w(E.expression,{sp:_.sp+1,env:l(_.env),action:null});return h([Ue.PUSH_EMPTY_ARRAY],C,m(E.expression.match|0,[Ue.IF_NOT_ERROR],h(y(C),[Ue.POP]),h([Ue.POP],[Ue.POP],[Ue.PUSH_FAILED])))},group(E,_){return w(E.expression,{sp:_.sp,env:l(_.env),action:null})},semantic_and(E,_){return g(E,!1,_)},semantic_not(E,_){return g(E,!0,_)},rule_ref(E){return[Ue.RULE,MJ.indexOfRule(e,E.name)]},literal(E){if(E.value.length>0){let _=E.match|0,F=_===dS||_===nh&&!E.ignoreCase?o(E.ignoreCase?E.value.toLowerCase():E.value):null,H=_!==nh?a({type:"literal",value:E.value,ignoreCase:E.ignoreCase}):null;return m(_,E.ignoreCase?[Ue.MATCH_STRING_IC,F]:[Ue.MATCH_STRING,F],E.ignoreCase?[Ue.ACCEPT_N,E.value.length]:[Ue.ACCEPT_STRING,F],[Ue.FAIL,H])}return[Ue.PUSH_EMPTY_STRING]},class(E){let _=E.match|0,C=_===dS?s(E):null,F=_!==nh?a({type:"class",value:E.parts,inverted:E.inverted,ignoreCase:E.ignoreCase}):null;return m(_,[Ue.MATCH_CHAR_CLASS,C],[Ue.ACCEPT_N,1],[Ue.FAIL,F])},any(E){let _=E.match|0,C=_!==nh?a({type:"any"}):null;return m(_,[Ue.MATCH_ANY],[Ue.ACCEPT_N,1],[Ue.FAIL,C])}});w(e)}s7.exports=jJ});var a7=be((Uye,o7)=>{"use strict";var Hye=B(x()),mS=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 o=this.sp;if(this.sp=i,n(),o!==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: "+o+", 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+").")}};o7.exports=mS});var gS=be((Mye,u7)=>{"use strict";var qye=B(x());u7.exports="2.0.1"});var c7=be(l2=>{"use strict";var Kye=B(x());function Ja(e){return e.charCodeAt(0).toString(16).toUpperCase()}l2.hex=Ja;function KJ(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"+Ja(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Ja(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Ja(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Ja(t))}l2.stringEscape=KJ;function VJ(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"+Ja(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Ja(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Ja(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Ja(t))}l2.regexpClassEscape=VJ});var h7=be(f7=>{var zye=B(x()),l7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");f7.encode=function(e){if(0<=e&&e<l7.length)return l7[e];throw new TypeError("Must be between 0 and 63: "+e)}});var g7=be(m7=>{var Wye=B(x()),zJ=h7(),d7=5,p7=1<<d7,GJ=p7-1,WJ=p7;function YJ(e){return e<0?(-e<<1)+1:(e<<1)+0}m7.encode=function(t){let r="",n,i=YJ(t);do n=i&GJ,i>>>=d7,i>0&&(n|=WJ),r+=zJ.encode(n);while(i>0);return r}});var h2=be(ic=>{var Xye=B(x());function XJ(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}ic.getArg=XJ;var w7=(function(){return!("__proto__"in Object.create(null))})();function y7(e){return e}function ZJ(e){return E7(e)?"$"+e:e}ic.toSetString=w7?y7:ZJ;function JJ(e){return E7(e)?e.slice(1):e}ic.fromSetString=w7?y7:JJ;function E7(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 v7(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function QJ(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=v7(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:v7(e.name,t.name)}ic.compareByGeneratedPositionsInflated=QJ;var vS="http:",Rp=`${vS}//host`;function b7(e){return t=>{let r=Tp(t),n=wS(t),i=new URL(t,n);e(i);let o=i.toString();return r==="absolute"?o:r==="scheme-relative"?o.slice(vS.length):r==="path-absolute"?o.slice(Rp.length):yS(n,o)}}function sc(e,t){return new URL(e,t).toString()}function eQ(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function wS(e){let t=e.split("..").length-1,r=eQ("p",e),n=`${Rp}/`;for(let i=0;i<t;i++)n+=`${r}/`;return n}var tQ=/^[A-Za-z0-9\+\-\.]+:/;function Tp(e){return e[0]==="/"?e[1]==="/"?"scheme-relative":"path-absolute":tQ.test(e)?"absolute":"path-relative"}function yS(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 rQ=b7(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),f2=b7(e=>{});ic.normalize=f2;function nQ(e,t){let r=Tp(t),n=Tp(e);if(e=rQ(e),r==="absolute")return sc(t,void 0);if(n==="absolute")return sc(t,e);if(r==="scheme-relative")return f2(t);if(n==="scheme-relative")return sc(t,sc(e,Rp)).slice(vS.length);if(r==="path-absolute")return f2(t);if(n==="path-absolute")return sc(t,sc(e,Rp)).slice(Rp.length);let i=wS(t+e),o=sc(t,sc(e,i));return yS(i,o)}ic.join=nQ;function sQ(e,t){let r=iQ(e,t);return typeof r=="string"?r:f2(t)}ic.relative=sQ;function iQ(e,t){if(Tp(e)!==Tp(t))return null;let n=wS(e+t),i=new URL(e,n),o=new URL(t,n);try{new URL("",o.toString())}catch{return null}return o.protocol!==i.protocol||o.user!==i.user||o.password!==i.password||o.hostname!==i.hostname||o.port!==i.port?null:yS(i,o)}});var S7=be(A7=>{var Jye=B(x()),ES=class e{constructor(){this._array=[],this._set=new Map}static fromArray(t,r){let n=new e;for(let i=0,o=t.length;i<o;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()}};A7.ArraySet=ES});var D7=be(C7=>{var eEe=B(x()),_7=h2();function oQ(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||_7.compareByGeneratedPositionsInflated(e,t)<=0}var bS=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){oQ(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(_7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};C7.MappingList=bS});var AS=be(F7=>{var rEe=B(x()),Op=g7(),$r=h2(),d2=S7().ArraySet,aQ=D7().MappingList,p2=class e{constructor(t){t||(t={}),this._file=$r.getArg(t,"file",null),this._sourceRoot=$r.getArg(t,"sourceRoot",null),this._skipValidation=$r.getArg(t,"skipValidation",!1),this._sources=new d2,this._names=new d2,this._mappings=new aQ,this._sourcesContents=null}static fromSourceMap(t){let r=t.sourceRoot,n=new e({file:t.file,sourceRoot:r});return t.eachMapping(function(i){let o={generated:{line:i.generatedLine,column:i.generatedColumn}};i.source!=null&&(o.source=i.source,r!=null&&(o.source=$r.relative(r,o.source)),o.original={line:i.originalLine,column:i.originalColumn},i.name!=null&&(o.name=i.name)),n.addMapping(o)}),t.sources.forEach(function(i){let o=i;r!=null&&(o=$r.relative(r,i)),n._sources.has(o)||n._sources.add(o);let s=t.sourceContentFor(i);s!=null&&n.setSourceContent(i,s)}),n}addMapping(t){let r=$r.getArg(t,"generated"),n=$r.getArg(t,"original",null),i=$r.getArg(t,"source",null),o=$r.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,i,o),i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),o!=null&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n&&n.line,originalColumn:n&&n.column,source:i,name:o})}setSourceContent(t,r){let n=t;this._sourceRoot!=null&&(n=$r.relative(this._sourceRoot,n)),r!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[$r.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[$r.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 o=this._sourceRoot;o!=null&&(i=$r.relative(o,i));let s=this._mappings.toArray().length>0?new d2:this._sources,a=new d2;this._mappings.unsortedForEach(function(u){if(u.source===i&&u.originalLine!=null){let m=t.originalPositionFor({line:u.originalLine,column:u.originalColumn});m.source!=null&&(u.source=m.source,n!=null&&(u.source=$r.join(n,u.source)),o!=null&&(u.source=$r.relative(o,u.source)),u.originalLine=m.line,u.originalColumn=m.column,m.name!=null&&(u.name=m.name))}let l=u.source;l!=null&&!s.has(l)&&s.add(l);let h=u.name;h!=null&&!a.has(h)&&a.add(h)},this),this._sources=s,this._names=a,t.sources.forEach(function(u){let l=t.sourceContentFor(u);l!=null&&(n!=null&&(u=$r.join(n,u)),o!=null&&(u=$r.relative(o,u)),this.setSourceContent(u,l))},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,o=0,s=0,a="",u,l,h,m,p=this._mappings.toArray();for(let d=0,v=p.length;d<v;d++){if(l=p[d],u="",l.generatedLine!==r)for(t=0;l.generatedLine!==r;)u+=";",r++;else if(d>0){if(!$r.compareByGeneratedPositionsInflated(l,p[d-1]))continue;u+=","}u+=Op.encode(l.generatedColumn-t),t=l.generatedColumn,l.source!=null&&(m=this._sources.indexOf(l.source),u+=Op.encode(m-s),s=m,u+=Op.encode(l.originalLine-1-i),i=l.originalLine-1,u+=Op.encode(l.originalColumn-n),n=l.originalColumn,l.name!=null&&(h=this._names.indexOf(l.name),u+=Op.encode(h-o),o=h)),a+=u}return a}_generateSourcesContent(t,r){return t.map(function(n){if(!this._sourcesContents)return null;r!=null&&(n=$r.relative(r,n));let i=$r.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())}};p2.prototype._version=3;F7.SourceMapGenerator=p2});var I7=be(B7=>{var sEe=B(x()),uQ=AS().SourceMapGenerator,m2=h2(),cQ=/(\r?\n)/,lQ=10,sh="$$$isSourceNode$$$",SS=class e{constructor(t,r,n,i,o){this.children=[],this.sourceContents={},this.line=t??null,this.column=r??null,this.source=n??null,this.name=o??null,this[sh]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,o=t.split(cQ),s=0,a=function(){let d=g(),v=g()||"";return d+v;function g(){return s<o.length?o[s++]:void 0}},u=1,l=0,h=null,m;return r.eachMapping(function(d){if(h!==null)if(u<d.generatedLine)p(h,a()),u++,l=0;else{m=o[s]||"";let v=m.substr(0,d.generatedColumn-l);o[s]=m.substr(d.generatedColumn-l),l=d.generatedColumn,p(h,v),h=d;return}for(;u<d.generatedLine;)i.add(a()),u++;l<d.generatedColumn&&(m=o[s]||"",i.add(m.substr(0,d.generatedColumn)),o[s]=m.substr(d.generatedColumn),l=d.generatedColumn),h=d},this),s<o.length&&(h&&p(h,a()),i.add(o.splice(s).join(""))),r.sources.forEach(function(d){let v=r.sourceContentFor(d);v!=null&&(n!=null&&(d=m2.join(n,d)),i.setSourceContent(d,v))}),i;function p(d,v){if(d===null||d.source===void 0)i.add(v);else{let g=n?m2.join(n,d.source):d.source;i.add(new e(d.originalLine,d.originalColumn,g,v,d.name))}}}add(t){if(Array.isArray(t))t.forEach(function(r){this.add(r)},this);else if(t[sh]||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[sh]||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[sh]?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[sh]?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[m2.toSetString(t)]=r}walkSourceContents(t){for(let n=0,i=this.children.length;n<i;n++)this.children[n][sh]&&this.children[n].walkSourceContents(t);let r=Object.keys(this.sourceContents);for(let n=0,i=r.length;n<i;n++)t(m2.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 uQ(t),i=!1,o=null,s=null,a=null,u=null;return this.walk(function(l,h){r.code+=l,h.source!==null&&h.line!==null&&h.column!==null?((o!==h.source||s!==h.line||a!==h.column||u!==h.name)&&n.addMapping({source:h.source,original:{line:h.line,column:h.column},generated:{line:r.line,column:r.column},name:h.name}),o=h.source,s=h.line,a=h.column,u=h.name,i=!0):i&&(n.addMapping({generated:{line:r.line,column:r.column}}),o=null,i=!1);for(let m=0,p=l.length;m<p;m++)l.charCodeAt(m)===lQ?(r.line++,r.column=0,m+1===p?(o=null,i=!1):i&&n.addMapping({source:h.source,original:{line:h.line,column:h.column},generated:{line:r.line,column:r.column},name:h.name})):r.column++}),this.walkSourceContents(function(l,h){n.setSourceContent(l,h)}),{code:r.code,map:n}}};B7.SourceNode=SS});var x7=be(_S=>{var oEe=B(x());_S.SourceMapGenerator=AS().SourceMapGenerator;_S.SourceNode=I7().SourceNode});var R7=be((aEe,k7)=>{"use strict";var uEe=B(x()),fQ=nc(),jt=fS(),hQ=a7(),dQ=gS(),{stringEscape:Ms,regexpClassEscape:CS}=c7(),{SourceNode:di}=x7();function P7(e,t,r){let n=t.start.line,i=t.start.column-1,o=e.split(`
|
||
`);return o.length===1?new di(n,i,t.source,e,r):new di(null,null,t.source,o.map((s,a)=>new di(n+a,a===0?i:0,t.source,a===o.length-1?s:[s,`
|
||
`],r)))}function $7(e,t,r,n,i){return r?new di(null,null,r.source,[e,P7(t,r,i),new di(r.end.line,r.end.column-1,r.source,n)]):new di(null,null,null,[e,t,n])}function pQ(e,t){function r(g){return g instanceof di?g:g.replace(/^(.+)$/gm," $1")}function n(g){return"peg$c"+g}function i(g){return"peg$r"+g}function o(g){return"peg$e"+g}function s(g){return"peg$f"+g}function a(g){return"peg$parse"+g}function u(){function g(_){return'"'+Ms(_)+'"'}function y(_){return"/^["+(_.inverted?"^":"")+_.value.map(C=>Array.isArray(C)?CS(C[0])+"-"+CS(C[1]):CS(C)).join("")+"]/"+(_.ignoreCase?"i":"")}function w(_){switch(_.type){case"rule":return'peg$otherExpectation("'+Ms(_.value)+'")';case"literal":return'peg$literalExpectation("'+Ms(_.value)+'", '+_.ignoreCase+")";case"class":return"peg$classExpectation(["+_.value.map(F=>Array.isArray(F)?'["'+Ms(F[0])+'", "'+Ms(F[1])+'"]':'"'+Ms(F)+'"').join(", ")+"], "+_.inverted+", "+_.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(_)+")")}}function E(_,C){return $7(`
|
||
var ${s(C)} = function(${_.params.join(", ")}) {`,_.body,_.location,"};")}return new di(null,null,t.grammarSource,[e.literals.map((_,C)=>" var "+n(C)+" = "+g(_)+";").concat("",e.classes.map((_,C)=>" var "+i(C)+" = "+y(_)+";")).concat("",e.expectations.map((_,C)=>" var "+o(C)+" = "+w(_)+";")).concat("").join(`
|
||
`),e.functions.map(E)])}function l(g,y){let w=[];return w.push(""),t.trace&&w.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+g+","," location: peg$computeLocation(startPos, startPos)","});",""),t.cache&&(w.push("var key = peg$currPos * "+e.rules.length+" + "+y+";","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: "+g+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+g+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),w.push(" return cached.result;","}","")),w}function h(g,y){let w=[];return t.cache&&w.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+y+" };"),t.trace&&w.push("","if ("+y+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+g+","," result: "+y+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+g+","," location: peg$computeLocation(startPos, startPos)"," });","}"),w.push("","return "+y+";"),w}function m(g){let y=[],w=new hQ(g.name,"s","var");function E(C){let F=0,H=C.length,K=[],S;function I(R,O){let T=O+3,N=C[F+T-2],P=C[F+T-1],M,Y;w.checkedIf(F,()=>{F+=T,M=E(C.slice(F,F+N)),F+=N},P>0?()=>{Y=E(C.slice(F,F+P)),F+=P}:null),K.push("if ("+R+") {"),K.push(...M.map(r)),P>0&&(K.push("} else {"),K.push(...Y.map(r))),K.push("}")}function q(R){let T=C[F+2-1],N;w.checkedLoop(F,()=>{F+=2,N=E(C.slice(F,F+T)),F+=T}),K.push("while ("+R+") {"),K.push(...N.map(r)),K.push("}")}function L(){let O=C[F+4-1],T=s(C[F+1])+"("+C.slice(F+4,F+4+O).map(N=>w.index(N)).join(", ")+")";w.pop(C[F+2]),K.push(w.push(T)),F+=4+O}for(;F<H;)switch(C[F]){case jt.PUSH_EMPTY_STRING:K.push(w.push("''")),F++;break;case jt.PUSH_CURR_POS:K.push(w.push("peg$currPos")),F++;break;case jt.PUSH_UNDEFINED:K.push(w.push("undefined")),F++;break;case jt.PUSH_NULL:K.push(w.push("null")),F++;break;case jt.PUSH_FAILED:K.push(w.push("peg$FAILED")),F++;break;case jt.PUSH_EMPTY_ARRAY:K.push(w.push("[]")),F++;break;case jt.POP:w.pop(),F++;break;case jt.POP_CURR_POS:K.push("peg$currPos = "+w.pop()+";"),F++;break;case jt.POP_N:w.pop(C[F+1]),F+=2;break;case jt.NIP:S=w.pop(),w.pop(),K.push(w.push(S)),F++;break;case jt.APPEND:S=w.pop(),K.push(w.top()+".push("+S+");"),F++;break;case jt.WRAP:K.push(w.push("["+w.pop(C[F+1]).join(", ")+"]")),F+=2;break;case jt.TEXT:K.push(w.push("input.substring("+w.pop()+", peg$currPos)")),F++;break;case jt.PLUCK:{let O=C[F+3-1],T=3+O;S=C.slice(F+3,F+T),S=O===1?w.index(S[0]):`[ ${S.map(N=>w.index(N)).join(", ")} ]`,w.pop(C[F+1]),K.push(w.push(S)),F+=T;break}case jt.IF:I(w.top(),0);break;case jt.IF_ERROR:I(w.top()+" === peg$FAILED",0);break;case jt.IF_NOT_ERROR:I(w.top()+" !== peg$FAILED",0);break;case jt.WHILE_NOT_ERROR:q(w.top()+" !== peg$FAILED");break;case jt.MATCH_ANY:I("input.length > peg$currPos",0);break;case jt.MATCH_STRING:I(e.literals[C[F+1]].length>1?"input.substr(peg$currPos, "+e.literals[C[F+1]].length+") === "+n(C[F+1]):"input.charCodeAt(peg$currPos) === "+e.literals[C[F+1]].charCodeAt(0),1);break;case jt.MATCH_STRING_IC:I("input.substr(peg$currPos, "+e.literals[C[F+1]].length+").toLowerCase() === "+n(C[F+1]),1);break;case jt.MATCH_CHAR_CLASS:I(i(C[F+1])+".test(input.charAt(peg$currPos))",1);break;case jt.ACCEPT_N:K.push(w.push(C[F+1]>1?"input.substr(peg$currPos, "+C[F+1]+")":"input.charAt(peg$currPos)")),K.push(C[F+1]>1?"peg$currPos += "+C[F+1]+";":"peg$currPos++;"),F+=2;break;case jt.ACCEPT_STRING:K.push(w.push(n(C[F+1]))),K.push(e.literals[C[F+1]].length>1?"peg$currPos += "+e.literals[C[F+1]].length+";":"peg$currPos++;"),F+=2;break;case jt.FAIL:K.push(w.push("peg$FAILED")),K.push("if (peg$silentFails === 0) { peg$fail("+o(C[F+1])+"); }"),F+=2;break;case jt.LOAD_SAVED_POS:K.push("peg$savedPos = "+w.index(C[F+1])+";"),F+=2;break;case jt.UPDATE_SAVED_POS:K.push("peg$savedPos = peg$currPos;"),F++;break;case jt.CALL:L();break;case jt.RULE:K.push(w.push(a(e.rules[C[F+1]].name)+"()")),F+=2;break;case jt.SILENT_FAILS_ON:K.push("peg$silentFails++;"),F++;break;case jt.SILENT_FAILS_OFF:K.push("peg$silentFails--;"),F++;break;default:throw new Error("Invalid opcode: "+C[F]+".")}return K}let _=E(g.bytecode);return y.push($7(" function ",a(g.name),g.nameLocation,`() {
|
||
`,g.name)),t.trace&&y.push(" var startPos = peg$currPos;"),y.push(r(w.defines())),y.push(...l('"'+Ms(g.name)+'"',fQ.indexOfRule(e,g.name)).map(r)),y.push(..._.map(r)),y.push(...h('"'+Ms(g.name)+'"',w.result()).map(r)),y.push("}"),y}function p(g){return g.codeLocation?P7(g.code,g.codeLocation,"$"+g.type):g.code}function d(){let g=[];e.topLevelInitializer&&(g.push(p(e.topLevelInitializer)),g.push("")),g.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&&g.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");let y="{ "+t.allowedStartRules.map(E=>E+": "+a(E)).join(", ")+" }",w=a(t.allowedStartRules[0]);return g.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+y+";"," var peg$startRuleFunction = "+w+";","",u(),""," 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&&g.push(" var peg$resultsCache = {};",""),t.trace&&g.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),g.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(E=>{g.push(...m(E).map(r)),g.push("")}),e.initializer&&(g.push(p(e.initializer)),g.push("")),g.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 di(null,null,t.grammarSource,g.map(E=>E instanceof di?E:E+`
|
||
`))}function v(g){function y(){return[`// Generated by Peggy ${dQ}.`,"//","// 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[...y(),"(function() {",' "use strict";',"",g,"",r("return "+w()+";"),"})()"]},commonjs(){let C=Object.keys(t.dependencies),F=y();return F.push("",'"use strict";',""),C.length>0&&(C.forEach(H=>{F.push("var "+H+' = require("'+Ms(t.dependencies[H])+'");')}),F.push("")),F.push(g,"","module.exports = "+w()+";"),F},es(){let C=Object.keys(t.dependencies),F=y();return F.push(""),C.length>0&&(C.forEach(H=>{F.push("import "+H+' from "'+Ms(t.dependencies[H])+'";')}),F.push("")),F.push(g,"","export {"," peg$SyntaxError as SyntaxError,",t.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),F},amd(){let C=Object.keys(t.dependencies),H="["+C.map(S=>t.dependencies[S]).map(S=>'"'+Ms(S)+'"').join(", ")+"]",K=C.join(", ");return[...y(),"define("+H+", function("+K+") {",' "use strict";',"",g,"",r("return "+w()+";"),"});"]},globals(){return[...y(),"(function(root) {",' "use strict";',"",g,"",r("root."+t.exportVar+" = "+w()+";"),"})(this);"]},umd(){let C=Object.keys(t.dependencies),F=C.map(q=>t.dependencies[q]),H="["+F.map(q=>'"'+Ms(q)+'"').join(", ")+"]",K=F.map(q=>'require("'+Ms(q)+'")').join(", "),S=C.join(", "),I=y();return I.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+H+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+K+");"),t.exportVar!==null&&I.push(" } else {"," root."+t.exportVar+" = factory();"),I.push(" }","})(this, function("+S+") {",' "use strict";',"",g,"",r("return "+w()+";"),"});"),I}}[t.format]();return new di(null,null,t.grammarSource,_.map(C=>C instanceof di?C:C+`
|
||
`))}e.code=v(d())}k7.exports=pQ});var O7=be((cEe,T7)=>{"use strict";var lEe=B(x()),mQ=nc(),gQ=hi();function vQ(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,a,u){gQ.build({rule_ref(h){h.name===a&&(h.name=u,r.info(`Proxy rule "${a}" replaced by the rule "${u}"`,h.location,[{message:"This rule will be used",location:mQ.findRule(s,u).nameLocation}]))}})(s)}let o=[];e.rules.forEach((s,a)=>{n(s)&&(i(e,s.name,s.expression.name),t.allowedStartRules.indexOf(s.name)===-1&&o.push(a))}),o.reverse(),o.forEach(s=>{e.rules.splice(s,1)})}T7.exports=vQ});var L7=be((fEe,N7)=>{"use strict";var hEe=B(x()),wQ=hi();function yQ(e,t,r){function n(s){let a={};return Object.keys(s).forEach(u=>{a[u]=s[u]}),a}function i(s,a){o(s.expression,n(a))}let o=wQ.build({rule(s){o(s.expression,{})},choice(s,a){s.alternatives.forEach(u=>{o(u,n(a))})},action:i,labeled(s,a){let u=s.label;u&&Object.prototype.hasOwnProperty.call(a,u)&&r.error(`Label "${s.label}" is already defined`,s.labelLocation,[{message:"Original label location",location:a[u]}]),o(s.expression,a),a[s.label]=s.labelLocation},text:i,simple_and:i,simple_not:i,optional:i,zero_or_more:i,one_or_more:i,group:i});o(e)}N7.exports=yQ});var H7=be((dEe,U7)=>{"use strict";var pEe=B(x()),EQ=hi();function bQ(e,t,r){let n={};EQ.build({rule(o){if(Object.prototype.hasOwnProperty.call(n,o.name)){r.error(`Rule "${o.name}" is already defined`,o.nameLocation,[{message:"Original rule location",location:n[o.name]}]);return}n[o.name]=o.nameLocation}})(e)}U7.exports=bQ});var j7=be((mEe,q7)=>{"use strict";var gEe=B(x()),M7=nc(),AQ=hi();function SQ(e,t,r){let n=[],i=[],o=AQ.build({rule(s){n.push(s.name),o(s.expression),n.pop()},sequence(s){s.elements.every(a=>(o(a),!M7.alwaysConsumesOnSuccess(e,a)))},rule_ref(s){i.push(s);let a=M7.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(" -> ")+")",a.nameLocation,i.map((u,l,h)=>({message:l+1!==h.length?`Step ${l+1}: call of the rule "${u.name}" without input consumption`:`Step ${l+1}: call itself without input consumption - left recursion`,location:u.location})));return}a&&o(a),i.pop()}});o(e)}q7.exports=SQ});var z7=be((vEe,V7)=>{"use strict";var wEe=B(x()),K7=nc(),_Q=hi();function CQ(e,t,r){_Q.build({zero_or_more(i){K7.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){K7.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)}V7.exports=CQ});var W7=be((yEe,G7)=>{"use strict";var EEe=B(x()),DQ=nc(),FQ=hi();function BQ(e,t,r){FQ.build({rule_ref(i){DQ.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}G7.exports=BQ});var X7=be((bEe,Y7)=>{"use strict";var AEe=B(x()),IQ=hi();function xQ(e,t,r){let n=IQ.build({action(i){n(i.expression,i)},labeled(i,o){i.pick&&o&&r.error('"@" cannot be used with an action block',i.labelLocation,[{message:"Action block location",location:o.codeLocation}]),n(i.expression)}});n(e)}Y7.exports=xQ});var J7=be((SEe,Z7)=>{"use strict";var _Ee=B(x()),$Q=u2(),DS=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(){}},FS=class{constructor(t){this._callbacks=new DS(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new $Q(...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}};Z7.exports=FS});var Q7=be((exports,module)=>{"use strict";var CEe=B(x()),generateBytecode=i7(),generateJS=R7(),inferenceMatchResult=hS(),removeProxyRules=O7(),reportDuplicateLabels=L7(),reportDuplicateRules=H7(),reportInfiniteRecursion=j7(),reportInfiniteRepetition=z7(),reportUndefinedRules=W7(),reportIncorrectPlucking=X7(),Session=J7(),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 tx=be((DEe,ex)=>{"use strict";var FEe=B(x()),PQ={$:"text","&":"simple_and","!":"simple_not"},kQ={"?":"optional","*":"zero_or_more","+":"one_or_more"},RQ={"&":"semantic_and","!":"semantic_not"};function TQ(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function oc(e,t,r,n){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,oc.prototype),i.expected=t,i.found=r,i.location=n,i.name="SyntaxError",i}TQ(oc,Error);function BS(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}oc.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,o=this.location.source+":"+i.line+":"+i.column;if(r){var s=this.location.end,a=BS("",i.line.toString().length," "),u=r[i.line-1],l=i.line===s.line?s.column:u.length+1,h=l-i.column||1;t+=`
|
||
--> `+o+`
|
||
`+a+` |
|
||
`+i.line+" | "+u+`
|
||
`+a+" | "+BS("",i.column-1," ")+BS("",h,"^")}else t+=`
|
||
at `+o}return t};oc.buildMessage=function(e,t){var r={literal:function(l){return'"'+i(l.text)+'"'},class:function(l){var h=l.parts.map(function(m){return Array.isArray(m)?o(m[0])+"-"+o(m[1]):o(m)});return"["+(l.inverted?"^":"")+h.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(l){return l.description}};function n(l){return l.charCodeAt(0).toString(16).toUpperCase()}function i(l){return l.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(h){return"\\x0"+n(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+n(h)})}function o(l){return l.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(h){return"\\x0"+n(h)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(h){return"\\x"+n(h)})}function s(l){return r[l.type](l)}function a(l){var h=l.map(s),m,p;if(h.sort(),h.length>0){for(m=1,p=1;m<h.length;m++)h[m-1]!==h[m]&&(h[p]=h[m],p++);h.length=p}switch(h.length){case 1:return h[0];case 2:return h[0]+" or "+h[1];default:return h.slice(0,-1).join(", ")+", or "+h[h.length-1]}}function u(l){return l?'"'+i(l)+'"':"end of input"}return"Expected "+a(e)+" but "+u(t)+" found."};function OQ(e,t){t=t!==void 0?t:{};var r={},n=t.grammarSource,i={Grammar:s0},o=s0,s="{",a="}",u="=",l="/",h="@",m=":",p="$",d="&",v="!",g="?",y="*",w="+",E="(",_=")",C=" ",F="\v",H="\f",K=" ",S="\xA0",I="\uFEFF",q=`
|
||
`,L=`\r
|
||
`,R="\r",O="\u2028",T="\u2029",N="/*",P="*/",M="//",Y="_",V="\\",X="\u200C",te="\u200D",ae="i",me='"',he="'",De="[",Pe="^",Ie="]",se="-",pe="0",Fe="b",Te="f",Ve="n",Oe="r",pt="t",Qe="v",ct="x",mn="u",gr=".",vr=";",lt=/^[\n\r\u2028\u2029]/,Pr=/^[0-9]/,Qn=/^[0-9a-f]/i,mi=/^[{}]/,Dt=/^[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]/,Ze=/^[\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]/,Re=/^[\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]/,or=/^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,Tn=/^[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]/,mt=/^[\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]/,ac=/^[\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]/,On=/^[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]/,Se=/^[\u16EE-\u16F0\u2160-\u2182\u2185-\u2188\u3007\u3021-\u3029\u3038-\u303A\uA6E6-\uA6EF]/,eu=/^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/,Ut=/^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,gn=rt("{",!1),Yi=rt("}",!1),bl=rt("=",!1),tu=rt("/",!1),ih=rt("@",!1),ru=rt(":",!1),Xi=rt("$",!1),Kt=rt("&",!1),qs=rt("!",!1),Al=rt("?",!1),oh=rt("*",!1),uc=rt("+",!1),nu=rt("(",!1),ah=rt(")",!1),Sl=Dl(),cc=vi("whitespace"),uh=rt(" ",!1),ie=rt("\v",!1),we=rt("\f",!1),je=rt(" ",!1),Me=rt("\xA0",!1),et=rt("\uFEFF",!1),gt=Vr([`
|
||
`,"\r","\u2028","\u2029"],!1,!1),wt=vi("end of line"),kr=rt(`
|
||
`,!1),ar=rt(`\r
|
||
`,!1),js=rt("\r",!1),Zi=rt("\u2028",!1),Nn=rt("\u2029",!1),es=vi("comment"),Fr=rt("/*",!1),Ln=rt("*/",!1),su=rt("//",!1),iu=vi("identifier"),ch=rt("_",!1),vn=rt("\\",!1),Ht=rt("\u200C",!1),Br=rt("\u200D",!1),ut=vi("literal"),ur=rt("i",!1),wn=vi("string"),nr=rt('"',!1),ts=rt("'",!1),_s=vi("character class"),Ks=rt("[",!1),gi=rt("^",!1),Ji=rt("]",!1),_l=rt("-",!1),Lp=rt("0",!1),lh=rt("b",!1),E2=rt("f",!1),Up=rt("n",!1),Cl=rt("r",!1),Hp=rt("t",!1),b2=rt("v",!1),fh=rt("x",!1),hh=rt("u",!1),dh=Vr([["0","9"]],!1,!1),A2=Vr([["0","9"],["a","f"]],!1,!0),Mp=rt(".",!1),ph=vi("code block"),ou=Vr(["{","}"],!1,!1),au=Vr([["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),qp=Vr([["\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),jp=Vr(["\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),S2=Vr(["\u01C5","\u01C8","\u01CB","\u01F2",["\u1F88","\u1F8F"],["\u1F98","\u1F9F"],["\u1FA8","\u1FAF"],"\u1FBC","\u1FCC","\u1FFC"],!1,!1),Kp=Vr([["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),Vp=Vr(["\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),zp=Vr([["\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),Gp=Vr([["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),_2=Vr([["\u16EE","\u16F0"],["\u2160","\u2182"],["\u2185","\u2188"],"\u3007",["\u3021","\u3029"],["\u3038","\u303A"],["\uA6E6","\uA6EF"]],!1,!1),C2=Vr(["_",["\u203F","\u2040"],"\u2054",["\uFE33","\uFE34"],["\uFE4D","\uFE4F"],"\uFF3F"],!1,!1),D2=Vr([" ","\xA0","\u1680",["\u2000","\u200A"],"\u202F","\u205F","\u3000"],!1,!1),Wp=rt(";",!1),F2=function(D,z,ee){return{type:"grammar",topLevelInitializer:D,initializer:z,rules:ee,location:tr()}},B2=function(D){return{type:"top_level_initializer",code:D[0],codeLocation:D[1],location:tr()}},I2=function(D){return{type:"initializer",code:D[0],codeLocation:D[1],location:tr()}},x2=function(D,z,ee){return{type:"rule",name:D[0],nameLocation:D[1],expression:z!==null?{type:"named",name:z,expression:ee,location:tr()}:ee,location:tr()}},mh=function(D,z){return z.length>0?{type:"choice",alternatives:[D].concat(z),location:tr()}:D},$2=function(D,z){return z!==null?{type:"action",expression:D,code:z[0],codeLocation:z[1],location:tr()}:D},P2=function(D,z){return z.length>0||D.type==="labeled"&&D.pick?{type:"sequence",elements:[D].concat(z),location:tr()}:D},k2=function(D,z,ee){return ee.type.startsWith("semantic_")&&wh('"@" cannot be used on a semantic predicate',D),{type:"labeled",label:z!==null?z[0]:null,labelLocation:z!==null?z[1]:D,pick:!0,expression:ee,location:tr()}},R2=function(D,z){return{type:"labeled",label:D[0],labelLocation:D[1],expression:z,location:tr()}},T2=function(){return tr()},er=function(D){return Wo.indexOf(D[0])>=0&&wh(`Label can't be a reserved word "${D[0]}"`,D[1]),D},Zt=function(D,z){return{type:PQ[D],expression:z,location:tr()}},O2=function(D,z){return{type:kQ[z],expression:D,location:tr()}},N2=function(D){return D.type==="labeled"||D.type==="sequence"?{type:"group",expression:D,location:tr()}:D},L2=function(D){return{type:"rule_ref",name:D[0],location:tr()}},U2=function(D,z){return{type:RQ[D],code:z[0],codeLocation:z[1],location:tr()}},H2=function(D,z){return[D+z.join(""),tr()]},M2=function(D,z){return{type:"literal",value:D,ignoreCase:z!==null,location:tr()}},Yp=function(D){return D.join("")},q2=function(D){return D.join("")},Ir=function(D,z,ee){return{type:"class",parts:z.filter(Z=>Z!==""),inverted:D!==null,ignoreCase:ee!==null,location:tr()}},gh=function(D,z){return D.charCodeAt(0)>z.charCodeAt(0)&&wh("Invalid character range: "+Qi()+"."),[D,z]},jo=function(){return""},Xp=function(){return"\0"},vh=function(){return"\b"},rs=function(){return"\f"},Zp=function(){return`
|
||
`},Jp=function(){return"\r"},Qp=function(){return" "},e0=function(){return"\v"},t0=function(D){return String.fromCharCode(parseInt(D,16))},r0=function(D){return String.fromCharCode(parseInt(D,16))},Un=function(){return{type:"any",location:tr()}},j2=function(D){return[D,tr()]},U=0,ft=0,lc=[{line:1,column:1}],Rr=0,uu=[],ce=0,Wt;if("startRule"in t){if(!(t.startRule in i))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');o=i[t.startRule]}function Qi(){return e.substring(ft,U)}function n0(){return ft}function zS(){return{source:n,start:ft,end:U}}function tr(){return lu(ft,U)}function GS(D,z){throw z=z!==void 0?z:lu(ft,U),bh([vi(D)],e.substring(ft,U),z)}function wh(D,z){throw z=z!==void 0?z:lu(ft,U),Eh(D,z)}function rt(D,z){return{type:"literal",text:D,ignoreCase:z}}function Vr(D,z,ee){return{type:"class",parts:D,inverted:z,ignoreCase:ee}}function Dl(){return{type:"any"}}function cu(){return{type:"end"}}function vi(D){return{type:"other",description:D}}function yh(D){var z=lc[D],ee;if(z)return z;for(ee=D-1;!lc[ee];)ee--;for(z=lc[ee],z={line:z.line,column:z.column};ee<D;)e.charCodeAt(ee)===10?(z.line++,z.column=1):z.column++,ee++;return lc[D]=z,z}function lu(D,z){var ee=yh(D),Z=yh(z);return{source:n,start:{offset:D,line:ee.line,column:ee.column},end:{offset:z,line:Z.line,column:Z.column}}}function Ae(D){U<Rr||(U>Rr&&(Rr=U,uu=[]),uu.push(D))}function Eh(D,z){return new oc(D,null,null,z)}function bh(D,z,ee){return new oc(oc.buildMessage(D,z),D,z,ee)}function s0(){var D,z,ee,Z,fe,ge,Mt,yr;if(D=U,z=Yt(),ee=U,Z=Ah(),Z!==r?(fe=Yt(),ee=Z):(U=ee,ee=r),ee===r&&(ee=null),Z=U,fe=Sh(),fe!==r?(ge=Yt(),Z=fe):(U=Z,Z=r),Z===r&&(Z=null),fe=[],ge=U,Mt=i0(),Mt!==r?(yr=Yt(),ge=Mt):(U=ge,ge=r),ge!==r)for(;ge!==r;)fe.push(ge),ge=U,Mt=i0(),Mt!==r?(yr=Yt(),ge=Mt):(U=ge,ge=r);else fe=r;return fe!==r?(ft=D,D=F2(ee,Z,fe)):(U=D,D=r),D}function Ah(){var D,z,ee,Z,fe;return D=U,e.charCodeAt(U)===123?(z=s,U++):(z=r,ce===0&&Ae(gn)),z!==r?(ee=Go(),ee!==r?(e.charCodeAt(U)===125?(Z=a,U++):(Z=r,ce===0&&Ae(Yi)),Z!==r?(fe=kl(),fe!==r?(ft=D,D=B2(ee)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function Sh(){var D,z,ee;return D=U,z=Go(),z!==r?(ee=kl(),ee!==r?(ft=D,D=I2(z)):(U=D,D=r)):(U=D,D=r),D}function i0(){var D,z,ee,Z,fe,ge,Mt,yr;return D=U,z=Hn(),z!==r?(ee=Yt(),Z=U,fe=Ih(),fe!==r?(ge=Yt(),Z=fe):(U=Z,Z=r),Z===r&&(Z=null),e.charCodeAt(U)===61?(fe=u,U++):(fe=r,ce===0&&Ae(bl)),fe!==r?(ge=Yt(),Mt=_h(),Mt!==r?(yr=kl(),yr!==r?(ft=D,D=x2(z,Z,Mt)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function _h(){var D,z,ee,Z,fe,ge,Mt,yr;if(D=U,z=Qr(),z!==r){for(ee=[],Z=U,fe=Yt(),e.charCodeAt(U)===47?(ge=l,U++):(ge=r,ce===0&&Ae(tu)),ge!==r?(Mt=Yt(),yr=Qr(),yr!==r?Z=yr:(U=Z,Z=r)):(U=Z,Z=r);Z!==r;)ee.push(Z),Z=U,fe=Yt(),e.charCodeAt(U)===47?(ge=l,U++):(ge=r,ce===0&&Ae(tu)),ge!==r?(Mt=Yt(),yr=Qr(),yr!==r?Z=yr:(U=Z,Z=r)):(U=Z,Z=r);ft=D,D=mh(z,ee)}else U=D,D=r;return D}function Qr(){var D,z,ee,Z,fe;return D=U,z=Ch(),z!==r?(ee=U,Z=Yt(),fe=Go(),fe!==r?ee=fe:(U=ee,ee=r),ee===r&&(ee=null),ft=D,D=$2(z,ee)):(U=D,D=r),D}function Ch(){var D,z,ee,Z,fe,ge;if(D=U,z=Ko(),z!==r){for(ee=[],Z=U,fe=Yt(),ge=Ko(),ge!==r?Z=ge:(U=Z,Z=r);Z!==r;)ee.push(Z),Z=U,fe=Yt(),ge=Ko(),ge!==r?Z=ge:(U=Z,Z=r);ft=D,D=P2(z,ee)}else U=D,D=r;return D}function Ko(){var D,z,ee,Z;return D=U,z=o0(),z!==r?(ee=Dh(),ee===r&&(ee=null),Z=Fh(),Z!==r?(ft=D,D=k2(z,ee,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=U,z=Dh(),z!==r?(ee=Yt(),Z=Fh(),Z!==r?(ft=D,D=R2(z,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=Fh())),D}function o0(){var D,z;return D=U,e.charCodeAt(U)===64?(z=h,U++):(z=r,ce===0&&Ae(ih)),z!==r&&(ft=D,z=T2()),D=z,D}function Dh(){var D,z,ee,Z;return D=U,z=Hn(),z!==r?(ee=Yt(),e.charCodeAt(U)===58?(Z=m,U++):(Z=r,ce===0&&Ae(ru)),Z!==r?(ft=D,D=er(z)):(U=D,D=r)):(U=D,D=r),D}function Fh(){var D,z,ee,Z;return D=U,z=K2(),z!==r?(ee=Yt(),Z=a0(),Z!==r?(ft=D,D=Zt(z,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=a0()),D}function K2(){var D;return e.charCodeAt(U)===36?(D=p,U++):(D=r,ce===0&&Ae(Xi)),D===r&&(e.charCodeAt(U)===38?(D=d,U++):(D=r,ce===0&&Ae(Kt)),D===r&&(e.charCodeAt(U)===33?(D=v,U++):(D=r,ce===0&&Ae(qs)))),D}function a0(){var D,z,ee,Z;return D=U,z=u0(),z!==r?(ee=Yt(),Z=V2(),Z!==r?(ft=D,D=O2(z,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=u0()),D}function V2(){var D;return e.charCodeAt(U)===63?(D=g,U++):(D=r,ce===0&&Ae(Al)),D===r&&(e.charCodeAt(U)===42?(D=y,U++):(D=r,ce===0&&Ae(oh)),D===r&&(e.charCodeAt(U)===43?(D=w,U++):(D=r,ce===0&&Ae(uc)))),D}function u0(){var D,z,ee,Z,fe,ge;return D=Z2(),D===r&&(D=ye(),D===r&&(D=Fl(),D===r&&(D=fu(),D===r&&(D=z2(),D===r&&(D=U,e.charCodeAt(U)===40?(z=E,U++):(z=r,ce===0&&Ae(nu)),z!==r?(ee=Yt(),Z=_h(),Z!==r?(fe=Yt(),e.charCodeAt(U)===41?(ge=_,U++):(ge=r,ce===0&&Ae(ah)),ge!==r?(ft=D,D=N2(Z)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)))))),D}function fu(){var D,z,ee,Z,fe,ge,Mt,yr;return D=U,z=Hn(),z!==r?(ee=U,ce++,Z=U,fe=Yt(),ge=U,Mt=Ih(),Mt!==r?(yr=Yt(),Mt=[Mt,yr],ge=Mt):(U=ge,ge=r),ge===r&&(ge=null),e.charCodeAt(U)===61?(Mt=u,U++):(Mt=r,ce===0&&Ae(bl)),Mt!==r?(fe=[fe,ge,Mt],Z=fe):(U=Z,Z=r),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(ft=D,D=L2(z)):(U=D,D=r)):(U=D,D=r),D}function z2(){var D,z,ee,Z;return D=U,z=G2(),z!==r?(ee=Yt(),Z=Go(),Z!==r?(ft=D,D=U2(z,Z)):(U=D,D=r)):(U=D,D=r),D}function G2(){var D;return e.charCodeAt(U)===38?(D=d,U++):(D=r,ce===0&&Ae(Kt)),D===r&&(e.charCodeAt(U)===33?(D=v,U++):(D=r,ce===0&&Ae(qs))),D}function zr(){var D;return e.length>U?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Sl)),D}function fc(){var D,z;return ce++,e.charCodeAt(U)===9?(D=C,U++):(D=r,ce===0&&Ae(uh)),D===r&&(e.charCodeAt(U)===11?(D=F,U++):(D=r,ce===0&&Ae(ie)),D===r&&(e.charCodeAt(U)===12?(D=H,U++):(D=r,ce===0&&Ae(we)),D===r&&(e.charCodeAt(U)===32?(D=K,U++):(D=r,ce===0&&Ae(je)),D===r&&(e.charCodeAt(U)===160?(D=S,U++):(D=r,ce===0&&Ae(Me)),D===r&&(e.charCodeAt(U)===65279?(D=I,U++):(D=r,ce===0&&Ae(et)),D===r&&(D=m0())))))),ce--,D===r&&(z=r,ce===0&&Ae(cc)),D}function en(){var D;return lt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(gt)),D}function Vo(){var D,z;return ce++,e.charCodeAt(U)===10?(D=q,U++):(D=r,ce===0&&Ae(kr)),D===r&&(e.substr(U,2)===L?(D=L,U+=2):(D=r,ce===0&&Ae(ar)),D===r&&(e.charCodeAt(U)===13?(D=R,U++):(D=r,ce===0&&Ae(js)),D===r&&(e.charCodeAt(U)===8232?(D=O,U++):(D=r,ce===0&&Ae(Zi)),D===r&&(e.charCodeAt(U)===8233?(D=T,U++):(D=r,ce===0&&Ae(Nn)))))),ce--,D===r&&(z=r,ce===0&&Ae(wt)),D}function c0(){var D,z;return ce++,D=W2(),D===r&&(D=zo()),ce--,D===r&&(z=r,ce===0&&Ae(es)),D}function W2(){var D,z,ee,Z,fe,ge;if(D=U,e.substr(U,2)===N?(z=N,U+=2):(z=r,ce===0&&Ae(Fr)),z!==r){for(ee=[],Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=r,ce===0&&Ae(Ln)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);Z!==r;)ee.push(Z),Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=r,ce===0&&Ae(Ln)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);e.substr(U,2)===P?(Z=P,U+=2):(Z=r,ce===0&&Ae(Ln)),Z!==r?(z=[z,ee,Z],D=z):(U=D,D=r)}else U=D,D=r;return D}function l0(){var D,z,ee,Z,fe,ge;if(D=U,e.substr(U,2)===N?(z=N,U+=2):(z=r,ce===0&&Ae(Fr)),z!==r){for(ee=[],Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=r,ce===0&&Ae(Ln)),ge===r&&(ge=en()),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);Z!==r;)ee.push(Z),Z=U,fe=U,ce++,e.substr(U,2)===P?(ge=P,U+=2):(ge=r,ce===0&&Ae(Ln)),ge===r&&(ge=en()),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);e.substr(U,2)===P?(Z=P,U+=2):(Z=r,ce===0&&Ae(Ln)),Z!==r?(z=[z,ee,Z],D=z):(U=D,D=r)}else U=D,D=r;return D}function zo(){var D,z,ee,Z,fe,ge;if(D=U,e.substr(U,2)===M?(z=M,U+=2):(z=r,ce===0&&Ae(su)),z!==r){for(ee=[],Z=U,fe=U,ce++,ge=en(),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);Z!==r;)ee.push(Z),Z=U,fe=U,ce++,ge=en(),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);z=[z,ee],D=z}else U=D,D=r;return D}function Hn(){var D,z,ee,Z;if(ce++,D=U,z=Bh(),z!==r){for(ee=[],Z=f0();Z!==r;)ee.push(Z),Z=f0();ft=D,D=H2(z,ee)}else U=D,D=r;return ce--,D===r&&(z=r,ce===0&&Ae(iu)),D}function Bh(){var D,z,ee;return D=Y2(),D===r&&(e.charCodeAt(U)===36?(D=p,U++):(D=r,ce===0&&Ae(Xi)),D===r&&(e.charCodeAt(U)===95?(D=Y,U++):(D=r,ce===0&&Ae(ch)),D===r&&(D=U,e.charCodeAt(U)===92?(z=V,U++):(z=r,ce===0&&Ae(vn)),z!==r?(ee=hc(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r)))),D}function f0(){var D;return D=Bh(),D===r&&(D=X2(),D===r&&(D=xl(),D===r&&(D=$l(),D===r&&(e.charCodeAt(U)===8204?(D=X,U++):(D=r,ce===0&&Ae(Ht)),D===r&&(e.charCodeAt(U)===8205?(D=te,U++):(D=r,ce===0&&Ae(Br))))))),D}function Y2(){var D;return D=tv(),D===r&&(D=d0(),D===r&&(D=ev(),D===r&&(D=Bl(),D===r&&(D=Q2(),D===r&&(D=p0()))))),D}function X2(){var D;return D=eo(),D===r&&(D=Il()),D}function Z2(){var D,z,ee;return ce++,D=U,z=Ih(),z!==r?(e.charCodeAt(U)===105?(ee=ae,U++):(ee=r,ce===0&&Ae(ur)),ee===r&&(ee=null),ft=D,D=M2(z,ee)):(U=D,D=r),ce--,D===r&&(z=r,ce===0&&Ae(ut)),D}function Ih(){var D,z,ee,Z;if(ce++,D=U,e.charCodeAt(U)===34?(z=me,U++):(z=r,ce===0&&Ae(nr)),z!==r){for(ee=[],Z=wi();Z!==r;)ee.push(Z),Z=wi();e.charCodeAt(U)===34?(Z=me,U++):(Z=r,ce===0&&Ae(nr)),Z!==r?(ft=D,D=Yp(ee)):(U=D,D=r)}else U=D,D=r;if(D===r)if(D=U,e.charCodeAt(U)===39?(z=he,U++):(z=r,ce===0&&Ae(ts)),z!==r){for(ee=[],Z=oe();Z!==r;)ee.push(Z),Z=oe();e.charCodeAt(U)===39?(Z=he,U++):(Z=r,ce===0&&Ae(ts)),Z!==r?(ft=D,D=q2(ee)):(U=D,D=r)}else U=D,D=r;return ce--,D===r&&(z=r,ce===0&&Ae(wn)),D}function wi(){var D,z,ee,Z;return D=U,z=U,ee=U,ce++,e.charCodeAt(U)===34?(Z=me,U++):(Z=r,ce===0&&Ae(nr)),Z===r&&(e.charCodeAt(U)===92?(Z=V,U++):(Z=r,ce===0&&Ae(vn)),Z===r&&(Z=en())),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(Z=zr(),Z!==r?(ee=[ee,Z],z=ee):(U=z,z=r)):(U=z,z=r),z!==r?D=e.substring(D,U):D=z,D===r&&(D=U,e.charCodeAt(U)===92?(z=V,U++):(z=r,ce===0&&Ae(vn)),z!==r?(ee=xt(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r),D===r&&(D=ot())),D}function oe(){var D,z,ee,Z;return D=U,z=U,ee=U,ce++,e.charCodeAt(U)===39?(Z=he,U++):(Z=r,ce===0&&Ae(ts)),Z===r&&(e.charCodeAt(U)===92?(Z=V,U++):(Z=r,ce===0&&Ae(vn)),Z===r&&(Z=en())),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(Z=zr(),Z!==r?(ee=[ee,Z],z=ee):(U=z,z=r)):(U=z,z=r),z!==r?D=e.substring(D,U):D=z,D===r&&(D=U,e.charCodeAt(U)===92?(z=V,U++):(z=r,ce===0&&Ae(vn)),z!==r?(ee=xt(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r),D===r&&(D=ot())),D}function ye(){var D,z,ee,Z,fe,ge;if(ce++,D=U,e.charCodeAt(U)===91?(z=De,U++):(z=r,ce===0&&Ae(Ks)),z!==r){for(e.charCodeAt(U)===94?(ee=Pe,U++):(ee=r,ce===0&&Ae(gi)),ee===r&&(ee=null),Z=[],fe=de(),fe===r&&(fe=He());fe!==r;)Z.push(fe),fe=de(),fe===r&&(fe=He());e.charCodeAt(U)===93?(fe=Ie,U++):(fe=r,ce===0&&Ae(Ji)),fe!==r?(e.charCodeAt(U)===105?(ge=ae,U++):(ge=r,ce===0&&Ae(ur)),ge===r&&(ge=null),ft=D,D=Ir(ee,Z,ge)):(U=D,D=r)}else U=D,D=r;return ce--,D===r&&(z=r,ce===0&&Ae(_s)),D}function de(){var D,z,ee,Z;return D=U,z=He(),z!==r?(e.charCodeAt(U)===45?(ee=se,U++):(ee=r,ce===0&&Ae(_l)),ee!==r?(Z=He(),Z!==r?(ft=D,D=gh(z,Z)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function He(){var D,z,ee,Z;return D=U,z=U,ee=U,ce++,e.charCodeAt(U)===93?(Z=Ie,U++):(Z=r,ce===0&&Ae(Ji)),Z===r&&(e.charCodeAt(U)===92?(Z=V,U++):(Z=r,ce===0&&Ae(vn)),Z===r&&(Z=en())),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(Z=zr(),Z!==r?(ee=[ee,Z],z=ee):(U=z,z=r)):(U=z,z=r),z!==r?D=e.substring(D,U):D=z,D===r&&(D=U,e.charCodeAt(U)===92?(z=V,U++):(z=r,ce===0&&Ae(vn)),z!==r?(ee=xt(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r),D===r&&(D=ot())),D}function ot(){var D,z,ee;return D=U,e.charCodeAt(U)===92?(z=V,U++):(z=r,ce===0&&Ae(vn)),z!==r?(ee=Vo(),ee!==r?(ft=D,D=jo()):(U=D,D=r)):(U=D,D=r),D}function xt(){var D,z,ee,Z;return D=wr(),D===r&&(D=U,e.charCodeAt(U)===48?(z=pe,U++):(z=r,ce===0&&Ae(Lp)),z!==r?(ee=U,ce++,Z=h0(),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(ft=D,D=Xp()):(U=D,D=r)):(U=D,D=r),D===r&&(D=ns(),D===r&&(D=hc()))),D}function wr(){var D;return D=Vt(),D===r&&(D=xh()),D}function Vt(){var D,z;return e.charCodeAt(U)===39?(D=he,U++):(D=r,ce===0&&Ae(ts)),D===r&&(e.charCodeAt(U)===34?(D=me,U++):(D=r,ce===0&&Ae(nr)),D===r&&(e.charCodeAt(U)===92?(D=V,U++):(D=r,ce===0&&Ae(vn)),D===r&&(D=U,e.charCodeAt(U)===98?(z=Fe,U++):(z=r,ce===0&&Ae(lh)),z!==r&&(ft=D,z=vh()),D=z,D===r&&(D=U,e.charCodeAt(U)===102?(z=Te,U++):(z=r,ce===0&&Ae(E2)),z!==r&&(ft=D,z=rs()),D=z,D===r&&(D=U,e.charCodeAt(U)===110?(z=Ve,U++):(z=r,ce===0&&Ae(Up)),z!==r&&(ft=D,z=Zp()),D=z,D===r&&(D=U,e.charCodeAt(U)===114?(z=Oe,U++):(z=r,ce===0&&Ae(Cl)),z!==r&&(ft=D,z=Jp()),D=z,D===r&&(D=U,e.charCodeAt(U)===116?(z=pt,U++):(z=r,ce===0&&Ae(Hp)),z!==r&&(ft=D,z=Qp()),D=z,D===r&&(D=U,e.charCodeAt(U)===118?(z=Qe,U++):(z=r,ce===0&&Ae(b2)),z!==r&&(ft=D,z=e0()),D=z)))))))),D}function xh(){var D,z,ee,Z;return D=U,z=U,ee=U,ce++,Z=J2(),Z===r&&(Z=en()),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(Z=zr(),Z!==r?(ee=[ee,Z],z=ee):(U=z,z=r)):(U=z,z=r),z!==r?D=e.substring(D,U):D=z,D}function J2(){var D;return D=Vt(),D===r&&(D=h0(),D===r&&(e.charCodeAt(U)===120?(D=ct,U++):(D=r,ce===0&&Ae(fh)),D===r&&(e.charCodeAt(U)===117?(D=mn,U++):(D=r,ce===0&&Ae(hh))))),D}function ns(){var D,z,ee,Z,fe,ge;return D=U,e.charCodeAt(U)===120?(z=ct,U++):(z=r,ce===0&&Ae(fh)),z!==r?(ee=U,Z=U,fe=Cs(),fe!==r?(ge=Cs(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r),Z!==r?ee=e.substring(ee,U):ee=Z,ee!==r?(ft=D,D=t0(ee)):(U=D,D=r)):(U=D,D=r),D}function hc(){var D,z,ee,Z,fe,ge,Mt,yr;return D=U,e.charCodeAt(U)===117?(z=mn,U++):(z=r,ce===0&&Ae(hh)),z!==r?(ee=U,Z=U,fe=Cs(),fe!==r?(ge=Cs(),ge!==r?(Mt=Cs(),Mt!==r?(yr=Cs(),yr!==r?(fe=[fe,ge,Mt,yr],Z=fe):(U=Z,Z=r)):(U=Z,Z=r)):(U=Z,Z=r)):(U=Z,Z=r),Z!==r?ee=e.substring(ee,U):ee=Z,ee!==r?(ft=D,D=r0(ee)):(U=D,D=r)):(U=D,D=r),D}function h0(){var D;return Pr.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(dh)),D}function Cs(){var D;return Qn.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(A2)),D}function Fl(){var D,z;return D=U,e.charCodeAt(U)===46?(z=gr,U++):(z=r,ce===0&&Ae(Mp)),z!==r&&(ft=D,z=Un()),D=z,D}function Go(){var D,z,ee,Z;return ce++,D=U,e.charCodeAt(U)===123?(z=s,U++):(z=r,ce===0&&Ae(gn)),z!==r?(ee=Ot(),e.charCodeAt(U)===125?(Z=a,U++):(Z=r,ce===0&&Ae(Yi)),Z!==r?D=ee:(U=D,D=r)):(U=D,D=r),ce--,D===r&&(z=r,ce===0&&Ae(ph)),D}function Ot(){var D,z;return D=U,z=$h(),ft=D,z=j2(z),D=z,D}function $h(){var D,z,ee,Z,fe,ge;if(D=U,z=[],ee=[],Z=U,fe=U,ce++,mi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=r,ce===0&&Ae(ou)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r),Z!==r)for(;Z!==r;)ee.push(Z),Z=U,fe=U,ce++,mi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=r,ce===0&&Ae(ou)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);else ee=r;for(ee===r&&(ee=U,e.charCodeAt(U)===123?(Z=s,U++):(Z=r,ce===0&&Ae(gn)),Z!==r?(fe=$h(),e.charCodeAt(U)===125?(ge=a,U++):(ge=r,ce===0&&Ae(Yi)),ge!==r?(Z=[Z,fe,ge],ee=Z):(U=ee,ee=r)):(U=ee,ee=r));ee!==r;){if(z.push(ee),ee=[],Z=U,fe=U,ce++,mi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=r,ce===0&&Ae(ou)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r),Z!==r)for(;Z!==r;)ee.push(Z),Z=U,fe=U,ce++,mi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=r,ce===0&&Ae(ou)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=zr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);else ee=r;ee===r&&(ee=U,e.charCodeAt(U)===123?(Z=s,U++):(Z=r,ce===0&&Ae(gn)),Z!==r?(fe=$h(),e.charCodeAt(U)===125?(ge=a,U++):(ge=r,ce===0&&Ae(Yi)),ge!==r?(Z=[Z,fe,ge],ee=Z):(U=ee,ee=r)):(U=ee,ee=r))}return D=e.substring(D,U),D}function d0(){var D;return Dt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(au)),D}function Bl(){var D;return Ze.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(qp)),D}function Q2(){var D;return Re.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(jp)),D}function ev(){var D;return or.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(S2)),D}function tv(){var D;return Tn.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Kp)),D}function Il(){var D;return mt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Vp)),D}function eo(){var D;return ac.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(zp)),D}function xl(){var D;return On.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Gp)),D}function p0(){var D;return Se.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(_2)),D}function $l(){var D;return eu.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(C2)),D}function m0(){var D;return Ut.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(D2)),D}function Yt(){var D,z;for(D=[],z=fc(),z===r&&(z=Vo(),z===r&&(z=c0()));z!==r;)D.push(z),z=fc(),z===r&&(z=Vo(),z===r&&(z=c0()));return D}function Pl(){var D,z;for(D=[],z=fc(),z===r&&(z=l0());z!==r;)D.push(z),z=fc(),z===r&&(z=l0());return D}function kl(){var D,z,ee,Z;return D=U,z=Yt(),e.charCodeAt(U)===59?(ee=vr,U++):(ee=r,ce===0&&Ae(Wp)),ee!==r?(z=[z,ee],D=z):(U=D,D=r),D===r&&(D=U,z=Pl(),ee=zo(),ee===r&&(ee=null),Z=Vo(),Z!==r?(z=[z,ee,Z],D=z):(U=D,D=r),D===r&&(D=U,z=Yt(),ee=dc(),ee!==r?(z=[z,ee],D=z):(U=D,D=r))),D}function dc(){var D,z;return D=U,ce++,e.length>U?(z=e.charAt(U),U++):(z=r,ce===0&&Ae(Sl)),ce--,z===r?D=void 0:(U=D,D=r),D}let Wo=t.reservedWords||[];if(Wt=o(),Wt!==r&&U===e.length)return Wt;throw Wt!==r&&U<e.length&&Ae(cu()),bh(uu,Rr<e.length?e.charAt(Rr):null,Rr<e.length?lu(Rr,Rr+1):lu(Rr,Rr))}ex.exports={SyntaxError:oc,parse:OQ}});var g2=be((BEe,rx)=>{"use strict";var IEe=B(x()),NQ=u2(),LQ=Q7(),UQ=tx(),HQ=gS(),MQ=["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"],Np={VERSION:HQ,RESERVED_WORDS:MQ,GrammarError:NQ,parser:UQ,compiler:LQ,generate(e,t){t=t!==void 0?t:{};function r(o){let s={};return Object.keys(o).forEach(a=>{s[a]=o[a].slice()}),s}let n="plugins"in t?t.plugins:[],i={parser:Np.parser,passes:r(Np.compiler.passes),reservedWords:Np.RESERVED_WORDS.slice()};return n.forEach(o=>{o.use(i,t)}),Np.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};rx.exports=Np});var LS=be((OS,NS)=>{var jEe=B(x());(function(e,t){typeof OS=="object"&&typeof NS<"u"?NS.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(OS,(function(){"use strict";function e(ie,we){return we={exports:{}},ie(we,we.exports),we.exports}var t=e(function(ie){var we=ie.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=we)}),r=e(function(ie){var we=ie.exports={version:"2.6.5"};typeof __e=="number"&&(__e=we)}),n=r.version,i=function(ie){return typeof ie=="object"?ie!==null:typeof ie=="function"},o=function(ie){if(!i(ie))throw TypeError(ie+" is not an object!");return ie},s=function(ie){try{return!!ie()}catch{return!0}},a=!s(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),u=t.document,l=i(u)&&i(u.createElement),h=function(ie){return l?u.createElement(ie):{}},m=!a&&!s(function(){return Object.defineProperty(h("div"),"a",{get:function(){return 7}}).a!=7}),p=function(ie,we){if(!i(ie))return ie;var je,Me;if(we&&typeof(je=ie.toString)=="function"&&!i(Me=je.call(ie))||typeof(je=ie.valueOf)=="function"&&!i(Me=je.call(ie))||!we&&typeof(je=ie.toString)=="function"&&!i(Me=je.call(ie)))return Me;throw TypeError("Can't convert object to primitive value")},d=Object.defineProperty,v=a?Object.defineProperty:function(we,je,Me){if(o(we),je=p(je,!0),o(Me),m)try{return d(we,je,Me)}catch{}if("get"in Me||"set"in Me)throw TypeError("Accessors not supported!");return"value"in Me&&(we[je]=Me.value),we},g={f:v},y=function(ie,we){return{enumerable:!(ie&1),configurable:!(ie&2),writable:!(ie&4),value:we}},w=a?function(ie,we,je){return g.f(ie,we,y(1,je))}:function(ie,we,je){return ie[we]=je,ie},E={}.hasOwnProperty,_=function(ie,we){return E.call(ie,we)},C=0,F=Math.random(),H=function(ie){return"Symbol(".concat(ie===void 0?"":ie,")_",(++C+F).toString(36))},K=!1,S=e(function(ie){var we="__core-js_shared__",je=t[we]||(t[we]={});(ie.exports=function(Me,et){return je[Me]||(je[Me]=et!==void 0?et:{})})("versions",[]).push({version:r.version,mode:K?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),I=S("native-function-to-string",Function.toString),q=e(function(ie){var we=H("src"),je="toString",Me=(""+I).split(je);r.inspectSource=function(et){return I.call(et)},(ie.exports=function(et,gt,wt,kr){var ar=typeof wt=="function";ar&&(_(wt,"name")||w(wt,"name",gt)),et[gt]!==wt&&(ar&&(_(wt,we)||w(wt,we,et[gt]?""+et[gt]:Me.join(String(gt)))),et===t?et[gt]=wt:kr?et[gt]?et[gt]=wt:w(et,gt,wt):(delete et[gt],w(et,gt,wt)))})(Function.prototype,je,function(){return typeof this=="function"&&this[we]||I.call(this)})}),L=function(ie){if(typeof ie!="function")throw TypeError(ie+" is not a function!");return ie},R=function(ie,we,je){if(L(ie),we===void 0)return ie;switch(je){case 1:return function(Me){return ie.call(we,Me)};case 2:return function(Me,et){return ie.call(we,Me,et)};case 3:return function(Me,et,gt){return ie.call(we,Me,et,gt)}}return function(){return ie.apply(we,arguments)}},O="prototype",T=function(ie,we,je){var Me=ie&T.F,et=ie&T.G,gt=ie&T.S,wt=ie&T.P,kr=ie&T.B,ar=et?t:gt?t[we]||(t[we]={}):(t[we]||{})[O],js=et?r:r[we]||(r[we]={}),Zi=js[O]||(js[O]={}),Nn,es,Fr,Ln;et&&(je=we);for(Nn in je)es=!Me&&ar&&ar[Nn]!==void 0,Fr=(es?ar:je)[Nn],Ln=kr&&es?R(Fr,t):wt&&typeof Fr=="function"?R(Function.call,Fr):Fr,ar&&q(ar,Nn,Fr,ie&T.U),js[Nn]!=Fr&&w(js,Nn,Ln),wt&&Zi[Nn]!=Fr&&(Zi[Nn]=Fr)};t.core=r,T.F=1,T.G=2,T.S=4,T.P=8,T.B=16,T.W=32,T.U=64,T.R=128;var N=T,P=Math.ceil,M=Math.floor,Y=function(ie){return isNaN(ie=+ie)?0:(ie>0?M:P)(ie)},V=function(ie){if(ie==null)throw TypeError("Can't call method on "+ie);return ie},X=function(ie){return function(we,je){var Me=String(V(we)),et=Y(je),gt=Me.length,wt,kr;return et<0||et>=gt?ie?"":void 0:(wt=Me.charCodeAt(et),wt<55296||wt>56319||et+1===gt||(kr=Me.charCodeAt(et+1))<56320||kr>57343?ie?Me.charAt(et):wt:ie?Me.slice(et,et+2):(wt-55296<<10)+(kr-56320)+65536)}},te=X(!1);N(N.P,"String",{codePointAt:function(we){return te(this,we)}});var ae=r.String.codePointAt,me=Math.max,he=Math.min,De=function(ie,we){return ie=Y(ie),ie<0?me(ie+we,0):he(ie,we)},Pe=String.fromCharCode,Ie=String.fromCodePoint;N(N.S+N.F*(!!Ie&&Ie.length!=1),"String",{fromCodePoint:function(we){for(var je=arguments,Me=[],et=arguments.length,gt=0,wt;et>gt;){if(wt=+je[gt++],De(wt,1114111)!==wt)throw RangeError(wt+" is not a valid code point");Me.push(wt<65536?Pe(wt):Pe(((wt-=65536)>>10)+55296,wt%1024+56320))}return Me.join("")}});var se=r.String.fromCodePoint,pe=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Fe=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Te=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Ve={Space_Separator:pe,ID_Start:Fe,ID_Continue:Te},Oe={isSpaceSeparator:function(we){return typeof we=="string"&&Ve.Space_Separator.test(we)},isIdStartChar:function(we){return typeof we=="string"&&(we>="a"&&we<="z"||we>="A"&&we<="Z"||we==="$"||we==="_"||Ve.ID_Start.test(we))},isIdContinueChar:function(we){return typeof we=="string"&&(we>="a"&&we<="z"||we>="A"&&we<="Z"||we>="0"&&we<="9"||we==="$"||we==="_"||we==="\u200C"||we==="\u200D"||Ve.ID_Continue.test(we))},isDigit:function(we){return typeof we=="string"&&/[0-9]/.test(we)},isHexDigit:function(we){return typeof we=="string"&&/[0-9A-Fa-f]/.test(we)}},pt,Qe,ct,mn,gr,vr,lt,Pr,Qn,mi=function(we,je){pt=String(we),Qe="start",ct=[],mn=0,gr=1,vr=0,lt=void 0,Pr=void 0,Qn=void 0;do lt=ac(),ih[Qe]();while(lt.type!=="eof");return typeof je=="function"?Dt({"":Qn},"",je):Qn};function Dt(ie,we,je){var Me=ie[we];if(Me!=null&&typeof Me=="object")if(Array.isArray(Me))for(var et=0;et<Me.length;et++){var gt=String(et),wt=Dt(Me,gt,je);wt===void 0?delete Me[gt]:Object.defineProperty(Me,gt,{value:wt,writable:!0,enumerable:!0,configurable:!0})}else for(var kr in Me){var ar=Dt(Me,kr,je);ar===void 0?delete Me[kr]:Object.defineProperty(Me,kr,{value:ar,writable:!0,enumerable:!0,configurable:!0})}return je.call(ie,we,Me)}var Ze,Re,or,Tn,mt;function ac(){for(Ze="default",Re="",or=!1,Tn=1;;){mt=On();var ie=eu[Ze]();if(ie)return ie}}function On(){if(pt[mn])return String.fromCodePoint(pt.codePointAt(mn))}function Se(){var ie=On();return ie===`
|
||
`?(gr++,vr=0):ie?vr+=ie.length:vr++,ie&&(mn+=ie.length),ie}var eu={default:function(){switch(mt){case" ":case"\v":case"\f":case" ":case"\xA0":case"\uFEFF":case`
|
||
`:case"\r":case"\u2028":case"\u2029":Se();return;case"/":Se(),Ze="comment";return;case void 0:return Se(),Ut("eof")}if(Oe.isSpaceSeparator(mt)){Se();return}return eu[Qe]()},comment:function(){switch(mt){case"*":Se(),Ze="multiLineComment";return;case"/":Se(),Ze="singleLineComment";return}throw Kt(Se())},multiLineComment:function(){switch(mt){case"*":Se(),Ze="multiLineCommentAsterisk";return;case void 0:throw Kt(Se())}Se()},multiLineCommentAsterisk:function(){switch(mt){case"*":Se();return;case"/":Se(),Ze="default";return;case void 0:throw Kt(Se())}Se(),Ze="multiLineComment"},singleLineComment:function(){switch(mt){case`
|
||
`:case"\r":case"\u2028":case"\u2029":Se(),Ze="default";return;case void 0:return Se(),Ut("eof")}Se()},value:function(){switch(mt){case"{":case"[":return Ut("punctuator",Se());case"n":return Se(),gn("ull"),Ut("null",null);case"t":return Se(),gn("rue"),Ut("boolean",!0);case"f":return Se(),gn("alse"),Ut("boolean",!1);case"-":case"+":Se()==="-"&&(Tn=-1),Ze="sign";return;case".":Re=Se(),Ze="decimalPointLeading";return;case"0":Re=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Re=Se(),Ze="decimalInteger";return;case"I":return Se(),gn("nfinity"),Ut("numeric",1/0);case"N":return Se(),gn("aN"),Ut("numeric",NaN);case'"':case"'":or=Se()==='"',Re="",Ze="string";return}throw Kt(Se())},identifierNameStartEscape:function(){if(mt!=="u")throw Kt(Se());Se();var we=tu();switch(we){case"$":case"_":break;default:if(!Oe.isIdStartChar(we))throw Al();break}Re+=we,Ze="identifierName"},identifierName:function(){switch(mt){case"$":case"_":case"\u200C":case"\u200D":Re+=Se();return;case"\\":Se(),Ze="identifierNameEscape";return}if(Oe.isIdContinueChar(mt)){Re+=Se();return}return Ut("identifier",Re)},identifierNameEscape:function(){if(mt!=="u")throw Kt(Se());Se();var we=tu();switch(we){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Oe.isIdContinueChar(we))throw Al();break}Re+=we,Ze="identifierName"},sign:function(){switch(mt){case".":Re=Se(),Ze="decimalPointLeading";return;case"0":Re=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Re=Se(),Ze="decimalInteger";return;case"I":return Se(),gn("nfinity"),Ut("numeric",Tn*(1/0));case"N":return Se(),gn("aN"),Ut("numeric",NaN)}throw Kt(Se())},zero:function(){switch(mt){case".":Re+=Se(),Ze="decimalPoint";return;case"e":case"E":Re+=Se(),Ze="decimalExponent";return;case"x":case"X":Re+=Se(),Ze="hexadecimal";return}return Ut("numeric",Tn*0)},decimalInteger:function(){switch(mt){case".":Re+=Se(),Ze="decimalPoint";return;case"e":case"E":Re+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},decimalPointLeading:function(){if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalFraction";return}throw Kt(Se())},decimalPoint:function(){switch(mt){case"e":case"E":Re+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalFraction";return}return Ut("numeric",Tn*Number(Re))},decimalFraction:function(){switch(mt){case"e":case"E":Re+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},decimalExponent:function(){switch(mt){case"+":case"-":Re+=Se(),Ze="decimalExponentSign";return}if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalExponentInteger";return}throw Kt(Se())},decimalExponentSign:function(){if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalExponentInteger";return}throw Kt(Se())},decimalExponentInteger:function(){if(Oe.isDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},hexadecimal:function(){if(Oe.isHexDigit(mt)){Re+=Se(),Ze="hexadecimalInteger";return}throw Kt(Se())},hexadecimalInteger:function(){if(Oe.isHexDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},string:function(){switch(mt){case"\\":Se(),Re+=Yi();return;case'"':if(or)return Se(),Ut("string",Re);Re+=Se();return;case"'":if(!or)return Se(),Ut("string",Re);Re+=Se();return;case`
|
||
`:case"\r":throw Kt(Se());case"\u2028":case"\u2029":oh(mt);break;case void 0:throw Kt(Se())}Re+=Se()},start:function(){switch(mt){case"{":case"[":return Ut("punctuator",Se())}Ze="value"},beforePropertyName:function(){switch(mt){case"$":case"_":Re=Se(),Ze="identifierName";return;case"\\":Se(),Ze="identifierNameStartEscape";return;case"}":return Ut("punctuator",Se());case'"':case"'":or=Se()==='"',Ze="string";return}if(Oe.isIdStartChar(mt)){Re+=Se(),Ze="identifierName";return}throw Kt(Se())},afterPropertyName:function(){if(mt===":")return Ut("punctuator",Se());throw Kt(Se())},beforePropertyValue:function(){Ze="value"},afterPropertyValue:function(){switch(mt){case",":case"}":return Ut("punctuator",Se())}throw Kt(Se())},beforeArrayValue:function(){if(mt==="]")return Ut("punctuator",Se());Ze="value"},afterArrayValue:function(){switch(mt){case",":case"]":return Ut("punctuator",Se())}throw Kt(Se())},end:function(){throw Kt(Se())}};function Ut(ie,we){return{type:ie,value:we,line:gr,column:vr}}function gn(ie){for(var we=0,je=ie;we<je.length;we+=1){var Me=je[we],et=On();if(et!==Me)throw Kt(Se());Se()}}function Yi(){var ie=On();switch(ie){case"b":return Se(),"\b";case"f":return Se(),"\f";case"n":return Se(),`
|
||
`;case"r":return Se(),"\r";case"t":return Se()," ";case"v":return Se(),"\v";case"0":if(Se(),Oe.isDigit(On()))throw Kt(Se());return"\0";case"x":return Se(),bl();case"u":return Se(),tu();case`
|
||
`:case"\u2028":case"\u2029":return Se(),"";case"\r":return Se(),On()===`
|
||
`&&Se(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Kt(Se());case void 0:throw Kt(Se())}return Se()}function bl(){var ie="",we=On();if(!Oe.isHexDigit(we)||(ie+=Se(),we=On(),!Oe.isHexDigit(we)))throw Kt(Se());return ie+=Se(),String.fromCodePoint(parseInt(ie,16))}function tu(){for(var ie="",we=4;we-- >0;){var je=On();if(!Oe.isHexDigit(je))throw Kt(Se());ie+=Se()}return String.fromCodePoint(parseInt(ie,16))}var ih={start:function(){if(lt.type==="eof")throw qs();ru()},beforePropertyName:function(){switch(lt.type){case"identifier":case"string":Pr=lt.value,Qe="afterPropertyName";return;case"punctuator":Xi();return;case"eof":throw qs()}},afterPropertyName:function(){if(lt.type==="eof")throw qs();Qe="beforePropertyValue"},beforePropertyValue:function(){if(lt.type==="eof")throw qs();ru()},beforeArrayValue:function(){if(lt.type==="eof")throw qs();if(lt.type==="punctuator"&<.value==="]"){Xi();return}ru()},afterPropertyValue:function(){if(lt.type==="eof")throw qs();switch(lt.value){case",":Qe="beforePropertyName";return;case"}":Xi()}},afterArrayValue:function(){if(lt.type==="eof")throw qs();switch(lt.value){case",":Qe="beforeArrayValue";return;case"]":Xi()}},end:function(){}};function ru(){var ie;switch(lt.type){case"punctuator":switch(lt.value){case"{":ie={};break;case"[":ie=[];break}break;case"null":case"boolean":case"numeric":case"string":ie=lt.value;break}if(Qn===void 0)Qn=ie;else{var we=ct[ct.length-1];Array.isArray(we)?we.push(ie):Object.defineProperty(we,Pr,{value:ie,writable:!0,enumerable:!0,configurable:!0})}if(ie!==null&&typeof ie=="object")ct.push(ie),Array.isArray(ie)?Qe="beforeArrayValue":Qe="beforePropertyName";else{var je=ct[ct.length-1];je==null?Qe="end":Array.isArray(je)?Qe="afterArrayValue":Qe="afterPropertyValue"}}function Xi(){ct.pop();var ie=ct[ct.length-1];ie==null?Qe="end":Array.isArray(ie)?Qe="afterArrayValue":Qe="afterPropertyValue"}function Kt(ie){return nu(ie===void 0?"JSON5: invalid end of input at "+gr+":"+vr:"JSON5: invalid character '"+uc(ie)+"' at "+gr+":"+vr)}function qs(){return nu("JSON5: invalid end of input at "+gr+":"+vr)}function Al(){return vr-=5,nu("JSON5: invalid identifier character at "+gr+":"+vr)}function oh(ie){console.warn("JSON5: '"+uc(ie)+"' in strings is not valid ECMAScript; consider escaping")}function uc(ie){var we={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(we[ie])return we[ie];if(ie<" "){var je=ie.charCodeAt(0).toString(16);return"\\x"+("00"+je).substring(je.length)}return ie}function nu(ie){var we=new SyntaxError(ie);return we.lineNumber=gr,we.columnNumber=vr,we}var ah=function(we,je,Me){var et=[],gt="",wt,kr,ar="",js;if(je!=null&&typeof je=="object"&&!Array.isArray(je)&&(Me=je.space,js=je.quote,je=je.replacer),typeof je=="function")kr=je;else if(Array.isArray(je)){wt=[];for(var Zi=0,Nn=je;Zi<Nn.length;Zi+=1){var es=Nn[Zi],Fr=void 0;typeof es=="string"?Fr=es:(typeof es=="number"||es instanceof String||es instanceof Number)&&(Fr=String(es)),Fr!==void 0&&wt.indexOf(Fr)<0&&wt.push(Fr)}}return Me instanceof Number?Me=Number(Me):Me instanceof String&&(Me=String(Me)),typeof Me=="number"?Me>0&&(Me=Math.min(10,Math.floor(Me)),ar=" ".substr(0,Me)):typeof Me=="string"&&(ar=Me.substr(0,10)),Ln("",{"":we});function Ln(Ht,Br){var ut=Br[Ht];switch(ut!=null&&(typeof ut.toJSON5=="function"?ut=ut.toJSON5(Ht):typeof ut.toJSON=="function"&&(ut=ut.toJSON(Ht))),kr&&(ut=kr.call(Br,Ht,ut)),ut instanceof Number?ut=Number(ut):ut instanceof String?ut=String(ut):ut instanceof Boolean&&(ut=ut.valueOf()),ut){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof ut=="string")return su(ut,!1);if(typeof ut=="number")return String(ut);if(typeof ut=="object")return Array.isArray(ut)?vn(ut):iu(ut)}function su(Ht){for(var Br={"'":.1,'"':.2},ut={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},ur="",wn=0;wn<Ht.length;wn++){var nr=Ht[wn];switch(nr){case"'":case'"':Br[nr]++,ur+=nr;continue;case"\0":if(Oe.isDigit(Ht[wn+1])){ur+="\\x00";continue}}if(ut[nr]){ur+=ut[nr];continue}if(nr<" "){var ts=nr.charCodeAt(0).toString(16);ur+="\\x"+("00"+ts).substring(ts.length);continue}ur+=nr}var _s=js||Object.keys(Br).reduce(function(Ks,gi){return Br[Ks]<Br[gi]?Ks:gi});return ur=ur.replace(new RegExp(_s,"g"),ut[_s]),_s+ur+_s}function iu(Ht){if(et.indexOf(Ht)>=0)throw TypeError("Converting circular structure to JSON5");et.push(Ht);var Br=gt;gt=gt+ar;for(var ut=wt||Object.keys(Ht),ur=[],wn=0,nr=ut;wn<nr.length;wn+=1){var ts=nr[wn],_s=Ln(ts,Ht);if(_s!==void 0){var Ks=ch(ts)+":";ar!==""&&(Ks+=" "),Ks+=_s,ur.push(Ks)}}var gi;if(ur.length===0)gi="{}";else{var Ji;if(ar==="")Ji=ur.join(","),gi="{"+Ji+"}";else{var _l=`,
|
||
`+gt;Ji=ur.join(_l),gi=`{
|
||
`+gt+Ji+`,
|
||
`+Br+"}"}}return et.pop(),gt=Br,gi}function ch(Ht){if(Ht.length===0)return su(Ht,!0);var Br=String.fromCodePoint(Ht.codePointAt(0));if(!Oe.isIdStartChar(Br))return su(Ht,!0);for(var ut=Br.length;ut<Ht.length;ut++)if(!Oe.isIdContinueChar(String.fromCodePoint(Ht.codePointAt(ut))))return su(Ht,!0);return Ht}function vn(Ht){if(et.indexOf(Ht)>=0)throw TypeError("Converting circular structure to JSON5");et.push(Ht);var Br=gt;gt=gt+ar;for(var ut=[],ur=0;ur<Ht.length;ur++){var wn=Ln(String(ur),Ht);ut.push(wn!==void 0?wn:"null")}var nr;if(ut.length===0)nr="[]";else if(ar===""){var ts=ut.join(",");nr="["+ts+"]"}else{var _s=`,
|
||
`+gt,Ks=ut.join(_s);nr=`[
|
||
`+gt+Ks+`,
|
||
`+Br+"]"}return et.pop(),gt=Br,nr}},Sl={parse:mi,stringify:ah},cc=Sl,uh=cc;return uh}))});var $be=B(x());var Dbe=B(x());var Hne=B(x(),1),w_="3.7.8",IU=w_,Vl=typeof Buffer=="function",d_=typeof TextDecoder=="function"?new TextDecoder:void 0,p_=typeof TextEncoder=="function"?new TextEncoder:void 0,xU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Wh=Array.prototype.slice.call(xU),Q0=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(Wh),$U=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,rn=String.fromCharCode.bind(String),m_=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),y_=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),E_=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),b_=e=>{let t,r,n,i,o="",s=e.length%3;for(let a=0;a<e.length;){if((r=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255||(i=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|i,o+=Wh[t>>18&63]+Wh[t>>12&63]+Wh[t>>6&63]+Wh[t&63]}return s?o.slice(0,s-3)+"===".substring(s):o},Uw=typeof btoa=="function"?e=>btoa(e):Vl?e=>Buffer.from(e,"binary").toString("base64"):b_,Nw=Vl?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,i=e.length;n<i;n+=4096)r.push(rn.apply(null,e.subarray(n,n+4096)));return Uw(r.join(""))},e1=(e,t=!1)=>t?y_(Nw(e)):Nw(e),PU=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?rn(192|t>>>6)+rn(128|t&63):rn(224|t>>>12&15)+rn(128|t>>>6&63)+rn(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return rn(240|t>>>18&7)+rn(128|t>>>12&63)+rn(128|t>>>6&63)+rn(128|t&63)}},kU=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,A_=e=>e.replace(kU,PU),g_=Vl?e=>Buffer.from(e,"utf8").toString("base64"):p_?e=>Nw(p_.encode(e)):e=>Uw(A_(e)),Kl=(e,t=!1)=>t?y_(g_(e)):g_(e),v_=e=>Kl(e,!0),RU=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,TU=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 rn((r>>>10)+55296)+rn((r&1023)+56320);case 3:return rn((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return rn((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},S_=e=>e.replace(RU,TU),__=e=>{if(e=e.replace(/\s+/g,""),!$U.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r,n,i=[];for(let o=0;o<e.length;)t=Q0[e.charAt(o++)]<<18|Q0[e.charAt(o++)]<<12|(r=Q0[e.charAt(o++)])<<6|(n=Q0[e.charAt(o++)]),r===64?i.push(rn(t>>16&255)):n===64?i.push(rn(t>>16&255,t>>8&255)):i.push(rn(t>>16&255,t>>8&255,t&255));return i.join("")},Hw=typeof atob=="function"?e=>atob(E_(e)):Vl?e=>Buffer.from(e,"base64").toString("binary"):__,C_=Vl?e=>m_(Buffer.from(e,"base64")):e=>m_(Hw(e).split("").map(t=>t.charCodeAt(0))),D_=e=>C_(F_(e)),OU=Vl?e=>Buffer.from(e,"base64").toString("utf8"):d_?e=>d_.decode(C_(e)):e=>S_(Hw(e)),F_=e=>E_(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Lw=e=>OU(F_(e)),NU=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)},B_=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),I_=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,B_(r));e("fromBase64",function(){return Lw(this)}),e("toBase64",function(t){return Kl(this,t)}),e("toBase64URI",function(){return Kl(this,!0)}),e("toBase64URL",function(){return Kl(this,!0)}),e("toUint8Array",function(){return D_(this)})},x_=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,B_(r));e("toBase64",function(t){return e1(this,t)}),e("toBase64URI",function(){return e1(this,!0)}),e("toBase64URL",function(){return e1(this,!0)})},LU=()=>{I_(),x_()},bt={version:w_,VERSION:IU,atob:Hw,atobPolyfill:__,btoa:Uw,btoaPolyfill:b_,fromBase64:Lw,toBase64:Kl,encode:Kl,encodeURI:v_,encodeURL:v_,utob:A_,btou:S_,decode:Lw,isValid:NU,fromUint8Array:e1,toUint8Array:D_,extendString:I_,extendUint8Array:x_,extendBuiltins:LU};var w2=B(oa());var Jne=B(x()),hy=B(AC());function cj(e){let t=hy.default.pemtohex(e);return hy.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var SC={generateFingerprint:cj};var efe=B(x());var Xle=B(x(),1);var kle=B(x(),1);var Yce=B(x(),1);var ase=B(x(),1);var ese=B(x(),1),w1=Symbol.for("yaml.alias"),y1=Symbol.for("yaml.document"),Fi=Symbol.for("yaml.map"),dy=Symbol.for("yaml.pair"),$s=Symbol.for("yaml.scalar"),ha=Symbol.for("yaml.seq"),Vn=Symbol.for("yaml.node.type"),ps=e=>!!e&&typeof e=="object"&&e[Vn]===w1,Bi=e=>!!e&&typeof e=="object"&&e[Vn]===y1,Ii=e=>!!e&&typeof e=="object"&&e[Vn]===Fi,It=e=>!!e&&typeof e=="object"&&e[Vn]===dy,dt=e=>!!e&&typeof e=="object"&&e[Vn]===$s,Ps=e=>!!e&&typeof e=="object"&&e[Vn]===ha;function qt(e){if(e&&typeof e=="object")switch(e[Vn]){case Fi:case ha:return!0}return!1}function kt(e){if(e&&typeof e=="object")switch(e[Vn]){case w1:case Fi:case $s:case ha:return!0}return!1}var E1=e=>(dt(e)||qt(e))&&!!e.anchor;var nse=B(x(),1);var ms=Symbol("break visit"),_C=Symbol("skip children"),uo=Symbol("remove node");function gs(e,t){let r=CC(t);Bi(e)?nf(null,e.contents,r,Object.freeze([e]))===uo&&(e.contents=null):nf(null,e,r,Object.freeze([]))}gs.BREAK=ms;gs.SKIP=_C;gs.REMOVE=uo;function nf(e,t,r,n){let i=DC(e,t,r,n);if(kt(i)||It(i))return FC(e,n,i),nf(e,i,r,n);if(typeof i!="symbol"){if(qt(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=nf(o,t.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===ms)return ms;s===uo&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){n=Object.freeze(n.concat(t));let o=nf("key",t.key,r,n);if(o===ms)return ms;o===uo&&(t.key=null);let s=nf("value",t.value,r,n);if(s===ms)return ms;s===uo&&(t.value=null)}}return i}async function b1(e,t){let r=CC(t);Bi(e)?await sf(null,e.contents,r,Object.freeze([e]))===uo&&(e.contents=null):await sf(null,e,r,Object.freeze([]))}b1.BREAK=ms;b1.SKIP=_C;b1.REMOVE=uo;async function sf(e,t,r,n){let i=await DC(e,t,r,n);if(kt(i)||It(i))return FC(e,n,i),sf(e,i,r,n);if(typeof i!="symbol"){if(qt(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=await sf(o,t.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===ms)return ms;s===uo&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){n=Object.freeze(n.concat(t));let o=await sf("key",t.key,r,n);if(o===ms)return ms;o===uo&&(t.key=null);let s=await sf("value",t.value,r,n);if(s===ms)return ms;s===uo&&(t.value=null)}}return i}function CC(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function DC(e,t,r,n){if(typeof r=="function")return r(e,t,n);if(Ii(t))return r.Map?.(e,t,n);if(Ps(t))return r.Seq?.(e,t,n);if(It(t))return r.Pair?.(e,t,n);if(dt(t))return r.Scalar?.(e,t,n);if(ps(t))return r.Alias?.(e,t,n)}function FC(e,t,r){let n=t[t.length-1];if(qt(n))n.items[e]=r;else if(It(n))e==="key"?n.key=r:n.value=r;else if(Bi(n))n.contents=r;else{let i=ps(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var lj={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},fj=e=>e.replace(/[!,[\]{}]/g,t=>lj[t]),co=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let n=t.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,n]of Object.entries(this.tags))if(t.startsWith(n))return r+fj(t.substring(n.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(t&&n.length>0&&kt(t.contents)){let o={};gs(t.contents,(s,a)=>{kt(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(`
|
||
`)}};co.defaultYaml={explicit:!1,version:"1.2"};co.defaultTags={"!!":"tag:yaml.org,2002:"};var Eue=B(x(),1);var Bse=B(x(),1);var fse=B(x(),1);function A1(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function py(e){let t=new Set;return gs(e,{Value(r,n){n.anchor&&t.add(n.anchor)}}),t}function my(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function BC(e,t){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=py(e));let s=my(t,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(dt(s.node)||qt(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}var bse=B(x(),1);var dse=B(x(),1);function Au(e,t,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i<o;++i){let s=n[i],a=Au(e,n,String(i),s);a===void 0?delete n[i]:a!==s&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let o=n.get(i),s=Au(e,n,i,o);s===void 0?n.delete(i):s!==o&&n.set(i,s)}else if(n instanceof Set)for(let i of Array.from(n)){let o=Au(e,n,i,i);o===void 0?n.delete(i):o!==i&&(n.delete(i),n.add(o))}else for(let[i,o]of Object.entries(n)){let s=Au(e,n,i,o);s===void 0?delete n[i]:s!==o&&(n[i]=s)}return e.call(t,r,n)}var gse=B(x(),1);function Lr(e,t,r){if(Array.isArray(e))return e.map((n,i)=>Lr(n,String(i),r));if(e&&typeof e.toJSON=="function"){if(!r||!E1(e))return e.toJSON(t,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(e,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let i=e.toJSON(t,r);return r.onCreate&&r.onCreate(i),i}return typeof e=="bigint"&&!r?.keep?Number(e):e}var Su=class{constructor(t){Object.defineProperty(this,Vn,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:o}={}){if(!Bi(t))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Lr(this,"",s);if(typeof i=="function")for(let{count:u,res:l}of s.anchors.values())i(l,u);return typeof o=="function"?Au(o,{"":a},"",a):a}};var da=class extends Su{constructor(t){super(w1),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){if(r?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],gs(t,{Node:(o,s)=>{(ps(s)||E1(s))&&n.push(s)}}),r&&(r.aliasResolveCache=n));let i;for(let o of n){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(t,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:o}=r,s=this.resolve(i,r);if(!s){let u=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(u)}let a=n.get(s);if(a||(Lr(s,null,r),a=n.get(s)),a?.res===void 0){let u="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(u)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=S1(i,s,n)),a.count*a.aliasCount>o)){let u="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(u)}return a.res}toString(t,r,n){let i=`*${this.source}`;if(t){if(A1(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${i} `}return i}};function S1(e,t,r){if(ps(t)){let n=t.resolve(e),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(qt(t)){let n=0;for(let i of t.items){let o=S1(e,i,r);o>n&&(n=o)}return n}else if(It(t)){let n=S1(e,t.key,r),i=S1(e,t.value,r);return Math.max(n,i)}return 1}var jse=B(x(),1);var Lse=B(x(),1);var kse=B(x(),1);var _1=e=>!e||typeof e!="function"&&typeof e!="object",Ke=class extends Su{constructor(t){super($s),this.value=t}toJSON(t,r){return r?.keep?this.value:Lr(this.value,t,r)}toString(){return String(this.value)}};Ke.BLOCK_FOLDED="BLOCK_FOLDED";Ke.BLOCK_LITERAL="BLOCK_LITERAL";Ke.PLAIN="PLAIN";Ke.QUOTE_DOUBLE="QUOTE_DOUBLE";Ke.QUOTE_SINGLE="QUOTE_SINGLE";var hj="tag:yaml.org,2002:";function dj(e,t,r){if(t){let n=r.filter(o=>o.tag===t),i=n.find(o=>!o.format)??n[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return r.find(n=>n.identify?.(e)&&!n.format)}function pa(e,t,r){if(Bi(e)&&(e=e.contents),kt(e))return e;if(It(e)){let m=r.schema[Fi].createNode?.(r.schema,null,r);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=r,u;if(n&&e&&typeof e=="object"){if(u=a.get(e),u)return u.anchor??(u.anchor=i(e)),new da(u.anchor);u={anchor:null,node:null},a.set(e,u)}t?.startsWith("!!")&&(t=hj+t.slice(2));let l=dj(e,t,s.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let m=new Ke(e);return u&&(u.node=m),m}l=e instanceof Map?s[Fi]:Symbol.iterator in Object(e)?s[ha]:s[Fi]}o&&(o(l),delete r.onTagObj);let h=l?.createNode?l.createNode(r.schema,e,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,e,r):new Ke(e);return t?h.tag=t:l.default||(h.tag=l.tag),u&&(u.node=h),h}function rd(e,t,r){let n=r;for(let i=t.length-1;i>=0;--i){let o=t[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=n,n=s}else n=new Map([[o,n]])}return pa(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var af=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,of=class extends Su{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(n=>kt(n)||It(n)?n.clone(t):n),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(af(t))this.add(r);else{let[n,...i]=t,o=this.get(n,!0);if(qt(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,rd(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(t){let[r,...n]=t;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(qt(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(t,r){let[n,...i]=t,o=this.get(n,!0);return i.length===0?!r&&dt(o)?o.value:o:qt(o)?o.getIn(i,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!It(r))return!1;let n=r.value;return n==null||t&&dt(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(t){let[r,...n]=t;if(n.length===0)return this.has(r);let i=this.get(r,!0);return qt(i)?i.hasIn(n):!1}setIn(t,r){let[n,...i]=t;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(qt(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,rd(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};var Bie=B(x(),1);var cie=B(x(),1);var nie=B(x(),1);var Vse=B(x(),1),IC=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Js(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var lo=(e,t,r)=>e.endsWith(`
|
||
`)?Js(r,t):r.includes(`
|
||
`)?`
|
||
`+Js(r,t):(e.endsWith(" ")?"":" ")+r;var Zse=B(x(),1);var Gse=B(x(),1),gy="flow",C1="block",nd="quoted";function sd(e,t,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return e;i<o&&(o=0);let u=Math.max(1+o,1+i-t.length);if(e.length<=u)return e;let l=[],h={},m=i-t.length;typeof n=="number"&&(n>i-Math.max(2,o)?l.push(0):m=i-n);let p,d,v=!1,g=-1,y=-1,w=-1;r===C1&&(g=xC(e,g,t.length),g!==-1&&(m=g+u));for(let _;_=e[g+=1];){if(r===nd&&_==="\\"){switch(y=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}w=g}if(_===`
|
||
`)r===C1&&(g=xC(e,g,t.length)),m=g+t.length+u,p=void 0;else{if(_===" "&&d&&d!==" "&&d!==`
|
||
`&&d!==" "){let C=e[g+1];C&&C!==" "&&C!==`
|
||
`&&C!==" "&&(p=g)}if(g>=m)if(p)l.push(p),m=p+u,p=void 0;else if(r===nd){for(;d===" "||d===" ";)d=_,_=e[g+=1],v=!0;let C=g>w+1?g-2:y-1;if(h[C])return e;l.push(C),h[C]=!0,m=C+u,p=void 0}else v=!0}d=_}if(v&&a&&a(),l.length===0)return e;s&&s();let E=e.slice(0,l[0]);for(let _=0;_<l.length;++_){let C=l[_],F=l[_+1]||e.length;C===0?E=`
|
||
${t}${e.slice(0,F)}`:(r===nd&&h[C]&&(E+=`${e[C]}\\`),E+=`
|
||
${t}${e.slice(C+1,F)}`)}return E}function xC(e,t,r){let n=t,i=t+1,o=e[i];for(;o===" "||o===" ";)if(t<i+r)o=e[++t];else{do o=e[++t];while(o&&o!==`
|
||
`);n=t,i=t+1,o=e[i]}return n}var F1=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),B1=e=>/^(%|---|\.\.\.)/m.test(e);function pj(e,t,r){if(!t||t<0)return!1;let n=t-r,i=e.length;if(i<=n)return!1;for(let o=0,s=0;o<i;++o)if(e[o]===`
|
||
`){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function od(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(B1(e)?" ":""),s="",a=0;for(let u=0,l=r[u];l;l=r[++u])if(l===" "&&r[u+1]==="\\"&&r[u+2]==="n"&&(s+=r.slice(a,u)+"\\ ",u+=1,a=u,l="\\"),l==="\\")switch(r[u+1]){case"u":{s+=r.slice(a,u);let h=r.substr(u+2,4);switch(h){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:h.substr(0,2)==="00"?s+="\\x"+h.substr(2):s+=r.substr(u,6)}u+=5,a=u+1}break;case"n":if(n||r[u+2]==='"'||r.length<i)u+=1;else{for(s+=r.slice(a,u)+`
|
||
|
||
`;r[u+2]==="\\"&&r[u+3]==="n"&&r[u+4]!=='"';)s+=`
|
||
`,u+=2;s+=o,r[u+2]===" "&&(s+="\\"),u+=1,a=u+1}break;default:u+=1}return s=a?s+r.slice(a):r,n?s:sd(s,o,nd,F1(t,!1))}function vy(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
||
`)||/[ \t]\n|\n[ \t]/.test(e))return od(e,t);let r=t.indent||(B1(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
||
${r}`)+"'";return t.implicitKey?n:sd(n,r,gy,F1(t,!1))}function uf(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=od;else{let i=e.includes('"'),o=e.includes("'");i&&!o?n=vy:o&&!i?n=od:n=r?vy:od}return n(e,t)}var wy;try{wy=new RegExp(`(^|(?<!
|
||
))
|
||
+(?!
|
||
|$)`,"g")}catch{wy=/\n+(?!\n|$)/g}function D1({comment:e,type:t,value:r},n,i,o){let{blockQuote:s,commentString:a,lineWidth:u}=n.options;if(!s||/\n[\t ]+$/.test(r))return uf(r,n);let l=n.indent||(n.forceBlockIndent||B1(r)?" ":""),h=s==="literal"?!0:s==="folded"||t===Ke.BLOCK_FOLDED?!1:t===Ke.BLOCK_LITERAL?!0:!pj(r,u,l.length);if(!r)return h?`|
|
||
`:`>
|
||
`;let m,p;for(p=r.length;p>0;--p){let F=r[p-1];if(F!==`
|
||
`&&F!==" "&&F!==" ")break}let d=r.substring(p),v=d.indexOf(`
|
||
`);v===-1?m="-":r===d||v!==d.length-1?(m="+",o&&o()):m="",d&&(r=r.slice(0,-d.length),d[d.length-1]===`
|
||
`&&(d=d.slice(0,-1)),d=d.replace(wy,`$&${l}`));let g=!1,y,w=-1;for(y=0;y<r.length;++y){let F=r[y];if(F===" ")g=!0;else if(F===`
|
||
`)w=y;else break}let E=r.substring(0,w<y?w+1:y);E&&(r=r.substring(E.length),E=E.replace(/\n+/g,`$&${l}`));let C=(g?l?"2":"1":"")+m;if(e&&(C+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!h){let F=r.replace(/\n+/g,`
|
||
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),H=!1,K=F1(n,!0);s!=="folded"&&t!==Ke.BLOCK_FOLDED&&(K.onOverflow=()=>{H=!0});let S=sd(`${E}${F}${d}`,l,C1,K);if(!H)return`>${C}
|
||
${l}${S}`}return r=r.replace(/\n+/g,`$&${l}`),`|${C}
|
||
${l}${E}${r}${d}`}function mj(e,t,r,n){let{type:i,value:o}=e,{actualString:s,implicitKey:a,indent:u,indentStep:l,inFlow:h}=t;if(a&&o.includes(`
|
||
`)||h&&/[[\]{},]/.test(o))return uf(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||h||!o.includes(`
|
||
`)?uf(o,t):D1(e,t,r,n);if(!a&&!h&&i!==Ke.PLAIN&&o.includes(`
|
||
`))return D1(e,t,r,n);if(B1(o)){if(u==="")return t.forceBlockIndent=!0,D1(e,t,r,n);if(a&&u===l)return uf(o,t)}let m=o.replace(/\n+/g,`$&
|
||
${u}`);if(s){let p=g=>g.default&&g.tag!=="tag:yaml.org,2002:str"&&g.test?.test(m),{compat:d,tags:v}=t.doc.schema;if(v.some(p)||d?.some(p))return uf(o,t)}return a?m:sd(m,u,gy,F1(t,!1))}function Dc(e,t,r,n){let{implicitKey:i,inFlow:o}=t,s=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==Ke.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Ke.QUOTE_DOUBLE);let u=h=>{switch(h){case Ke.BLOCK_FOLDED:case Ke.BLOCK_LITERAL:return i||o?uf(s.value,t):D1(s,t,r,n);case Ke.QUOTE_DOUBLE:return od(s.value,t);case Ke.QUOTE_SINGLE:return vy(s.value,t);case Ke.PLAIN:return mj(s,t,r,n);default:return null}},l=u(a);if(l===null){let{defaultKeyType:h,defaultStringType:m}=t.options,p=i&&h||m;if(l=u(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}function I1(e,t){let r=Object.assign({blockQuote:!0,commentString:IC,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function gj(e,t){if(t.tag){let i=e.filter(o=>o.tag===t.tag);if(i.length>0)return i.find(o=>o.format===t.format)??i[0]}let r,n;if(dt(t)){n=t.value;let i=e.filter(o=>o.identify?.(n));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}r=i.find(o=>o.format===t.format)??i.find(o=>!o.format)}else n=t,r=e.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return r}function vj(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(dt(e)||qt(e))&&e.anchor;o&&A1(o)&&(r.add(o),i.push(`&${o}`));let s=e.tag??(t.default?null:t.tag);return s&&i.push(n.directives.tagString(s)),i.join(" ")}function ma(e,t,r,n){if(It(e))return e.toString(t,r,n);if(ps(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,o=kt(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=gj(t.doc.schema.tags,o));let s=vj(o,i,t);s.length>0&&(t.indentAtStart=(t.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,t,r,n):dt(o)?Dc(o,t,r,n):o.toString(t,r,n);return s?dt(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
||
${t.indent}${a}`:a}function $C({key:e,value:t},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:u,options:{commentString:l,indentSeq:h,simpleKeys:m}}=r,p=kt(e)&&e.comment||null;if(m){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(qt(e)||!kt(e)&&typeof e=="object"){let K="With simple keys, collection cannot be used as a key value";throw new Error(K)}}let d=!m&&(!e||p&&t==null&&!r.inFlow||qt(e)||(dt(e)?e.type===Ke.BLOCK_FOLDED||e.type===Ke.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!d&&(m||!o),indent:a+u});let v=!1,g=!1,y=ma(e,r,()=>v=!0,()=>g=!0);if(!d&&!r.inFlow&&y.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(r.inFlow){if(o||t==null)return v&&n&&n(),y===""?"?":d?`? ${y}`:y}else if(o&&!m||t==null&&d)return y=`? ${y}`,p&&!v?y+=lo(y,r.indent,l(p)):g&&i&&i(),y;v&&(p=null),d?(p&&(y+=lo(y,r.indent,l(p))),y=`? ${y}
|
||
${a}:`):(y=`${y}:`,p&&(y+=lo(y,r.indent,l(p))));let w,E,_;kt(t)?(w=!!t.spaceBefore,E=t.commentBefore,_=t.comment):(w=!1,E=null,_=null,t&&typeof t=="object"&&(t=s.createNode(t))),r.implicitKey=!1,!d&&!p&&dt(t)&&(r.indentAtStart=y.length+1),g=!1,!h&&u.length>=2&&!r.inFlow&&!d&&Ps(t)&&!t.flow&&!t.tag&&!t.anchor&&(r.indent=r.indent.substring(2));let C=!1,F=ma(t,r,()=>C=!0,()=>g=!0),H=" ";if(p||w||E){if(H=w?`
|
||
`:"",E){let K=l(E);H+=`
|
||
${Js(K,r.indent)}`}F===""&&!r.inFlow?H===`
|
||
`&&_&&(H=`
|
||
|
||
`):H+=`
|
||
${r.indent}`}else if(!d&&qt(t)){let K=F[0],S=F.indexOf(`
|
||
`),I=S!==-1,q=r.inFlow??t.flow??t.items.length===0;if(I||!q){let L=!1;if(I&&(K==="&"||K==="!")){let R=F.indexOf(" ");K==="&"&&R!==-1&&R<S&&F[R+1]==="!"&&(R=F.indexOf(" ",R+1)),(R===-1||S<R)&&(L=!0)}L||(H=`
|
||
${r.indent}`)}}else(F===""||F[0]===`
|
||
`)&&(H="");return y+=H+F,r.inFlow?C&&n&&n():_&&!C?y+=lo(y,r.indent,l(_)):g&&i&&i(),y}var Aie=B(x(),1);var fie=B(x(),1);function x1(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var mie=B(x(),1);var $1="<<",xi={identify:e=>e===$1||typeof e=="symbol"&&e.description===$1,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ke(Symbol($1)),{addToJSMap:Ey}),stringify:()=>$1},PC=(e,t)=>(xi.identify(t)||dt(t)&&(!t.type||t.type===Ke.PLAIN)&&xi.identify(t.value))&&e?.doc.schema.tags.some(r=>r.tag===xi.tag&&r.default);function Ey(e,t,r){let n=kC(e,r);if(Ps(n))for(let i of n.items)yy(e,t,i);else if(Array.isArray(n))for(let i of n)yy(e,t,i);else yy(e,t,n)}function yy(e,t,r){let n=kC(e,r);if(!Ii(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,e,Map);for(let[o,s]of i)t instanceof Map?t.has(o)||t.set(o,s):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function kC(e,t){return e&&ps(t)?t.resolve(e.doc,e):t}function P1(e,t,{key:r,value:n}){if(kt(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(PC(e,r))Ey(e,t,n);else{let i=Lr(r,"",e);if(t instanceof Map)t.set(i,Lr(n,i,e));else if(t instanceof Set)t.add(i);else{let o=wj(r,i,e),s=Lr(n,o,e);o in t?Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[o]=s}}return t}function wj(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(kt(e)&&r?.doc){let n=I1(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),x1(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(t)}function cf(e,t,r){let n=pa(e,void 0,r),i=pa(t,void 0,r);return new dr(n,i)}var dr=class e{constructor(t,r=null){Object.defineProperty(this,Vn,{value:dy}),this.key=t,this.value=r}clone(t){let{key:r,value:n}=this;return kt(r)&&(r=r.clone(t)),kt(n)&&(n=n.clone(t)),new e(r,n)}toJSON(t,r){let n=r?.mapAsMap?new Map:{};return P1(r,n,this)}toString(t,r,n){return t?.doc?$C(this,t,r,n):JSON.stringify(this)}};var rue=B(x(),1);var Vie=B(x(),1);var Mie=B(x(),1);var kie=B(x(),1);function R1(e,t,r){return(t.inFlow??e.flow?Ej:yj)(e,t,r)}function yj({comment:e,items:t},r,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:u,options:{commentString:l}}=r,h=Object.assign({},r,{indent:o,type:null}),m=!1,p=[];for(let v=0;v<t.length;++v){let g=t[v],y=null;if(kt(g))!m&&g.spaceBefore&&p.push(""),k1(r,p,g.commentBefore,m),g.comment&&(y=g.comment);else if(It(g)){let E=kt(g.key)?g.key:null;E&&(!m&&E.spaceBefore&&p.push(""),k1(r,p,E.commentBefore,m))}m=!1;let w=ma(g,h,()=>y=null,()=>m=!0);y&&(w+=lo(w,o,l(y))),m&&y&&(m=!1),p.push(n+w)}let d;if(p.length===0)d=i.start+i.end;else{d=p[0];for(let v=1;v<p.length;++v){let g=p[v];d+=g?`
|
||
${u}${g}`:`
|
||
`}}return e?(d+=`
|
||
`+Js(l(e),u),a&&a()):m&&s&&s(),d}function Ej({items:e},t,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;n+=o;let u=Object.assign({},t,{indent:n,inFlow:!0,type:null}),l=!1,h=0,m=[];for(let v=0;v<e.length;++v){let g=e[v],y=null;if(kt(g))g.spaceBefore&&m.push(""),k1(t,m,g.commentBefore,!1),g.comment&&(y=g.comment);else if(It(g)){let E=kt(g.key)?g.key:null;E&&(E.spaceBefore&&m.push(""),k1(t,m,E.commentBefore,!1),E.comment&&(l=!0));let _=kt(g.value)?g.value:null;_?(_.comment&&(y=_.comment),_.commentBefore&&(l=!0)):g.value==null&&E?.comment&&(y=E.comment)}y&&(l=!0);let w=ma(g,u,()=>y=null);l||(l=m.length>h||w.includes(`
|
||
`)),v<e.length-1?w+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=m.reduce((E,_)=>E+_.length+2,2)+(w.length+2)>t.options.lineWidth)),l&&(w+=",")),y&&(w+=lo(w,n,a(y))),m.push(w),h=m.length}let{start:p,end:d}=r;if(m.length===0)return p+d;if(!l){let v=m.reduce((g,y)=>g+y.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=p;for(let g of m)v+=g?`
|
||
${o}${i}${g}`:`
|
||
`;return`${v}
|
||
${i}${d}`}else return`${p}${s}${m.join(" ")}${s}${d}`}function k1({indent:e,options:{commentString:t}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Js(t(n),e);r.push(o.trimStart())}}function _u(e,t){let r=dt(t)?t.value:t;for(let n of e)if(It(n)&&(n.key===t||n.key===r||dt(n.key)&&n.key.value===r))return n}var Sr=class extends of{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Fi,t),this.items=[]}static from(t,r,n){let{keepUndefined:i,replacer:o}=n,s=new this(t),a=(u,l)=>{if(typeof o=="function")l=o.call(r,u,l);else if(Array.isArray(o)&&!o.includes(u))return;(l!==void 0||i)&&s.items.push(cf(u,l,n))};if(r instanceof Map)for(let[u,l]of r)a(u,l);else if(r&&typeof r=="object")for(let u of Object.keys(r))a(u,r[u]);return typeof t.sortMapEntries=="function"&&s.items.sort(t.sortMapEntries),s}add(t,r){let n;It(t)?n=t:!t||typeof t!="object"||!("key"in t)?n=new dr(t,t?.value):n=new dr(t.key,t.value);let i=_u(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);dt(i.value)&&_1(n.value)?i.value.value=n.value:i.value=n.value}else if(o){let s=this.items.findIndex(a=>o(n,a)<0);s===-1?this.items.push(n):this.items.splice(s,0,n)}else this.items.push(n)}delete(t){let r=_u(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let i=_u(this.items,t)?.value;return(!r&&dt(i)?i.value:i)??void 0}has(t){return!!_u(this.items,t)}set(t,r){this.add(new dr(t,r),!0)}toJSON(t,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let o of this.items)P1(r,i,o);return i}toString(t,r,n){if(!t)return JSON.stringify(this);for(let i of this.items)if(!It(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),R1(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:n,onComment:r})}};var $i={collection:"map",default:!0,nodeClass:Sr,tag:"tag:yaml.org,2002:map",resolve(e,t){return Ii(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,r)=>Sr.from(e,t,r)};var noe=B(x(),1);var Qie=B(x(),1);var Sn=class extends of{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(ha,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=T1(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let n=T1(t);if(typeof n!="number")return;let i=this.items[n];return!r&&dt(i)?i.value:i}has(t){let r=T1(t);return typeof r=="number"&&r<this.items.length}set(t,r){let n=T1(t);if(typeof n!="number")throw new Error(`Expected a valid index, not ${t}.`);let i=this.items[n];dt(i)&&_1(r)?i.value=r:this.items[n]=r}toJSON(t,r){let n=[];r?.onCreate&&r.onCreate(n);let i=0;for(let o of this.items)n.push(Lr(o,String(i++),r));return n}toString(t,r,n){return t?R1(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(t,r,n){let{replacer:i}=n,o=new this(t);if(r&&Symbol.iterator in Object(r)){let s=0;for(let a of r){if(typeof i=="function"){let u=r instanceof Set?a:String(s++);a=i.call(r,u,a)}o.items.push(pa(a,void 0,n))}}return o}};function T1(e){let t=dt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var Pi={collection:"seq",default:!0,nodeClass:Sn,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Ps(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>Sn.from(e,t,r)};var ooe=B(x(),1);var Cu={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,r,n){return t=Object.assign({actualString:!0},t),Dc(e,t,r,n)}};var Yae=B(x(),1);var coe=B(x(),1);var Fc={identify:e=>e==null,createNode:()=>new Ke(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ke(null),stringify:({source:e},t)=>typeof e=="string"&&Fc.test.test(e)?e:t.options.nullStr};var hoe=B(x(),1);var ad={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Ke(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},r){if(e&&ad.test.test(e)){let n=e[0]==="t"||e[0]==="T";if(t===n)return e}return t?r.options.trueStr:r.options.falseStr}};var woe=B(x(),1);var poe=B(x(),1);function _n({format:e,minFractionDigits:t,tag:r,value:n}){if(typeof n=="bigint")return String(n);let i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=t-(o.length-s-1);for(;a-- >0;)o+="0"}return o}var O1={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_n},N1={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():_n(e)}},L1={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Ke(parseFloat(e)),r=e.indexOf(".");return r!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-r-1),t},stringify:_n};var boe=B(x(),1);var U1=e=>typeof e=="bigint"||Number.isInteger(e),by=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);function RC(e,t,r){let{value:n}=e;return U1(n)&&n>=0?r+n.toString(t):_n(e)}var H1={identify:e=>U1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>by(e,2,8,r),stringify:e=>RC(e,8,"0o")},M1={identify:U1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>by(e,0,10,r),stringify:_n},q1={identify:e=>U1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>by(e,2,16,r),stringify:e=>RC(e,16,"0x")};var xoe=B(x(),1);var TC=[$i,Pi,Cu,Fc,ad,H1,M1,q1,O1,N1,L1];var Toe=B(x(),1);function OC(e){return typeof e=="bigint"||Number.isInteger(e)}var j1=({value:e})=>JSON.stringify(e),bj=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:j1},{identify:e=>e==null,createNode:()=>new Ke(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:j1},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:j1},{identify:OC,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:r})=>r?BigInt(e):parseInt(e,10),stringify:({value:e})=>OC(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:j1}],Aj={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},NC=[$i,Pi].concat(bj,Aj);var Uoe=B(x(),1);var ud={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){let r=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let i=0;i<r.length;++i)n[i]=r.charCodeAt(i);return n}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:r},n,i,o){if(!r)return"";let s=r,a;if(typeof btoa=="function"){let u="";for(let l=0;l<s.length;++l)u+=String.fromCharCode(s[l]);a=btoa(u)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Ke.BLOCK_LITERAL),t!==Ke.QUOTE_DOUBLE){let u=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/u),h=new Array(l);for(let m=0,p=0;m<l;++m,p+=u)h[m]=a.substr(p,u);a=h.join(t===Ke.BLOCK_LITERAL?`
|
||
`:" ")}return Dc({comment:e,type:t,value:a},n,i,o)}};var Joe=B(x(),1);var Voe=B(x(),1);function Ay(e,t){if(Ps(e))for(let r=0;r<e.items.length;++r){let n=e.items[r];if(!It(n)){if(Ii(n)){n.items.length>1&&t("Each pair must have its own sequence indicator");let i=n.items[0]||new dr(new Ke(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
||
${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment}
|
||
${o.comment}`:n.comment}n=i}e.items[r]=It(n)?n:new dr(n)}}else t("Expected a sequence for this tag");return e}function Sy(e,t,r){let{replacer:n}=r,i=new Sn(e);i.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof n=="function"&&(s=n.call(t,String(o++),s));let a,u;if(Array.isArray(s))if(s.length===2)a=s[0],u=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let l=Object.keys(s);if(l.length===1)a=l[0],u=s[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=s;i.items.push(cf(a,u,r))}return i}var cd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ay,createNode:Sy};var lf=class e extends Sn{constructor(){super(),this.add=Sr.prototype.add.bind(this),this.delete=Sr.prototype.delete.bind(this),this.get=Sr.prototype.get.bind(this),this.has=Sr.prototype.has.bind(this),this.set=Sr.prototype.set.bind(this),this.tag=e.tag}toJSON(t,r){if(!r)return super.toJSON(t);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let o,s;if(It(i)?(o=Lr(i.key,"",r),s=Lr(i.value,o,r)):o=Lr(i,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,s)}return n}static from(t,r,n){let i=Sy(t,r,n),o=new this;return o.items=i.items,o}};lf.tag="tag:yaml.org,2002:omap";var ld={collection:"seq",identify:e=>e instanceof Map,nodeClass:lf,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=Ay(e,t),n=[];for(let{key:i}of r.items)dt(i)&&(n.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new lf,r)},createNode:(e,t,r)=>lf.from(e,t,r)};var $ae=B(x(),1);var tae=B(x(),1);function LC({value:e,source:t},r){return t&&(e?_y:Cy).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var _y={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ke(!0),stringify:LC},Cy={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ke(!1),stringify:LC};var iae=B(x(),1);var UC={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_n},HC={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():_n(e)}},MC={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Ke(parseFloat(e.replace(/_/g,""))),r=e.indexOf(".");if(r!==-1){let n=e.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(t.minFractionDigits=n.length)}return t},stringify:_n};var uae=B(x(),1);var fd=e=>typeof e=="bigint"||Number.isInteger(e);function K1(e,t,r,{intAsBigInt:n}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),n){switch(r){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return i==="-"?BigInt(-1)*s:s}let o=parseInt(e,r);return i==="-"?-1*o:o}function Dy(e,t,r){let{value:n}=e;if(fd(n)){let i=n.toString(t);return n<0?"-"+r+i.substr(1):r+i}return _n(e)}var qC={identify:fd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>K1(e,2,2,r),stringify:e=>Dy(e,2,"0b")},jC={identify:fd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>K1(e,1,8,r),stringify:e=>Dy(e,8,"0")},KC={identify:fd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>K1(e,0,10,r),stringify:_n},VC={identify:fd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>K1(e,2,16,r),stringify:e=>Dy(e,16,"0x")};var dae=B(x(),1);var ff=class e extends Sr{constructor(t){super(t),this.tag=e.tag}add(t){let r;It(t)?r=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?r=new dr(t.key,null):r=new dr(t,null),_u(this.items,r.key)||this.items.push(r)}get(t,r){let n=_u(this.items,t);return!r&&It(n)?dt(n.key)?n.key.value:n.key:n}set(t,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=_u(this.items,t);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new dr(t))}toJSON(t,r){return super.toJSON(t,r,Set)}toString(t,r,n){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(t,r,n){let{replacer:i}=n,o=new this(t);if(r&&Symbol.iterator in Object(r))for(let s of r)typeof i=="function"&&(s=i.call(r,s,s)),o.items.push(cf(s,null,n));return o}};ff.tag="tag:yaml.org,2002:set";var hd={collection:"map",identify:e=>e instanceof Set,nodeClass:ff,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>ff.from(e,t,r),resolve(e,t){if(Ii(e)){if(e.hasAllNullValues(!0))return Object.assign(new ff,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};var gae=B(x(),1);function Fy(e,t){let r=e[0],n=r==="-"||r==="+"?e.substring(1):e,i=s=>t?BigInt(s):Number(s),o=n.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return r==="-"?i(-1)*o:o}function zC(e){let{value:t}=e,r=s=>s;if(typeof t=="bigint")r=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return _n(e);let n="";t<0&&(n="-",t*=r(-1));let i=r(60),o=[t%i];return t<60?o.unshift(0):(t=(t-o[0])/i,o.unshift(t%i),t>=60&&(t=(t-o[0])/i,o.unshift(t))),n+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var V1={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:r})=>Fy(e,r),stringify:zC},z1={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Fy(e,!1),stringify:zC},hf={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(hf.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,o,s,a]=t.map(Number),u=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,o||0,s||0,a||0,u),h=t[8];if(h&&h!=="Z"){let m=Fy(h,!1);Math.abs(m)<30&&(m*=60),l-=6e4*m}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var By=[$i,Pi,Cu,Fc,_y,Cy,qC,jC,KC,VC,UC,HC,MC,ud,xi,ld,cd,hd,V1,z1,hf];var GC=new Map([["core",TC],["failsafe",[$i,Pi,Cu]],["json",NC],["yaml11",By],["yaml-1.1",By]]),WC={binary:ud,bool:ad,float:L1,floatExp:N1,floatNaN:O1,floatTime:z1,int:M1,intHex:q1,intOct:H1,intTime:V1,map:$i,merge:xi,null:Fc,omap:ld,pairs:cd,seq:Pi,set:hd,timestamp:hf},YC={"tag:yaml.org,2002:binary":ud,"tag:yaml.org,2002:merge":xi,"tag:yaml.org,2002:omap":ld,"tag:yaml.org,2002:pairs":cd,"tag:yaml.org,2002:set":hd,"tag:yaml.org,2002:timestamp":hf};function G1(e,t,r){let n=GC.get(t);if(n&&!e)return r&&!n.includes(xi)?n.concat(xi):n.slice();let i=n;if(!i)if(Array.isArray(e))i=[];else{let o=Array.from(GC.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)i=i.concat(o);else typeof e=="function"&&(i=e(i.slice()));return r&&(i=i.concat(xi)),i.reduce((o,s)=>{let a=typeof s=="string"?WC[s]:s;if(!a){let u=JSON.stringify(s),l=Object.keys(WC).map(h=>JSON.stringify(h)).join(", ");throw new Error(`Unknown custom tag ${u}; use one of ${l}`)}return o.includes(a)||o.push(a),o},[])}var Sj=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,dd=class e{constructor({compat:t,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?G1(t,"compat"):t?G1(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?YC:{},this.tags=G1(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Fi,{value:$i}),Object.defineProperty(this,$s,{value:Cu}),Object.defineProperty(this,ha,{value:Pi}),this.sortMapEntries=typeof s=="function"?s:s===!0?Sj:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};var aue=B(x(),1);function XC(e,t){let r=[],n=t.directives===!0;if(t.directives!==!1&&e.directives){let u=e.directives.toString(e);u?(r.push(u),n=!0):e.directives.docStart&&(n=!0)}n&&r.push("---");let i=I1(e,t),{commentString:o}=i.options;if(e.commentBefore){r.length!==1&&r.unshift("");let u=o(e.commentBefore);r.unshift(Js(u,""))}let s=!1,a=null;if(e.contents){if(kt(e.contents)){if(e.contents.spaceBefore&&n&&r.push(""),e.contents.commentBefore){let h=o(e.contents.commentBefore);r.push(Js(h,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let u=a?void 0:()=>s=!0,l=ma(e.contents,i,()=>a=null,u);a&&(l+=lo(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ma(e.contents,i));if(e.directives?.docEnd)if(e.comment){let u=o(e.comment);u.includes(`
|
||
`)?(r.push("..."),r.push(Js(u,""))):r.push(`... ${u}`)}else r.push("...");else{let u=e.comment;u&&s&&(u=u.replace(/^\n+/,"")),u&&((!s||a)&&r[r.length-1]!==""&&r.push(""),r.push(Js(o(u),"")))}return r.join(`
|
||
`)+`
|
||
`}var ga=class e{constructor(t,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Vn,{value:y1});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new co({version:s}),this.setSchema(s,n),this.contents=t===void 0?null:this.createNode(t,i,n)}clone(){let t=Object.create(e.prototype,{[Vn]:{value:y1}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=kt(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){df(this.contents)&&this.contents.add(t)}addIn(t,r){df(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let n=py(this);t.anchor=!r||n.has(r)?my(r||"a",n):r}return new da(t.anchor)}createNode(t,r,n){let i;if(typeof r=="function")t=r.call({"":t},"",t),i=r;else if(Array.isArray(r)){let y=E=>typeof E=="number"||E instanceof String||E instanceof Number,w=r.filter(y).map(String);w.length>0&&(r=r.concat(w)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:u,onTagObj:l,tag:h}=n??{},{onAnchor:m,setAnchors:p,sourceObjects:d}=BC(this,s||"a"),v={aliasDuplicateObjects:o??!0,keepUndefined:u??!1,onAnchor:m,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:d},g=pa(t,h,v);return a&&qt(g)&&(g.flow=!0),p(),g}createPair(t,r,n={}){let i=this.createNode(t,null,n),o=this.createNode(r,null,n);return new dr(i,o)}delete(t){return df(this.contents)?this.contents.delete(t):!1}deleteIn(t){return af(t)?this.contents==null?!1:(this.contents=null,!0):df(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return qt(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return af(t)?!r&&dt(this.contents)?this.contents.value:this.contents:qt(this.contents)?this.contents.getIn(t,r):void 0}has(t){return qt(this.contents)?this.contents.has(t):!1}hasIn(t){return af(t)?this.contents!==void 0:qt(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=rd(this.schema,[t],r):df(this.contents)&&this.contents.set(t,r)}setIn(t,r){af(t)?this.contents=r:this.contents==null?this.contents=rd(this.schema,Array.from(t),r):df(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let n;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new co({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new co({version:t}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new dd(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},u=Lr(this.contents,r??"",a);if(typeof o=="function")for(let{count:l,res:h}of a.anchors.values())o(h,l);return typeof s=="function"?Au(s,{"":u},"",u):u}toJSON(t,r){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:r})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let r=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return XC(this,t)}};function df(e){if(qt(e))return!0;throw new Error("Expected a YAML collection as document contents")}var Aue=B(x(),1),pd=class extends Error{constructor(t,r,n,i){super(),this.name=t,this.code=n,this.message=i,this.pos=r}},ki=class extends pd{constructor(t,r,n){super("YAMLParseError",t,r,n)}},md=class extends pd{constructor(t,r,n){super("YAMLWarning",t,r,n)}},Iy=(e,t)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>t.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let o=i-1,s=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
||
`),s=a+s}if(/[^ ]/.test(s)){let a=1,u=r.linePos[1];u?.line===n&&u.col>i&&(a=Math.max(1,Math.min(u.col-i,80-o)));let l=" ".repeat(o)+"^".repeat(a);r.message+=`:
|
||
|
||
${s}
|
||
${l}
|
||
`}};var Mce=B(x(),1);var Tce=B(x(),1);var hce=B(x(),1);var Hue=B(x(),1);var _ue=B(x(),1);function fo(e,{flow:t,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let u=!1,l=a,h=a,m="",p="",d=!1,v=!1,g=null,y=null,w=null,E=null,_=null,C=null,F=null;for(let S of e)switch(v&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&o(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),g&&(l&&S.type!=="comment"&&S.type!=="newline"&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),S.type){case"space":!t&&(r!=="doc-start"||n?.type!=="flow-collection")&&S.source.includes(" ")&&(g=S),h=!0;break;case"comment":{h||o(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let I=S.source.substring(1)||" ";m?m+=p+I:m=I,p="",l=!1;break}case"newline":l?m?m+=S.source:(!C||r!=="seq-item-ind")&&(u=!0):p+=S.source,l=!0,d=!0,(y||w)&&(E=S),h=!0;break;case"anchor":y&&o(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&o(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=S,F??(F=S.offset),l=!1,h=!1,v=!0;break;case"tag":{w&&o(S,"MULTIPLE_TAGS","A node can have at most one tag"),w=S,F??(F=S.offset),l=!1,h=!1,v=!0;break}case r:(y||w)&&o(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),C&&o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${t??"collection"}`),C=S,l=r==="seq-item-ind"||r==="explicit-key-ind",h=!1;break;case"comma":if(t){_&&o(S,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),_=S,l=!1,h=!1;break}default:o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),l=!1,h=!1}let H=e[e.length-1],K=H?H.offset+H.source.length:i;return v&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(l&&g.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:_,found:C,spaceBefore:u,comment:m,hasNewline:d,anchor:y,tag:w,newlineAfterProp:E,end:K,start:F??K}}var Due=B(x(),1);function Du(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
||
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let r of t.start)if(r.type==="newline")return!0;if(t.sep){for(let r of t.sep)if(r.type==="newline")return!0}if(Du(t.key)||Du(t.value))return!0}return!1;default:return!0}}var Iue=B(x(),1);function gd(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];n.indent===e&&(n.source==="]"||n.source==="}")&&Du(t)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var Pue=B(x(),1);function W1(e,t,r){let{uniqueKeys:n}=e.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||dt(o)&&dt(s)&&o.value===s.value;return t.some(o=>i(o.key,r))}var ZC="All mapping items must start at the same column";function JC({composeNode:e,composeEmptyNode:t},r,n,i,o){let s=o?.nodeClass??Sr,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let u=n.offset,l=null;for(let h of n.items){let{start:m,key:p,sep:d,value:v}=h,g=fo(m,{indicator:"explicit-key-ind",next:p??d?.[0],offset:u,onError:i,parentIndent:n.indent,startOnNewline:!0}),y=!g.found;if(y){if(p&&(p.type==="block-seq"?i(u,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==n.indent&&i(u,"BAD_INDENT",ZC)),!g.anchor&&!g.tag&&!d){l=g.end,g.comment&&(a.comment?a.comment+=`
|
||
`+g.comment:a.comment=g.comment);continue}(g.newlineAfterProp||Du(p))&&i(p??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else g.found?.indent!==n.indent&&i(u,"BAD_INDENT",ZC);r.atKey=!0;let w=g.end,E=p?e(r,p,g,i):t(r,w,m,null,g,i);r.schema.compat&&gd(n.indent,p,i),r.atKey=!1,W1(r,a.items,E)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let _=fo(d??[],{indicator:"map-value-ind",next:v,offset:E.range[2],onError:i,parentIndent:n.indent,startOnNewline:!p||p.type==="block-scalar"});if(u=_.end,_.found){y&&(v?.type==="block-map"&&!_.hasNewline&&i(u,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&g.start<_.found.offset-1024&&i(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=v?e(r,v,_,i):t(r,u,d,null,_,i);r.schema.compat&&gd(n.indent,v,i),u=C.range[2];let F=new dr(E,C);r.options.keepSourceTokens&&(F.srcToken=h),a.items.push(F)}else{y&&i(E.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(E.comment?E.comment+=`
|
||
`+_.comment:E.comment=_.comment);let C=new dr(E);r.options.keepSourceTokens&&(C.srcToken=h),a.items.push(C)}}return l&&l<u&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,u,l??u],a}var Vue=B(x(),1);function QC({composeNode:e,composeEmptyNode:t},r,n,i,o){let s=o?.nodeClass??Sn,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let u=n.offset,l=null;for(let{start:h,value:m}of n.items){let p=fo(h,{indicator:"seq-item-ind",next:m,offset:u,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||m)m?.type==="block-seq"?i(p.end,"BAD_INDENT","All sequence items must start at the same column"):i(u,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(a.comment=p.comment);continue}let d=m?e(r,m,p,i):t(r,p.end,h,null,p,i);r.schema.compat&&gd(n.indent,m,i),u=d.range[2],a.items.push(d)}return a.range=[n.offset,u,l??u],a}var nce=B(x(),1);var Gue=B(x(),1);function ho(e,t,r,n){let i="";if(e){let o=!1,s="";for(let a of e){let{source:u,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let h=u.substring(1)||" ";i?i+=s+h:i=h,s="";break}case"newline":i&&(s+=u),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=u.length}}return{comment:i,offset:t}}var xy="Block collections are not allowed within flow collections",$y=e=>e&&(e.type==="block-map"||e.type==="block-seq");function e8({composeNode:e,composeEmptyNode:t},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",u=o?.nodeClass??(s?Sr:Sn),l=new u(r.schema);l.flow=!0;let h=r.atRoot;h&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let m=n.offset+n.start.source.length;for(let y=0;y<n.items.length;++y){let w=n.items[y],{start:E,key:_,sep:C,value:F}=w,H=fo(E,{flow:a,indicator:"explicit-key-ind",next:_??C?.[0],offset:m,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!H.found){if(!H.anchor&&!H.tag&&!C&&!F){y===0&&H.comma?i(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<n.items.length-1&&i(H.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),H.comment&&(l.comment?l.comment+=`
|
||
`+H.comment:l.comment=H.comment),m=H.end;continue}!s&&r.options.strict&&Du(_)&&i(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)H.comma&&i(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(H.comma||i(H.start,"MISSING_CHAR",`Missing , between ${a} items`),H.comment){let K="";e:for(let S of E)switch(S.type){case"comma":case"space":break;case"comment":K=S.source.substring(1);break e;default:break e}if(K){let S=l.items[l.items.length-1];It(S)&&(S=S.value??S.key),S.comment?S.comment+=`
|
||
`+K:S.comment=K,H.comment=H.comment.substring(K.length+1)}}if(!s&&!C&&!H.found){let K=F?e(r,F,H,i):t(r,H.end,C,null,H,i);l.items.push(K),m=K.range[2],$y(F)&&i(K.range,"BLOCK_IN_FLOW",xy)}else{r.atKey=!0;let K=H.end,S=_?e(r,_,H,i):t(r,K,E,null,H,i);$y(_)&&i(S.range,"BLOCK_IN_FLOW",xy),r.atKey=!1;let I=fo(C??[],{flow:a,indicator:"map-value-ind",next:F,offset:S.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(I.found){if(!s&&!H.found&&r.options.strict){if(C)for(let R of C){if(R===I.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}H.start<I.found.offset-1024&&i(I.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else F&&("source"in F&&F.source?.[0]===":"?i(F,"MISSING_CHAR",`Missing space after : in ${a}`):i(I.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let q=F?e(r,F,I,i):I.found?t(r,I.end,C,null,I,i):null;q?$y(F)&&i(q.range,"BLOCK_IN_FLOW",xy):I.comment&&(S.comment?S.comment+=`
|
||
`+I.comment:S.comment=I.comment);let L=new dr(S,q);if(r.options.keepSourceTokens&&(L.srcToken=w),s){let R=l;W1(r,R.items,S)&&i(K,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(L)}else{let R=new Sr(r.schema);R.flow=!0,R.items.push(L);let O=(q??S).range;R.range=[S.range[0],O[1],O[2]],l.items.push(R)}m=q?q.range[2]:I.end}}let p=s?"}":"]",[d,...v]=n.end,g=m;if(d?.source===p)g=d.offset+d.source.length;else{let y=a[0].toUpperCase()+a.substring(1),w=h?`${y} must end with a ${p}`:`${y} in block collection must be sufficiently indented and end with a ${p}`;i(m,h?"MISSING_CHAR":"BAD_INDENT",w),d&&d.source.length!==1&&v.unshift(d)}if(v.length>0){let y=ho(v,g,r.options.strict,i);y.comment&&(l.comment?l.comment+=`
|
||
`+y.comment:l.comment=y.comment),l.range=[n.offset,g,y.offset]}else l.range=[n.offset,g,g];return l}function Py(e,t,r,n,i,o){let s=r.type==="block-map"?JC(e,t,r,n,o):r.type==="block-seq"?QC(e,t,r,n,o):e8(e,t,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function t8(e,t,r,n,i){let o=n.tag,s=o?t.directives.tagName(o.source,p=>i(o,"TAG_RESOLVE_FAILED",p)):null;if(r.type==="block-seq"){let{anchor:p,newlineAfterProp:d}=n,v=p&&o?p.offset>o.offset?p:o:p??o;v&&(!d||d.offset<v.offset)&&i(v,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Sr.tagName&&a==="map"||s===Sn.tagName&&a==="seq")return Py(e,t,r,i,s);let u=t.schema.tags.find(p=>p.tag===s&&p.collection===a);if(!u){let p=t.schema.knownTags[s];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),u=p;else return p?i(o,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Py(e,t,r,i,s)}let l=Py(e,t,r,i,s,u),h=u.resolve?.(l,p=>i(o,"TAG_RESOLVE_FAILED",p),t.options)??l,m=kt(h)?h:new Ke(h);return m.range=l.range,m.tag=s,u?.format&&(m.format=u.format),m}var Cce=B(x(),1);var mce=B(x(),1);function ky(e,t,r){let n=t.offset,i=_j(t,e.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?Ke.BLOCK_FOLDED:Ke.BLOCK_LITERAL,s=t.source?Cj(t.source):[],a=s.length;for(let g=s.length-1;g>=0;--g){let y=s[g][1];if(y===""||y==="\r")a=g;else break}if(a===0){let g=i.chomp==="+"&&s.length>0?`
|
||
`.repeat(Math.max(1,s.length-1)):"",y=n+i.length;return t.source&&(y+=t.source.length),{value:g,type:o,comment:i.comment,range:[n,y,y]}}let u=t.indent+i.indent,l=t.offset+i.length,h=0;for(let g=0;g<a;++g){let[y,w]=s[g];if(w===""||w==="\r")i.indent===0&&y.length>u&&(u=y.length);else{y.length<u&&r(l+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(u=y.length),h=g,u===0&&!e.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=y.length+w.length+1}for(let g=s.length-1;g>=a;--g)s[g][0].length>u&&(a=g+1);let m="",p="",d=!1;for(let g=0;g<h;++g)m+=s[g][0].slice(u)+`
|
||
`;for(let g=h;g<a;++g){let[y,w]=s[g];l+=y.length+w.length+1;let E=w[w.length-1]==="\r";if(E&&(w=w.slice(0,-1)),w&&y.length<u){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(l-w.length-(E?2:1),"BAD_INDENT",C),y=""}o===Ke.BLOCK_LITERAL?(m+=p+y.slice(u)+w,p=`
|
||
`):y.length>u||w[0]===" "?(p===" "?p=`
|
||
`:!d&&p===`
|
||
`&&(p=`
|
||
|
||
`),m+=p+y.slice(u)+w,p=`
|
||
`,d=!0):w===""?p===`
|
||
`?m+=`
|
||
`:p=`
|
||
`:(m+=p+w,p=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let g=a;g<s.length;++g)m+=`
|
||
`+s[g][0].slice(u);m[m.length-1]!==`
|
||
`&&(m+=`
|
||
`);break;default:m+=`
|
||
`}let v=n+i.length+t.source.length;return{value:m,type:o,comment:i.comment,range:[n,v,v]}}function _j({offset:e,props:t},r,n){if(t[0].type!=="block-scalar-header")return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],o=i[0],s=0,a="",u=-1;for(let p=1;p<i.length;++p){let d=i[p];if(!a&&(d==="-"||d==="+"))a=d;else{let v=Number(d);!s&&v?s=v:u===-1&&(u=e+p)}}u!==-1&&n(u,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,h="",m=i.length;for(let p=1;p<t.length;++p){let d=t[p];switch(d.type){case"space":l=!0;case"newline":m+=d.source.length;break;case"comment":r&&!l&&n(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),m+=d.source.length,h=d.source.substring(1);break;case"error":n(d,"UNEXPECTED_TOKEN",d.message),m+=d.source.length;break;default:{let v=`Unexpected token in block scalar header: ${d.type}`;n(d,"UNEXPECTED_TOKEN",v);let g=d.source;g&&typeof g=="string"&&(m+=g.length)}}}return{mode:o,indent:s,chomp:a,comment:h,length:m}}function Cj(e){let t=e.split(/\n( *)/),r=t[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}var yce=B(x(),1);function Ry(e,t,r){let{offset:n,type:i,source:o,end:s}=e,a,u,l=(p,d,v)=>r(n+p,d,v);switch(i){case"scalar":a=Ke.PLAIN,u=Dj(o,l);break;case"single-quoted-scalar":a=Ke.QUOTE_SINGLE,u=Fj(o,l);break;case"double-quoted-scalar":a=Ke.QUOTE_DOUBLE,u=Bj(o,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let h=n+o.length,m=ho(s,h,t,r);return{value:u,type:a,comment:m.comment,range:[n,h,m.offset]}}function Dj(e,t){let r="";switch(e[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${e[0]}`;break}case"@":case"`":{r=`reserved character ${e[0]}`;break}}return r&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),r8(e)}function Fj(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),r8(e.slice(1,-1)).replace(/''/g,"'")}function r8(e){let t,r;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
||
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
||
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=t.exec(e);if(!n)return e;let i=n[1],o=" ",s=t.lastIndex;for(r.lastIndex=s;n=r.exec(e);)n[1]===""?o===`
|
||
`?i+=o:o=`
|
||
`:(i+=o+n[1],o=" "),s=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,n=a.exec(e),i+o+(n?.[1]??"")}function Bj(e,t){let r="";for(let n=1;n<e.length-1;++n){let i=e[n];if(!(i==="\r"&&e[n+1]===`
|
||
`))if(i===`
|
||
`){let{fold:o,offset:s}=Ij(e,n);r+=o,n=s}else if(i==="\\"){let o=e[++n],s=xj[o];if(s)r+=s;else if(o===`
|
||
`)for(o=e[n+1];o===" "||o===" ";)o=e[++n+1];else if(o==="\r"&&e[n+1]===`
|
||
`)for(o=e[++n+1];o===" "||o===" ";)o=e[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=$j(e,n+1,a,t),n+=a}else{let a=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(i===" "||i===" "){let o=n,s=e[n+1];for(;s===" "||s===" ";)s=e[++n+1];s!==`
|
||
`&&!(s==="\r"&&e[n+2]===`
|
||
`)&&(r+=n>o?e.slice(o,n+1):i)}else r+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),r}function Ij(e,t){let r="",n=e[t+1];for(;(n===" "||n===" "||n===`
|
||
`||n==="\r")&&!(n==="\r"&&e[t+2]!==`
|
||
`);)n===`
|
||
`&&(r+=`
|
||
`),t+=1,n=e[t+1];return r||(r=" "),{fold:r,offset:t}}var xj={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
||
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function $j(e,t,r,n){let i=e.substr(t,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,r+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Ty(e,t,r,n){let{value:i,type:o,comment:s,range:a}=t.type==="block-scalar"?ky(e,t,n):Ry(t,e.options.strict,n),u=r?e.directives.tagName(r.source,m=>n(r,"TAG_RESOLVE_FAILED",m)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[$s]:u?l=Pj(e.schema,i,u,r,n):t.type==="scalar"?l=kj(e,i,t,n):l=e.schema[$s];let h;try{let m=l.resolve(i,p=>n(r??t,"TAG_RESOLVE_FAILED",p),e.options);h=dt(m)?m:new Ke(m)}catch(m){let p=m instanceof Error?m.message:String(m);n(r??t,"TAG_RESOLVE_FAILED",p),h=new Ke(i)}return h.range=a,h.source=i,o&&(h.type=o),u&&(h.tag=u),l.format&&(h.format=l.format),s&&(h.comment=s),h}function Pj(e,t,r,n,i){if(r==="!")return e[$s];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),e[$s])}function kj({atKey:e,directives:t,schema:r},n,i,o){let s=r.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(n))||r[$s];if(r.compat){let a=r.compat.find(u=>u.default&&u.test?.test(n))??r[$s];if(s.tag!==a.tag){let u=t.tagString(s.tag),l=t.tagString(a.tag),h=`Value may be parsed as either ${u} or ${l}`;o(i,"TAG_RESOLVE_FAILED",h,!0)}}return s}var Fce=B(x(),1);function n8(e,t,r){if(t){r??(r=t.length);for(let n=r-1;n>=0;--n){let i=t[n];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++n];i?.type==="space";)e+=i.source.length,i=t[++n];break}}return e}var Rj={composeNode:Oy,composeEmptyNode:Y1};function Oy(e,t,r,n){let i=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:u}=r,l,h=!0;switch(t.type){case"alias":l=Tj(e,t,n),(a||u)&&n(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Ty(e,t,u,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=t8(Rj,e,t,r,n),a&&(l.anchor=a.source.substring(1))}catch(m){let p=m instanceof Error?m.message:String(m);n(t,"RESOURCE_EXHAUSTION",p)}break;default:{let m=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;n(t,"UNEXPECTED_TOKEN",m),h=!1}}return l??(l=Y1(e,t.offset,void 0,null,r,n)),a&&l.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!dt(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&n(u??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(l.spaceBefore=!0),s&&(t.type==="scalar"&&t.source===""?l.comment=s:l.commentBefore=s),e.options.keepSourceTokens&&h&&(l.srcToken=t),l}function Y1(e,t,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:u},l){let h={type:"scalar",offset:n8(t,r,n),indent:-1,source:""},m=Ty(e,h,a,l);return s&&(m.anchor=s.source.substring(1),m.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(m.spaceBefore=!0),o&&(m.comment=o,m.range[2]=u),m}function Tj({options:e},{offset:t,source:r,end:n},i){let o=new da(r.substring(1));o.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(t+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+r.length,a=ho(n,s,e.strict,i);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}function s8(e,t,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:t},e),u=new ga(void 0,a),l={atKey:!1,atRoot:!0,directives:u.directives,options:u.options,schema:u.schema},h=fo(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});h.found&&(u.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!h.hasNewline&&s(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),u.contents=i?Oy(l,i,h,s):Y1(l,h.end,n,null,h,s);let m=u.contents.range[2],p=ho(o,m,!1,s);return p.comment&&(u.comment=p.comment),u.range=[r,m,p.offset],u}function vd(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:r}=e;return[t,t+(typeof r=="string"?r.length:1)]}function i8(e){let t="",r=!1,n=!1;for(let i=0;i<e.length;++i){let o=e[i];switch(o[0]){case"#":t+=(t===""?"":n?`
|
||
|
||
`:`
|
||
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:t,afterEmptyLine:n}}var wd=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=vd(r);o?this.warnings.push(new md(s,n,i)):this.errors.push(new ki(s,n,i))},this.directives=new co({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:n,afterEmptyLine:i}=i8(this.prelude);if(n){let o=t.contents;if(r)t.comment=t.comment?`${t.comment}
|
||
${n}`:n;else if(i||t.directives.docStart||!o)t.commentBefore=n;else if(qt(o)&&!o.flow&&o.items.length>0){let s=o.items[0];It(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n}
|
||
${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n}
|
||
${s}`:n}}if(r){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:i8(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,r=!1,n=-1){for(let i of t)yield*this.next(i);yield*this.end(r,n)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(r,n,i)=>{let o=vd(t);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=s8(this.options,this.directives,t,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let r=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,n=new ki(vd(t),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new ki(vd(t),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=ho(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
||
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new ki(vd(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let n=Object.assign({_directives:this.directives},this.options),i=new ga(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,r,r],this.decorate(i,!1),yield i}}};var lle=B(x(),1);var tle=B(x(),1);var nle=B(x(),1);var ile=B(x(),1),Ny=Symbol("break visit"),Oj=Symbol("skip children"),o8=Symbol("remove item");function Bc(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),a8(Object.freeze([]),e,t)}Bc.BREAK=Ny;Bc.SKIP=Oj;Bc.REMOVE=o8;Bc.itemAtPath=(e,t)=>{let r=e;for(let[n,i]of t){let o=r?.[n];if(o&&"items"in o)r=o.items[i];else return}return r};Bc.parentCollection=(e,t)=>{let r=Bc.itemAtPath(e,t.slice(0,-1)),n=t[t.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function a8(e,t,r){let n=r(t,e);if(typeof n=="symbol")return n;for(let i of["key","value"]){let o=t[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=a8(Object.freeze(e.concat([[i,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===Ny)return Ny;a===o8&&(o.items.splice(s,1),s-=1)}}typeof n=="function"&&i==="key"&&(n=n(t,e))}}return typeof n=="function"?n(t,e):n}var Ly="\uFEFF",Uy="",Hy="",X1="";function u8(e){switch(e){case Ly:return"byte-order-mark";case Uy:return"doc-mode";case Hy:return"flow-error-end";case X1:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
||
`:case`\r
|
||
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}var gle=B(x(),1);function Ri(e){switch(e){case void 0:case" ":case`
|
||
`:case"\r":case" ":return!0;default:return!1}}var c8=new Set("0123456789ABCDEFabcdef"),Lj=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Z1=new Set(",[]{}"),Uj=new Set(` ,[]{}
|
||
\r `),My=e=>!e||Uj.has(e),yd=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
|
||
`?!0:r==="\r"?this.buffer[t+1]===`
|
||
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let r=this.buffer[t];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+t];if(r==="\r"){let i=this.buffer[n+t+1];if(i===`
|
||
`||!i&&!this.atEnd)return t+n+1}return r===`
|
||
`||n>=this.indentNext||!r&&!this.atEnd?t+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(t,3);if((n==="---"||n==="...")&&Ri(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
||
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Ly&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let r=t.length,n=t.indexOf("#");for(;n!==-1;){let o=t[n-1];if(o===" "||o===" "){r=n-1;break}else n=t.indexOf("#",n+1)}for(;;){let o=t[r-1];if(o===" "||o===" ")r-=1;else break}let i=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-r),yield*this.pushNewline(),"stream"}return yield Uy,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&Ri(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ri(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ri(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(My),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,n=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&Ri(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Hy,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(My),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||Ri(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),i=n.indexOf(`
|
||
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=n.indexOf(`
|
||
`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let r=this.buffer[++t];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Ri(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case`
|
||
`:t=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
||
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(t+1);if(o===-1)break;t=this.buffer.indexOf(`
|
||
`,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
||
`;)n=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let o=t-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
|
||
`&&o>=this.pos&&o+1+r>a)t=o;else break}while(!0);return yield X1,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Ri(o)||t&&Z1.has(o))break;r=n}else if(Ri(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===`
|
||
`?(n+=1,i=`
|
||
`,o=this.buffer[n+1]):r=n),o==="#"||t&&Z1.has(o))break;if(i===`
|
||
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(t&&Z1.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield X1,yield*this.pushToIndex(r+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,r){let n=this.buffer.slice(this.pos,t);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(My),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Ri(n)||r&&Z1.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!Ri(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if(Lj.has(r))r=this.buffer[++t];else if(r==="%"&&c8.has(this.buffer[t+1])&&c8.has(this.buffer[t+2]))r=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
||
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
||
`?yield*this.pushCount(2):0}*pushSpaces(t){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||t&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(t){let r=this.pos,n=this.buffer[r];for(;!t(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};var wle=B(x(),1),Ed=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let r=0,n=this.lineStarts.length;for(;r<n;){let o=r+n>>1;this.lineStarts[o]<t?r=o+1:n=o}if(this.lineStarts[r]===t)return{line:r+1,col:1};if(r===0)return{line:0,col:t};let i=this.lineStarts[r-1];return{line:r,col:t-i+1}}}};var Ale=B(x(),1);function Fu(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function l8(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function h8(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function J1(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function pf(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Q1(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let r=0;r<t.length;++r)e.push(t[r])}function f8(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Fu(t.start,"explicit-key-ind")&&!Fu(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,h8(t.value)?t.value.end?Q1(t.value.end,t.sep):t.value.end=t.sep:Q1(t.start,t.sep),delete t.sep)}var bd=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new yd,this.onNewLine=t}*parse(t,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(t,r))yield*this.next(n);r||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let r=u8(t);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let n=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let r=t??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&f8(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&l8(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{l8(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let r=J1(this.peek(2)),n=pf(r),i;t.end?(i=t.end,i.push(this.sourceToken),delete t.end):i=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:n,key:t,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
||
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
||
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Q1(i,r.start),i.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let n=!this.onKeyLine&&this.indent===t.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;a<r.sep.length;++a){let u=r.sep[a];switch(u.type){case"newline":s.push(a);break;case"space":break;case"comment":u.indent>t.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=r.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Fu(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(h8(r.key)&&!Fu(r.sep,"newline")){let s=pf(r.start),a=r.key,u=r.sep;u.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:u}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(Fu(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=pf(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?t.items.push({start:o,key:null,sep:[this.sourceToken]}):Fu(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||r.value?(t.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(s):(Object.assign(r,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(t);if(s){if(s.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Fu(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&t.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let r=t.items[t.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Q1(i,r.start),i.push(this.sourceToken),t.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=t.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;r.value||Fu(r.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>t.indent){let n=this.startBlockValue(t);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let r=t.items[t.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?t.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?t.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?t.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===t.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=J1(n),o=pf(i);f8(t);let s=t.end.splice(1,t.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let r=this.source.indexOf(`
|
||
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
||
`,r)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=J1(t),n=pf(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=J1(t),n=pf(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,r){return this.type!=="comment"||this.indent<=r?!1:t.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};var $le=B(x(),1);function Hj(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Ed||null,prettyErrors:t}}function Ad(e,t={}){let{lineCounter:r,prettyErrors:n}=Hj(t),i=new bd(r?.addNewLine),o=new wd(t),s=null;for(let a of o.compose(i.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new ki(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Iy(e,r)),s.warnings.forEach(Iy(e,r))),s}function qy(e,t,r){let n;typeof t=="function"?n=t:r===void 0&&t&&typeof t=="object"&&(r=t);let i=Ad(e,r);if(!i)return null;if(i.warnings.forEach(o=>x1(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function jy(e,t,r){let n=null;if(typeof t=="function"||Array.isArray(t)?n=t:r===void 0&&t&&(r=t),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=r??t??{};if(!i)return}return Bi(e)&&!n?e.toString(r):new ga(e,n,r).toString(r)}var qj={logLevel:"error",merge:!0};function p8(e,t,...r){try{return e(t,...r)}catch{return e(v8(e(t.replace(/!<str>\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function em(e){return JSON.parse(JSON.stringify(e))}function jj(e){return{...qj,...e||{}}}function Kj(e={}){let{forceQuotes:t,lineWidth:r,noArrayIndent:n,noRefs:i,quotingType:o,sortKeys:s,...a}=e||{},u={...a};return typeof r=="number"&&(u.lineWidth=r<=0?0:r),typeof n=="boolean"&&(u.indentSeq=!n),typeof i=="boolean"&&(u.aliasDuplicateObjects=!i),typeof s<"u"&&(u.sortMapEntries=s),o==="'"?u.singleQuote=!0:o==='"'&&(u.singleQuote=!1),t&&(u.defaultStringType=o==="'"?"QUOTE_SINGLE":"QUOTE_DOUBLE"),u}function m8(e,t){return qy(e,jj(t))}function g8(e,t){return jy(e,Kj(t))}function mf(e,...t){return p8(m8,em(e),...t)}function Vj(e,...t){return p8(m8,em(e),...t)}function d8(e,...t){return g8(em(e),...t)}function v8(e,...t){return g8(em(e),...t)}var ks={safeLoad:mf,load:Vj,safeDump:d8,dump:v8,parse:mf,stringify:d8};var t2e=B(x());var rfe=B(x());var pr="settings",tm="subs",Ky="collections",Ic="files",rm="modules",Sd="artifacts",w8="rules";var xc="#sub-store-cached-resource",$c="#sub-store-cached-headers-resource",Pc="#sub-store-cached-script-resource",Vy="#sub-store-logs";var gfe=B(x());var ife=B(x());var E8=1e4,zj=1e3,F8=["log","info","warn","error","debug"],b8="unknown",B8=/^Sub-Store\s+--\s+v\d+(?:\.\d+){0,3}$/,A8=/^\u2505{8,}$/,Gj=/^\[sub-store\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/,I8=/^\[[^\]\r\n]+\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/i,Wj=/^\[([^\]\r\n]+)\]\s*/,Yj=[/^(?:.+\sParser|Rule parser \[.+\]) is activated!?$/,/^Pre-processor \[.+\] activated!?$/,/^Fallback Base64 Pre-processor error: decoded line does not start with protocol$/,/^\[CORS\] allowed origins: .+$/],S8=!1,zy=!1,nm=null,_8=0;function Xj(e,{isNode:t}={}){let r=Array.from(e||[]);if(!t)return r;let n=new Date().toLocaleString();if(typeof r[0]=="string"){let[o,...s]=r;return[`${s.length?C8(n):n} ${o}`,...s]}return[r.length?C8(n):n,...r]}function C8(e){return`${e}`.replace(/%/g,"%%")}function Zj(e,t=0){let r=D8(t,0,E8);return D8(e,r,E8)}function Jj(e){return Array.from(e||[]).map(uK).join(" ")}function Qj(e){try{let t=e.read(Vy);if(!t)return[];let r=typeof t=="string"?JSON.parse(t):t;return Array.isArray(r)?r.filter(cK):[]}catch{return[]}}function eK(e,t){e.write(JSON.stringify(Array.isArray(t)?t:[]),Vy)}function tK(e,t,r){try{let n=rK(e);if(n===0)return;let i=Jj(r);if(sK(i))return;let o=Qj(e),s=$8(t);o.push({id:lK(),time:Date.now(),level:s,message:nK(i,s)}),eK(e,o.slice(-n))}catch{}}function x8(e){S8||typeof console>"u"||(S8=!0,F8.forEach(t=>{let r=console[t];typeof r=="function"&&(console[t]=function(...n){if(r.apply(console,Xj(n,{isNode:e.env.isNode})),!zy)try{zy=!0,tK(e,t,n)}finally{zy=!1}})}))}function rK(e){let t=Date.now();if(nm!==null&&t<_8)return nm;let r=e.read(pr)||{};return nm=Zj(r.logsMaxCount),_8=t+zj,nm}function D8(e,t,r){if(e==null||e==="")return t;let n=Number(e);return!isFinite(n)||n<0?t:Math.min(Math.floor(n),r)}function $8(e){return F8.includes(e)?e:"log"}function nK(e,t){let r=`${e||""}`;if(I8.test(r))return r;let n=$8(t).toUpperCase(),i=r.match(Wj);if(i){let o=i[1].trim()||b8,s=r.slice(i[0].length).trimStart();return`[${o}] ${n}: ${s}`}return`[${b8}] ${n}: ${r}`}function sK(e){let t=iK(e);return t.length===1?B8.test(t[0])||aK(t[0]):oK(t)}function iK(e){let t=`${e||""}`.split(/\r?\n/).map(n=>n.trim()).filter(Boolean);if(t.length===0)return t;let r=t[0].replace(I8,"").trim();return r!==t[0]&&(r?t[0]=r:t.shift()),t}function oK(e){return e.length<3||!A8.test(e[0])||!A8.test(e[e.length-1])?!1:e.slice(1,-1).some(t=>B8.test(t))}function aK(e){let t=e.replace(Gj,"");return Yj.some(r=>r.test(t))}function uK(e){if(e instanceof Error)return e.stack||e.message||String(e);if(typeof e=="string")return e;if(e==null)return String(e);if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function cK(e){return e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.time=="number"&&typeof e.level=="string"&&typeof e.message=="string"}function lK(){return`${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var ffe=B(x());var ufe=B(x());function po(e){if(Qs().isNode)try{return e()}catch{return}}function mo(){return po(()=>vu("fs"))}var Bu=typeof $task<"u",vo=typeof $loon<"u",va=typeof Egern<"u",Iu=typeof $httpClient<"u"&&!vo&&!va,go=eval('typeof process !== "undefined"'),P8=typeof $environment<"u"&&$environment["stash-version"],k8=typeof $rocket<"u",fK=typeof $native<"u",xu=typeof $Plugins<"u",hK=vo&&typeof $loon=="object"&&$loon!==null&&$loon.isSubsCheckPro===!0;function sm(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function dK(e){let[t,r,n,i,o,s,a]=e.match(/^socks5:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(o)o=parseInt(o,10);else throw $.error(`port is not present in line: ${e}`),new Error(`port is not present in line: ${e}`);return{type:5,host:i,port:o,userId:r!=null?decodeURIComponent(r):void 0,password:n!=null?decodeURIComponent(n):void 0}}function pK(e){let t=[],r=!1;for(let[n,i]of Object.entries(e||{})){let o=n.toLowerCase();o==="accept"&&(r=!0,i==null)||t.push([o,i])}return r||t.push(["accept","*/*"]),Object.fromEntries(t)}var im=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=wo(),this.env=Qs(),go){let dotenv=eval('require("dotenv")');dotenv.config()}this.node=go?{fs:mo()}:null,this.initCache(),x8(this);let delay=(e,t)=>new Promise(function(r){setTimeout(r.bind(null,t),e)});Promise.prototype.delay=async function(e){let t=await this;return await delay(e,t)}}initCache(){if(Bu&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(vo||Iu||va)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),xu&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),go){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}`)}sm(this.root)||(this.node.fs.writeFileSync(rootPath,JSON.stringify({}),{flag:"w"}),this.root={});let fpath=`${basePath}/${this.name}.json`,backupPath=`${basePath}/${this.name}_${Date.now()}.json`;if(this.log(`Data path: ${fpath}`),this.node.fs.existsSync(fpath))try{if(this.cache=JSON.parse(this.node.fs.readFileSync(`${fpath}`,"utf-8")),!sm(this.cache))throw new Error("Invalid Data")}catch{try{let t=bt.decode(this.node.fs.readFileSync(`${fpath}`,"utf-8"));if(this.cache=JSON.parse(t),this.node.fs.writeFileSync(fpath,t,{flag:"w"}),!sm(this.cache))throw new Error("Invalid Data")}catch(t){this.node.fs.copyFileSync(fpath,backupPath),this.error(`Failed to parse ${fpath}: ${t.message}. Backup created at ${backupPath}`)}}sm(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(Bu&&$prefs.setValueForKey(data,this.name),(vo||Iu||va)&&$persistentStore.write(data,this.name),xu&&$Plugins.SubStoreCache.set(this.name,data),go){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),Iu||vo||va)return $persistentStore.write(e,t);if(Bu)return $prefs.setValueForKey(e,t);if(go&&(this.root[t]=e),xu)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),Iu||vo||va)return $persistentStore.read(e);if(Bu)return $prefs.valueForKey(e);if(go)return this.root[e];if(xu)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),Iu||vo||va)return $persistentStore.write(null,e);if(Bu)return $prefs.removeValueForKey(e);if(go&&delete this.root[e],xu)return $Plugins.SubStoreCache.remove(e)}else delete this.cache[e];this.persistCache()}notify(title,subtitle="",content="",options={}){let openURL=options["open-url"],mediaURL=options["media-url"];if(Bu&&$notify(title,subtitle,content,options),(Iu||va)&&$notification.post(title,subtitle,content+`${mediaURL?`
|
||
\u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),vo){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(go){let content_=content+(openURL?`
|
||
\u70B9\u51FB\u8DF3\u8F6C: ${openURL}`:"")+(mediaURL?`
|
||
\u591A\u5A92\u4F53: ${mediaURL}`:"");console.log(`[Notify] ${title}
|
||
${subtitle}
|
||
${content_}
|
||
|
||
`);let push=eval("process.env.SUB_STORE_PUSH_SERVICE");if(push)if(/^https?:\/\//.test(push)){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(`
|
||
`)));wo().get({url:e}).then(r=>{console.log(`[Push Service] URL: ${e}
|
||
RES: ${r.statusCode} ${r.body}`)}).catch(r=>{console.log(`[Push Service] URL: ${e}
|
||
ERROR: ${r}`)})}else eval('import("shoutrrr-ts")').then(({send:e})=>e(push,`${title}
|
||
${subtitle}
|
||
${content_}`,{transport:mK(wo())}).then(()=>console.log("[Push Service] RES: sent"),t=>console.log(`[Push Service] ERROR: ${t.message}`))).catch(()=>console.log("[Push Service] ERROR: notification delivery failed"))}xu&&$Plugins.Notify(title,subtitle+`
|
||
`+content)}log(e){this.debug&&console.log(`[${this.name}] LOG: ${e}`)}info(e){console.log(`[${this.name}] INFO: ${e}`)}warn(e){console.log(`[${this.name}] WARN: ${e}`)}error(e){console.log(`[${this.name}] ERROR: ${e}`)}wait(e){return new Promise(t=>setTimeout(t,e))}done(e={}){Bu||vo||Iu||xu||va?$done(e):go&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function Qs(){return{isQX:Bu,isLoon:vo,isSurge:Iu,isNode:go,isStash:P8,isShadowRocket:k8,isEgern:va,isLanceX:fK,isGUIforCores:xu,isSubsCheckPro:hK}}function mK(e){return async(t,r={})=>{let n=r.body;if(n!=null&&typeof n!="string"&&!(n instanceof Uint8Array)&&!(n instanceof ArrayBuffer))throw new Error("unsupported notification request body");let i=Object.fromEntries(new Headers(r.headers).entries()),o=await e.request({url:t,method:r.method||"GET",headers:i,body:n instanceof ArrayBuffer?new Uint8Array(n):n,encoding:null,timeout:8e3});return new Response([204,205,304].includes(o.statusCode)?null:o.body,{status:o.statusCode})}}function wo(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores,isEgern}=Qs(),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()@:%_+.~#?&//=]*)/,requestIdCounter=0;function generateRequestId(){return`${Date.now()}-${++requestIdCounter}`}async 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,requestId=options.requestId||generateRequestId(),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;return isQX?worker=$task.fetch({method,url:options.url,headers:options.headers,body:options.body,opts:options.opts}):isLoon||isSurge||isNode||isEgern?worker=new Promise((resolve,reject)=>{let body=options.body,opts=JSON.parse(JSON.stringify(options));if(opts.body=body,opts.timeout=Number(opts.timeout)||8e3,isNode){let undici=eval("require('undici')"),{socksDispatcher}=eval("require('fetch-socks')"),defaultMaxHeaderSize=32*1024,parsedMaxHeaderSize=Number.parseInt(eval("process.env.SUB_STORE_MAX_HEADER_SIZE"),10),maxHeaderSize=Number.isInteger(parsedMaxHeaderSize)&&parsedMaxHeaderSize>0?parsedMaxHeaderSize:defaultMaxHeaderSize,{ProxyAgent,EnvHttpProxyAgent,request,interceptors}=undici,allowH2=opts.allowH2!==!1,agentOpts={connect:{rejectUnauthorized:!(opts.strictSSL===!1||opts.insecure===!0||opts.rejectUnauthorized===!1),allowH2},bodyTimeout:opts.timeout,headersTimeout:opts.timeout,maxHeaderSize,allowH2},tlsOptions={rejectUnauthorized:agentOpts.connect.rejectUnauthorized,allowH2};opts.tls={...opts.tls||{},...tlsOptions};try{let url=new URL(opts.url);(url.username||url.password)&&(opts.headers={...opts.headers||{},Authorization:`Basic ${Buffer.from(`${decodeURIComponent(url.username)}:${decodeURIComponent(url.password)}`).toString("base64")}`}),opts.headers=pK(opts.headers);let dispatcher;if(!opts.proxy){let allProxy=eval("process.env.all_proxy")||eval("process.env.ALL_PROXY");allProxy&&/^socks5:\/\//.test(allProxy)&&(opts.proxy=allProxy)}opts.proxy?/^socks5:\/\//.test(opts.proxy)?dispatcher=socksDispatcher(dK(opts.proxy),{...agentOpts,requestTls:tlsOptions}):dispatcher=new ProxyAgent({...agentOpts,uri:opts.proxy,requestTls:tlsOptions,proxyTunnel:opts.proxyTunnel}):dispatcher=new EnvHttpProxyAgent({...agentOpts,requestTls:tlsOptions,proxyTunnel:opts.proxyTunnel}),request(opts.url,{...opts,method:method.toUpperCase(),dispatcher:dispatcher.compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirect:!0}),interceptors.decompress({skipErrorResponses:!1}))}).then(async e=>{let t=opts.encoding===null?await e.body.arrayBuffer():await e.body.text();resolve({statusCode:e.statusCode,headers:e.headers,body:t,requestId})}).catch(reject)}catch(e){reject(e)}}else{(isSurge||isEgern||P8||k8)&&(opts.timeout=Math.ceil(opts.timeout/1e3));try{$httpClient[method.toLowerCase()](opts,(e,t,r)=>{if(e){reject(e);return}resolve({statusCode:t?.status||t?.statusCode,headers:t?.headers||{},body:r,requestId})})}catch(e){reject(e)}}}):isGUIforCores&&(worker=new Promise(async(e,t)=>{try{let r=await $Plugins.Requests({method,url:options.url,headers:options.headers,body:options.body,autoTransformBody:!1,options:{Proxy:options.proxy,Timeout:options.timeout?options.timeout/1e3:15}});e({statusCode:r.status,headers:r.headers,body:r.body,requestId})}catch(r){t(r)}})),new Promise((e,t)=>{let r=!1,n=!1,i=null,o=()=>{i!==null&&(clearTimeout(i),i=null)},s=async u=>{if(!(r||n)){n=!0;try{if(await Promise.resolve(events.onResponse(u)),r)return;r=!0,o(),e({...u,requestId})}catch(l){if(r)return;r=!0,o(),t(l)}}},a=u=>{r||(r=!0,o(),t(u))};worker.then(async u=>{await s(u)},u=>{a(u)}),timeout&&(i=setTimeout(()=>{if(!r){try{events.onTimeout()}catch{}a(new Error(`${method} URL: ${options.url} exceeds the timeout ${timeout} ms`))}},timeout))})}let http={request:e=>send(e.method||"GET",e)};return methods.forEach(e=>http[e.toLowerCase()]=t=>send(e,t)),http}var wfe=B(x()),R8=0;function Ur(e){return vK(gK(wK(e)))}function gK(e){return EK(bK(yK(e),e.length*8))}function vK(e){for(var t=R8?"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 wK(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 yK(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 EK(e){for(var t="",r=0;r<e.length*32;r+=8)t+=String.fromCharCode(e[r>>5]>>>r%32&255);return t}function bK(e,t){e[t>>5]|=128<<t%32,e[(t+64>>>9<<4)+14]=t;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s<e.length;s+=16){var a=r,u=n,l=i,h=o;r=Cn(r,n,i,o,e[s+0],7,-680876936),o=Cn(o,r,n,i,e[s+1],12,-389564586),i=Cn(i,o,r,n,e[s+2],17,606105819),n=Cn(n,i,o,r,e[s+3],22,-1044525330),r=Cn(r,n,i,o,e[s+4],7,-176418897),o=Cn(o,r,n,i,e[s+5],12,1200080426),i=Cn(i,o,r,n,e[s+6],17,-1473231341),n=Cn(n,i,o,r,e[s+7],22,-45705983),r=Cn(r,n,i,o,e[s+8],7,1770035416),o=Cn(o,r,n,i,e[s+9],12,-1958414417),i=Cn(i,o,r,n,e[s+10],17,-42063),n=Cn(n,i,o,r,e[s+11],22,-1990404162),r=Cn(r,n,i,o,e[s+12],7,1804603682),o=Cn(o,r,n,i,e[s+13],12,-40341101),i=Cn(i,o,r,n,e[s+14],17,-1502002290),n=Cn(n,i,o,r,e[s+15],22,1236535329),r=Dn(r,n,i,o,e[s+1],5,-165796510),o=Dn(o,r,n,i,e[s+6],9,-1069501632),i=Dn(i,o,r,n,e[s+11],14,643717713),n=Dn(n,i,o,r,e[s+0],20,-373897302),r=Dn(r,n,i,o,e[s+5],5,-701558691),o=Dn(o,r,n,i,e[s+10],9,38016083),i=Dn(i,o,r,n,e[s+15],14,-660478335),n=Dn(n,i,o,r,e[s+4],20,-405537848),r=Dn(r,n,i,o,e[s+9],5,568446438),o=Dn(o,r,n,i,e[s+14],9,-1019803690),i=Dn(i,o,r,n,e[s+3],14,-187363961),n=Dn(n,i,o,r,e[s+8],20,1163531501),r=Dn(r,n,i,o,e[s+13],5,-1444681467),o=Dn(o,r,n,i,e[s+2],9,-51403784),i=Dn(i,o,r,n,e[s+7],14,1735328473),n=Dn(n,i,o,r,e[s+12],20,-1926607734),r=Fn(r,n,i,o,e[s+5],4,-378558),o=Fn(o,r,n,i,e[s+8],11,-2022574463),i=Fn(i,o,r,n,e[s+11],16,1839030562),n=Fn(n,i,o,r,e[s+14],23,-35309556),r=Fn(r,n,i,o,e[s+1],4,-1530992060),o=Fn(o,r,n,i,e[s+4],11,1272893353),i=Fn(i,o,r,n,e[s+7],16,-155497632),n=Fn(n,i,o,r,e[s+10],23,-1094730640),r=Fn(r,n,i,o,e[s+13],4,681279174),o=Fn(o,r,n,i,e[s+0],11,-358537222),i=Fn(i,o,r,n,e[s+3],16,-722521979),n=Fn(n,i,o,r,e[s+6],23,76029189),r=Fn(r,n,i,o,e[s+9],4,-640364487),o=Fn(o,r,n,i,e[s+12],11,-421815835),i=Fn(i,o,r,n,e[s+15],16,530742520),n=Fn(n,i,o,r,e[s+2],23,-995338651),r=Bn(r,n,i,o,e[s+0],6,-198630844),o=Bn(o,r,n,i,e[s+7],10,1126891415),i=Bn(i,o,r,n,e[s+14],15,-1416354905),n=Bn(n,i,o,r,e[s+5],21,-57434055),r=Bn(r,n,i,o,e[s+12],6,1700485571),o=Bn(o,r,n,i,e[s+3],10,-1894986606),i=Bn(i,o,r,n,e[s+10],15,-1051523),n=Bn(n,i,o,r,e[s+1],21,-2054922799),r=Bn(r,n,i,o,e[s+8],6,1873313359),o=Bn(o,r,n,i,e[s+15],10,-30611744),i=Bn(i,o,r,n,e[s+6],15,-1560198380),n=Bn(n,i,o,r,e[s+13],21,1309151649),r=Bn(r,n,i,o,e[s+4],6,-145523070),o=Bn(o,r,n,i,e[s+11],10,-1120210379),i=Bn(i,o,r,n,e[s+2],15,718787259),n=Bn(n,i,o,r,e[s+9],21,-343485551),r=$u(r,a),n=$u(n,u),i=$u(i,l),o=$u(o,h)}return Array(r,n,i,o)}function om(e,t,r,n,i,o){return $u(AK($u($u(t,e),$u(n,o)),i),r)}function Cn(e,t,r,n,i,o,s){return om(t&r|~t&n,e,t,i,o,s)}function Dn(e,t,r,n,i,o,s){return om(t&n|r&~n,e,t,i,o,s)}function Fn(e,t,r,n,i,o,s){return om(t^r^n,e,t,i,o,s)}function Bn(e,t,r,n,i,o,s){return om(r^(t|~n),e,t,i,o,s)}function $u(e,t){var r=(e&65535)+(t&65535),n=(e>>16)+(t>>16)+(r>>16);return n<<16|r&65535}function AK(e,t){return e<<t|e>>>32-t}var Lfe=B(x()),mm=B(K8()),_V=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,CV=/^(([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 _r(e){return _V.test(e)}function Xt(e){return CV.test(e)}function V8(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 qe(e){return typeof e=="string"&&e.trim().length>0}function vt(e,t){return qe(e)?e:t}function gf(e){return typeof e<"u"&&e!==null}function wa(e,t){return gf(e)?e:t}function ya(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function DV(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function Cd(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return DV(n,i)}else return Number(r)}function z8(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function gm(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 Ge(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}var Wfe=B(x());var Kfe=B(x()),Mfe=B(W8());var FV=new im("sub-store"),Q=FV;var tE=class{constructor(){Q.read(xc)||Q.write("{}",xc);try{this.resourceCache=JSON.parse(Q.read(xc))}catch(t){Q.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${xc} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},Q.write("{}",xc)}this._cleanup()}_cleanup(t,r){let n=eE(r)??0,i=!1,o=Date.now();Object.entries(this.resourceCache).forEach(s=>{let[a,u]=s;(!u.time||u.time<o+n)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],i=!0)}),i&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){Q.write(JSON.stringify(this.resourceCache),xc)}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()<=r?this.resourceCache[t].time:null}get(t,r,n){let i=eE(r)??0,o=this.resourceCache[t],s=o&&o.time;if(s){if(Date.now()+i<=s)return o.data;n&&(delete this.resourceCache[t],this._persist())}return null}set(t,r,n){let i=eE(n)??IV();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function eE(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function IV(){let t=(Q.read(pr)||{})?.resourceCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:36e5}var Hr=new tE;var Jfe=B(x());var nE=class{constructor(){Q.read($c)||Q.write("{}",$c);try{this.resourceCache=JSON.parse(Q.read($c))}catch(t){Q.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${$c} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},Q.write("{}",$c)}this._cleanup()}_cleanup(t,r){let n=rE(r)??0,i=!1,o=Date.now();Object.entries(this.resourceCache).forEach(s=>{let[a,u]=s;(!u.time||u.time<o+n)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],i=!0)}),i&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){Q.write(JSON.stringify(this.resourceCache),$c)}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()<=r?this.resourceCache[t].time:null}get(t,r,n){let i=rE(r)??0,o=this.resourceCache[t],s=o&&o.time;if(s){if(Date.now()+i<=s)return o.data;n&&(delete this.resourceCache[t],this._persist())}return null}set(t,r,n){let i=rE(n)??$V();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function rE(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function $V(){let t=(Q.read(pr)||{})?.headersCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:6e4}var Dd=new nE;var fhe=B(x());var rhe=B(x());var Y8=10,PV="backendRequestConcurrency",X8=0,kV="backendRequestConcurrencyWaitTime",Fd=0,oE=[];function RV(e){return new Promise(t=>setTimeout(t,e))}function TV(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return Y8;let t=Number(e);return!Number.isInteger(t)||t<1?Y8:t}function OV(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return X8;let t=Number(e);return!Number.isInteger(t)||t<0?X8:t}function sE(){let e=Q.read(pr)||{};return TV(e[PV])}function iE(){let e=Q.read(pr)||{};return OV(e[kV])}function NV(e,t){return`active=${Fd}, pending=${oE.length}, limit=${e}, waitTime=${t}ms`}function vm(e,t,r,n){Q.log(`[Backend Request Concurrency] ${e}: ${t} (${NV(r,n)})`)}function LV(){let e=oE.shift();e&&e()}async function UV(e){let t=sE(),r=iE();for(;Fd>=t;)vm("queued",e,t,r),await new Promise(n=>{oE.push(n)}),t=sE(),r=iE();Fd+=1,vm("acquired",e,t,r),r>0&&(vm("waiting before request",e,t,r),await RV(r))}function HV(e){Fd=Math.max(0,Fd-1),vm("released",e,sE(),iE()),LV()}async function vf(e,t="request"){await UV(t);try{return await e()}finally{HV(t)}}function Nc(e){let t=Object.keys(e),r="",n="",i="";for(let o of t){let s=o.toLowerCase();s==="subscription-userinfo"?r=e[o]:s==="profile-web-page-url"?n=e[o]:s==="plan-name"&&(i=e[o])}return`${r||""}${n?`; app_url=${encodeURIComponent(n)}`:""}${i?`; plan_name=${encodeURIComponent(i)}`:""}`}async function wm(rawUrl,ua,timeout,customProxy,flowUrl,flowHeaders){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}=Qs(),insecure=$arguments?.insecure?Q.env.isNode?{strictSSL:!1}:{insecure:!0}:void 0,{defaultProxy,defaultFlowUserAgent,defaultTimeout}=Q.read(pr)||{},proxy=customProxy||defaultProxy;Q.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultFlowUserAgent||"clash.meta/v1.19.34",requestTimeout=timeout||defaultTimeout||8e3,customHeaders,customHeadersArg=flowHeaders||$arguments?.flowHeaders||$arguments?.headers;if(customHeadersArg)try{let e=typeof customHeadersArg=="string"?JSON.parse(customHeadersArg):customHeadersArg;if(e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0){let t={"user-agent":userAgent};for(let r in e)t[r.toLowerCase()]=e[r];customHeaders=t}}catch(e){Q.error(`\u89E3\u6790\u81EA\u5B9A\u4E49 ${flowHeaders||$arguments?.flowHeaders?"flowHeaders":"headers"} \u5931\u8D25: ${e}`)}let id=Ur(`${customHeaders?JSON.stringify(customHeaders):userAgent}${url}`),cached=Dd.get(id),flowInfo;if(!$arguments?.noCache&&cached)Q.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),flowInfo=cached;else{let e=wo();if(flowUrl){let t;try{Q.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:r,body:n,statusCode:i}=await vf(()=>e.get({url,headers:customHeaders||{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ya(proxy):{},...insecure||{}}),"flow body GET");if(i<200||i>=400)throw new Error(`statusCode: ${i}`);t=r;let o=wf(n);if(Number.isFinite(o?.total)&&Number.isFinite(o?.usage?.download)&&Number.isFinite(o?.usage?.upload))flowInfo=n;else throw new Error("\u54CD\u5E94\u4F53\u4E2D\u672A\u5305\u542B\u5408\u6CD5\u7684\u6D41\u91CF\u4FE1\u606F")}catch(r){if(Q.error(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${r.message??r}`),t)try{let n=Nc(t),i=wf(n);if(Number.isFinite(i?.total)&&Number.isFinite(i?.usage?.download)&&Number.isFinite(i?.usage?.upload))Q.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u6210\u529F: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`),flowInfo=n;else throw new Error("\u54CD\u5E94\u4F53\u4E2D\u672A\u5305\u542B\u5408\u6CD5\u7684\u6D41\u91CF\u4FE1\u606F")}catch(n){Q.error(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${n.message??n}`)}}}else{try{Q.info(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await vf(()=>e.head({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{...customHeaders||{"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?ya(proxy):{},...insecure||{}}),"flow headers HEAD");flowInfo=Nc(t)}catch(t){Q.error(`\u4F7F\u7528 HEAD \u65B9\u6CD5\u4ECE\u54CD\u5E94\u5934\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F\u5931\u8D25: ${url}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}: ${t.message??t}`)}if(!flowInfo){Q.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:t}=await vf(()=>e.get({url:url.split(/[\r\n]+/).map(r=>r.trim()).filter(r=>r.length)[0],headers:{...customHeaders||{"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?ya(proxy):{},...insecure||{}}),"flow headers GET");flowInfo=Nc(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&Dd.set(id,flowInfo,$arguments?.headersCacheTtl?$arguments?.headersCacheTtl*1e3:void 0)}return flowInfo}function wf(e){if(!e)return;let t=e.match(/upload=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),r=t==null?0:Number(t[1]+t[2]),n=e.match(/download=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),i=Number(n[1]+n[2]),o=e.match(/total=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),s=Number(o[1]+o[2]),a=e.match(/expire=([-+]?)([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)/),u=a?Number(a[1]+a[2]):void 0,l=e.match(/reset_day=([0-9]+)/),h=l?Number(l[1]):void 0,m=e.match(/app_url=(.*?)\s*?(;|$)/),p=m?decodeURIComponent(m[1]):void 0,d=e.match(/plan_name=(.*?)\s*?(;|$)/),v=d?decodeURIComponent(d[1]):void 0;return{expires:u,total:s,usage:{upload:r,download:i},remainingDays:h,appUrl:p,planName:v}}function Bd(e,t="B"){let r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=r.indexOf(t);return e<1024||n===r.length-1?{value:(Math.round(e*100)/100).toString(),unit:t}:Bd(e/1024,r[++n])}function ym(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=Bd(Math.abs(n));i.value=n<0?"-"+i.value:i.value;let o=Bd(e.total);throw new Error(`\u6D41\u91CF\u5DF2\u7528\u5B8C: ${i.value} ${i.unit} / ${o.value} ${o.unit}`)}}}function Z8(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),o=new Date;if(i.setHours(0,0,0,0),o.setHours(0,0,0,0),i.getTime()>o.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<o;)s.setDate(s.getDate()+n);s.setHours(0,0,0,0);let a=s.getTime()-o.getTime();return Math.ceil(a/(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,o=i.getDate(),s=i.getMonth(),a=i.getFullYear(),u;return t>o?u=0:u=new Date(a,s+1,0).getDate(),u-o+t}}catch(t){Q.error(`getRmainingDays failed: ${t.message??t}`)}}function J8(e,t){try{let r=new Map;e.split(";").map(o=>o.trim()).filter(Boolean).forEach(o=>{let s=o.indexOf("=");if(s===-1)return;let a=o.slice(0,s).trim(),u=o.slice(s+1).trim();if(!r.has(a))try{let l=decodeURIComponent(u);if(["upload","download","total","expire","reset_day"].includes(a))try{l=Number(l),["expire","reset_day"].includes(a)&&(l<=0||!Number.isFinite(l))?l="":["upload","download","total"].includes(a)&&!Number.isFinite(l)?l=0:l=l.toFixed(0)}catch(h){Q.error(`Failed to convert value for key "${a}=${u}": ${h.message??h}`)}r.set(a,l)}catch{r.set(a,u)}});let n={},i={"subscription-userinfo":"","profile-web-page-url":"","plan-name":""};return r.forEach((o,s)=>{t&&s==="app_url"?i["profile-web-page-url"]=o:t&&s==="plan_name"?i["plan-name"]=o:n[s]=o}),Object.keys(n).length>0&&(i["subscription-userinfo"]=Object.entries(n).map(([o,s])=>`${o}=${encodeURIComponent(s)}`).join("; ")),t?i:i["subscription-userinfo"]}catch(r){return Q.error(`normalizeFlowHeader failed: ${r.message??r}`),t?{"subscription-userinfo":e}:e}}var dhe=B(x());function ri(e,t,r="name"){return e.find(n=>n[r]===t)}var Rge=B(x());var mhe=B(x());var vhe=B(x()),aE=class{constructor(t,r,n){this.code=t,this.message=r,this.details=n}};var Ea=class extends aE{constructor(t,r,n){super(t,r,n),this.type="RequestInvalidError"}};var She=B(x());var cE=new Map,uE=new Set,lE;function fE(e){return e?.cron==null?"":`${e.cron}`.trim()}function Q8(e){return fE(e).length>0}function MV(e){let t=e?.displayName??e?.["display-name"];return t==null?"":`${t}`.trim()}function eD(e){if(!e||typeof e!="object")return`${e}`;let t=e.name==null?"":`${e.name}`,r=MV(e);return!r||r===t?t:`${t} (${r})`}function qV(e){return!Q8(e)}function jV(cron){if(!(!cron||!Q.env.isNode))try{let{CronTime}=eval('require("cron")');new CronTime(cron)}catch(e){throw new Ea("INVALID_ARTIFACT_CRON",`Artifact cron ${cron} is invalid.`,`Reason: ${e.message??e}`)}}function KV(e){if(!e||typeof e!="object")return e;let t=fE(e);return t?(jV(t),e.cron=t,e):(delete e.cron,e)}function VV(){cE.forEach(e=>e.stop()),cE.clear()}async function zV(e,t,r){if(uE.has(e)){Q.info(`[ARTIFACT CRON] ${t} ${r} skipped: previous run is still running`);return}uE.add(e);try{Q.info(`[ARTIFACT CRON] ${t} ${r} started`),await lE(e),Q.info(`[ARTIFACT CRON] ${t} ${r} finished`)}catch(n){Q.error(`[ARTIFACT CRON] ${t} ${r} error: ${n.message??n}`)}finally{uE.delete(e)}}function GV(artifact){let cron=fE(artifact),name=artifact.name,logName=eD(artifact),{CronJob}=eval('require("cron")');try{let e=new CronJob(cron,async function(){await zV(name,logName,cron)},null,!0);cE.set(name,e),Q.info(`[ARTIFACT CRON] ${logName} ${cron} scheduled`)}catch(e){Q.error(`[ARTIFACT CRON] ${logName} ${cron} schedule error: ${e.message??e}`)}}function tD(){if(!Q.env.isNode||!lE)return;VV();let e=Q.read(Sd);(Array.isArray(e)?e:[]).filter(r=>r.sync&&r.source).filter(Q8).forEach(GV)}function bhe(e){Q.env.isNode&&(lE=e,tD())}var Ohe=B(x());var Che=B(x());function WV(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function YV(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var rD=[WV(),YV()];var Bhe=B(x());function XV(){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 nD(){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 ZV(){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))),nD().func(r))}}function JV(){return{type:"ALL",func:r=>{let n={"DEST-PORT":"DST-PORT","SRC-IP":"SRC-IP-CIDR","IN-PORT":"SRC-PORT"},i={payload:r.map(o=>{let s=`${n[o.type]||o.type},${o.content}`;return["IP-CIDR","IP-CIDR6","GEOIP"].includes(o.type)&&(o.options&&(o.options=o.options.filter(a=>["no-resolve"].includes(a))),s+=o.options?.length>0?`,${o.options.join(",")}`:""),s})};return ks.dump(i)}}}var sD={QX:XV(),Surge:nD(),Loon:ZV(),Clash:JV()};var xhe=B(x()),QV=[[/^(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 ez(){return{name:"Universal Rule Parser",test:()=>!0,parse:n=>{let i=n.split(`
|
||
`),o=[];for(let s of i)if(s=s.trim(),s.length!==0&&!/\s*#/.test(s))try{let a=s.split(",").map(h=>h.trim()),u=a[0],l=!1;for(let h of QV)if(h[0].test(u)){l=!0;let p={type:h[1],content:a[1]};["IP-CIDR","IP-CIDR6","GEOIP"].includes(p.type)&&(p.options=a.slice(2)),o.push(p)}if(!l)throw new Error("Invalid rule type: "+u)}catch(a){console.log(`Failed to parse line: ${s}
|
||
Reason: ${a}`)}return o}}}var iD=[ez()];var Em=(function(){function e(n){for(let i of rD)try{if(i.test(n))return Q.info(`Pre-processor [${i.name}] activated`),i.parse(n)}catch(o){Q.error(`Parser [${i.name}] failed
|
||
Reason: ${o}`)}return n}function t(n){n=e(n);for(let i of iD){let o;try{o=i.test(n)}catch{o=!1}if(o)return Q.info(`Rule parser [${i.name}] is activated!`),i.parse(n)}}function r(n,i){let o=sD[i];if(!o)throw new Error(`Target platform: ${i} is not supported!`);if(typeof o.type>"u"||o.type==="SINGLE")return n.map(s=>{try{return o.func(s)}catch(a){return console.log(`ERROR: cannot produce rule: ${JSON.stringify(s)}
|
||
Reason: ${a}`),""}}).filter(s=>s.length>0).join(`
|
||
`);if(o.type==="ALL")return o.func(n)}return{parse:t,produce:r}})();var Qme=B(x());var Hhe=B(x());var Ghe=B(x());var hE="https://api.github.com";function oD(e){let t;try{t=JSON.parse(e.body)}catch{}let r=t?.message?.error??t?.error??t?.message??e.body??"Unknown error";return`ERROR: HTTP ${e.statusCode}: ${r}`}function tz(e,t=hE){return(String(e??"").trim()||t).replace(/\/+$/,"")}function rz({githubApiUrl:e,githubProxy:t}={}){let r=tz(e),n=r!==hE,i=String(t||"").trim().replace(/\/+$/,"");return n?r:`${i?`${i}/`:""}${hE}`}function Vhe(e={}){return!!e?.gistToken}var yf=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=Qs(),{defaultProxy,githubApiTimeout,githubProxy,githubApiUrl}=Q.read(pr)||{},githubApiRequestTimeout=githubApiTimeout||1e4,githubGistBaseURL=rz({githubApiUrl,githubProxy}),proxy=defaultProxy;Q.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=wo({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?ya(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(oD(e)):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=wo({baseURL:githubGistBaseURL,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?ya(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(oD(e)):e}})),this.key=key,this.syncPlatform=syncPlatform,this._requestQueue=Promise.resolve();let queuedMethods=["get","post","put","patch","delete"];for(let e of queuedMethods){let t=this.http[e];typeof t=="function"&&(this.http[e]=(...r)=>new Promise((n,i)=>{this._requestQueue=this._requestQueue.then(()=>t.apply(this.http,r).then(n,i))}))}}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);Q.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,t={}){if(Object.keys(e).length===0)return Promise.reject("\u672A\u63D0\u4F9B\u9700\u4E0A\u4F20\u7684\u6587\u4EF6");let r=await this.locate(),n=e,i=t.emptyFileFallback,o=!!i?.filename,s={},a=async l=>{let h=await l;return Object.keys(s).length>0&&(h.subStoreUploadMeta=s),h},u=({actions:l,existingFiles:h,result:m})=>{if(!o)return;let p=i.filename,d=i.content??"",v=Object.keys(m).filter(g=>g!==p);Object.keys(m).length===0?(m[p]={content:d},s.emptyFileFallback={status:"created",filename:p},this.syncPlatform==="gitlab"?l.push({action:h[p]?"update":"create",file_path:p,content:d}):n[p]={content:d}):m[p]&&v.length>0?(delete m[p],s.emptyFileFallback={status:"removed",filename:p},this.syncPlatform==="gitlab"?l.push({action:"delete",file_path:p}):n[p]=null):m[p]&&v.length===0&&(s.emptyFileFallback={status:"retained",filename:p})};if(r?.id){this.syncPlatform==="gitlab"&&(r.files=r.files.reduce((m,p)=>(m[p.path]=p,m),{}));let l=[],h={...r.files};return Object.keys(n).map(m=>{h[m]?n[m].content==null||n[m].content===""?(delete h[m],n[m]=null,l.push({action:"delete",file_path:m})):(h[m]=n[m],l.push({action:"update",file_path:m,content:n[m].content})):n[m].content==null||n[m].content===""?(delete h[m],delete n[m]):(h[m]=n[m],l.push({action:"create",file_path:m,content:n[m].content}))}),u({actions:l,existingFiles:r.files,result:h}),this.syncPlatform==="gitlab"?Object.keys(h).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(h).length>10?Promise.reject("\u672C\u6B21\u64CD\u4F5C\u5C06\u5BFC\u81F4 snippet \u7684\u6587\u4EF6\u6570\u8D85\u8FC7 10, \u65E0\u6CD5\u66F4\u65B0 snippet"):(n=l,a(this.http.put({headers:{...this.headers,"Content-Type":"application/json"},url:`/snippets/${r.id}`,body:JSON.stringify({files:n})}))):Object.keys(h).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"):a(this.http.patch({url:`/gists/${r.id}`,headers:{...this.headers,"Accept-Encoding":"gzip, deflate, br"},body:JSON.stringify({files:n})}))}else return n=Object.entries(n).reduce((l,[h,m])=>(m.content!==null&&m.content!==""&&(l[h]=m),l),{}),this.syncPlatform==="gitlab"?Object.keys(n).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA snippet"):(n=Object.keys(n).map(l=>({file_path:l,content:n[l].content})),a(this.http.post({headers:{...this.headers,"Content-Type":"application/json"},url:"/snippets",body:JSON.stringify({title:this.key,visibility:"private",files:n})}))):Object.keys(n).length===0?Promise.reject("\u6240\u6709\u6587\u4EF6\u7684\u5185\u5BB9\u90FD\u4E3A\u7A7A, \u65E0\u6CD5\u521B\u5EFA gist"):a(this.http.post({url:"/gists",body:JSON.stringify({description:this.key,public:!1,files:n})}))}async download(e){let t=await this.locate();if(t?.id)try{let{files:r}=await this.http.get(`/gists/${t.id}`).then(i=>JSON.parse(i.body)),n=r[e].raw_url;return await this.http.get(n).then(i=>i.body)}catch(r){return Promise.reject(r)}else return Promise.reject(`\u627E\u4E0D\u5230 Sub-Store Gist (${this.key})`)}};var tde=B(x());var Rme=B(x());var Ime=B(x(),1);var ode=B(x(),1);var nde=B(x(),1);function dE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Cr(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new RangeError(`${r}expected integer >= 0, got ${e}`)}}function nn(e,t,r=""){let n=dE(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let s=r&&`"${r}" `,a=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`,l=s+"expected Uint8Array"+a+", got "+u;throw n?new RangeError(l):new TypeError(l)}return e}function Aa(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Cr(e.outputLen),Cr(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Ef(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function bm(e,t){nn(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function Am(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function zn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function bf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Oi(e,t){return e<<32-t|e>>>t}function Rt(e,t){return e<<t|e>>>32-t>>>0}var nz=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function sz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function iz(e){for(let t=0;t<e.length;t++)e[t]=sz(e[t]);return e}var pE=nz?e=>e:iz,cD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",oz=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Sm(e){if(nn(e),cD)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=oz[e[r]];return t}var ba={_0:48,_9:57,A:65,F:70,a:97,f:102};function uD(e){if(e>=ba._0&&e<=ba._9)return e-ba._0;if(e>=ba.A&&e<=ba.F)return e-(ba.A-10);if(e>=ba.a&&e<=ba.f)return e-(ba.a-10)}function Id(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(cD)try{return Uint8Array.fromHex(e)}catch(i){throw i instanceof SyntaxError?new RangeError(i.message):i}let t=e.length,r=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=uD(e.charCodeAt(o)),a=uD(e.charCodeAt(o+1));if(s===void 0||a===void 0){let u=e[o]+e[o+1];throw new RangeError('hex string expected, got non-hex character "'+u+'" at index '+o)}n[i]=s*16+a}return n}function az(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function mE(e,t=""){return typeof e=="string"?az(e):nn(e,void 0,t)}function gE(...e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];nn(i),t+=i.length}let r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){let o=e[n];r.set(o,i),i+=o.length}return r}function _m(e,t){if(t!==void 0&&{}.toString.call(t)!=="[object Object]")throw new TypeError("options must be object or undefined");return Object.assign(e,t)}function vE(e,t={}){let r=(i,o)=>e(o).update(i).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=i=>e(i),Object.assign(r,t),Object.freeze(r)}function Pu(e=32){Cr(e,"bytesLength");let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var wE=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Cm=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if(Aa(t),nn(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),zn(i)}update(t){return Ef(this),this.iHash.update(t),this}digestInto(t){Ef(this),bm(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=s,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},So=(()=>{let e=((t,r,n)=>new Cm(t,r).update(n).digest());return e.create=(t,r)=>new Cm(t,r),e})();var lde=B(x(),1);function xd(e,t,r){return Aa(e),r===void 0&&(r=new Uint8Array(e.outputLen)),So(e,r,t)}var yE=Uint8Array.of(0),lD=Uint8Array.of();function EE(e,t,r,n=32){Aa(e),Cr(n,"length"),nn(t,void 0,"prk");let i=e.outputLen;if(t.length<i)throw new Error('"prk" must be at least HashLen octets');if(n>255*i)throw new Error("Length must be <= 255*HashLen");let o=Math.ceil(n/i);r===void 0?r=lD:nn(r,void 0,"info");let s=new Uint8Array(o*i),a=So.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)yE[0]=h+1,u.update(h===0?lD:l).update(r).update(yE).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),zn(l,yE),s.slice(0,n)}var ku=(e,t,r,n,i)=>EE(e,xd(e,t,r),n,i);var Ede=B(x(),1);var dde=B(x(),1);function fD(e,t,r){return e&t^~e&r}function hD(e,t,r){return e&t^e&r^t&r}var $d=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,i){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=bf(this.buffer)}update(t){Ef(this),nn(t);let{view:r,buffer:n,blockLen:i}=this,o=t.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let u=bf(t);for(;i<=o-s;s+=i)this.process(u,s);continue}n.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ef(this),bm(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,zn(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(n,0),s=0);for(let m=s;m<i;m++)r[m]=0;n.setBigUint64(i-8,BigInt(this.length*8),o),this.process(n,0);let a=bf(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=u/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)a.setUint32(4*m,h[m],o)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=i,t.pos=a,i%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},Sa=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var sn=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var pde=B(x(),1),Dm=BigInt(4294967295),dD=BigInt(32);function uz(e,t=!1){return t?{h:Number(e&Dm),l:Number(e>>dD&Dm)}:{h:Number(e>>dD&Dm)|0,l:Number(e&Dm)|0}}function pD(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:s,l:a}=uz(e[o],t);[n[o],i[o]]=[s,a]}return[n,i]}var bE=(e,t,r)=>e>>>r,AE=(e,t,r)=>e<<32-r|t>>>r,Lc=(e,t,r)=>e>>>r|t<<32-r,Uc=(e,t,r)=>e<<32-r|t>>>r,Pd=(e,t,r)=>e<<64-r|t>>>r-32,kd=(e,t,r)=>e>>>r-32|t<<64-r;function _o(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var mD=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),gD=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,vD=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),wD=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,yD=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),ED=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;var lz=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ru=new Uint32Array(64),SE=class extends $d{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:n,D:i,E:o,F:s,G:a,H:u}=this;return[t,r,n,i,o,s,a,u]}set(t,r,n,i,o,s,a,u){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,r){for(let m=0;m<16;m++,r+=4)Ru[m]=t.getUint32(r,!1);for(let m=16;m<64;m++){let p=Ru[m-15],d=Ru[m-2],v=Oi(p,7)^Oi(p,18)^p>>>3,g=Oi(d,17)^Oi(d,19)^d>>>10;Ru[m]=g+Ru[m-7]+v+Ru[m-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:u,G:l,H:h}=this;for(let m=0;m<64;m++){let p=Oi(a,6)^Oi(a,11)^Oi(a,25),d=h+p+fD(a,u,l)+lz[m]+Ru[m]|0,g=(Oi(n,2)^Oi(n,13)^Oi(n,22))+hD(n,i,o)|0;h=l,l=u,u=a,a=s+d|0,s=o,o=i,i=n,n=d+g|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(n,i,o,s,a,u,l,h)}roundClean(){zn(Ru)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),zn(this.buffer)}},_E=class extends SE{A=Sa[0]|0;B=Sa[1]|0;C=Sa[2]|0;D=Sa[3]|0;E=Sa[4]|0;F=Sa[5]|0;G=Sa[6]|0;H=Sa[7]|0;constructor(){super(32)}};var bD=pD(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),fz=bD[0],hz=bD[1],Tu=new Uint32Array(80),Ou=new Uint32Array(80),CE=class extends $d{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:l,El:h,Fh:m,Fl:p,Gh:d,Gl:v,Hh:g,Hl:y}=this;return[t,r,n,i,o,s,a,u,l,h,m,p,d,v,g,y]}set(t,r,n,i,o,s,a,u,l,h,m,p,d,v,g,y){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=l|0,this.El=h|0,this.Fh=m|0,this.Fl=p|0,this.Gh=d|0,this.Gl=v|0,this.Hh=g|0,this.Hl=y|0}process(t,r){for(let _=0;_<16;_++,r+=4)Tu[_]=t.getUint32(r),Ou[_]=t.getUint32(r+=4);for(let _=16;_<80;_++){let C=Tu[_-15]|0,F=Ou[_-15]|0,H=Lc(C,F,1)^Lc(C,F,8)^bE(C,F,7),K=Uc(C,F,1)^Uc(C,F,8)^AE(C,F,7),S=Tu[_-2]|0,I=Ou[_-2]|0,q=Lc(S,I,19)^Pd(S,I,61)^bE(S,I,6),L=Uc(S,I,19)^kd(S,I,61)^AE(S,I,6),R=vD(K,L,Ou[_-7],Ou[_-16]),O=wD(R,H,q,Tu[_-7],Tu[_-16]);Tu[_]=O|0,Ou[_]=R|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:h,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let _=0;_<80;_++){let C=Lc(m,p,14)^Lc(m,p,18)^Pd(m,p,41),F=Uc(m,p,14)^Uc(m,p,18)^kd(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=yD(E,F,K,hz[_],Ou[_]),I=ED(S,w,C,H,fz[_],Tu[_]),q=S|0,L=Lc(n,i,28)^Pd(n,i,34)^Pd(n,i,39),R=Uc(n,i,28)^kd(n,i,34)^kd(n,i,39),O=n&o^n&a^o&a,T=i&s^i&u^s&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=_o(l|0,h|0,I|0,q|0),l=a|0,h=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let N=mD(q,R,T);n=gD(N,I,L,O),i=N|0}({h:n,l:i}=_o(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=_o(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=_o(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=_o(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=_o(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=_o(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=_o(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=_o(this.Hh|0,this.Hl|0,w|0,E|0),this.set(n,i,o,s,a,u,l,h,m,p,d,v,g,y,w,E)}roundClean(){zn(Tu,Ou)}destroy(){this.destroyed=!0,zn(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},DE=class extends CE{Ah=sn[0]|0;Al=sn[1]|0;Bh=sn[2]|0;Bl=sn[3]|0;Ch=sn[4]|0;Cl=sn[5]|0;Dh=sn[6]|0;Dl=sn[7]|0;Eh=sn[8]|0;El=sn[9]|0;Fh=sn[10]|0;Fl=sn[11]|0;Gh=sn[12]|0;Gl=sn[13]|0;Hh=sn[14]|0;Hl=sn[15]|0;constructor(){super(64)}};var Dr=vE(()=>new _E,wE(1));var Fm=vE(()=>new DE,wE(3));var X1e=B(x(),1);var Ade=B(x(),1);function xE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function dz(e){if(!xE(e))throw new TypeError("Uint8Array expected")}function CD(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(r=>typeof r=="string"):t.every(r=>Number.isSafeInteger(r)):!1}function pz(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function Hc(e,t){if(typeof t!="string")throw new TypeError(`${e}: string expected`);return!0}function $E(e){if(typeof e!="number")throw new TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function FE(e){if(!Array.isArray(e))throw new TypeError("array expected")}function Im(e,t){if(!CD(!0,t))throw new TypeError(`${e}: array of strings expected`)}function DD(e,t){if(!CD(!1,t))throw new TypeError(`${e}: array of numbers expected`)}function PE(...e){let t=o=>o,r=(o,s)=>a=>o(s(a)),n=e.map(o=>o.encode).reduceRight(r,t),i=e.map(o=>o.decode).reduce(r,t);return{encode:n,decode:i}}function kE(e){let t=typeof e=="string"?e.split(""):e,r=t.length;Im("alphabet",t);let n=new Map(t.map((i,o)=>[i,o]));return{encode:i=>(FE(i),i.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=r)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:i=>(FE(i),i.map(o=>{Hc("alphabet.decode",o);let s=n.get(o);if(s===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return s}))}}function RE(e=""){return Hc("join",e),{encode:t=>(Im("join.decode",t),t.join(e)),decode:t=>(Hc("join.decode",t),t.split(e))}}function mz(e,t="="){return $E(e),Hc("padding",t),{encode(r){for(Im("padding.encode",r);r.length*e%8;)r.push(t);return r},decode(r){Im("padding.decode",r);let n=r.length;if(n*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if((n-1)*e%8===0)throw new Error("padding: invalid, string has too much padding");return r.slice(0,n)}}}var FD=(e,t)=>t===0?e:FD(t,e%t),xm=(e,t)=>e+(t-FD(e,t)),Bm=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function BE(e,t,r,n){if(FE(e),t<=0||t>32)throw new RangeError(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new RangeError(`convertRadix2: wrong to=${r}`);if(xm(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${xm(t,r)}`);let i=0,o=0,s=Bm[t],a=Bm[r]-1,u=[];for(let l of e){if($E(l),l>=s)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(i=i<<t|l,o+t>32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=r;o-=r)u.push((i>>o-r&a)>>>0);let h=Bm[o];if(h===void 0)throw new Error("invalid carry");i&=h-1}if(i=i<<r-o&a,!n&&o>=t)throw new Error("Excess padding");if(!n&&i>0)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&u.push(i>>>0),u}function TE(e,t=!1){if($E(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(xm(8,e)>32||xm(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:r=>{if(!xE(r))throw new TypeError("radix2.encode input should be Uint8Array");return BE(Array.from(r),8,e,!t)},decode:r=>(DD("radix2.decode",r),Uint8Array.from(BE(r,e,8,t)))}}function AD(e){return pz(e),function(...t){try{return e.apply(null,t)}catch{}}}var gz=typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function",vz=/[\t\n\f\r ]/,wz=(e,t)=>{Hc("base64",e);let r=t?"base64url":"base64";if(e.length>0&&vz.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},OE=Object.freeze(gz?{encode(e){return dz(e),e.toBase64()},decode(e){return wz(e,!1)}}:PE(TE(6),kE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),mz(6),RE(""))),$n=Object.freeze(PE(TE(6),kE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),RE("")));var IE=PE(kE("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),RE("")),SD=[996825010,642813549,513874426,1027748829,705979059];function Rd(e){let t=e>>25,r=(e&33554431)<<5;for(let n=0;n<SD.length;n++)(t>>n&1)===1&&(r^=SD[n]);return r}function _D(e,t,r=1){let n=e.length,i=1;for(let o=0;o<n;o++){let s=e.charCodeAt(o);if(s<33||s>126)throw new Error(`Invalid prefix (${e})`);i=Rd(i)^s>>5}i=Rd(i);for(let o=0;o<n;o++)i=Rd(i)^e.charCodeAt(o)&31;for(let o of t)i=Rd(i)^o;for(let o=0;o<6;o++)i=Rd(i);return i^=r,IE.encode(BE([i%Bm[30]],30,5,!1))}function yz(e){let t=e==="bech32"?1:734539939,r=TE(5),n=r.decode,i=r.encode,o=AD(n);function s(m,p,d=90){Hc("bech32.encode prefix",m),xE(p)&&(p=Array.from(p)),DD("bech32.encode",p);let v=m.length;if(v===0)throw new TypeError(`Invalid prefix length ${v}`);let g=v+7+p.length;if(d!==!1&&g>d)throw new TypeError(`Length ${g} exceeds limit ${d}`);let y=m.toLowerCase(),w=_D(y,p,t);return`${y}1${IE.encode(p)}${w}`}function a(m,p=90){Hc("bech32.decode input",m);let d=m.length;if(d<8||p!==!1&&d>p)throw new TypeError(`invalid string length: ${d} (${m}). Expected (8..${p})`);let v=m.toLowerCase();if(m!==v&&m!==m.toUpperCase())throw new Error("String must be lowercase or uppercase");let g=v.lastIndexOf("1");if(g===0||g===-1)throw new Error('Letter "1" must be present between prefix and data only');let y=v.slice(0,g),w=v.slice(g+1);if(w.length<6)throw new Error("Data must be at least 6 characters long");let E=IE.decode(w).slice(0,-6),_=_D(y,E,t);if(!w.endsWith(_))throw new Error(`Invalid checksum in ${m}: expected "${_}"`);return{prefix:y,words:E}}let u=AD(a);function l(m){let{prefix:p,words:d}=a(m,!1);return{prefix:p,words:d,bytes:n(d)}}function h(m,p){return s(m,i(p))}return{encode:s,decode:a,encodeFromBytes:h,decodeToBytes:l,decodeUnsafe:u,fromWords:n,fromWordsUnsafe:o,toWords:i}}var ni=Object.freeze(yz("bech32"));var $de=B(x(),1);var Dde=B(x(),1);function bz(e,t,r,n){Aa(e);let i=_m({dkLen:32,asyncTick:10},n),{c:o,dkLen:s,asyncTick:a}=i;if(Cr(o,"c"),Cr(s,"dkLen"),Cr(a,"asyncTick"),o<1)throw new Error("iterations (c) must be >= 1");if(s<1)throw new Error('"dkLen" must be >= 1');if(s>(2**32-1)*e.outputLen)throw new Error("derived key too long");let u=mE(t,"password"),l=mE(r,"salt"),h=new Uint8Array(s),m=So.create(e,u),p=m._cloneInto().update(l);return{c:o,dkLen:s,asyncTick:a,DK:h,PRF:m,PRFSalt:p}}function Az(e,t,r,n,i){return e.destroy(),t.destroy(),n&&n.destroy(),zn(i),r}function NE(e,t,r,n){let{c:i,dkLen:o,DK:s,PRF:a,PRFSalt:u}=bz(e,t,r,n),l,h=new Uint8Array(4),m=bf(h),p=new Uint8Array(a.outputLen);for(let d=1,v=0;v<o;d++,v+=a.outputLen){let g=s.subarray(v,v+a.outputLen);m.setInt32(0,d,!1),(l=u._cloneInto(l)).update(h).digestInto(p),g.set(p.subarray(0,g.length));for(let y=1;y<i;y++){a._cloneInto(l).update(p).digestInto(p);for(let w=0;w<g.length;w++)g[w]^=p[w]}}return Az(a,u,s,l,p)}function BD(e,t,r,n,i,o){let s=e[t++]^r[n++],a=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],h=e[t++]^r[n++],m=e[t++]^r[n++],p=e[t++]^r[n++],d=e[t++]^r[n++],v=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],w=e[t++]^r[n++],E=e[t++]^r[n++],_=e[t++]^r[n++],C=e[t++]^r[n++],F=e[t++]^r[n++],H=s,K=a,S=u,I=l,q=h,L=m,R=p,O=d,T=v,N=g,P=y,M=w,Y=E,V=_,X=C,te=F;for(let ae=0;ae<8;ae+=2)q^=Rt(H+Y|0,7),T^=Rt(q+H|0,9),Y^=Rt(T+q|0,13),H^=Rt(Y+T|0,18),N^=Rt(L+K|0,7),V^=Rt(N+L|0,9),K^=Rt(V+N|0,13),L^=Rt(K+V|0,18),X^=Rt(P+R|0,7),S^=Rt(X+P|0,9),R^=Rt(S+X|0,13),P^=Rt(R+S|0,18),I^=Rt(te+M|0,7),O^=Rt(I+te|0,9),M^=Rt(O+I|0,13),te^=Rt(M+O|0,18),K^=Rt(H+I|0,7),S^=Rt(K+H|0,9),I^=Rt(S+K|0,13),H^=Rt(I+S|0,18),R^=Rt(L+q|0,7),O^=Rt(R+L|0,9),q^=Rt(O+R|0,13),L^=Rt(q+O|0,18),M^=Rt(P+N|0,7),T^=Rt(M+P|0,9),N^=Rt(T+M|0,13),P^=Rt(N+T|0,18),Y^=Rt(te+X|0,7),V^=Rt(Y+te|0,9),X^=Rt(V+Y|0,13),te^=Rt(X+V|0,18);i[o++]=s+H|0,i[o++]=a+K|0,i[o++]=u+S|0,i[o++]=l+I|0,i[o++]=h+q|0,i[o++]=m+L|0,i[o++]=p+R|0,i[o++]=d+O|0,i[o++]=v+T|0,i[o++]=g+N|0,i[o++]=y+P|0,i[o++]=w+M|0,i[o++]=E+Y|0,i[o++]=_+V|0,i[o++]=C+X|0,i[o++]=F+te|0}function LE(e,t,r,n,i){let o=n+0,s=n+16*i;for(let a=0;a<16;a++)r[s+a]=e[t+(2*i-1)*16+a];for(let a=0;a<i;a++,o+=16,t+=16)BD(r,s,e,t,r,o),a>0&&(s+=16),BD(r,o,e,t+=16,r,s)}function Sz(e,t,r){let n=_m({dkLen:32,asyncTick:10,maxmem:1073742848},r),{N:i,r:o,p:s,dkLen:a,asyncTick:u,maxmem:l,onProgress:h}=n;if(Cr(i,"N"),Cr(o,"r"),Cr(s,"p"),Cr(a,"dkLen"),Cr(u,"asyncTick"),Cr(l,"maxmem"),h!==void 0&&typeof h!="function")throw new Error("progressCb must be a function");let m=128*o,p=m/4,d=Math.pow(2,32);if(i<=1||(i&i-1)!==0||i>d)throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(s<1||s>(d-1)*32/m)throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');if(a<1||a>(d-1)*32)throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');let v=m*(i+s+1);if(v>l)throw new Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+v+", maxmem="+l);let g=NE(Dr,e,t,{c:1,dkLen:m*s}),y=Am(g),w=Am(new Uint8Array(m*i)),E=Am(new Uint8Array(m)),_=()=>{};if(h){let C=2*i*s,F=Math.max(Math.floor(C/1e4),1),H=0;_=()=>{H++,h&&(!(H%F)||H===C)&&h(H/C)}}return{N:i,r:o,p:s,dkLen:a,blockSize32:p,V:w,B32:y,B:g,tmp:E,blockMixCb:_,asyncTick:u}}function _z(e,t,r,n,i){let o=NE(Dr,e,r,{c:1,dkLen:t});return zn(r,n,i),o}function UE(e,t,r){let{N:n,r:i,p:o,dkLen:s,blockSize32:a,V:u,B32:l,B:h,tmp:m,blockMixCb:p}=Sz(e,t,r);pE(l);for(let d=0;d<o;d++){let v=a*d;for(let g=0;g<a;g++)u[g]=l[v+g];for(let g=0,y=0;g<n-1;g++)LE(u,y,u,y+=a,i),p();LE(u,(n-1)*a,l,v,i),p();for(let g=0;g<n;g++){let y=(l[v+a-16]&n-1)>>>0;for(let w=0;w<a;w++)m[w]=l[v+w]^u[y*a+w];LE(m,0,l,v,i),p()}}return pE(l),_z(e,s,h,u,m)}var Zde=B(x(),1);var Nde=B(x(),1);var kde=B(x(),1);function Cz(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function $m(e){if(typeof e!="boolean")throw new TypeError(`boolean expected, not ${e}`)}function Af(e){if(typeof e!="number")throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError("positive integer expected, got "+e)}function Mr(e,t,r=""){let n=Cz(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let s=r&&`"${r}" `,a=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`,l=s+"expected Uint8Array"+a+", got "+u;throw n?new RangeError(l):new TypeError(l)}return e}function HE(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ID(e,t,r=!1){Mr(e,void 0,"output");let n=t.outputLen;if(e.length<n)throw new RangeError("digestInto() expects output buffer of length at least "+n);if(r&&!Sf(e))throw new Error("invalid output, must be aligned")}function Co(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Ni(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Dz(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Mc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Fz=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;var Bz=e=>{for(let t=0;t<e.length;t++)e[t]=Fz(e[t]);return e},_a=Mc?e=>e:Bz;function xD(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function $D(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function PD(e,t,r){let n=t,i=r||(()=>[]),o=(a,u)=>n(u,...i(a)).update(a).digest(),s=n(new Uint8Array(e),...i(new Uint8Array(0)));return o.outputLen=s.outputLen,o.blockLen=s.blockLen,o.create=(a,...u)=>n(a,...u),o}var kD=(e,t)=>{function r(n,...i){if(Mr(n,void 0,"key"),e.nonceLength!==void 0){let h=i[0];Mr(h,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let o=e.tagLength;o&&i[1]!==void 0&&Mr(i[1],void 0,"AAD");let s=t(n,...i),a=(h,m)=>{if(m!==void 0){if(h!==2)throw new Error("cipher output not supported");Mr(m,void 0,"output")}},u=!1;return{encrypt(h,m){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,Mr(h),a(s.encrypt.length,m),s.encrypt(h,m)},decrypt(h,m){if(Mr(h),o&&h.length<o)throw new Error('"ciphertext" expected length bigger than tagLength='+o);return a(s.decrypt.length,m),s.decrypt(h,m)}}}return Object.assign(r,e),r};function Td(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(Mr(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(r&&!Sf(t))throw new Error("invalid output, must be aligned");return t}function RD(e,t,r){Af(e),Af(t),$m(r);let n=new Uint8Array(16),i=Dz(n);return i.setBigUint64(0,BigInt(t),r),i.setBigUint64(8,BigInt(e),r),n}function Sf(e){return e.byteOffset%4===0}function _f(e){return Uint8Array.from(Mr(e))}var OD=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),Iz=_a(Co(OD("expand 16-byte k"))),xz=_a(Co(OD("expand 32-byte k")));function Tt(e,t){return e<<t|e>>>32-t}var Od=64,$z=16,ME=2**32-1,TD=Uint32Array.of();function Pz(e,t,r,n,i,o,s,a){let u=i.length,l=new Uint8Array(Od),h=Co(l),m=Mc&&Sf(i)&&Sf(o),p=m?Co(i):TD,d=m?Co(o):TD;if(!Mc){for(let v=0;v<u;s++){if(e(t,r,n,h,s,a),_a(h),s>=ME)throw new Error("arx: counter overflow");let g=Math.min(Od,u-v);for(let y=0,w;y<g;y++)w=v+y,o[w]=i[w]^l[y];v+=g}return}for(let v=0;v<u;s++){if(e(t,r,n,h,s,a),s>=ME)throw new Error("arx: counter overflow");let g=Math.min(Od,u-v);if(m&&g===Od){let y=v/4;if(v%4!==0)throw new Error("arx: invalid block position");for(let w=0,E;w<$z;w++)E=y+w,d[E]=p[E]^h[w];v+=Od;continue}for(let y=0,w;y<g;y++)w=v+y,o[w]=i[w]^l[y];v+=g}}function ND(e,t){let{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:o,rounds:s}=xD({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Af(i),Af(s),$m(o),$m(r),(a,u,l,h,m=0)=>{Mr(a,void 0,"key"),Mr(u,void 0,"nonce"),Mr(l,void 0,"data");let p=l.length;if(h=Td(p,h,!1),Af(m),m<0||m>=ME)throw new Error("arx: counter overflow");let d=[],v=a.length,g,y;if(v===32)d.push(g=_f(a)),y=xz;else if(v===16&&r)g=new Uint8Array(32),g.set(a),g.set(a,16),y=Iz,d.push(g);else throw Mr(a,32,"arx key"),new Error("invalid key size");(!Mc||!Sf(u))&&d.push(u=_f(u));let w=Co(g);if(n){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let C=u.subarray(0,16);if(Mc)n(y,w,Co(C),w);else{let F=_a(Uint32Array.from(y));n(F,w,Co(C),w),Ni(F),_a(w)}u=u.subarray(16)}else Mc||_a(w);let E=16-i;if(E!==u.length)throw new Error(`arx: nonce must be ${E} or 16 bytes`);if(E!==12){let C=new Uint8Array(12);C.set(u,o?0:12-u.length),u=C,d.push(u)}let _=_a(Co(u));try{return Pz(e,y,w,_,l,h,m,s),h}finally{Ni(...d)}}}var Kde=B(x(),1);function on(e,t){return e[t++]&255|(e[t++]&255)<<8}var qE=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(t){t=_f(Mr(t,32,"key"));let r=on(t,0),n=on(t,2),i=on(t,4),o=on(t,6),s=on(t,8),a=on(t,10),u=on(t,12),l=on(t,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|u<<5)&8065,this.r[8]=(u>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let h=0;h<8;h++)this.pad[h]=on(t,16+2*h)}process(t,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],u=s[1],l=s[2],h=s[3],m=s[4],p=s[5],d=s[6],v=s[7],g=s[8],y=s[9],w=on(t,r+0),E=on(t,r+2),_=on(t,r+4),C=on(t,r+6),F=on(t,r+8),H=on(t,r+10),K=on(t,r+12),S=on(t,r+14),I=o[0]+(w&8191),q=o[1]+((w>>>13|E<<3)&8191),L=o[2]+((E>>>10|_<<6)&8191),R=o[3]+((_>>>7|C<<9)&8191),O=o[4]+((C>>>4|F<<12)&8191),T=o[5]+(F>>>1&8191),N=o[6]+((F>>>14|H<<2)&8191),P=o[7]+((H>>>11|K<<5)&8191),M=o[8]+((K>>>8|S<<8)&8191),Y=o[9]+(S>>>5|i),V=0,X=V+I*a+q*(5*y)+L*(5*g)+R*(5*v)+O*(5*d);V=X>>>13,X&=8191,X+=T*(5*p)+N*(5*m)+P*(5*h)+M*(5*l)+Y*(5*u),V+=X>>>13,X&=8191;let te=V+I*u+q*a+L*(5*y)+R*(5*g)+O*(5*v);V=te>>>13,te&=8191,te+=T*(5*d)+N*(5*p)+P*(5*m)+M*(5*h)+Y*(5*l),V+=te>>>13,te&=8191;let ae=V+I*l+q*u+L*a+R*(5*y)+O*(5*g);V=ae>>>13,ae&=8191,ae+=T*(5*v)+N*(5*d)+P*(5*p)+M*(5*m)+Y*(5*h),V+=ae>>>13,ae&=8191;let me=V+I*h+q*l+L*u+R*a+O*(5*y);V=me>>>13,me&=8191,me+=T*(5*g)+N*(5*v)+P*(5*d)+M*(5*p)+Y*(5*m),V+=me>>>13,me&=8191;let he=V+I*m+q*h+L*l+R*u+O*a;V=he>>>13,he&=8191,he+=T*(5*y)+N*(5*g)+P*(5*v)+M*(5*d)+Y*(5*p),V+=he>>>13,he&=8191;let De=V+I*p+q*m+L*h+R*l+O*u;V=De>>>13,De&=8191,De+=T*a+N*(5*y)+P*(5*g)+M*(5*v)+Y*(5*d),V+=De>>>13,De&=8191;let Pe=V+I*d+q*p+L*m+R*h+O*l;V=Pe>>>13,Pe&=8191,Pe+=T*u+N*a+P*(5*y)+M*(5*g)+Y*(5*v),V+=Pe>>>13,Pe&=8191;let Ie=V+I*v+q*d+L*p+R*m+O*h;V=Ie>>>13,Ie&=8191,Ie+=T*l+N*u+P*a+M*(5*y)+Y*(5*g),V+=Ie>>>13,Ie&=8191;let se=V+I*g+q*v+L*d+R*p+O*m;V=se>>>13,se&=8191,se+=T*h+N*l+P*u+M*a+Y*(5*y),V+=se>>>13,se&=8191;let pe=V+I*y+q*g+L*v+R*d+O*p;V=pe>>>13,pe&=8191,pe+=T*m+N*h+P*l+M*u+Y*a,V+=pe>>>13,pe&=8191,V=(V<<2)+V|0,V=V+X|0,X=V&8191,V=V>>>13,te+=V,o[0]=X,o[1]=te,o[2]=ae,o[3]=me,o[4]=he,o[5]=De,o[6]=Pe,o[7]=Ie,o[8]=se,o[9]=pe}finalize(){let{h:t,pad:r}=this,n=new Uint16Array(10),i=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=i,i=t[a]>>>13,t[a]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,n[0]=t[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=t[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)t[a]=t[a]&o|n[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let s=t[0]+r[0];t[0]=s&65535;for(let a=1;a<8;a++)s=(t[a]+r[a]|0)+(s>>>16)|0,t[a]=s&65535;Ni(n)}update(t){HE(this),Mr(t),t=_f(t);let{buffer:r,blockLen:n}=this,i=t.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){for(;n<=i-o;o+=n)this.process(t,o);continue}r.set(t.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(r,0,!1),this.pos=0)}return this}destroy(){this.destroyed=!0,Ni(this.h,this.r,this.buffer,this.pad)}digestInto(t){HE(this),ID(t,this),this.finished=!0;let{buffer:r,h:n}=this,{pos:i}=this;if(i){for(r[i++]=1;i<16;i++)r[i]=0;this.process(r,0,!0)}this.finalize();let o=0;for(let s=0;s<8;s++)t[o++]=n[s]>>>0,t[o++]=n[s]>>>8}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}},LD=PD(32,e=>new qE(e));function kz(e,t,r,n,i,o=20){let s=e[0],a=e[1],u=e[2],l=e[3],h=t[0],m=t[1],p=t[2],d=t[3],v=t[4],g=t[5],y=t[6],w=t[7],E=i,_=r[0],C=r[1],F=r[2],H=s,K=a,S=u,I=l,q=h,L=m,R=p,O=d,T=v,N=g,P=y,M=w,Y=E,V=_,X=C,te=F;for(let me=0;me<o;me+=2)H=H+q|0,Y=Tt(Y^H,16),T=T+Y|0,q=Tt(q^T,12),H=H+q|0,Y=Tt(Y^H,8),T=T+Y|0,q=Tt(q^T,7),K=K+L|0,V=Tt(V^K,16),N=N+V|0,L=Tt(L^N,12),K=K+L|0,V=Tt(V^K,8),N=N+V|0,L=Tt(L^N,7),S=S+R|0,X=Tt(X^S,16),P=P+X|0,R=Tt(R^P,12),S=S+R|0,X=Tt(X^S,8),P=P+X|0,R=Tt(R^P,7),I=I+O|0,te=Tt(te^I,16),M=M+te|0,O=Tt(O^M,12),I=I+O|0,te=Tt(te^I,8),M=M+te|0,O=Tt(O^M,7),H=H+L|0,te=Tt(te^H,16),P=P+te|0,L=Tt(L^P,12),H=H+L|0,te=Tt(te^H,8),P=P+te|0,L=Tt(L^P,7),K=K+R|0,Y=Tt(Y^K,16),M=M+Y|0,R=Tt(R^M,12),K=K+R|0,Y=Tt(Y^K,8),M=M+Y|0,R=Tt(R^M,7),S=S+O|0,V=Tt(V^S,16),T=T+V|0,O=Tt(O^T,12),S=S+O|0,V=Tt(V^S,8),T=T+V|0,O=Tt(O^T,7),I=I+q|0,X=Tt(X^I,16),N=N+X|0,q=Tt(q^N,12),I=I+q|0,X=Tt(X^I,8),N=N+X|0,q=Tt(q^N,7);let ae=0;n[ae++]=s+H|0,n[ae++]=a+K|0,n[ae++]=u+S|0,n[ae++]=l+I|0,n[ae++]=h+q|0,n[ae++]=m+L|0,n[ae++]=p+R|0,n[ae++]=d+O|0,n[ae++]=v+T|0,n[ae++]=g+N|0,n[ae++]=y+P|0,n[ae++]=w+M|0,n[ae++]=E+Y|0,n[ae++]=_+V|0,n[ae++]=C+X|0,n[ae++]=F+te|0}var Rz=ND(kz,{counterRight:!1,counterLength:4,allowShortKeys:!1});var Tz=new Uint8Array(16),UD=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(Tz.subarray(r))},Oz=new Uint8Array(32);function HD(e,t,r,n,i){i!==void 0&&Mr(i,void 0,"AAD");let o=e(t,r,Oz),s=RD(n.length,i?i.length:0,!0),a=LD.create(o);i&&UD(a,i),UD(a,n),a.update(s);let u=a.digest();return Ni(o,s),u}var Nz=e=>(t,r,n)=>({encrypt(o,s){let a=o.length;s=Td(a+16,s,!1),s.set(o);let u=s.subarray(0,-16);e(t,r,u,u,1);let l=HD(e,t,r,u,n);return s.set(l,a),Ni(l),s},decrypt(o,s){s=Td(o.length-16,s,!1);let a=o.subarray(0,-16),u=o.subarray(-16),l=HD(e,t,r,a,n);if(!$D(u,l))throw Ni(l),new Error("invalid tag");return s.set(o.subarray(0,-16)),e(t,r,s,s,1),Ni(l),s}}),si=kD({blockSize:64,nonceLength:12,tagLength:16},Nz(Rz));var T0e=B(x(),1);var rpe=B(x(),1);var Qde=B(x(),1);function Cf(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zr(e,t=""){if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new Error(`${r}expected integer >0, got ${e}`)}}function Je(e,t,r=""){let n=Cf(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let s=r&&`"${r}" `,a=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return e}function ii(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Zr(e.outputLen),Zr(e.blockLen)}function Da(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Pm(e,t){Je(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function km(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ws(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Rm(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Li(e,t){return e<<32-t|e>>>t}var Lz=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Uz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Hz(e){for(let t=0;t<e.length;t++)e[t]=Uz(e[t]);return e}var jE=Lz?e=>e:Hz,qD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Mz=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function qc(e){if(Je(e),qD)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=Mz[e[r]];return t}var Ca={_0:48,_9:57,A:65,F:70,a:97,f:102};function MD(e){if(e>=Ca._0&&e<=Ca._9)return e-Ca._0;if(e>=Ca.A&&e<=Ca.F)return e-(Ca.A-10);if(e>=Ca.a&&e<=Ca.f)return e-(Ca.a-10)}function jc(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(qD)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=MD(e.charCodeAt(o)),a=MD(e.charCodeAt(o+1));if(s===void 0||a===void 0){let u=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+o)}n[i]=s*16+a}return n}function xr(...e){let t=0;for(let n=0;n<e.length;n++){let i=e[n];Je(i),t+=i.length}let r=new Uint8Array(t);for(let n=0,i=0;n<e.length;n++){let o=e[n];r.set(o,i),i+=o.length}return r}function Df(e,t={}){let r=(i,o)=>e(o).update(i).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=i=>e(i),Object.assign(r,t),Object.freeze(r)}function Nu(e=32){let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return t.getRandomValues(new Uint8Array(e))}var Lu=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var VE=BigInt(0),KE=BigInt(1);function Nd(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new Error(r+"expected boolean, got type="+typeof e)}return e}function jD(e){if(typeof e=="bigint"){if(!Tm(e))throw new Error("positive bigint expected, got "+e)}else Zr(e);return e}function Ld(e){let t=jD(e).toString(16);return t.length&1?"0"+t:t}function KD(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?VE:BigInt("0x"+e)}function Uu(e){return KD(qc(e))}function Hu(e){return KD(qc(Om(Je(e)).reverse()))}function Ff(e,t){Zr(t),e=jD(e);let r=jc(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw new Error("number too large");return r}function Ud(e,t){return Ff(e,t).reverse()}function Om(e){return Uint8Array.from(e)}function Mu(e){return Uint8Array.from(e,(t,r)=>{let n=t.charCodeAt(0);if(t.length!==1||n>127)throw new Error(`string contains non-ASCII character "${e[r]}" with code ${n} at position ${r}`);return n})}var Tm=e=>typeof e=="bigint"&&VE<=e;function qz(e,t,r){return Tm(e)&&Tm(t)&&Tm(r)&&t<=e&&e<r}function Hd(e,t,r,n){if(!qz(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function zE(e){let t;for(t=0;e>VE;e>>=KE,t+=1);return t}var Md=e=>(KE<<BigInt(e))-KE;function VD(e,t,r){if(Zr(e,"hashLen"),Zr(t,"qByteLen"),typeof r!="function")throw new Error("hmacFn must be a function");let n=y=>new Uint8Array(y),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),a=1e3,u=n(e),l=n(e),h=0,m=()=>{u.fill(1),l.fill(0),h=0},p=(...y)=>r(l,xr(u,...y)),d=(y=i)=>{l=p(o,y),u=p(),y.length!==0&&(l=p(s,y),u=p())},v=()=>{if(h++>=a)throw new Error("drbg: tried max amount of iterations");let y=0,w=[];for(;y<t;){u=p();let E=u.slice();w.push(E),y+=u.length}return xr(...w)};return(y,w)=>{m(),d(y);let E;for(;!(E=w(v()));)d();return m(),E}}function Kc(e,t={},r={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function n(o,s,a){let u=e[o];if(a&&u===void 0)return;let l=typeof u;if(l!==s||u===null)throw new Error(`param "${o}" is invalid: expected ${s}, got ${l}`)}let i=(o,s)=>Object.entries(o).forEach(([a,u])=>n(a,u,s));i(t,!1),i(r,!0)}function GE(e){let t=new WeakMap;return(r,...n)=>{let i=t.get(r);if(i!==void 0)return i;let o=e(r,...n);return t.set(r,o),o}}var lpe=B(x(),1);var ope=B(x(),1);var Wn=BigInt(0),Pn=BigInt(1),Vc=BigInt(2),WD=BigInt(3),YD=BigInt(4),XD=BigInt(5),jz=BigInt(7),ZD=BigInt(8),Kz=BigInt(9),JD=BigInt(16);function Gn(e,t){let r=e%t;return r>=Wn?r:t+r}function oi(e,t,r){let n=e;for(;t-- >Wn;)n*=n,n%=r;return n}function zD(e,t){if(e===Wn)throw new Error("invert: expected non-zero number");if(t<=Wn)throw new Error("invert: expected positive modulus, got "+t);let r=Gn(e,t),n=t,i=Wn,o=Pn,s=Pn,a=Wn;for(;r!==Wn;){let l=n/r,h=n%r,m=i-s*l,p=o-a*l;n=r,r=h,i=s,o=a,s=m,a=p}if(n!==Pn)throw new Error("invert: does not exist");return Gn(i,t)}function YE(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function QD(e,t){let r=(e.ORDER+Pn)/YD,n=e.pow(t,r);return YE(e,n,t),n}function Vz(e,t){let r=(e.ORDER-XD)/ZD,n=e.mul(t,Vc),i=e.pow(n,r),o=e.mul(t,i),s=e.mul(e.mul(o,Vc),i),a=e.mul(o,e.sub(s,e.ONE));return YE(e,a,t),a}function zz(e){let t=Nm(e),r=eF(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+jz)/JD;return(a,u)=>{let l=a.pow(u,s),h=a.mul(l,n),m=a.mul(l,i),p=a.mul(l,o),d=a.eql(a.sqr(h),u),v=a.eql(a.sqr(m),u);l=a.cmov(l,h,d),h=a.cmov(p,m,v);let g=a.eql(a.sqr(h),u),y=a.cmov(l,h,g);return YE(a,y,u),y}}function eF(e){if(e<WD)throw new Error("sqrt is not defined for small field");let t=e-Pn,r=0;for(;t%Vc===Wn;)t/=Vc,r++;let n=Vc,i=Nm(e);for(;GD(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return QD;let o=i.pow(n,t),s=(t+Pn)/Vc;return function(u,l){if(u.is0(l))return l;if(GD(u,l)!==1)throw new Error("Cannot find square root");let h=r,m=u.mul(u.ONE,o),p=u.pow(l,t),d=u.pow(l,s);for(;!u.eql(p,u.ONE);){if(u.is0(p))return u.ZERO;let v=1,g=u.sqr(p);for(;!u.eql(g,u.ONE);)if(v++,g=u.sqr(g),v===h)throw new Error("Cannot find square root");let y=Pn<<BigInt(h-v-1),w=u.pow(m,y);h=v,m=u.sqr(w),p=u.mul(p,m),d=u.mul(d,w)}return d}}function Gz(e){return e%YD===WD?QD:e%ZD===XD?Vz:e%JD===Kz?zz(e):eF(e)}var Wz=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function XE(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=Wz.reduce((n,i)=>(n[i]="function",n),t);return Kc(e,r),e}function Yz(e,t,r){if(r<Wn)throw new Error("invalid exponent, negatives unsupported");if(r===Wn)return e.ONE;if(r===Pn)return t;let n=e.ONE,i=t;for(;r>Wn;)r&Pn&&(n=e.mul(n,i)),i=e.sqr(i),r>>=Pn;return n}function qd(e,t,r=!1){let n=new Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((s,a,u)=>e.is0(a)?s:(n[u]=s,e.mul(s,a)),e.ONE),o=e.inv(i);return t.reduceRight((s,a,u)=>e.is0(a)?s:(n[u]=e.mul(s,n[u]),e.mul(s,a)),o),n}function GD(e,t){let r=(e.ORDER-Pn)/Vc,n=e.pow(t,r),i=e.eql(n,e.ONE),o=e.eql(n,e.ZERO),s=e.eql(n,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function Xz(e,t){t!==void 0&&Zr(t);let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}var WE=class{ORDER;BITS;BYTES;isLE;ZERO=Wn;ONE=Pn;_lengths;_sqrt;_mod;constructor(t,r={}){if(t<=Wn)throw new Error("invalid field: expected ORDER > 0, got "+t);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&(this.sqrt=r.sqrt),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=r.allowedLengths?.slice()),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:i,nByteLength:o}=Xz(t,n);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=o,this._sqrt=void 0,Object.preventExtensions(this)}create(t){return Gn(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof t);return Wn<=t&&t<this.ORDER}is0(t){return t===Wn}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&Pn)===Pn}neg(t){return Gn(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return Gn(t*t,this.ORDER)}add(t,r){return Gn(t+r,this.ORDER)}sub(t,r){return Gn(t-r,this.ORDER)}mul(t,r){return Gn(t*r,this.ORDER)}pow(t,r){return Yz(this,t,r)}div(t,r){return Gn(t*zD(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return zD(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=Gz(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Ud(t,this.BYTES):Ff(t,this.BYTES)}fromBytes(t,r=!1){Je(t);let{_lengths:n,BYTES:i,isLE:o,ORDER:s,_mod:a}=this;if(n){if(!n.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let l=new Uint8Array(i);l.set(t,o?0:l.length-t.length),t=l}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let u=o?Hu(t):Uu(t);if(a&&(u=Gn(u,s)),!r&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return qd(this,t)}cmov(t,r,n){return n?r:t}};function Nm(e,t={}){return new WE(e,t)}function tF(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function ZE(e){let t=tF(e);return t+Math.ceil(t/2)}function rF(e,t,r=!1){Je(e);let n=e.length,i=tF(t),o=ZE(t);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?Hu(e):Uu(e),a=Gn(s,t-Pn)+Pn;return r?Ud(a,i):Ff(a,i)}var Bf=BigInt(0),zc=BigInt(1);function jd(e,t){let r=t.negate();return e?r:t}function tb(e,t){let r=qd(e.Fp,t.map(n=>n.Z));return t.map((n,i)=>e.fromAffine(n.toAffine(r[i])))}function oF(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function JE(e,t){oF(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e,o=Md(e),s=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function nF(e,t,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r,a=Number(e&i),u=e>>s;a>n&&(a-=o,u+=zc);let l=t*n,h=l+Math.abs(a)-1,m=a===0,p=a<0,d=t%2!==0;return{nextN:u,offset:h,isZero:m,isNeg:p,isNegF:d,offsetF:l}}var QE=new WeakMap,aF=new WeakMap;function eb(e){return aF.get(e)||1}function sF(e){if(e!==Bf)throw new Error("invalid wNAF")}var Lm=class{BASE;ZERO;Fn;bits;constructor(t,r){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,n=this.ZERO){let i=t;for(;r>Bf;)r&zc&&(n=n.add(i)),i=i.double(),r>>=zc;return n}precomputeWindow(t,r){let{windows:n,windowSize:i}=JE(r,this.bits),o=[],s=t,a=s;for(let u=0;u<n;u++){a=s,o.push(a);for(let l=1;l<i;l++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(t,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,o=this.BASE,s=JE(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=nF(n,a,s);n=u,h?o=o.add(jd(p,r[d])):i=i.add(jd(m,r[l]))}return sF(n),{p:i,f:o}}wNAFUnsafe(t,r,n,i=this.ZERO){let o=JE(t,this.bits);for(let s=0;s<o.windows&&n!==Bf;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=nF(n,s,o);if(n=a,!l){let m=r[u];i=i.add(h?m.negate():m)}}return sF(n),i}getPrecomputes(t,r,n){let i=QE.get(r);return i||(i=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(i=n(i)),QE.set(r,i))),i}cached(t,r,n){let i=eb(t);return this.wNAF(i,this.getPrecomputes(i,t,n),r)}unsafe(t,r,n,i){let o=eb(t);return o===1?this._unsafeLadder(t,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,i)}createCache(t,r){oF(r,this.bits),aF.set(t,r),QE.delete(t)}hasCache(t){return eb(t)!==1}};function uF(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>Bf||n>Bf;)r&zc&&(o=o.add(i)),n&zc&&(s=s.add(i)),i=i.double(),r>>=zc,n>>=zc;return{p1:o,p2:s}}function iF(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return XE(t),t}else return Nm(e,{isLE:r})}function cF(e,t,r={},n){if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let u of["p","n","h"]){let l=t[u];if(!(typeof l=="bigint"&&l>Bf))throw new Error(`CURVE.${u} must be positive bigint`)}let i=iF(t.p,r.Fp,n),o=iF(t.n,r.Fn,n),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let u of a)if(!i.isValid(t[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:o}}function Um(e,t){return function(n){let i=e(n);return{secretKey:i,publicKey:t(i)}}}var mpe=B(x(),1);var Kd=BigInt(0),If=BigInt(1),Hm=BigInt(2);function Zz(e){return Kc(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function lF(e){let t=Zz(e),{P:r,type:n,adjustScalarBytes:i,powPminus2:o,randomBytes:s}=t,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let u=s||Nu,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?Hm**BigInt(254):Hm**BigInt(447),v=a?BigInt(8)*Hm**BigInt(251)-If:BigInt(4)*Hm**BigInt(445)-If,g=d+v+If,y=T=>Gn(T,r),w=E(m);function E(T){return Ud(y(T),h)}function _(T){let N=Om(Je(T,h,"uCoordinate"));return a&&(N[31]&=127),y(Hu(N))}function C(T){return Hu(i(Om(Je(T,h,"scalar"))))}function F(T,N){let P=q(_(N),C(T));if(P===Kd)throw new Error("invalid private or public key received");return E(P)}function H(T){return F(T,w)}let K=H,S=F;function I(T,N,P){let M=y(T*(N-P));return N=y(N-M),P=y(P+M),{x_2:N,x_3:P}}function q(T,N){Hd("u",T,Kd,r),Hd("scalar",N,d,g);let P=N,M=T,Y=If,V=Kd,X=T,te=If,ae=Kd;for(let he=BigInt(l-1);he>=Kd;he--){let De=P>>he&If;ae^=De,{x_2:Y,x_3:X}=I(ae,Y,X),{x_2:V,x_3:te}=I(ae,V,te),ae=De;let Pe=Y+V,Ie=y(Pe*Pe),se=Y-V,pe=y(se*se),Fe=Ie-pe,Te=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Te*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(M*y(ct*ct)),Y=y(Ie*pe),V=y(Fe*(Ie+y(p*Fe)))}({x_2:Y,x_3:X}=I(ae,Y,X)),{x_2:V,x_3:te}=I(ae,V,te);let me=o(V);return y(Y*me)}let L={secretKey:h,publicKey:h,seed:h},R=(T=u(h))=>(Je(T,L.seed,"seed"),T),O={randomSecretKey:R};return Object.freeze({keygen:Um(R,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var Cpe=B(x(),1);var wpe=B(x(),1);var Mm=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,r){if(ii(t),Je(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),ws(i)}update(t){return Da(this),this.iHash.update(t),this}digestInto(t){Da(this),Je(t,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=s,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},xf=(e,t,r)=>new Mm(e,t).update(r).digest();xf.create=(e,t)=>new Mm(e,t);var fF=(e,t)=>(e+(e>=0?t:-t)/hF)/t;function Jz(e,t,r){let[[n,i],[o,s]]=t,a=fF(s*e,r),u=fF(-i*e,r),l=e-a*n-u*o,h=-a*i-u*s,m=l<Fa,p=h<Fa;m&&(l=-l),p&&(h=-h);let d=Md(Math.ceil(zE(r)/2))+$f;if(l<Fa||l>=d||h<Fa||h>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:m,k1:l,k2neg:p,k2:h}}function nb(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function rb(e,t){let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return Nd(r.lowS,"lowS"),Nd(r.prehash,"prehash"),r.format!==void 0&&nb(r.format),r}var sb=class extends Error{constructor(t=""){super(t)}},qu={Err:sb,_tlv:{encode:(e,t)=>{let{Err:r}=qu;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=Ld(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?Ld(i.length/2|128):"";return Ld(e)+o+i+t},decode(e,t){let{Err:r}=qu,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],o=!!(i&128),s=0;if(!o)s=i;else{let u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let l=t.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let h of l)s=s<<8|h;if(n+=u,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=qu;if(e<Fa)throw new t("integer: negative integers are not allowed");let r=Ld(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=qu;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Uu(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=qu,i=Je(e,void 0,"signature"),{v:o,l:s}=n.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:u}=n.decode(2,o),{v:l,l:h}=n.decode(2,u);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=qu,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s)),o=n+i;return t.encode(48,o)}},Fa=BigInt(0),$f=BigInt(1),hF=BigInt(2),qm=BigInt(3),Qz=BigInt(4);function ib(e,t={}){let r=cF("weierstrass",e,t),{Fp:n,Fn:i}=r,o=r.CURVE,{h:s,n:a}=o;Kc(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:u}=t;if(u&&(!n.is0(o.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let l=pF(n,i);function h(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(R,O,T){let{x:N,y:P}=O.toAffine(),M=n.toBytes(N);if(Nd(T,"isCompressed"),T){h();let Y=!n.isOdd(P);return xr(dF(Y),M)}else return xr(Uint8Array.of(4),M,n.toBytes(P))}function p(R){Je(R,void 0,"Point");let{publicKey:O,publicKeyUncompressed:T}=l,N=R.length,P=R[0],M=R.subarray(1);if(N===O&&(P===2||P===3)){let Y=n.fromBytes(M);if(!n.isValid(Y))throw new Error("bad point: is not on curve, wrong x");let V=g(Y),X;try{X=n.sqrt(V)}catch(me){let he=me instanceof Error?": "+me.message:"";throw new Error("bad point: is not on curve, sqrt error"+he)}h();let te=n.isOdd(X);return(P&1)===1!==te&&(X=n.neg(X)),{x:Y,y:X}}else if(N===T&&P===4){let Y=n.BYTES,V=n.fromBytes(M.subarray(0,Y)),X=n.fromBytes(M.subarray(Y,Y*2));if(!y(V,X))throw new Error("bad point: is not on curve");return{x:V,y:X}}else throw new Error(`bad point: got length ${N}, expected compressed=${O} or uncompressed=${T}`)}let d=t.toBytes||m,v=t.fromBytes||p;function g(R){let O=n.sqr(R),T=n.mul(O,R);return n.add(n.add(T,n.mul(R,o.a)),o.b)}function y(R,O){let T=n.sqr(O),N=g(R);return n.eql(T,N)}if(!y(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let w=n.mul(n.pow(o.a,qm),Qz),E=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(w,E)))throw new Error("bad curve params: a or b");function _(R,O,T=!1){if(!n.isValid(O)||T&&n.is0(O))throw new Error(`bad point coordinate ${R}`);return O}function C(R){if(!(R instanceof I))throw new Error("Weierstrass Point expected")}function F(R){if(!u||!u.basises)throw new Error("no endo");return Jz(R,u.basises,i.ORDER)}let H=GE((R,O)=>{let{X:T,Y:N,Z:P}=R;if(n.eql(P,n.ONE))return{x:T,y:N};let M=R.is0();O==null&&(O=M?n.ONE:n.inv(P));let Y=n.mul(T,O),V=n.mul(N,O),X=n.mul(P,O);if(M)return{x:n.ZERO,y:n.ZERO};if(!n.eql(X,n.ONE))throw new Error("invZ was invalid");return{x:Y,y:V}}),K=GE(R=>{if(R.is0()){if(t.allowInfinityPoint&&!n.is0(R.Y))return;throw new Error("bad point: ZERO")}let{x:O,y:T}=R.toAffine();if(!n.isValid(O)||!n.isValid(T))throw new Error("bad point: x or y not field elements");if(!y(O,T))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function S(R,O,T,N,P){return T=new I(n.mul(T.X,R),T.Y,T.Z),O=jd(N,O),T=jd(P,T),O.add(T)}class I{static BASE=new I(o.Gx,o.Gy,n.ONE);static ZERO=new I(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(O,T,N){this.X=_("x",O),this.Y=_("y",T,!0),this.Z=_("z",N),Object.freeze(this)}static CURVE(){return o}static fromAffine(O){let{x:T,y:N}=O||{};if(!O||!n.isValid(T)||!n.isValid(N))throw new Error("invalid affine point");if(O instanceof I)throw new Error("projective point not allowed");return n.is0(T)&&n.is0(N)?I.ZERO:new I(T,N,n.ONE)}static fromBytes(O){let T=I.fromAffine(v(Je(O,void 0,"point")));return T.assertValidity(),T}static fromHex(O){return I.fromBytes(jc(O))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(O=8,T=!0){return L.createCache(this,O),T||this.multiply(qm),this}assertValidity(){K(this)}hasEvenY(){let{y:O}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(O)}equals(O){C(O);let{X:T,Y:N,Z:P}=this,{X:M,Y,Z:V}=O,X=n.eql(n.mul(T,V),n.mul(M,P)),te=n.eql(n.mul(N,V),n.mul(Y,P));return X&&te}negate(){return new I(this.X,n.neg(this.Y),this.Z)}double(){let{a:O,b:T}=o,N=n.mul(T,qm),{X:P,Y:M,Z:Y}=this,V=n.ZERO,X=n.ZERO,te=n.ZERO,ae=n.mul(P,P),me=n.mul(M,M),he=n.mul(Y,Y),De=n.mul(P,M);return De=n.add(De,De),te=n.mul(P,Y),te=n.add(te,te),V=n.mul(O,te),X=n.mul(N,he),X=n.add(V,X),V=n.sub(me,X),X=n.add(me,X),X=n.mul(V,X),V=n.mul(De,V),te=n.mul(N,te),he=n.mul(O,he),De=n.sub(ae,he),De=n.mul(O,De),De=n.add(De,te),te=n.add(ae,ae),ae=n.add(te,ae),ae=n.add(ae,he),ae=n.mul(ae,De),X=n.add(X,ae),he=n.mul(M,Y),he=n.add(he,he),ae=n.mul(he,De),V=n.sub(V,ae),te=n.mul(he,me),te=n.add(te,te),te=n.add(te,te),new I(V,X,te)}add(O){C(O);let{X:T,Y:N,Z:P}=this,{X:M,Y,Z:V}=O,X=n.ZERO,te=n.ZERO,ae=n.ZERO,me=o.a,he=n.mul(o.b,qm),De=n.mul(T,M),Pe=n.mul(N,Y),Ie=n.mul(P,V),se=n.add(T,N),pe=n.add(M,Y);se=n.mul(se,pe),pe=n.add(De,Pe),se=n.sub(se,pe),pe=n.add(T,P);let Fe=n.add(M,V);return pe=n.mul(pe,Fe),Fe=n.add(De,Ie),pe=n.sub(pe,Fe),Fe=n.add(N,P),X=n.add(Y,V),Fe=n.mul(Fe,X),X=n.add(Pe,Ie),Fe=n.sub(Fe,X),ae=n.mul(me,pe),X=n.mul(he,Ie),ae=n.add(X,ae),X=n.sub(Pe,ae),ae=n.add(Pe,ae),te=n.mul(X,ae),Pe=n.add(De,De),Pe=n.add(Pe,De),Ie=n.mul(me,Ie),pe=n.mul(he,pe),Pe=n.add(Pe,Ie),Ie=n.sub(De,Ie),Ie=n.mul(me,Ie),pe=n.add(pe,Ie),De=n.mul(Pe,pe),te=n.add(te,De),De=n.mul(Fe,pe),X=n.mul(se,X),X=n.sub(X,De),De=n.mul(se,Pe),ae=n.mul(Fe,ae),ae=n.add(ae,De),new I(X,te,ae)}subtract(O){return this.add(O.negate())}is0(){return this.equals(I.ZERO)}multiply(O){let{endo:T}=t;if(!i.isValidNot0(O))throw new Error("invalid scalar: out of range");let N,P,M=Y=>L.cached(this,Y,V=>tb(I,V));if(T){let{k1neg:Y,k1:V,k2neg:X,k2:te}=F(O),{p:ae,f:me}=M(V),{p:he,f:De}=M(te);P=me.add(De),N=S(T.beta,ae,he,Y,X)}else{let{p:Y,f:V}=M(O);N=Y,P=V}return tb(I,[N,P])[0]}multiplyUnsafe(O){let{endo:T}=t,N=this;if(!i.isValid(O))throw new Error("invalid scalar: out of range");if(O===Fa||N.is0())return I.ZERO;if(O===$f)return N;if(L.hasCache(this))return this.multiply(O);if(T){let{k1neg:P,k1:M,k2neg:Y,k2:V}=F(O),{p1:X,p2:te}=uF(I,N,M,V);return S(T.beta,X,te,P,Y)}else return L.unsafe(N,O)}toAffine(O){return H(this,O)}isTorsionFree(){let{isTorsionFree:O}=t;return s===$f?!0:O?O(I,this):L.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:O}=t;return s===$f?this:O?O(I,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(O=!0){return Nd(O,"isCompressed"),this.assertValidity(),d(I,this,O)}toHex(O=!0){return qc(this.toBytes(O))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let q=i.BITS,L=new Lm(I,t.endo?Math.ceil(q/2):q);return I.BASE.precompute(8),I}function dF(e){return Uint8Array.of(e?2:3)}function pF(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function eG(e,t={}){let{Fn:r}=e,n=t.randomBytes||Nu,i=Object.assign(pF(e.Fp,r),{seed:ZE(r.ORDER)});function o(d){try{let v=r.fromBytes(d);return r.isValidNot0(v)}catch{return!1}}function s(d,v){let{publicKey:g,publicKeyUncompressed:y}=i;try{let w=d.length;return v===!0&&w!==g||v===!1&&w!==y?!1:!!e.fromBytes(d)}catch{return!1}}function a(d=n(i.seed)){return rF(Je(d,i.seed,"seed"),r.ORDER)}function u(d,v=!0){return e.BASE.multiply(r.fromBytes(d)).toBytes(v)}function l(d){let{secretKey:v,publicKey:g,publicKeyUncompressed:y}=i;if(!Cf(d)||"_lengths"in r&&r._lengths||v===g)return;let w=Je(d,void 0,"key").length;return w===g||w===y}function h(d,v,g=!0){if(l(d)===!0)throw new Error("first arg must be private key");if(l(v)===!1)throw new Error("second arg must be public key");let y=r.fromBytes(d);return e.fromBytes(v).multiply(y).toBytes(g)}let m={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a},p=Um(a,u);return Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function ob(e,t,r={}){ii(t),Kc(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes||Nu,i=r.hmac||((T,N)=>xf(t,T,N)),{Fp:o,Fn:s}=e,{ORDER:a,BITS:u}=s,{keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d}=eG(e,r),v={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},g=a*hF<o.ORDER;function y(T){let N=a>>$f;return T>N}function w(T,N){if(!s.isValidNot0(N))throw new Error(`invalid signature ${T}: out of range 1..Point.Fn.ORDER`);return N}function E(){if(g)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function _(T,N){nb(N);let P=d.signature,M=N==="compact"?P:N==="recovered"?P+1:void 0;return Je(T,M)}class C{r;s;recovery;constructor(N,P,M){if(this.r=w("r",N),this.s=w("s",P),M!=null){if(E(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(N,P=v.format){_(N,P);let M;if(P==="der"){let{r:te,s:ae}=qu.toSig(Je(N));return new C(te,ae)}P==="recovered"&&(M=N[0],P="compact",N=N.subarray(1));let Y=d.signature/2,V=N.subarray(0,Y),X=N.subarray(Y,Y*2);return new C(s.fromBytes(V),s.fromBytes(X),M)}static fromHex(N,P){return this.fromBytes(jc(N),P)}assertRecovery(){let{recovery:N}=this;if(N==null)throw new Error("invalid recovery id: must be present");return N}addRecoveryBit(N){return new C(this.r,this.s,N)}recoverPublicKey(N){let{r:P,s:M}=this,Y=this.assertRecovery(),V=Y===2||Y===3?P+a:P;if(!o.isValid(V))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let X=o.toBytes(V),te=e.fromBytes(xr(dF((Y&1)===0),X)),ae=s.inv(V),me=H(Je(N,void 0,"msgHash")),he=s.create(-me*ae),De=s.create(M*ae),Pe=e.BASE.multiplyUnsafe(he).add(te.multiplyUnsafe(De));if(Pe.is0())throw new Error("invalid recovery: point at infinify");return Pe.assertValidity(),Pe}hasHighS(){return y(this.s)}toBytes(N=v.format){if(nb(N),N==="der")return jc(qu.hexFromSig(this));let{r:P,s:M}=this,Y=s.toBytes(P),V=s.toBytes(M);return N==="recovered"?(E(),xr(Uint8Array.of(this.assertRecovery()),Y,V)):xr(Y,V)}toHex(N){return qc(this.toBytes(N))}}let F=r.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");let P=Uu(N),M=N.length*8-u;return M>0?P>>BigInt(M):P},H=r.bits2int_modN||function(N){return s.create(F(N))},K=Md(u);function S(T){return Hd("num < 2^"+u,T,Fa,K),s.toBytes(T)}function I(T,N){return Je(T,void 0,"message"),N?Je(t(T),void 0,"prehashed message"):T}function q(T,N,P){let{lowS:M,prehash:Y,extraEntropy:V}=rb(P,v);T=I(T,Y);let X=H(T),te=s.fromBytes(N);if(!s.isValidNot0(te))throw new Error("invalid private key");let ae=[S(te),S(X)];if(V!=null&&V!==!1){let Pe=V===!0?n(d.secretKey):V;ae.push(Je(Pe,void 0,"extraEntropy"))}let me=xr(...ae),he=X;function De(Pe){let Ie=F(Pe);if(!s.isValidNot0(Ie))return;let se=s.inv(Ie),pe=e.BASE.multiply(Ie).toAffine(),Fe=s.create(pe.x);if(Fe===Fa)return;let Te=s.create(se*s.create(he+Fe*te));if(Te===Fa)return;let Ve=(pe.x===Fe?0:2)|Number(pe.y&$f),Oe=Te;return M&&y(Te)&&(Oe=s.neg(Te),Ve^=1),new C(Fe,Oe,g?void 0:Ve)}return{seed:me,k2sig:De}}function L(T,N,P={}){let{seed:M,k2sig:Y}=q(T,N,P);return VD(t.outputLen,s.BYTES,i)(M,Y).toBytes(P.format)}function R(T,N,P,M={}){let{lowS:Y,prehash:V,format:X}=rb(M,v);if(P=Je(P,void 0,"publicKey"),N=I(N,V),!Cf(T)){let te=T instanceof C?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}_(T,X);try{let te=C.fromBytes(T,X),ae=e.fromBytes(P);if(Y&&te.hasHighS())return!1;let{r:me,s:he}=te,De=H(N),Pe=s.inv(he),Ie=s.create(De*Pe),se=s.create(me*Pe),pe=e.BASE.multiplyUnsafe(Ie).add(ae.multiplyUnsafe(se));return pe.is0()?!1:s.create(pe.x)===me}catch{return!1}}function O(T,N,P={}){let{prehash:M}=rb(P,v);return N=I(N,M),C.fromBytes(T,"recovered").recoverPublicKey(N).toBytes()}return Object.freeze({keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d,Point:e,sign:L,verify:R,recoverPublicKey:O,Signature:C,hash:t})}var qpe=B(x(),1);var Tpe=B(x(),1);var Bpe=B(x(),1);function mF(e,t,r){return e&t^~e&r}function gF(e,t,r){return e&t^e&r^t&r}var Vd=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,i){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(t),this.view=Rm(this.buffer)}update(t){Da(this),Je(t);let{view:r,buffer:n,blockLen:i}=this,o=t.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let u=Rm(t);for(;i<=o-s;s+=i)this.process(u,s);continue}n.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Da(this),Pm(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,ws(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(n,0),s=0);for(let m=s;m<i;m++)r[m]=0;n.setBigUint64(i-8,BigInt(this.length*8),o),this.process(n,0);let a=Rm(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=u/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)a.setUint32(4*m,h[m],o)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||=new this.constructor,t.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return t.destroyed=s,t.finished=o,t.length=i,t.pos=a,i%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},Ba=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var an=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]);var Ipe=B(x(),1),jm=BigInt(4294967295),vF=BigInt(32);function tG(e,t=!1){return t?{h:Number(e&jm),l:Number(e>>vF&jm)}:{h:Number(e>>vF&jm)|0,l:Number(e&jm)|0}}function Km(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:s,l:a}=tG(e[o],t);[n[o],i[o]]=[s,a]}return[n,i]}var ab=(e,t,r)=>e>>>r,ub=(e,t,r)=>e<<32-r|t>>>r,Gc=(e,t,r)=>e>>>r|t<<32-r,Wc=(e,t,r)=>e<<32-r|t>>>r,zd=(e,t,r)=>e<<64-r|t>>>r-32,Gd=(e,t,r)=>e>>>r-32|t<<64-r;var wF=(e,t,r)=>e<<r|t>>>32-r,yF=(e,t,r)=>t<<r|e>>>32-r,EF=(e,t,r)=>t<<r-32|e>>>64-r,bF=(e,t,r)=>e<<r-32|t>>>64-r;function Do(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var AF=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),SF=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,_F=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),CF=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,DF=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),FF=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;var nG=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ju=new Uint32Array(64),cb=class extends Vd{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:n,D:i,E:o,F:s,G:a,H:u}=this;return[t,r,n,i,o,s,a,u]}set(t,r,n,i,o,s,a,u){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,r){for(let m=0;m<16;m++,r+=4)ju[m]=t.getUint32(r,!1);for(let m=16;m<64;m++){let p=ju[m-15],d=ju[m-2],v=Li(p,7)^Li(p,18)^p>>>3,g=Li(d,17)^Li(d,19)^d>>>10;ju[m]=g+ju[m-7]+v+ju[m-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:u,G:l,H:h}=this;for(let m=0;m<64;m++){let p=Li(a,6)^Li(a,11)^Li(a,25),d=h+p+mF(a,u,l)+nG[m]+ju[m]|0,g=(Li(n,2)^Li(n,13)^Li(n,22))+gF(n,i,o)|0;h=l,l=u,u=a,a=s+d|0,s=o,o=i,i=n,n=d+g|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(n,i,o,s,a,u,l,h)}roundClean(){ws(ju)}destroy(){this.set(0,0,0,0,0,0,0,0),ws(this.buffer)}},lb=class extends cb{A=Ba[0]|0;B=Ba[1]|0;C=Ba[2]|0;D=Ba[3]|0;E=Ba[4]|0;F=Ba[5]|0;G=Ba[6]|0;H=Ba[7]|0;constructor(){super(32)}};var BF=Km(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),sG=BF[0],iG=BF[1],Ku=new Uint32Array(80),Vu=new Uint32Array(80),fb=class extends Vd{constructor(t){super(128,t,16,!1)}get(){let{Ah:t,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:l,El:h,Fh:m,Fl:p,Gh:d,Gl:v,Hh:g,Hl:y}=this;return[t,r,n,i,o,s,a,u,l,h,m,p,d,v,g,y]}set(t,r,n,i,o,s,a,u,l,h,m,p,d,v,g,y){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=l|0,this.El=h|0,this.Fh=m|0,this.Fl=p|0,this.Gh=d|0,this.Gl=v|0,this.Hh=g|0,this.Hl=y|0}process(t,r){for(let _=0;_<16;_++,r+=4)Ku[_]=t.getUint32(r),Vu[_]=t.getUint32(r+=4);for(let _=16;_<80;_++){let C=Ku[_-15]|0,F=Vu[_-15]|0,H=Gc(C,F,1)^Gc(C,F,8)^ab(C,F,7),K=Wc(C,F,1)^Wc(C,F,8)^ub(C,F,7),S=Ku[_-2]|0,I=Vu[_-2]|0,q=Gc(S,I,19)^zd(S,I,61)^ab(S,I,6),L=Wc(S,I,19)^Gd(S,I,61)^ub(S,I,6),R=_F(K,L,Vu[_-7],Vu[_-16]),O=CF(R,H,q,Ku[_-7],Ku[_-16]);Ku[_]=O|0,Vu[_]=R|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:h,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let _=0;_<80;_++){let C=Gc(m,p,14)^Gc(m,p,18)^zd(m,p,41),F=Wc(m,p,14)^Wc(m,p,18)^Gd(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=DF(E,F,K,iG[_],Vu[_]),I=FF(S,w,C,H,sG[_],Ku[_]),q=S|0,L=Gc(n,i,28)^zd(n,i,34)^zd(n,i,39),R=Wc(n,i,28)^Gd(n,i,34)^Gd(n,i,39),O=n&o^n&a^o&a,T=i&s^i&u^s&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=Do(l|0,h|0,I|0,q|0),l=a|0,h=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let N=AF(q,R,T);n=SF(N,I,L,O),i=N|0}({h:n,l:i}=Do(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Do(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=Do(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=Do(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=Do(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=Do(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=Do(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=Do(this.Hh|0,this.Hl|0,w|0,E|0),this.set(n,i,o,s,a,u,l,h,m,p,d,v,g,y,w,E)}roundClean(){ws(Ku,Vu)}destroy(){ws(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var hb=class extends fb{Ah=an[0]|0;Al=an[1]|0;Bh=an[2]|0;Bl=an[3]|0;Ch=an[4]|0;Cl=an[5]|0;Dh=an[6]|0;Dl=an[7]|0;Eh=an[8]|0;El=an[9]|0;Fh=an[10]|0;Fl=an[11]|0;Gh=an[12]|0;Gl=an[13]|0;Hh=an[14]|0;Hl=an[15]|0;constructor(){super(48)}};var Vm=Df(()=>new lb,Lu(1));var IF=Df(()=>new hb,Lu(2));var oG=BigInt(1),xF=BigInt(2),aG=BigInt(3),uG=BigInt(5),Hpe=BigInt(8),$F=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");function cG(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=$F,a=e*e%o*e%o,u=oi(a,xF,o)*a%o,l=oi(u,oG,o)*e%o,h=oi(l,uG,o)*l%o,m=oi(h,t,o)*h%o,p=oi(m,r,o)*m%o,d=oi(p,n,o)*p%o,v=oi(d,i,o)*d%o,g=oi(v,i,o)*d%o,y=oi(g,t,o)*h%o;return{pow_p_5_8:oi(y,xF,o)*e%o,b2:a}}function lG(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var PF=(()=>{let e=$F;return lF({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=cG(t);return Gn(oi(r,aG,e)*n,e)},adjustScalarBytes:lG})})();var Wpe=B(x(),1);var fG={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},hG={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")};var dG=ib(fG),db=ob(dG,Vm);var pG=ib(hG),kF=ob(pG,IF);var Jpe=B(x(),1);function TF(e,t,r){return ii(e),r===void 0&&(r=new Uint8Array(e.outputLen)),xf(e,r,t)}var pb=Uint8Array.of(0),RF=Uint8Array.of();function OF(e,t,r,n=32){ii(e),Zr(n,"length");let i=e.outputLen;if(n>255*i)throw new Error("Length must be <= 255*HashLen");let o=Math.ceil(n/i);r===void 0?r=RF:Je(r,void 0,"info");let s=new Uint8Array(o*i),a=xf.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)pb[0]=h+1,u.update(h===0?RF:l).update(r).update(pb).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),ws(l,pb),s.slice(0,n)}var r0e=B(x(),1);var mG=BigInt(0),Wd=BigInt(1),gG=BigInt(2),vG=BigInt(7),wG=BigInt(256),yG=BigInt(113),UF=[],HF=[],MF=[];for(let e=0,t=Wd,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],UF.push(2*(5*n+r)),HF.push((e+1)*(e+2)/2%64);let i=mG;for(let o=0;o<7;o++)t=(t<<Wd^(t>>vG)*yG)%wG,t&gG&&(i^=Wd<<(Wd<<BigInt(o))-Wd);MF.push(i)}var qF=Km(MF,!0),EG=qF[0],bG=qF[1],NF=(e,t,r)=>r>32?EF(e,t,r):wF(e,t,r),LF=(e,t,r)=>r>32?bF(e,t,r):yF(e,t,r);function AG(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,u=(s+2)%10,l=r[u],h=r[u+1],m=NF(l,h,1)^r[a],p=LF(l,h,1)^r[a+1];for(let d=0;d<50;d+=10)e[s+d]^=m,e[s+d+1]^=p}let i=e[2],o=e[3];for(let s=0;s<24;s++){let a=HF[s],u=NF(i,o,a),l=LF(i,o,a),h=UF[s];i=e[h],o=e[h+1],e[h]=u,e[h+1]=l}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)r[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=EG[n],e[1]^=bG[n]}ws(r)}var zm=class e{state;pos=0;posOut=0;finished=!1;state32;destroyed=!1;blockLen;suffix;outputLen;enableXOF=!1;rounds;constructor(t,r,n,i=!1,o=24){if(this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=o,Zr(n,"outputLen"),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=km(this.state)}clone(){return this._cloneInto()}keccak(){jE(this.state32),AG(this.state32,this.rounds),jE(this.state32),this.posOut=0,this.pos=0}update(t){Da(this),Je(t);let{blockLen:r,state:n}=this,i=t.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);for(let a=0;a<s;a++)n[this.pos++]^=t[o++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:i}=this;t[n]^=r,(r&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Da(this,!1),Je(t),this.finish();let r=this.state,{blockLen:n}=this;for(let i=0,o=t.length;i<o;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);t.set(r.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Zr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Pm(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ws(this.state)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return t||=new e(r,n,i,s,o),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}},jF=(e,t,r,n={})=>Df(()=>new zm(t,e,r),n);var Yc=jF(6,136,32,Lu(8));var KF=jF(6,72,64,Lu(10));var VF=(e,t,r,n={})=>Df((i={})=>new zm(t,e,i.dkLen===void 0?r:i.dkLen,!0),n),zF=VF(31,168,16,Lu(11)),Fo=VF(31,136,32,Lu(12));var b0e=B(x(),1);var p0e=B(x(),1);var s0e=B(x(),1);function mb(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function WF(e){return mb(e),(e&e-1)===0&&e!==0}function gb(e,t){mb(e);let r=0;for(let n=0;n<t;n++,e>>>=1)r=r<<1|e&1;return r}function YF(e){return mb(e),31-Math.clz32(e)}function GF(e){let t=e.length;if(t<2||!WF(t))throw new Error("n must be a power of 2 and greater than 1. Got "+t);let r=YF(t);for(let n=0;n<t;n++){let i=gb(n,r);if(n<i){let o=e[n];e[n]=e[i],e[i]=o}}return e}var vb=(e,t)=>{let{N:r,roots:n,dit:i,invertButterflies:o=!1,skipStages:s=0,brp:a=!0}=t,u=YF(r);if(!WF(r))throw new Error("FFT: Polynomial size should be power of two");let l=i!==o;return h=>{if(h.length!==r)throw new Error("FFT: wrong Polynomial length");i&&a&&GF(h);for(let m=0,p=1;m<u-s;m++){let d=i?m+1+s:u-m,v=1<<d,g=v>>1,y=r>>d;for(let w=0;w<r;w+=v)for(let E=0,_=p++;E<g;E++){let C=o?i?r-_:_:E*y,F=w+E,H=w+E+g,K=n[C],S=h[H],I=h[F];if(l){let q=e.mul(S,K);h[F]=e.add(I,q),h[H]=e.sub(I,q)}else o?(h[F]=e.add(S,I),h[H]=e.mul(e.sub(S,I),K)):(h[F]=e.add(I,S),h[H]=e.mul(e.sub(I,S),K))}}return!i&&a&&GF(h),h}};var u0e=B(x(),1);var Bo=Nu;function Gm(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function XF(e){return Uint8Array.from(e)}function Xc(e,...t){let r=i=>typeof i=="number"?i:i.bytesLen,n=t.reduce((i,o)=>i+r(o),0);return{bytesLen:n,encode:i=>{let o=new Uint8Array(n);for(let s=0,a=0;s<t.length;s++){let u=t[s],l=r(u),h=typeof u=="number"?i[s]:u.encode(i[s]);Je(h,l,e),o.set(h,a),typeof u!="number"&&h.fill(0),a+=l}return o},decode:i=>{Je(i,n,e);let o=[];for(let s of t){let a=r(s),u=i.subarray(0,a);o.push(typeof s=="number"?u:s.decode(u)),i=i.subarray(a)}return o}}}function Wm(e,t){let r=t*e.bytesLen;return{bytesLen:r,encode:n=>{if(n.length!==t)throw new Error(`vecCoder.encode: wrong length=${n.length}. Expected: ${t}`);let i=new Uint8Array(r);for(let o=0,s=0;o<n.length;o++){let a=e.encode(n[o]);i.set(a,s),a.fill(0),s+=a.length}return i},decode:n=>{Je(n,r);let i=[];for(let o=0;o<n.length;o+=e.bytesLen)i.push(e.decode(n.subarray(o,o+e.bytesLen)));return i}}}function qr(...e){for(let t of e)if(Array.isArray(t))for(let r of t)r.fill(0);else t.fill(0)}function wb(e){return(1<<e)-1}var o0e=Uint8Array.of();var ZF=e=>{let{newPoly:t,N:r,Q:n,F:i,ROOT_OF_UNITY:o,brvBits:s,isKyber:a}=e,u=(E,_=n)=>{let C=E%_|0;return(C>=0?C|0:_+C|0)|0},l=(E,_=n)=>{let C=u(E,_)|0;return(C>_>>1?C-_|0:C)|0};function h(){let E=t(r);for(let _=0;_<r;_++){let C=gb(_,s),F=BigInt(o)**BigInt(C)%BigInt(n);E[_]=Number(F)|0}return E}let m=h(),p={add:(E,_)=>u((E|0)+(_|0))|0,sub:(E,_)=>u((E|0)-(_|0))|0,mul:(E,_)=>u((E|0)*(_|0))|0,inv:E=>{throw new Error("not implemented")}},d={N:r,roots:m,invertButterflies:!0,skipStages:a?1:0,brp:!1},v=vb(p,{dit:!1,...d}),g=vb(p,{dit:!0,...d});return{mod:u,smod:l,nttZetas:m,NTT:{encode:E=>v(E),decode:E=>{g(E);for(let _=0;_<E.length;_++)E[_]=u(i*E[_]);return E}},bitsCoder:(E,_)=>{let C=wb(E),F=E*(r/8);return{bytesLen:F,encode:H=>{let K=new Uint8Array(F);for(let S=0,I=0,q=0,L=0;S<H.length;S++)for(I|=(_.encode(H[S])&C)<<q,q+=E;q>=8;q-=8,I>>=8)K[L++]=I&wb(q);return K},decode:H=>{let K=t(r);for(let S=0,I=0,q=0,L=0;S<H.length;S++)for(I|=H[S]<<q,q+=8;q>=E;q-=E,I>>=E)K[L++]=_.decode(I&C);return K}}}}},SG=e=>(t,r)=>{r||(r=e.blockLen);let n=new Uint8Array(t.length+2);n.set(t);let i=t.length,o=new Uint8Array(r),s=e.create({}),a=0,u=0;return{stats:()=>({calls:a,xofs:u}),get:(l,h)=>(n[i+0]=l,n[i+1]=h,s.destroy(),s=e.create({}).update(n),a++,()=>(u++,s.xofInto(o))),clean:()=>{s.destroy(),qr(o,n)}}},JF=SG(zF);var kn=256,Ia=3329,_G=3303,CG=17,{mod:Zd,nttZetas:DG,NTT:Zc,bitsCoder:FG}=ZF({N:kn,Q:Ia,F:_G,ROOT_OF_UNITY:CG,newPoly:e=>new Uint16Array(e),brvBits:7,isKyber:!0}),yb={512:{N:kn,Q:Ia,K:2,ETA1:3,ETA2:2,du:10,dv:4,RBGstrength:128},768:{N:kn,Q:Ia,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:kn,Q:Ia,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}},BG=e=>{if(e>=12)return{encode:r=>r,decode:r=>r};let t=2**(e-1);return{encode:r=>((r<<e)+Ia/2)/Ia,decode:r=>r*Ia+t>>>e}},Yd=e=>FG(e,BG(e));function Jc(e,t){for(let r=0;r<kn;r++)e[r]=Zd(e[r]+t[r])}function IG(e,t){for(let r=0;r<kn;r++)e[r]=Zd(e[r]-t[r])}function xG(e,t,r,n,i){let o=Zd(t*n*i+e*r),s=Zd(e*n+t*r);return{c0:o,c1:s}}function Ym(e,t){for(let r=0;r<kn/2;r++){let n=DG[64+(r>>1)];r&1&&(n=-n);let{c0:i,c1:o}=xG(e[2*r+0],e[2*r+1],t[2*r+0],t[2*r+1],n);e[2*r+0]=i,e[2*r+1]=o}return e}function QF(e){let t=new Uint16Array(kn);for(let r=0;r<kn;){let n=e();if(n.length%3)throw new Error("SampleNTT: unaligned block");for(let i=0;r<kn&&i+3<=n.length;i+=3){let o=(n[i+0]>>0|n[i+1]<<8)&4095,s=(n[i+1]>>4|n[i+2]<<4)&4095;o<Ia&&(t[r++]=o),r<kn&&s<Ia&&(t[r++]=s)}}return t}function Xd(e,t,r,n){let i=e(n*kn/4,t,r),o=new Uint16Array(kn),s=km(i),a=0;for(let u=0,l=0,h=0,m=0;u<s.length;u++){let p=s[u];for(let d=0;d<32;d++)h+=p&1,p>>=1,a+=1,a===n?(m=h,h=0):a===2*n&&(o[l++]=Zd(m-h),h=0,a=0)}if(a)throw new Error(`sampleCBD: leftover bits: ${a}`);return o}var $G=e=>{let{K:t,PRF:r,XOF:n,HASH512:i,ETA1:o,ETA2:s,du:a,dv:u}=e,l=Yd(1),h=Yd(u),m=Yd(a),p=Xc("publicKey",Wm(Yd(12),t),32),d=Wm(Yd(12),t),v=Xc("ciphertext",Wm(m,t),h),g=Xc("seed",32,32);return{secretCoder:d,lengths:{secretKey:d.bytesLen,publicKey:p.bytesLen,cipherText:v.bytesLen},keygen:y=>{Je(y,32,"seed");let w=new Uint8Array(33);w.set(y),w[32]=t;let E=i(w),[_,C]=g.decode(E),F=[],H=[];for(let I=0;I<t;I++)F.push(Zc.encode(Xd(r,C,I,o)));let K=n(_);for(let I=0;I<t;I++){let q=Zc.encode(Xd(r,C,t+I,o));for(let L=0;L<t;L++){let R=QF(K.get(L,I));Jc(q,Ym(R,F[L]))}H.push(q)}K.clean();let S={publicKey:p.encode([H,_]),secretKey:d.encode(F)};return qr(_,C,F,H,w,E),S},encrypt:(y,w,E)=>{let[_,C]=p.decode(y),F=[];for(let L=0;L<t;L++)F.push(Zc.encode(Xd(r,E,L,o)));let H=n(C),K=new Uint16Array(kn),S=[];for(let L=0;L<t;L++){let R=Xd(r,E,t+L,s),O=new Uint16Array(kn);for(let T=0;T<t;T++){let N=QF(H.get(L,T));Jc(O,Ym(N,F[T]))}Jc(R,Zc.decode(O)),S.push(R),Jc(K,Ym(_[L],F[L])),qr(O)}H.clean();let I=Xd(r,E,2*t,s);Jc(I,Zc.decode(K));let q=l.decode(w);return Jc(q,I),qr(_,F,K,I),v.encode([S,q])},decrypt:(y,w)=>{let[E,_]=v.decode(y),C=d.decode(w),F=new Uint16Array(kn);for(let H=0;H<t;H++)Jc(F,Ym(C[H],Zc.encode(E[H])));return IG(_,Zc.decode(F)),qr(F,C,E),l.encode(_)}}};function Eb(e){let t=$G(e),{HASH256:r,HASH512:n,KDF:i}=e,{secretCoder:o,lengths:s}=t,a=Xc("secretKey",s.secretKey,s.publicKey,32,32),u=32,l=64;return{info:{type:"ml-kem"},lengths:{...s,seed:64,msg:u,msgRand:u,secretKey:a.bytesLen},keygen:(h=Bo(l))=>{Je(h,l,"seed");let{publicKey:m,secretKey:p}=t.keygen(h.subarray(0,32)),d=r(m),v=a.encode([p,m,d,h.subarray(32)]);return qr(p,d),{publicKey:m,secretKey:v}},getPublicKey:h=>{let[m,p,d,v]=a.decode(h);return Uint8Array.from(p)},encapsulate:(h,m=Bo(u))=>{Je(h,s.publicKey,"publicKey"),Je(m,u,"message");let p=h.subarray(0,384*e.K),d=o.encode(o.decode(XF(p)));if(!Gm(d,p))throw qr(d),new Error("ML-KEM.encapsulate: wrong publicKey modulus");qr(d);let v=n.create().update(m).update(r(h)).digest(),g=t.encrypt(h,m,v.subarray(32,64));return qr(v.subarray(32)),{cipherText:g,sharedSecret:v.subarray(0,32)}},decapsulate:(h,m)=>{Je(m,a.bytesLen,"secretKey"),Je(h,s.cipherText,"cipherText");let p=a.bytesLen-96,d=p+32,v=r(m.subarray(p/2,d));if(!Gm(v,m.subarray(d,d+32)))throw new Error("invalid secretKey: hash check failed");let[g,y,w,E]=a.decode(m),_=t.decrypt(h,g),C=n.create().update(_).update(w).digest(),F=C.subarray(0,32),H=t.encrypt(y,_,C.subarray(32,64)),K=Gm(h,H),S=i.create({dkLen:32}).update(E).update(h).digest();return qr(_,H,K?S:F),K?F:S}}}function PG(e,t,r){return Fo.create({dkLen:e}).update(t).update(new Uint8Array([r])).digest()}var bb={HASH256:Yc,HASH512:KF,KDF:Fo,XOF:JF,PRF:PG},y0e=Eb({...bb,...yb[512]}),Jd=Eb({...bb,...yb[768]}),eB=Eb({...bb,...yb[1024]});function kG(e,t=!1){let r=e.lengths,n=e.keygen;if(t){let o=e.Point.Fn;if(!o)throw new Error("No Point.Fn");n=(s=Bo(r.seed))=>{Je(s,r.seed,"seed");let a=o.isLE?Hu(s):Uu(s),u=o.toBytes(o.create(a));return{secretKey:u,publicKey:e.getPublicKey(u)}}}return{lengths:{secretKey:r.secretKey,publicKey:r.publicKey,seed:r.seed},keygen:n,getPublicKey:i=>e.getPublicKey(i)}}function Ab(e,t=!1){let r=kG(e,t);if(!e.getSharedSecret)throw new Error("wrong curve");return{lengths:{...r.lengths,msg:r.lengths.seed,cipherText:r.lengths.publicKey},keygen:r.keygen,getPublicKey:r.getPublicKey,encapsulate(n,i=Bo(e.lengths.seed)){let o=this.keygen(i).secretKey,s=this.decapsulate(n,o),a=e.getPublicKey(o);return qr(o),{sharedSecret:s,cipherText:a}},decapsulate(n,i){let o=e.getSharedSecret(i,n);return e.lengths.publicKeyHasPrefix?o.subarray(1):o}}}function Qd(e,t){return Xc(t,...e.map(r=>{if(typeof r.lengths[t]!="number")throw new Error("wrong length: "+t);return r.lengths[t]}))}function Sb(e){return(t,r)=>e(t,{dkLen:r})}function RG(e,t,...r){let n=Qd(r,"seed"),i=Qd(r,"publicKey");e===void 0&&(e=n.bytesLen),Zr(e);function o(s){Je(s,e);let a=n.decode(t(s,n.bytesLen)),u=r.map((m,p)=>m.keygen(a[p])),l=u.map(m=>m.secretKey),h=u.map(m=>m.publicKey);return{secretKey:l,publicKey:h}}return{info:{lengths:{seed:e,publicKey:i.bytesLen,secretKey:e}},getPublicKey(s){return this.keygen(s).publicKey},keygen(s=Bo(e)){let{publicKey:a,secretKey:u}=o(s),l=i.encode(a);return qr(a),qr(u),{secretKey:s,publicKey:l}},expandDecapsulationKey:o,realSeedLen:e}}function Xm(e,t,r,n,...i){let o=RG(e,r,...i),s=Qd(i,"cipherText"),a=Qd(i,"publicKey"),u=Qd(i,"msg");return t===void 0&&(t=u.bytesLen),Zr(t),{lengths:{...o.info.lengths,msg:t,msgRand:u.bytesLen,cipherText:s.bytesLen},getPublicKey:o.getPublicKey,keygen:o.keygen,encapsulate(l,h=Bo(u.bytesLen)){let m=a.decode(l),p=u.decode(h),d=i.map((w,E)=>w.encapsulate(m[E],p[E])),v=d.map(w=>w.sharedSecret),g=d.map(w=>w.cipherText),y={sharedSecret:n(m,g,v),cipherText:s.encode(g)};return qr(v,g),y},decapsulate(l,h){let m=s.decode(l),{publicKey:p,secretKey:d}=o.expandDecapsulationKey(h),v=i.map((g,y)=>g.decapsulate(m[y],d[y]));return n(p,m,v)}}}function tB(e,t,r,n,i){return ii(n),ii(i),Xm(32,32,Sb(n),(o,s,a)=>i(xr(a[0],a[1],s[1],o[1],Mu(e))),t,r)}var $0e=tB("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",Jd,Ab(db,!0),Fo,Yc),P0e=tB("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",eB,Ab(kF,!0),Fo,Yc);function TG(e,t,r,n,i){return ii(n),ii(i),Xm(32,32,Sb(n),(o,s,a)=>{let u=xr(a[0],a[1],s[0],o[0],s[1],o[1],Mu(e)),l=32,h=xr(Mu("hybrid_prk"),u),m=TF(i,h),p=xr(Ff(l,2),Mu("shared_secret"),Mu("")),d=OF(i,m,p,l);return qr(m,p,h,u),d},t,r)}var rB=Ab(PF),k0e=TG("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",Jd,rB,Fo,Vm),OG=Xm(32,32,Sb(Fo),(e,t,r)=>Yc(xr(r[0],r[1],t[1],e[1],Mu("\\.//^\\"))),Jd,rB);function NG(e,t,r,n){let i=e.Point.Fn;if(!i)throw new Error("no Point.Fn");function o(s){let a;for(let h=0,m=t;;h=m,m+=t){if(m>s.length)throw new Error("rejection sampling failed");if(a=i.fromBytes(s.subarray(h,m),!0),i.isValidNot0(a))break}let u=i.toBytes(i.create(a)),l=e.getPublicKey(u,!1);return{secretKey:u,publicKey:l}}return{lengths:{secretKey:t,publicKey:r,seed:n,msg:n,cipherText:r},keygen(s=Bo(n)){return Je(s,n,"seed"),o(s)},getPublicKey(s){return e.getPublicKey(s,!1)},encapsulate(s,a=Bo(n)){Je(a,n,"rand");let{secretKey:u}=o(a),l=this.decapsulate(s,u),h=e.getPublicKey(u,!1);return qr(u),{sharedSecret:l,cipherText:h}},decapsulate(s,a){return e.getSharedSecret(a,s).subarray(1)}}}function LG(e,t,r,n){let{secretKey:i,publicKeyUncompressed:o}=r.lengths;if(!i||!o)throw new Error("wrong curve");let s=NG(r,i,o,n),a=64,u=a+n;return Xm(32,32,l=>{Je(l,32);let h=Fo(l,{dkLen:u}),m=h.subarray(0,a),p=h.subarray(a,u);return xr(m,p)},(l,h,m)=>Yc(xr(m[0],m[1],h[1],l[1],Mu(e))),t,s)}var UG=LG("MLKEM768-P256",Jd,db,128);var Zm=OG,nB=UG;var u1e=B(x(),1);var L0e=B(x(),1);var Qt=(e,t,r)=>nn(e,t,r),Cb=Cr,Pf=Sm,un=(...e)=>gE(...e),kf=e=>Id(e),Rf=dE,Tf=e=>Pu(e),Qm=BigInt(0),_b=BigInt(1);function xa(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new TypeError(r+"expected boolean, got type="+typeof e)}return e}function eg(e){if(typeof e=="bigint"){if(!Jm(e))throw new RangeError("positive bigint expected, got "+e)}else Cb(e);return e}function Io(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw new RangeError(r+"expected safe integer, got "+e)}}function ep(e){let t=eg(e).toString(16);return t.length&1?"0"+t:t}function sB(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Qm:BigInt("0x"+e)}function Qc(e){return sB(Sm(e))}function Ui(e){return sB(Sm(zu(nn(e)).reverse()))}function tg(e,t){if(Cr(t),t===0)throw new RangeError("zero length");e=eg(e);let r=e.toString(16);if(r.length>t*2)throw new RangeError("number too large");return Id(r.padStart(t*2,"0"))}function tp(e,t){return tg(e,t).reverse()}function iB(e,t){if(e=Qt(e),t=Qt(t),e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function zu(e){return Uint8Array.from(Qt(e))}function rg(e){if(typeof e!="string")throw new TypeError("ascii string expected, got "+typeof e);return Uint8Array.from(e,(t,r)=>{let n=t.charCodeAt(0);if(t.length!==1||n>127)throw new RangeError(`string contains non-ASCII character "${e[r]}" with code ${n} at position ${r}`);return n})}var Jm=e=>typeof e=="bigint"&&Qm<=e;function HG(e,t,r){return Jm(e)&&Jm(t)&&Jm(r)&&t<=e&&e<r}function $a(e,t,r,n){if(!HG(t,r,n))throw new RangeError("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function Of(e){if(e<Qm)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Qm;e>>=_b,t+=1);return t}var rp=e=>(_b<<BigInt(e))-_b;function oB(e,t,r){if(Cr(e,"hashLen"),Cr(t,"qByteLen"),typeof r!="function")throw new TypeError("hmacFn must be a function");let n=y=>new Uint8Array(y),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),a=1e3,u=n(e),l=n(e),h=0,m=()=>{u.fill(1),l.fill(0),h=0},p=(...y)=>r(l,un(u,...y)),d=(y=i)=>{l=p(o,y),u=p(),y.length!==0&&(l=p(s,y),u=p())},v=()=>{if(h++>=a)throw new Error("drbg: tried max amount of iterations");let y=0,w=[];for(;y<t;){u=p();let E=u.slice();w.push(E),y+=u.length}return un(...w)};return(y,w)=>{m(),d(y);let E;for(;(E=w(v()))===void 0;)d();return m(),E}}function ai(e,t={},r={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function n(o,s,a){if(!a&&s!=="function"&&!Object.hasOwn(e,o))throw new TypeError(`param "${o}" is invalid: expected own property`);let u=e[o];if(a&&u===void 0)return;let l=typeof u;if(l!==s||u===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${l}`)}let i=(o,s)=>Object.entries(o).forEach(([a,u])=>n(a,u,s));i(t,!1),i(r,!0)}var Db=()=>{throw new Error("not implemented")};var V0e=B(x(),1);var M0e=B(x(),1);var cn=BigInt(0),mr=BigInt(1),el=BigInt(2),lB=BigInt(3),fB=BigInt(4),hB=BigInt(5),MG=BigInt(7),dB=BigInt(8),qG=BigInt(9),pB=BigInt(16);function ir(e,t){if(t<=cn)throw new Error("mod: expected positive modulus, got "+t);let r=e%t;return r>=cn?r:t+r}function ui(e,t,r){if(t<cn)throw new Error("pow2: expected non-negative exponent, got "+t);let n=e;for(;t-- >cn;)n*=n,n%=r;return n}function aB(e,t){if(e===cn)throw new Error("invert: expected non-zero number");if(t<=cn)throw new Error("invert: expected positive modulus, got "+t);let r=ir(e,t),n=t,i=cn,o=mr,s=mr,a=cn;for(;r!==cn;){let l=n/r,h=n-r*l,m=i-s*l,p=o-a*l;n=r,r=h,i=s,o=a,s=m,a=p}if(n!==mr)throw new Error("invert: does not exist");return ir(i,t)}function Fb(e,t,r){let n=e;if(!n.eql(n.sqr(t),r))throw new Error("Cannot find square root")}function mB(e,t){let r=e,n=(r.ORDER+mr)/fB,i=r.pow(t,n);return Fb(r,i,t),i}function jG(e,t){let r=e,n=(r.ORDER-hB)/dB,i=r.mul(t,el),o=r.pow(i,n),s=r.mul(t,o),a=r.mul(r.mul(s,el),o),u=r.mul(s,r.sub(a,r.ONE));return Fb(r,u,t),u}function KG(e){let t=sg(e),r=gB(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+MG)/pB;return((a,u)=>{let l=a,h=l.pow(u,s),m=l.mul(h,n),p=l.mul(h,i),d=l.mul(h,o),v=l.eql(l.sqr(m),u),g=l.eql(l.sqr(p),u);h=l.cmov(h,m,v),m=l.cmov(d,p,g);let y=l.eql(l.sqr(m),u),w=l.cmov(h,m,y);return Fb(l,w,u),w})}function gB(e){if(e<lB)throw new Error("sqrt is not defined for small field");let t=e-mr,r=0;for(;t%el===cn;)t/=el,r++;let n=el,i=sg(e);for(;uB(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return mB;let o=i.pow(n,t),s=(t+mr)/el;return function(u,l){let h=u;if(h.is0(l))return l;if(uB(h,l)!==1)throw new Error("Cannot find square root");let m=r,p=h.mul(h.ONE,o),d=h.pow(l,t),v=h.pow(l,s);for(;!h.eql(d,h.ONE);){if(h.is0(d))return h.ZERO;let g=1,y=h.sqr(d);for(;!h.eql(y,h.ONE);)if(g++,y=h.sqr(y),g===m)throw new Error("Cannot find square root");let w=mr<<BigInt(m-g-1),E=h.pow(p,w);m=g,p=h.sqr(E),d=h.mul(d,p),v=h.mul(v,E)}return v}}function VG(e){return e%fB===lB?mB:e%dB===hB?jG:e%pB===qG?KG(e):gB(e)}var Pa=(e,t)=>(ir(e,t)&mr)===mr,zG=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Bb(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=zG.reduce((n,i)=>(n[i]="function",n),t);if(ai(e,r),Io(e.BYTES,"BYTES"),Io(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=mr)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function GG(e,t,r){let n=e;if(r<cn)throw new Error("invalid exponent, negatives unsupported");if(r===cn)return n.ONE;if(r===mr)return t;let i=n.ONE,o=t;for(;r>cn;)r&mr&&(i=n.mul(i,o)),o=n.sqr(o),r>>=mr;return i}function np(e,t,r=!1){let n=e,i=new Array(t.length).fill(r?n.ZERO:void 0),o=t.reduce((a,u,l)=>n.is0(u)?a:(i[l]=a,n.mul(a,u)),n.ONE),s=n.inv(o);return t.reduceRight((a,u,l)=>n.is0(u)?a:(i[l]=n.mul(a,i[l]),n.mul(a,u)),s),i}function uB(e,t){let r=e,n=(r.ORDER-mr)/el,i=r.pow(t,n),o=r.eql(i,r.ONE),s=r.eql(i,r.ZERO),a=r.eql(i,r.neg(r.ONE));if(!o&&!s&&!a)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function WG(e,t){if(t!==void 0&&Cb(t),e<=cn)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);let r=Of(e);if(t!==void 0&&t<r)throw new Error(`invalid n length: expected bit length (${r}) >= n.length (${t})`);let n=t!==void 0?t:r,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}var cB=new WeakMap,ng=class{ORDER;BITS;BYTES;isLE;ZERO=cn;ONE=mr;_lengths;_mod;constructor(t,r={}){if(t<=mr)throw new Error("invalid field: expected ORDER > 1, got "+t);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:i,nByteLength:o}=WG(t,n);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=i,this.BYTES=o,Object.freeze(this)}create(t){return ir(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return cn<=t&&t<this.ORDER}is0(t){return t===cn}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&mr)===mr}neg(t){return ir(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return ir(t*t,this.ORDER)}add(t,r){return ir(t+r,this.ORDER)}sub(t,r){return ir(t-r,this.ORDER)}mul(t,r){return ir(t*r,this.ORDER)}pow(t,r){return GG(this,t,r)}div(t,r){return ir(t*aB(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return aB(t,this.ORDER)}sqrt(t){let r=cB.get(this);return r||cB.set(this,r=VG(this.ORDER)),r(this,t)}toBytes(t){return this.isLE?tp(t,this.BYTES):tg(t,this.BYTES)}fromBytes(t,r=!1){Qt(t);let{_lengths:n,BYTES:i,isLE:o,ORDER:s,_mod:a}=this;if(n){if(t.length<1||!n.includes(t.length)||t.length>i)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let l=new Uint8Array(i);l.set(t,o?0:l.length-t.length),t=l}if(t.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let u=o?Ui(t):Qc(t);if(a&&(u=ir(u,s)),!r&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return np(this,t)}cmov(t,r,n){return xa(n,"condition"),n?r:t}};Object.freeze(ng.prototype);function sg(e,t={}){return new ng(e,t)}function vB(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=mr)throw new Error("field order must be greater than 1");let t=Of(e-mr);return Math.ceil(t/8)}function Ib(e){let t=vB(e);return t+Math.ceil(t/2)}function wB(e,t,r=!1){Qt(e);let n=e.length,i=vB(t),o=Math.max(Ib(t),16);if(n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?Ui(e):Qc(e),a=ir(s,t-mr)+mr;return r?tp(a,i):tg(a,i)}var Nf=BigInt(0),tl=BigInt(1);function sp(e,t){let r=t.negate();return e?r:t}function rl(e,t){let r=np(e.Fp,t.map(n=>n.Z));return t.map((n,i)=>e.fromAffine(n.toAffine(r[i])))}function AB(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function xb(e,t){AB(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e,o=rp(e),s=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function yB(e,t,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r,a=Number(e&i),u=e>>s;a>n&&(a-=o,u+=tl);let l=t*n,h=l+Math.abs(a)-1,m=a===0,p=a<0,d=t%2!==0;return{nextN:u,offset:h,isZero:m,isNeg:p,isNegF:d,offsetF:l}}var $b=new WeakMap,SB=new WeakMap;function Pb(e){return SB.get(e)||1}function EB(e){if(e!==Nf)throw new Error("invalid wNAF")}var Lf=class{BASE;ZERO;Fn;bits;constructor(t,r){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,n=this.ZERO){let i=t;for(;r>Nf;)r&tl&&(n=n.add(i)),i=i.double(),r>>=tl;return n}precomputeWindow(t,r){let{windows:n,windowSize:i}=xb(r,this.bits),o=[],s=t,a=s;for(let u=0;u<n;u++){a=s,o.push(a);for(let l=1;l<i;l++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(t,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,o=this.BASE,s=xb(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=yB(n,a,s);n=u,h?o=o.add(sp(p,r[d])):i=i.add(sp(m,r[l]))}return EB(n),{p:i,f:o}}wNAFUnsafe(t,r,n,i=this.ZERO){let o=xb(t,this.bits);for(let s=0;s<o.windows&&n!==Nf;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=yB(n,s,o);if(n=a,!l){let m=r[u];i=i.add(h?m.negate():m)}}return EB(n),i}getPrecomputes(t,r,n){let i=$b.get(r);return i||(i=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(i=n(i)),$b.set(r,i))),i}cached(t,r,n){let i=Pb(t);return this.wNAF(i,this.getPrecomputes(i,t,n),r)}unsafe(t,r,n,i){let o=Pb(t);return o===1?this._unsafeLadder(t,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,i)}createCache(t,r){AB(r,this.bits),SB.set(t,r),$b.delete(t)}hasCache(t){return Pb(t)!==1}};function _B(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>Nf||n>Nf;)r&tl&&(o=o.add(i)),n&tl&&(s=s.add(i)),i=i.double(),r>>=tl,n>>=tl;return{p1:o,p2:s}}function bB(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Bb(t),t}else return sg(e,{isLE:r})}function ig(e,t,r={},n){if(n===void 0&&(n=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let u of["p","n","h"]){let l=t[u];if(!(typeof l=="bigint"&&l>Nf))throw new Error(`CURVE.${u} must be positive bigint`)}let i=bB(t.p,r.Fp,n),o=bB(t.n,r.Fn,n),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let u of a)if(!i.isValid(t[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:o}}function ip(e,t){return function(n){let i=e(n);return{secretKey:i,publicKey:t(i)}}}var W0e=B(x(),1);function op(e,t){if(Io(e),Io(t),t<0||t>4)throw new Error("invalid I2OSP length: "+t);if(e<0||e>2**(8*t)-1)throw new Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=e&255,e>>>=8;return new Uint8Array(r)}function YG(e,t){let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}function XG(e){if(!Rf(e)&&typeof e!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof e=="string"?rg(e):e;if(t.length===0)throw new Error("DST must be non-empty");return t}function kb(e,t,r,n){Qt(e),Io(r),t=XG(t),t.length>255&&(t=n(un(rg("H2C-OVERSIZE-DST-"),t)));let{outputLen:i,blockLen:o}=n,s=Math.ceil(r/i);if(r>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=un(t,op(t.length,1)),u=new Uint8Array(o),l=op(r,2),h=new Array(s),m=n(un(u,e,l,op(0,1),a));h[0]=n(un(m,op(1,1),a));for(let d=1;d<s;d++){let v=[YG(m,h[d-1]),op(d+1,1),a];h[d]=n(un(...v))}return un(...h).slice(0,r)}var CB="HashToScalar-";var r1e=B(x(),1);var DB=(e,t)=>(e+(e>=0?t:-t)/FB)/t;function ZG(e,t,r){$a("scalar",e,xo,r);let[[n,i],[o,s]]=t,a=DB(s*e,r),u=DB(-i*e,r),l=e-a*n-u*o,h=-a*i-u*s,m=l<xo,p=h<xo;m&&(l=-l),p&&(h=-h);let d=rp(Math.ceil(Of(r)/2))+Gu;if(l<xo||l>=d||h<xo||h>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:l,k2neg:p,k2:h}}function Tb(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Rb(e,t){ai(e);let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return xa(r.lowS,"lowS"),xa(r.prehash,"prehash"),r.format!==void 0&&Tb(r.format),r}var Ob=class extends Error{constructor(t=""){super(t)}},Hi={Err:Ob,_tlv:{encode:(e,t)=>{let{Err:r}=Hi;if(Io(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=ep(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?ep(i.length/2|128):"";return ep(e)+o+i+t},decode(e,t){let{Err:r}=Hi;t=Qt(t,void 0,"DER data");let n=0;if(e<0||e>255)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],o=!!(i&128),s=0;if(!o)s=i;else{let u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let l=t.subarray(n,n+u);if(l.length!==u)throw new r("tlv.decode: length bytes not complete");if(l[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let h of l)s=s<<8|h;if(n+=u,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=Hi;if(eg(e),e<xo)throw new t("integer: negative integers are not allowed");let r=ep(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=Hi;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Qc(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=Hi,i=Qt(e,void 0,"signature"),{v:o,l:s}=n.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:u}=n.decode(2,o),{v:l,l:h}=n.decode(2,u);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=Hi,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s)),o=n+i;return t.encode(48,o)}};Object.freeze(Hi._tlv);Object.freeze(Hi._int);Object.freeze(Hi);var xo=BigInt(0),Gu=BigInt(1),FB=BigInt(2),og=BigInt(3),JG=BigInt(4);function BB(e,t={}){let r=ig("weierstrass",e,t),n=r.Fp,i=r.Fn,o=r.CURVE,{h:s,n:a}=o;ai(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:u,allowInfinityPoint:l}=t;if(u&&(!n.is0(o.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let h=xB(n,i);function m(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function p(L,R,O){if(l&&R.is0())return Uint8Array.of(0);let{x:T,y:N}=R.toAffine(),P=n.toBytes(T);if(xa(O,"isCompressed"),O){m();let M=!n.isOdd(N);return un(IB(M),P)}else return un(Uint8Array.of(4),P,n.toBytes(N))}function d(L){Qt(L,void 0,"Point");let{publicKey:R,publicKeyUncompressed:O}=h,T=L.length,N=L[0],P=L.subarray(1);if(l&&T===1&&N===0)return{x:n.ZERO,y:n.ZERO};if(T===R&&(N===2||N===3)){let M=n.fromBytes(P);if(!n.isValid(M))throw new Error("bad point: is not on curve, wrong x");let Y=y(M),V;try{V=n.sqrt(Y)}catch(ae){let me=ae instanceof Error?": "+ae.message:"";throw new Error("bad point: is not on curve, sqrt error"+me)}m();let X=n.isOdd(V);return(N&1)===1!==X&&(V=n.neg(V)),{x:M,y:V}}else if(T===O&&N===4){let M=n.BYTES,Y=n.fromBytes(P.subarray(0,M)),V=n.fromBytes(P.subarray(M,M*2));if(!w(Y,V))throw new Error("bad point: is not on curve");return{x:Y,y:V}}else throw new Error(`bad point: got length ${T}, expected compressed=${R} or uncompressed=${O}`)}let v=t.toBytes===void 0?p:t.toBytes,g=t.fromBytes===void 0?d:t.fromBytes;function y(L){let R=n.sqr(L),O=n.mul(R,L);return n.add(n.add(O,n.mul(L,o.a)),o.b)}function w(L,R){let O=n.sqr(R),T=y(L);return n.eql(O,T)}if(!w(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let E=n.mul(n.pow(o.a,og),JG),_=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(E,_)))throw new Error("bad curve params: a or b");function C(L,R,O=!1){if(!n.isValid(R)||O&&n.is0(R))throw new Error(`bad point coordinate ${L}`);return R}function F(L){if(!(L instanceof S))throw new Error("Weierstrass Point expected")}function H(L){if(!u||!u.basises)throw new Error("no endo");return ZG(L,u.basises,i.ORDER)}function K(L,R,O,T,N){return O=new S(n.mul(O.X,L),O.Y,O.Z),R=sp(T,R),O=sp(N,O),R.add(O)}class S{static BASE=new S(o.Gx,o.Gy,n.ONE);static ZERO=new S(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(R,O,T){this.X=C("x",R),this.Y=C("y",O,!0),this.Z=C("z",T),Object.freeze(this)}static CURVE(){return o}static fromAffine(R){let{x:O,y:T}=R||{};if(!R||!n.isValid(O)||!n.isValid(T))throw new Error("invalid affine point");if(R instanceof S)throw new Error("projective point not allowed");return n.is0(O)&&n.is0(T)?S.ZERO:new S(O,T,n.ONE)}static fromBytes(R){let O=S.fromAffine(g(Qt(R,void 0,"point")));return O.assertValidity(),O}static fromHex(R){return S.fromBytes(kf(R))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(R=8,O=!0){return q.createCache(this,R),O||this.multiply(og),this}assertValidity(){let R=this;if(R.is0()){if(t.allowInfinityPoint&&n.is0(R.X)&&n.eql(R.Y,n.ONE)&&n.is0(R.Z))return;throw new Error("bad point: ZERO")}let{x:O,y:T}=R.toAffine();if(!n.isValid(O)||!n.isValid(T))throw new Error("bad point: x or y not field elements");if(!w(O,T))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:R}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(R)}equals(R){F(R);let{X:O,Y:T,Z:N}=this,{X:P,Y:M,Z:Y}=R,V=n.eql(n.mul(O,Y),n.mul(P,N)),X=n.eql(n.mul(T,Y),n.mul(M,N));return V&&X}negate(){return new S(this.X,n.neg(this.Y),this.Z)}double(){let{a:R,b:O}=o,T=n.mul(O,og),{X:N,Y:P,Z:M}=this,Y=n.ZERO,V=n.ZERO,X=n.ZERO,te=n.mul(N,N),ae=n.mul(P,P),me=n.mul(M,M),he=n.mul(N,P);return he=n.add(he,he),X=n.mul(N,M),X=n.add(X,X),Y=n.mul(R,X),V=n.mul(T,me),V=n.add(Y,V),Y=n.sub(ae,V),V=n.add(ae,V),V=n.mul(Y,V),Y=n.mul(he,Y),X=n.mul(T,X),me=n.mul(R,me),he=n.sub(te,me),he=n.mul(R,he),he=n.add(he,X),X=n.add(te,te),te=n.add(X,te),te=n.add(te,me),te=n.mul(te,he),V=n.add(V,te),me=n.mul(P,M),me=n.add(me,me),te=n.mul(me,he),Y=n.sub(Y,te),X=n.mul(me,ae),X=n.add(X,X),X=n.add(X,X),new S(Y,V,X)}add(R){F(R);let{X:O,Y:T,Z:N}=this,{X:P,Y:M,Z:Y}=R,V=n.ZERO,X=n.ZERO,te=n.ZERO,ae=o.a,me=n.mul(o.b,og),he=n.mul(O,P),De=n.mul(T,M),Pe=n.mul(N,Y),Ie=n.add(O,T),se=n.add(P,M);Ie=n.mul(Ie,se),se=n.add(he,De),Ie=n.sub(Ie,se),se=n.add(O,N);let pe=n.add(P,Y);return se=n.mul(se,pe),pe=n.add(he,Pe),se=n.sub(se,pe),pe=n.add(T,N),V=n.add(M,Y),pe=n.mul(pe,V),V=n.add(De,Pe),pe=n.sub(pe,V),te=n.mul(ae,se),V=n.mul(me,Pe),te=n.add(V,te),V=n.sub(De,te),te=n.add(De,te),X=n.mul(V,te),De=n.add(he,he),De=n.add(De,he),Pe=n.mul(ae,Pe),se=n.mul(me,se),De=n.add(De,Pe),Pe=n.sub(he,Pe),Pe=n.mul(ae,Pe),se=n.add(se,Pe),he=n.mul(De,se),X=n.add(X,he),he=n.mul(pe,se),V=n.mul(Ie,V),V=n.sub(V,he),he=n.mul(Ie,De),te=n.mul(pe,te),te=n.add(te,he),new S(V,X,te)}subtract(R){return F(R),this.add(R.negate())}is0(){return this.equals(S.ZERO)}multiply(R){let{endo:O}=t;if(!i.isValidNot0(R))throw new RangeError("invalid scalar: out of range");let T,N,P=M=>q.cached(this,M,Y=>rl(S,Y));if(O){let{k1neg:M,k1:Y,k2neg:V,k2:X}=H(R),{p:te,f:ae}=P(Y),{p:me,f:he}=P(X);N=ae.add(he),T=K(O.beta,te,me,M,V)}else{let{p:M,f:Y}=P(R);T=M,N=Y}return rl(S,[T,N])[0]}multiplyUnsafe(R){let{endo:O}=t,T=this,N=R;if(!i.isValid(N))throw new RangeError("invalid scalar: out of range");if(N===xo||T.is0())return S.ZERO;if(N===Gu)return T;if(q.hasCache(this))return this.multiply(N);if(O){let{k1neg:P,k1:M,k2neg:Y,k2:V}=H(N),{p1:X,p2:te}=_B(S,T,M,V);return K(O.beta,X,te,P,Y)}else return q.unsafe(T,N)}toAffine(R){let O=this,T=R,{X:N,Y:P,Z:M}=O;if(n.eql(M,n.ONE))return{x:N,y:P};let Y=O.is0();T==null&&(T=Y?n.ONE:n.inv(M));let V=n.mul(N,T),X=n.mul(P,T),te=n.mul(M,T);if(Y)return{x:n.ZERO,y:n.ZERO};if(!n.eql(te,n.ONE))throw new Error("invZ was invalid");return{x:V,y:X}}isTorsionFree(){let{isTorsionFree:R}=t;return s===Gu?!0:R?R(S,this):q.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:R}=t;return s===Gu?this:R?R(S,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===Gu?this.is0():this.clearCofactor().is0()}toBytes(R=!0){return xa(R,"isCompressed"),this.assertValidity(),v(S,this,R)}toHex(R=!0){return Pf(this.toBytes(R))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let I=i.BITS,q=new Lf(S,t.endo?Math.ceil(I/2):I);return I>=8&&S.BASE.precompute(8),Object.freeze(S.prototype),Object.freeze(S),S}function IB(e){return Uint8Array.of(e?2:3)}function xB(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function QG(e,t={}){let{Fn:r}=e,n=t.randomBytes===void 0?Tf:t.randomBytes,i=Object.assign(xB(e.Fp,r),{seed:Math.max(Ib(r.ORDER),16)});function o(d){try{let v=r.fromBytes(d);return r.isValidNot0(v)}catch{return!1}}function s(d,v){let{publicKey:g,publicKeyUncompressed:y}=i;try{let w=d.length;return v===!0&&w!==g||v===!1&&w!==y?!1:!!e.fromBytes(d)}catch{return!1}}function a(d){return d=d===void 0?n(i.seed):d,wB(Qt(d,i.seed,"seed"),r.ORDER)}function u(d,v=!0){return e.BASE.multiply(r.fromBytes(d)).toBytes(v)}function l(d){let{secretKey:v,publicKey:g,publicKeyUncompressed:y}=i,w=r._lengths;if(!Rf(d))return;let E=Qt(d,void 0,"key").length,_=E===g||E===y,C=E===v||!!w?.includes(E);if(!(_&&C))return _}function h(d,v,g=!0){if(l(d)===!0)throw new Error("first arg must be private key");if(l(v)===!1)throw new Error("second arg must be public key");let y=r.fromBytes(d);return e.fromBytes(v).multiply(y).toBytes(g)}let m={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a},p=ip(a,u);return Object.freeze(m),Object.freeze(i),Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function $B(e,t,r={}){let n=t;Aa(n),ai(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let i=r.randomBytes===void 0?Tf:r.randomBytes,o=r.hmac===void 0?(N,P)=>So(n,N,P):r.hmac,{Fp:s,Fn:a}=e,{ORDER:u,BITS:l}=a,{keygen:h,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v}=QG(e,r),g={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},y=u*FB+Gu<s.ORDER;function w(N){let P=u>>Gu;return N>P}function E(N,P){if(!a.isValidNot0(P))throw new Error(`invalid signature ${N}: out of range 1..Point.Fn.ORDER`);return P}function _(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function C(N,P){Tb(P);let M=v.signature,Y=P==="compact"?M:P==="recovered"?M+1:void 0;return Qt(N,Y)}class F{r;s;recovery;constructor(P,M,Y){if(this.r=E("r",P),this.s=E("s",M),Y!=null){if(_(),![0,1,2,3].includes(Y))throw new Error("invalid recovery id");this.recovery=Y}Object.freeze(this)}static fromBytes(P,M=g.format){C(P,M);let Y;if(M==="der"){let{r:ae,s:me}=Hi.toSig(Qt(P));return new F(ae,me)}M==="recovered"&&(Y=P[0],M="compact",P=P.subarray(1));let V=v.signature/2,X=P.subarray(0,V),te=P.subarray(V,V*2);return new F(a.fromBytes(X),a.fromBytes(te),Y)}static fromHex(P,M){return this.fromBytes(kf(P),M)}assertRecovery(){let{recovery:P}=this;if(P==null)throw new Error("invalid recovery id: must be present");return P}addRecoveryBit(P){return new F(this.r,this.s,P)}recoverPublicKey(P){let{r:M,s:Y}=this,V=this.assertRecovery(),X=V===2||V===3?M+u:M;if(!s.isValid(X))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let te=s.toBytes(X),ae=e.fromBytes(un(IB((V&1)===0),te)),me=a.inv(X),he=K(Qt(P,void 0,"msgHash")),De=a.create(-he*me),Pe=a.create(Y*me),Ie=e.BASE.multiplyUnsafe(De).add(ae.multiplyUnsafe(Pe));if(Ie.is0())throw new Error("invalid recovery: point at infinify");return Ie.assertValidity(),Ie}hasHighS(){return w(this.s)}toBytes(P=g.format){if(Tb(P),P==="der")return kf(Hi.hexFromSig(this));let{r:M,s:Y}=this,V=a.toBytes(M),X=a.toBytes(Y);return P==="recovered"?(_(),un(Uint8Array.of(this.assertRecovery()),V,X)):un(V,X)}toHex(P){return Pf(this.toBytes(P))}}Object.freeze(F.prototype),Object.freeze(F);let H=r.bits2int===void 0?function(P){if(P.length>8192)throw new Error("input is too large");let M=Qc(P),Y=P.length*8-l;return Y>0?M>>BigInt(Y):M}:r.bits2int,K=r.bits2int_modN===void 0?function(P){return a.create(H(P))}:r.bits2int_modN,S=rp(l);function I(N){return $a("num < 2^"+l,N,xo,S),a.toBytes(N)}function q(N,P){return Qt(N,void 0,"message"),P?Qt(n(N),void 0,"prehashed message"):N}function L(N,P,M){let{lowS:Y,prehash:V,extraEntropy:X}=Rb(M,g);N=q(N,V);let te=K(N),ae=a.fromBytes(P);if(!a.isValidNot0(ae))throw new Error("invalid private key");let me=[I(ae),I(te)];if(X!=null&&X!==!1){let Ie=X===!0?i(v.secretKey):X;me.push(Qt(Ie,void 0,"extraEntropy"))}let he=un(...me),De=te;function Pe(Ie){let se=H(Ie);if(!a.isValidNot0(se))return;let pe=a.inv(se),Fe=e.BASE.multiply(se).toAffine(),Te=a.create(Fe.x);if(Te===xo)return;let Ve=a.create(pe*a.create(De+Te*ae));if(Ve===xo)return;let Oe=(Fe.x===Te?0:2)|Number(Fe.y&Gu),pt=Ve;return Y&&w(Ve)&&(pt=a.neg(Ve),Oe^=1),new F(Te,pt,y?void 0:Oe)}return{seed:he,k2sig:Pe}}function R(N,P,M={}){let{seed:Y,k2sig:V}=L(N,P,M);return oB(n.outputLen,a.BYTES,o)(Y,V).toBytes(M.format)}function O(N,P,M,Y={}){let{lowS:V,prehash:X,format:te}=Rb(Y,g);if(M=Qt(M,void 0,"publicKey"),P=q(P,X),!Rf(N)){let ae=N instanceof F?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+ae)}C(N,te);try{let ae=F.fromBytes(N,te),me=e.fromBytes(M);if(V&&ae.hasHighS())return!1;let{r:he,s:De}=ae,Pe=K(P),Ie=a.inv(De),se=a.create(Pe*Ie),pe=a.create(he*Ie),Fe=e.BASE.multiplyUnsafe(se).add(me.multiplyUnsafe(pe));return Fe.is0()?!1:a.create(Fe.x)===he}catch{return!1}}function T(N,P,M={}){let{prehash:Y}=Rb(M,g);return P=q(P,Y),F.fromBytes(N,"recovered").recoverPublicKey(P).toBytes()}return Object.freeze({keygen:h,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v,Point:e,sign:R,verify:O,recoverPublicKey:T,Signature:F,hash:n})}var eW={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")};var tW=BB(eW),Uf=$B(tW,Dr);var $1e=B(x(),1);var I1e=B(x(),1);var h1e=B(x(),1);var Wu=BigInt(0),ys=BigInt(1),Nb=BigInt(2),rW=BigInt(8);function nW(e,t,r,n){let i=e.sqr(r),o=e.sqr(n),s=e.add(e.mul(t.a,i),o),a=e.add(e.ONE,e.mul(t.d,e.mul(i,o)));return e.eql(s,a)}function PB(e,t={}){let r=t,n=ig("edwards",e,r,r.FpFnLE),{Fp:i,Fn:o}=n,s=n.CURVE,{h:a}=s;ai(r,{},{uvRatio:"function"});let u=Nb<<BigInt(o.BYTES*8)-ys,l=g=>i.create(g),h=r.uvRatio===void 0?(g,y)=>{try{return{isValid:!0,value:i.sqrt(i.div(g,y))}}catch{return{isValid:!1,value:Wu}}}:r.uvRatio;if(!nW(i,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function m(g,y,w=!1){let E=w?ys:Wu;return $a("coordinate "+g,y,E,u),y}function p(g){if(!(g instanceof d))throw new Error("EdwardsPoint expected")}class d{static BASE=new d(s.Gx,s.Gy,ys,l(s.Gx*s.Gy));static ZERO=new d(Wu,ys,ys,Wu);static Fp=i;static Fn=o;X;Y;Z;T;constructor(y,w,E,_){this.X=m("x",y),this.Y=m("y",w),this.Z=m("z",E,!0),this.T=m("t",_),Object.freeze(this)}static CURVE(){return s}static fromAffine(y){if(y instanceof d)throw new Error("extended point not allowed");let{x:w,y:E}=y||{};return m("x",w),m("y",E),new d(w,E,ys,l(w*E))}static fromBytes(y,w=!1){let E=i.BYTES,{a:_,d:C}=s;y=zu(Qt(y,E,"point")),xa(w,"zip215");let F=zu(y),H=y[E-1];F[E-1]=H&-129;let K=Ui(F),S=w?u:i.ORDER;$a("point.y",K,Wu,S);let I=l(K*K),q=l(I-ys),L=l(C*I-_),{isValid:R,value:O}=h(q,L);if(!R)throw new Error("bad point: invalid y coordinate");let T=(O&ys)===ys,N=(H&128)!==0;if(!w&&O===Wu&&N)throw new Error("bad point: x=0 and x_0=1");return N!==T&&(O=l(-O)),d.fromAffine({x:O,y:K})}static fromHex(y,w=!1){return d.fromBytes(kf(y),w)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,w=!0){return v.createCache(this,y),w||this.multiply(Nb),this}assertValidity(){let y=this,{a:w,d:E}=s;if(y.is0())throw new Error("bad point: ZERO");let{X:_,Y:C,Z:F,T:H}=y,K=l(_*_),S=l(C*C),I=l(F*F),q=l(I*I),L=l(K*w),R=l(I*l(L+S)),O=l(q+l(E*l(K*S)));if(R!==O)throw new Error("bad point: equation left != right (1)");let T=l(_*C),N=l(F*H);if(T!==N)throw new Error("bad point: equation left != right (2)")}equals(y){p(y);let{X:w,Y:E,Z:_}=this,{X:C,Y:F,Z:H}=y,K=l(w*H),S=l(C*_),I=l(E*H),q=l(F*_);return K===S&&I===q}is0(){return this.equals(d.ZERO)}negate(){return new d(l(-this.X),this.Y,this.Z,l(-this.T))}double(){let{a:y}=s,{X:w,Y:E,Z:_}=this,C=l(w*w),F=l(E*E),H=l(Nb*l(_*_)),K=l(y*C),S=w+E,I=l(l(S*S)-C-F),q=K+F,L=q-H,R=K-F,O=l(I*L),T=l(q*R),N=l(I*R),P=l(L*q);return new d(O,T,P,N)}add(y){p(y);let{a:w,d:E}=s,{X:_,Y:C,Z:F,T:H}=this,{X:K,Y:S,Z:I,T:q}=y,L=l(_*K),R=l(C*S),O=l(H*E*q),T=l(F*I),N=l((_+C)*(K+S)-L-R),P=T-O,M=T+O,Y=l(R-w*L),V=l(N*P),X=l(M*Y),te=l(N*Y),ae=l(P*M);return new d(V,X,ae,te)}subtract(y){return p(y),this.add(y.negate())}multiply(y){if(!o.isValidNot0(y))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:w,f:E}=v.cached(this,y,_=>rl(d,_));return rl(d,[w,E])[0]}multiplyUnsafe(y){if(!o.isValid(y))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return y===Wu?d.ZERO:this.is0()||y===ys?this:v.unsafe(this,y,w=>rl(d,w))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return v.unsafe(this,s.n).is0()}toAffine(y){let w=this,E=y,{X:_,Y:C,Z:F}=w,H=w.is0();E==null&&(E=H?rW:i.inv(F));let K=l(_*E),S=l(C*E),I=i.mul(F,E);if(H)return{x:Wu,y:ys};if(I!==ys)throw new Error("invZ was invalid");return{x:K,y:S}}clearCofactor(){return a===ys?this:this.multiplyUnsafe(a)}toBytes(){let{x:y,y:w}=this.toAffine(),E=i.toBytes(w);return E[E.length-1]|=y&ys?128:0,E}toHex(){return Pf(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let v=new Lf(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var ag=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){Db()}static fromHex(t){Db()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(t){return this.ep.toAffine(t)}toHex(){return Pf(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(t){return this.assertSame(t),this.init(this.ep.add(t.ep))}subtract(t){return this.assertSame(t),this.init(this.ep.subtract(t.ep))}multiply(t){return this.init(this.ep.multiply(t))}multiplyUnsafe(t){return this.init(this.ep.multiplyUnsafe(t))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(t,r){return this.ep.precompute(t,r),this}};var v1e=B(x(),1);var ap=BigInt(0),Hf=BigInt(1),ug=BigInt(2);function sW(e){return ai(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function kB(e){let t=sW(e),{P:r,type:n,adjustScalarBytes:i,powPminus2:o,randomBytes:s}=t,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let u=s===void 0?Tf:s,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?ug**BigInt(254):ug**BigInt(447),v=a?BigInt(8)*ug**BigInt(251)-Hf:BigInt(4)*ug**BigInt(445)-Hf,g=d+v+Hf,y=T=>ir(T,r),w=E(m);function E(T){return tp(y(T),h)}function _(T){let N=zu(Qt(T,h,"uCoordinate"));return a&&(N[31]&=127),y(Ui(N))}function C(T){return Ui(i(zu(Qt(T,h,"scalar"))))}function F(T,N){let P=q(_(N),C(T));if(P===ap)throw new Error("invalid private or public key received");return E(P)}function H(T){return F(T,w)}let K=H,S=F;function I(T,N,P){let M=y(T*(N-P));return N=y(N-M),P=y(P+M),{x_2:N,x_3:P}}function q(T,N){$a("u",T,ap,r),$a("scalar",N,d,g);let P=N,M=T,Y=Hf,V=ap,X=T,te=Hf,ae=ap;for(let he=BigInt(l-1);he>=ap;he--){let De=P>>he&Hf;ae^=De,{x_2:Y,x_3:X}=I(ae,Y,X),{x_2:V,x_3:te}=I(ae,V,te),ae=De;let Pe=Y+V,Ie=y(Pe*Pe),se=Y-V,pe=y(se*se),Fe=Ie-pe,Te=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Te*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(M*y(ct*ct)),Y=y(Ie*pe),V=y(Fe*(Ie+y(p*Fe)))}({x_2:Y,x_3:X}=I(ae,Y,X)),{x_2:V,x_3:te}=I(ae,V,te);let me=o(V);return y(Y*me)}let L={secretKey:h,publicKey:h,seed:h},R=T=>(T=T===void 0?u(h):T,Qt(T,L.seed,"seed"),T),O={randomSecretKey:R};return Object.freeze(L),Object.freeze(O),Object.freeze({keygen:ip(R,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var iW=BigInt(0),ka=BigInt(1),RB=BigInt(2),oW=BigInt(3),aW=BigInt(5),uW=BigInt(8),sl=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Mb={p:sl,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:uW,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function NB(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=sl,a=e*e%o*e%o,u=ui(a,RB,o)*a%o,l=ui(u,ka,o)*e%o,h=ui(l,aW,o)*l%o,m=ui(h,t,o)*h%o,p=ui(m,r,o)*m%o,d=ui(p,n,o)*p%o,v=ui(d,i,o)*d%o,g=ui(v,i,o)*d%o,y=ui(g,t,o)*h%o;return{pow_p_5_8:ui(y,RB,o)*e%o,b2:a}}function cW(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var Lb=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function qb(e,t){let r=sl,n=ir(t*t*t,r),i=ir(n*n*t,r),o=NB(e*i).pow_p_5_8,s=ir(e*n*o,r),a=ir(t*s*s,r),u=s,l=ir(s*Lb,r),h=a===e,m=a===ir(-e,r),p=a===ir(-e*Lb,r);return h&&(s=u),(m||p)&&(s=l),Pa(s,r)&&(s=ir(-s,r)),{isValid:h||m,value:s}}var nl=PB(Mb,{uvRatio:qb}),Yu=nl.Fp,LB=nl.Fn;var cg=(()=>{let e=sl;return kB({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=NB(t);return ir(ui(r,oW,e)*n,e)},adjustScalarBytes:cW})})();var Ub=Lb,lW=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),fW=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),hW=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),dW=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),TB=e=>qb(ka,e),pW=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Hb=e=>Yu.create(Ui(e)&pW);function OB(e){let{d:t}=Mb,r=sl,n=w=>Yu.create(w),i=n(Ub*e*e),o=n((i+ka)*hW),s=BigInt(-1),a=n((s-t*i)*n(i+t)),{isValid:u,value:l}=qb(o,a),h=n(l*e);Pa(h,r)||(h=n(-h)),u||(l=h),u||(s=i);let m=n(s*(i-ka)*dW-a),p=l*l,d=n((l+l)*a),v=n(m*lW),g=n(ka-p),y=n(ka+p);return new nl(n(d*y),n(g*v),n(v*y),n(d*g))}var Xu=class e extends ag{static BASE=new e(nl.BASE);static ZERO=new e(nl.ZERO);static Fp=Yu;static Fn=LB;constructor(t){super(t)}static fromAffine(t){return new e(nl.fromAffine(t))}assertSame(t){if(!(t instanceof e))throw new Error("RistrettoPoint expected")}init(t){return new e(t)}static fromBytes(t){nn(t,32);let{a:r,d:n}=Mb,i=sl,o=C=>Yu.create(C),s=Hb(t);if(!iB(Yu.toBytes(s),t)||Pa(s,i))throw new Error("invalid ristretto255 encoding 1");let a=o(s*s),u=o(ka+r*a),l=o(ka-r*a),h=o(u*u),m=o(l*l),p=o(r*n*h-m),{isValid:d,value:v}=TB(o(p*m)),g=o(v*l),y=o(v*g*p),w=o((s+s)*g);Pa(w,i)&&(w=o(-w));let E=o(u*y),_=o(w*E);if(!d||Pa(_,i)||E===iW)throw new Error("invalid ristretto255 encoding 2");return new e(new nl(w,E,ka,_))}static fromHex(t){return e.fromBytes(Id(t))}toBytes(){let{X:t,Y:r,Z:n,T:i}=this.ep,o=sl,s=y=>Yu.create(y),a=s(s(n+r)*s(n-r)),u=s(t*r),l=s(u*u),{value:h}=TB(s(a*l)),m=s(h*a),p=s(h*u),d=s(m*p*i),v;if(Pa(i*d,o)){let y=s(r*Ub),w=s(t*Ub);t=y,r=w,v=s(m*fW)}else v=p;Pa(t*d,o)&&(r=s(-r));let g=s((n-r)*v);return Pa(g,o)&&(g=s(-g)),Yu.toBytes(g)}equals(t){this.assertSame(t);let{X:r,Y:n}=this.ep,{X:i,Y:o}=t.ep,s=l=>Yu.create(l),a=s(r*o)===s(n*i),u=s(n*o)===s(r*i);return a||u}is0(){return this.equals(e.ZERO)}};Object.freeze(Xu.BASE);Object.freeze(Xu.ZERO);Object.freeze(Xu.prototype);Object.freeze(Xu);var mW=Object.freeze({Point:Xu,hashToCurve(e,t){let r=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,n=kb(e,r,64,Fm);return mW.deriveToCurve(n)},hashToScalar(e,t={DST:CB}){let r=kb(e,t.DST,64,Fm);return LB.create(Ui(r))},deriveToCurve(e){nn(e,64);let t=Hb(e.subarray(0,32)),r=OB(t),n=Hb(e.subarray(32,64)),i=OB(n);return new Xu(r.add(i))}});var UB=!1,gW=!1;async function HB(e,t){if(gW)return await t();try{return await e()}catch(r){if(r instanceof ReferenceError||r instanceof DOMException&&r.name==="NotSupportedError")return await t();throw r}}async function lg(e,t){return await HB(async()=>{let r=jb(e)?e:await wW(e),n=await crypto.subtle.importKey("raw",t,{name:"X25519"},UB,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:n},r,256))},()=>{if(jb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return cg.scalarMult(e,t)})}async function up(e){return await HB(async()=>lg(e,cg.GuBytes),()=>{if(jb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return cg.scalarMultBase(e)})}var vW=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);async function wW(e){if(e.length!==32)throw new Error("X25519 private key must be 32 bytes");let t=new Uint8Array([...vW,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},UB,["deriveBits"])}function jb(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var N1e=B(x(),1);var k1e=B(x(),1);var fg=class{s;transcript=[];buf=new Uint8Array(0);constructor(t){this.s=t.getReader()}async readLine(){let t=[];for(;;){let r=this.buf.indexOf(10);if(r>=0)return t.push(this.buf.subarray(0,r)),this.transcript.push(this.buf.subarray(0,r+1)),this.buf=this.buf.subarray(r+1),EW(il(t));this.buf.length>0&&(t.push(this.buf),this.transcript.push(this.buf));let n=await this.s.read();if(n.done)return this.buf=il(t),null;this.buf=n.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:il(this.transcript)}}};function EW(e){return e.forEach(t=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function il(e){let t=e.reduce(((i,o)=>i+o.length),0),r=new Uint8Array(t),n=0;for(let i of e)r.set(i,n),n+=i.length;return r}function Mf(e,...t){return e.pipeThrough(new TransformStream({start(r){for(let n of t)r.enqueue(n)}}))}function hg(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function Kb(e){if(!(e instanceof ReadableStream))throw new Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function MB(e){if(!(e instanceof ReadableStream))throw new Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function qB(e,t){let r=e.getReader(),n=[],i=0;for(;i<t;){let{done:u,value:l}=await r.read();if(u)throw Error("stream ended before reading "+t.toString()+" bytes");n.push(l),i+=l.length}r.releaseLock();let o=il(n),s=o.subarray(0,t),a=Mf(e,o.subarray(t));return{data:s,rest:a}}var Mi=class{args;body;constructor(t,r){this.args=t,this.body=r}};async function bW(e){let t=await e.readLine();if(t===null)throw Error("invalid stanza");let r=t.split(" ");if(r.length<2||r.shift()!=="->")return{next:t};for(let o of r)if(o.length===0)throw Error("invalid stanza");let n=[];for(;;){let o=await e.readLine();if(o===null)throw Error("invalid stanza");let s=$n.decode(o);if(s.length>48)throw Error("invalid stanza");if(n.push(s),s.length<48)break}let i=il(n);return{s:new Mi(r,i)}}async function jB(e){let t=new fg(e),r=await t.readLine();if(r!=="age-encryption.org/v1")throw Error("invalid version "+(r??"line"));let n=[];for(;;){let{s:i,next:o}=await bW(t);if(i!==void 0){n.push(i);continue}if(!o.startsWith("--- "))throw Error("invalid header");let s=$n.decode(o.slice(4)),{rest:a,transcript:u}=t.close(),l=u.slice(0,u.length-1-o.length+3);return{stanzas:n,headerNoMAC:l,MAC:s,headerSize:u.length,rest:Mf(e,a)}}}function Vb(e){let t=[];t.push(`age-encryption.org/v1
|
||
`);for(let r of e){t.push("-> "+r.args.join(" ")+`
|
||
`);for(let n=0;n<r.body.length;n+=48){let i=n+48;i>r.body.length&&(i=r.body.length),t.push($n.encode(r.body.subarray(n,i))+`
|
||
`)}r.body.length%48===0&&t.push(`
|
||
`)}return t.push("---"),new TextEncoder().encode(t.join(""))}function KB(e,t){return il([Vb(e),new TextEncoder().encode(" "+$n.encode(t)+`
|
||
`)])}async function bg(e){let t;if(zB(e))t=e;else if(e.startsWith("AGE-SECRET-KEY-PQ-1")){let n=ni.decodeToBytes(e);if(n.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||n.bytes.length!==32)throw Error("invalid identity");let i=Zm.getPublicKey(n.bytes);return ni.encode("age1pq",ni.toWords(i),!1)}else{let n=ni.decodeToBytes(e);if(!e.startsWith("AGE-SECRET-KEY-1")||n.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||n.bytes.length!==32)throw Error("invalid identity");t=n.bytes}let r=await up(t);return ni.encodeFromBytes("age",r)}var pg=class{recipient;constructor(t){let r=ni.decodeToBytes(t);if(!t.startsWith("age1pq1")||r.prefix.toLowerCase()!=="age1pq"||r.bytes.length!==1216)throw Error("invalid recipient");this.recipient=r.bytes}wrapFileKey(t){let{cipherText:r,sharedSecret:n}=Zm.encapsulate(this.recipient),i=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:o,nonce:s}=Ag(VB,n,i),a=si(o,s).encrypt(t);return[new Mi(["mlkem768x25519",$n.encode(r)],a)]}},mg=class{identity;constructor(t){let r=ni.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-PQ-1")||r.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||r.bytes.length!==32)throw Error("invalid identity");this.identity=r.bytes}unwrapFileKey(t){for(let r of t){if(r.args.length<1||r.args[0]!=="mlkem768x25519")continue;if(r.args.length!==2)throw Error("invalid mlkem768x25519 stanza");let n=$n.decode(r.args[1]);if(n.length!==1120||r.body.length!==32)throw Error("invalid mlkem768x25519 stanza");let i=Zm.decapsulate(n,this.identity),o=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:s,nonce:a}=Ag(VB,i,o);try{return si(s,a).decrypt(r.body)}catch{continue}}return null}},VB=25722,AW=80,zb=16;function Ag(e,t,r){let n=SW(e),i=dg(n,void 0,"psk_id_hash",new Uint8Array(0)),o=dg(n,void 0,"info_hash",r),s=new Uint8Array(1+i.length+o.length);s[0]=0,s.set(i,1),s.set(o,1+i.length);let a=dg(n,t,"secret",new Uint8Array(0)),u=Gb(n,a,"key",s,32),l=Gb(n,a,"base_nonce",s,12);return{key:u,nonce:l}}function SW(e){let t=new Uint8Array(10);return t.set(new TextEncoder().encode("HPKE"),0),t[4]=e>>8&255,t[5]=e&255,t[6]=0,t[7]=1,t[8]=0,t[9]=3,t}function dg(e,t,r,n){let i=new Uint8Array(7+e.length+r.length+n.length),o=0;return i.set(new TextEncoder().encode("HPKE-v1"),o),o+=7,i.set(e,o),o+=e.length,i.set(new TextEncoder().encode(r),o),o+=r.length,i.set(n,o),xd(Dr,i,t)}function Gb(e,t,r,n,i){let o=new Uint8Array(9+e.length+r.length+n.length),s=0;return o[s]=i>>8&255,o[s+1]=i&255,s+=2,o.set(new TextEncoder().encode("HPKE-v1"),s),s+=7,o.set(e,s),s+=e.length,o.set(new TextEncoder().encode(r),s),s+=r.length,o.set(n,s),EE(Dr,t,o,i)}function _W(e){e.length!==Uf.lengths.publicKeyUncompressed&&(e=Uf.Point.fromBytes(e).toBytes(!1));let t=Uf.utils.randomSecretKey(),r=Uf.getPublicKey(t,!1),n=Uf.getSharedSecret(t,e,!0).subarray(1),i=new Uint8Array(r.length+e.length);i.set(r,0),i.set(e,r.length);let o=new Uint8Array(5);o.set(new TextEncoder().encode("KEM"),0),o[3]=zb>>8,o[4]=zb&255;let s=dg(o,void 0,"eae_prk",n),a=Gb(o,s,"shared_secret",i,32);return{encapsulatedKey:r,sharedSecret:a}}var gg=class{recipient;constructor(t){let r=ni.decodeToBytes(t);if(!t.startsWith("age1tag1")||r.prefix.toLowerCase()!=="age1tag"||r.bytes.length!==33)throw Error("invalid recipient");this.recipient=r.bytes}wrapFileKey(t){let{encapsulatedKey:r,sharedSecret:n}=_W(this.recipient),i=new TextEncoder().encode("age-encryption.org/p256tag"),o=(()=>{let l=Dr(this.recipient).subarray(0,4),h=new Uint8Array(r.length+l.length);return h.set(r,0),h.set(l,r.length),xd(Dr,h,i).subarray(0,4)})(),{key:s,nonce:a}=Ag(zb,n,i),u=si(s,a).encrypt(t);return[new Mi(["p256tag",$n.encode(o),$n.encode(r)],u)]}},vg=class{recipient;constructor(t){let r=ni.decodeToBytes(t);if(!t.startsWith("age1tagpq1")||r.prefix.toLowerCase()!=="age1tagpq"||r.bytes.length!==1249)throw Error("invalid recipient");this.recipient=r.bytes}wrapFileKey(t){let{cipherText:r,sharedSecret:n}=nB.encapsulate(this.recipient),i=new TextEncoder().encode("age-encryption.org/mlkem768p256tag"),o=(()=>{let l=Dr(this.recipient.subarray(1184)).subarray(0,4),h=new Uint8Array(r.length+l.length);return h.set(r,0),h.set(l,r.length),xd(Dr,h,i).subarray(0,4)})(),{key:s,nonce:a}=Ag(AW,n,i),u=si(s,a).encrypt(t);return[new Mi(["mlkem768p256tag",$n.encode(o),$n.encode(r)],u)]}},wg=class{recipient;constructor(t){let r=ni.decodeToBytes(t);if(!t.startsWith("age1")||r.prefix.toLowerCase()!=="age"||r.bytes.length!==32)throw Error("invalid recipient");this.recipient=r.bytes}async wrapFileKey(t){let r=Pu(32),n=await up(r),i=await lg(r,this.recipient),o=new Uint8Array(n.length+this.recipient.length);o.set(n),o.set(this.recipient,n.length);let s=new TextEncoder().encode("age-encryption.org/v1/X25519"),a=ku(Dr,i,o,s,32);return[new Mi(["X25519",$n.encode(n)],Wb(t,a))]}},cp=class{identity;recipient;constructor(t){if(zB(t)){this.identity=t,this.recipient=up(t);return}let r=ni.decodeToBytes(t);if(!t.startsWith("AGE-SECRET-KEY-1")||r.prefix.toUpperCase()!=="AGE-SECRET-KEY-"||r.bytes.length!==32)throw Error("invalid identity");this.identity=r.bytes,this.recipient=up(r.bytes)}async unwrapFileKey(t){for(let r of t){if(r.args.length<1||r.args[0]!=="X25519")continue;if(r.args.length!==2)throw Error("invalid X25519 stanza");let n=$n.decode(r.args[1]);if(n.length!==32)throw Error("invalid X25519 stanza");let i=await lg(this.identity,n),o=await this.recipient,s=new Uint8Array(n.length+o.length);s.set(n),s.set(o,n.length);let a=new TextEncoder().encode("age-encryption.org/v1/X25519"),u=ku(Dr,i,s,a,32),l=Yb(r.body,u);if(l!==null)return l}return null}},yg=class{passphrase;logN;constructor(t,r){this.passphrase=t,this.logN=r}wrapFileKey(t){let r=Pu(16),n="age-encryption.org/v1/scrypt",i=new Uint8Array(n.length+16);i.set(new TextEncoder().encode(n)),i.set(r,n.length);let o=UE(this.passphrase,i,{N:2**this.logN,r:8,p:1,dkLen:32});return[new Mi(["scrypt",$n.encode(r),this.logN.toString()],Wb(t,o))]}},Eg=class{passphrase;constructor(t){this.passphrase=t}unwrapFileKey(t){for(let r of t){if(r.args.length<1||r.args[0]!=="scrypt")continue;if(t.length!==1)throw Error("scrypt recipient is not the only one in the header");if(r.args.length!==3||!/^[1-9][0-9]*$/.test(r.args[2]))throw Error("invalid scrypt stanza");let n=$n.decode(r.args[1]);if(n.length!==16)throw Error("invalid scrypt stanza");let i=Number(r.args[2]);if(i>20)throw Error("scrypt work factor is too high");let o="age-encryption.org/v1/scrypt",s=new Uint8Array(o.length+16);s.set(new TextEncoder().encode(o)),s.set(n,o.length);let a=UE(this.passphrase,s,{N:2**i,r:8,p:1,dkLen:32}),u=Yb(r.body,a);if(u!==null)return u}return null}};function Wb(e,t){let r=new Uint8Array(12);return si(t,r).encrypt(e)}function Yb(e,t){if(e.length!==32)throw Error("invalid stanza");let r=new Uint8Array(12);try{return si(t,r).decrypt(e)}catch{return null}}function zB(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var Q1e=B(x(),1);var ol=16,Zb=64*1024,Xb=Zb+ol;function GB(e){let t=new Uint8Array(12),r=()=>{for(let s=t.length-2;s>=0&&(t[s]++,t[s]===0);s--);},n=!0,i=new Uint8Array(Xb),o=0;return new TransformStream({transform(s,a){for(;s.length>0;){if(o===i.length){let l=si(e,t).decrypt(i);a.enqueue(l),r(),o=0,n=!1}let u=Math.min(i.length-o,s.length);i.set(s.subarray(0,u),o),o+=u,s=s.subarray(u)}},flush(s){t[11]=1;let a=si(e,t).decrypt(i.subarray(0,o));if(!n&&a.length===0)throw new Error("final chunk is empty");s.enqueue(a)}})}function WB(e){if(e<ol)throw Error("ciphertext is too small");if(e===ol)return 0;let t=Math.floor(e/Xb),r=e%Xb;if(0<r&&r<=ol)throw Error("ciphertext size is invalid");let n=e;return n-=t*ol,n-=r>0?ol:0,n}function YB(e){let t=new Uint8Array(12),r=()=>{for(let o=t.length-2;o>=0&&(t[o]++,t[o]===0);o--);},n=new Uint8Array(Zb),i=0;return new TransformStream({transform(o,s){for(;o.length>0;){if(i===n.length){let u=si(e,t).encrypt(n);s.enqueue(u),r(),i=0}let a=Math.min(n.length-i,o.length);n.set(o.subarray(0,a),i),i+=a,o=o.subarray(a)}},flush(o){t[11]=1;let s=si(e,t).encrypt(n.subarray(0,i));o.enqueue(s)}})}function XB(e){let t=Math.max(1,Math.ceil(e/Zb));return e+ol*t}var lp={};wO(lp,{decode:()=>DW,encode:()=>CW});var rme=B(x(),1);function CW(e){let t=[];t.push(`-----BEGIN AGE ENCRYPTED FILE-----
|
||
`);for(let r=0;r<e.length;r+=48){let n=r+48;n>e.length&&(n=e.length),t.push(OE.encode(e.subarray(r,n))+`
|
||
`)}return t.push(`-----END AGE ENCRYPTED FILE-----
|
||
`),t.join("")}function DW(e){let t=e.trim().replaceAll(`\r
|
||
`,`
|
||
`).split(`
|
||
`);if(t.shift()!=="-----BEGIN AGE ENCRYPTED FILE-----")throw Error("invalid header");if(t.pop()!=="-----END AGE ENCRYPTED FILE-----")throw Error("invalid footer");function r(n,i){return n===t.length-1?i.length>0&&i.length<=64&&i.length%4===0:i.length===64}if(!t.every((n,i)=>r(i,n)))throw Error("invalid line length");if(!t.every(n=>/^[A-Za-z0-9+/=]+$/.test(n)))throw Error("invalid base64");return OE.decode(t.join(""))}var gme=B(x(),1);var nme=B(x(),1);var fp=class{passphrase=null;scryptWorkFactor=18;recipients=[];setPassphrase(t){if(this.passphrase!==null)throw new Error("can encrypt to at most one passphrase");if(this.recipients.length!==0)throw new Error("can't encrypt to both recipients and passphrases");this.passphrase=t}setScryptWorkFactor(t){this.scryptWorkFactor=t}addRecipient(t){if(this.passphrase!==null)throw new Error("can't encrypt to both recipients and passphrases");if(typeof t=="string")if(t.startsWith("age1pq1"))this.recipients.push(new pg(t));else if(t.startsWith("age1tag1"))this.recipients.push(new gg(t));else if(t.startsWith("age1tagpq1"))this.recipients.push(new vg(t));else if(t.startsWith("age1"))this.recipients.push(new wg(t));else throw new Error("unrecognized recipient type");else this.recipients.push(t)}async encrypt(t){let r=Pu(16),n=[],i=this.recipients;this.passphrase!==null&&(i=[new yg(this.passphrase,this.scryptWorkFactor)]);for(let d of i)n.push(...await d.wrapFileKey(r));let o=new TextEncoder().encode("header"),s=ku(Dr,r,void 0,o,32),a=So(Dr,s,Vb(n)),u=KB(n,a),l=Pu(16),h=new TextEncoder().encode("payload"),m=ku(Dr,r,l,h,32),p=YB(m);return t instanceof ReadableStream?Object.assign(Mf(t.pipeThrough(p),u,l),{size:d=>XB(d)+u.length+l.length}):(typeof t=="string"&&(t=new TextEncoder().encode(t)),await Kb(Mf(hg(t).pipeThrough(p),u,l)))}},Sg=class{identities=[];addPassphrase(t){this.identities.push(new Eg(t))}addIdentity(t){if(PW(t))this.identities.push(new cp(t));else if(typeof t=="string")if(t.startsWith("AGE-SECRET-KEY-1"))this.identities.push(new cp(t));else if(t.startsWith("AGE-SECRET-KEY-PQ-1"))this.identities.push(new mg(t));else throw new Error("unrecognized identity type");else this.identities.push(t)}async decrypt(t,r){let n=t instanceof ReadableStream?t:hg(t),{fileKey:i,headerSize:o,rest:s}=await this.decryptHeaderInternal(n),{data:a,rest:u}=await qB(s,16),l=new TextEncoder().encode("payload"),h=ku(Dr,i,a,l,32),m=GB(h),p=u.pipeThrough(m),d=Object.assign(p,{size:v=>WB(v-o-a.length)});return t instanceof ReadableStream?d:r==="text"?await MB(p):await Kb(p)}async decryptHeader(t){return(await this.decryptHeaderInternal(hg(t))).fileKey}async decryptHeaderInternal(t){let r=await jB(t),n=await this.unwrapFileKey(r.stanzas);if(n===null)throw Error("no identity matched any of the file's recipients");let i=new TextEncoder().encode("header"),o=ku(Dr,n,void 0,i,32),s=So(Dr,o,r.headerNoMAC);if(!$W(r.MAC,s))throw Error("invalid header HMAC");return{fileKey:n,headerSize:r.headerSize,rest:r.rest}}async unwrapFileKey(t){for(let r of this.identities){let n=await r.unwrapFileKey(t);if(n!==null)return n}return null}};function $W(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function PW(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var RW="-----BEGIN AGE ENCRYPTED FILE-----";var Jb="age-secret-key",Pme=Object.freeze({X25519:"x25519",HYBRID:"mlkem768-x25519"}),TW=["TextEncoder","TextDecoder","ReadableStream","TransformStream","Response","Uint8Array"],OW=/\bAGE-SECRET-KEY(?:-PQ)?-1[023456789ACDEFGHJKLMNPQRSTUVWXYZ]+\b/g,Qb="__subStoreAgeX25519Fallback";function eA(e){return String(e??"").trim()}function NW(e){return e.startsWith("age1")&&!e.startsWith("age1pq1")&&!e.startsWith("age1tag1")&&!e.startsWith("age1tagpq1")}function LW(e){return e.startsWith("age1pq1")}function UW(e){return e.startsWith("AGE-SECRET-KEY-1")}function HW(e){return e.startsWith("AGE-SECRET-KEY-PQ-1")}function ZB(){return new Ea("INVALID_AGE_PUBLIC_KEY","age-public-key \u4EC5\u652F\u6301 X25519(age1...) \u6216 MLKEM768-X25519(age1pq1...) \u516C\u94A5")}function JB(){return new Ea("INVALID_AGE_SECRET_KEY","age-secret-key \u4EC5\u652F\u6301 X25519(AGE-SECRET-KEY-1...) \u6216 MLKEM768-X25519(AGE-SECRET-KEY-PQ-1...) \u79C1\u94A5")}function tA(e=globalThis){let t=TW.filter(i=>typeof e?.[i]>"u"),r=e?.crypto;if(r&&typeof r.getRandomValues=="function"||t.push("crypto.getRandomValues"),t.length>0)throw new Error(`\u5F53\u524D\u8FD0\u884C\u73AF\u5883\u7F3A\u5C11 age \u52A0\u89E3\u5BC6\u6240\u9700 Web API: ${t.join(", ")}`);VW(e)}function _g(){return typeof DOMException<"u"?new DOMException("X25519 WebCrypto is not available","NotSupportedError"):new ReferenceError("X25519 WebCrypto is not available")}function MW(){let e={importKey(){throw _g()},deriveBits(){throw _g()}};return e[Qb]=!0,e}function qW(e){return typeof e=="string"?e:e?.name}function QB(e){return String(qW(e)||"").toUpperCase()==="X25519"}function jW(e){let t=String(e?.message||e||"");return/x25519|algorithm|not\s+supported|unsupported|unrecognized|unknown/i.test(t)}function eI(e){return e instanceof TypeError||e instanceof ReferenceError||e?.name==="TypeError"||e?.name==="ReferenceError"||e?.name==="NotSupportedError"||e?.name==="Error"&&jW(e)||typeof DOMException<"u"&&e instanceof DOMException&&e.name==="NotSupportedError"}function KW(e){let t=Object.create(e);return Object.defineProperty(t,Qb,{configurable:!0,value:!0}),Object.defineProperty(t,"importKey",{configurable:!0,value:async(...r)=>{try{return await e.importKey.apply(e,r)}catch(n){throw QB(r[2])&&eI(n)?_g():n}}}),Object.defineProperty(t,"deriveBits",{configurable:!0,value:async(...r)=>{try{return await e.deriveBits.apply(e,r)}catch(n){throw QB(r[0])&&eI(n)?_g():n}}}),t}function tI(e,t,r){try{if(t.subtle=r,t.subtle===r)return!0}catch{}try{if(Object.defineProperty(t,"subtle",{configurable:!0,value:r}),t.subtle===r)return!0}catch{}try{let n=Object.create(t);return Object.defineProperty(n,"subtle",{configurable:!0,value:r}),typeof t.getRandomValues=="function"&&Object.defineProperty(n,"getRandomValues",{configurable:!0,value:t.getRandomValues.bind(t)}),e.crypto=n,e.crypto?.subtle===r}catch{return!1}}function VW(e=globalThis){let t=e?.crypto,r=t?.subtle;if(!(!t||r?.[Qb])){if(!r||typeof r.importKey!="function"||typeof r.deriveBits!="function"){tI(e,t,MW());return}typeof process>"u"&&tI(e,t,KW(r))}}function rI(e){let t=eA(e);if(!t||!NW(t)&&!LW(t))throw ZB();try{new fp().addRecipient(t)}catch{throw ZB()}return t}async function nI(e){let t=eA(e);if(!t||!UW(t)&&!HW(t))throw JB();try{await bg(t)}catch{throw JB()}return t}async function sI(e){tA();let t=await nI(e),r=await bg(t);return rI(r)}async function rA(e,t){tA();let r=rI(t),n=new fp;n.addRecipient(r);let i=await n.encrypt(e??"");return lp.encode(i)}function zW(e){return eA(e).startsWith(RW)}async function Cg(e,t){let r=e??"",n=typeof r=="string"?r:new TextDecoder().decode(r);if(!zW(n))return r;tA();let i=await nI(t),o=new Sg;o.addIdentity(i);try{let s=lp.decode(n);return await o.decrypt(s,"text")}catch(s){throw new Error(`age \u89E3\u5BC6\u5931\u8D25: ${s?.message??s}`)}}function GW(e){return String(e??"").replace(OW,t=>`${t.startsWith("AGE-SECRET-KEY-PQ-1")?"AGE-SECRET-KEY-PQ-1":"AGE-SECRET-KEY-1"}...${t.slice(-6)}`)}function Zu(e){return GW(String(e??"").replace(/([?#&]age-secret-key=)[^&#\s]+/gi,"$1***"))}var Zme=["Sub-Store placeholder","This file keeps the Gist alive when all sync configuration files are deleted."].join(`
|
||
`);var rge=B(x());var JW=new Set(["enabled","fallbackNotify"]),QW=new Set(["fallbackNotify","fallbackQuiet"]);function Dg(e){return e===!0?"quiet":e===!1||e==null||e===""?"disabled":e}function Fg(...e){for(let t of e)if(t!=null&&t!=="")return Dg(t);return"disabled"}function Bg(e){return JW.has(Dg(e))}function qf(e){return QW.has(Dg(e))}function hp({mode:e,message:t,notify:r}){let n=Dg(e);if(n==="disabled"||qf(n))throw new Error(t);Bg(n)&&r?.(t)}function Ig({mode:e,notify:t,error:r}){Bg(e)&&t?.(r)}function nA({platform:e="JSON",produceType:t,produceOpts:r={}}){return t==="raw"?JSON.stringify([]):Lt.produce([],e,t,r)}var uge=B(x());var iI={merge:!0,logLevel:"error"};function oI(e){return typeof e=="string"&&e.includes("short-id")}function xg(e){if(!oI(e))return e;try{let t=Ad(e,iI);return aI(e,t)}catch{return e}}function aI(e,t,r){let n=new Map,i=new Map;gs(t,{Node(p,d){ps(d)?i.set(d.range[0],n.get(d.source)):d.anchor&&n.set(d.anchor,d)}});let o=p=>ps(p)?i.get(p.range[0]):p,s=p=>dt(p)&&typeof p.value!="string"&&p.value!==null&&!p.tag&&p.source,a=new Set;gs(t,{Pair(p,{key:d,value:v}){let g=o(d)?.value;["reality-opts","reality-config"].includes(g)&&a.add(v)}});let u=new Set;for(let p of a)gs(p,{Alias(d,v){a.add(o(v))},Pair(d,{key:v,value:g}){o(v)?.value==="short-id"&&u.add(g)}});let l=new Map;for(let p of u){let d=o(p);if(Ps(d))for(let v of d.items)u.add(v);else s(d)&&l.set(d,JSON.stringify(d.source))}if(l.size===0||(r===void 0&&(r=t.errors.length>0?mf(e):t.toJS()),![r?.proxies,r?.listeners].some(p=>Array.isArray(p)&&p.length>0)))return e;let h=[],m=0;for(let[p,d]of[...l].sort(([v],[g])=>v.range[0]-g.range[0]))h.push(e.slice(m,p.range[0]),d),m=p.range[1];return h.join("")+e.slice(m)}function eY(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function tY(){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 bt.isValid(i)&&!/^\w+:\/\/\w+/im.test(i)&&t.some(o=>i.indexOf(o)!==-1)},parse:function(i){let o=bt.decode(i);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(o)?o:(Q.error("Base64 Pre-processor error: decoded line does not start with protocol"),i)}}}function rY(){return{name:"Fallback Base64 Pre-processor",test:function(n){return bt.isValid(n)},parse:function(n){let i=bt.decode(n);return/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(i)?i:(Q.error("Fallback Base64 Pre-processor error: decoded line does not start with protocol"),n)}}}function nY(){let e="Clash Pre-processor",t=function(i,o){if(o&&!/proxies/.test(i))return!1;let s,a;if(oI(i))try{s=Ad(i,iI),s.errors.length===0&&(a=s.toJS())}catch{s=void 0}if(a===void 0&&(a=mf(i)),o&&!Array.isArray(a.proxies)&&!Array.isArray(a["proxy-groups"]))return!1;if(s){let u=aI(i,s,a);if(u!==i)return{normalized:u}}return{content:a}};return{name:e,test:i=>t(i,!0),parse:function(i,o,s=t(i)){let{proxies:a}=s.normalized===void 0?s.content:mf(s.normalized);return(o?`proxies:
|
||
`:"")+(Array.isArray(a)?a:[]).map(u=>`${o?" - ":""}${JSON.stringify(u)}
|
||
`).join("")}}}function sY(){return{name:"SSD Pre-processor",test:function(n){return n.indexOf("ssd://")===0},parse:function(n){let i=[],o=JSON.parse(bt.decode(n.split("ssd://")[1])),s=o.port,a=o.encryption,u=o.password,l=o.servers;for(let h=0;h<l.length;h++){let m=l[h];a=m.encryption?m.encryption:a,u=m.password?m.password:u;let p=bt.encode(a+":"+u),d=m.server;s=m.port?m.port:s;let v=m.remarks?m.remarks:h,g=m.plugin_options?"/?plugin="+encodeURIComponent(m.plugin+";"+m.plugin_options):"";i[h]="ss://"+p+"@"+d+":"+s+g+"#"+v}return i.join(`
|
||
`)}}}function iY(){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 $g=[eY(),nY(),tY(),sY(),iY(),rY()];var hge=B(x());var pge=B(x()),sA="mihomoConfig",oY="mihomoProfile",aY=[sA,oY];function al(e){let t=typeof e=="string"?e:e?.type;return aY.includes(t)}function uI(e){return!e||!al(e)||e.type===sA?e:{...e,type:sA}}var uY=["localFirst","remoteFirst"],cY=["local","remote"],lY=["collection","local","none","remote","subscription"];function dp(e){return Object.keys(e).map(Zu).join(", ")}function cI(e){return uY.includes(e)}function fY(e){return al(e)?fI(e):e?.source}function fI(e){return lY.includes(e?.sourceType)?e.sourceType:"collection"}function Pg(e){return(Array.isArray(e)?e:[e]).flat()}function hI(e){return Pg(e).filter(t=>t!=null&&t!=="").join(`
|
||
`)}function hY(e,t){return t!=null&&t!==""?t:e.ignoreFailedRemoteFile}async function lI({file:e,sourceUrl:t,ua:r,proxy:n,noCache:i,noFlow:o,ignoreFailedRemoteFile:s,notifyTitle:a="\u{1F30D} Sub-Store \u5904\u7406\u6587\u4EF6\u5931\u8D25"}){let u={},l=`${t||""}`.split(/[\r\n]+/).map(p=>p.trim()).filter(p=>p.length);if(l.length===0)throw new Error(`\u6587\u4EF6 ${e.name} \u672A\u914D\u7F6E\u8FDC\u7A0B\u6587\u4EF6 URL`);let h=await Promise.all(l.map(async p=>{try{return await ci(p,r||e.ua,void 0,e.proxy||n,void 0,void 0,i||e.noCache,void 0,{noFlow:o})}catch(d){return u[p]=d,Q.error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${Zu(p)} \u53D1\u751F\u9519\u8BEF: ${d}`),""}})),m=hY(e,s);if(Object.keys(u).length>0)if(m)m==="enabled"&&Q.notify(a,`\u274C ${e.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${dp(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${dp(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);return h}async function dI(e,{url:t,ua:r,content:n,mergeSources:i,ignoreFailedRemoteFile:o,proxy:s,noCache:a,noFlow:u,notifyTitle:l}={}){if(n&&!cI(i))return n;if(t){let m=await lI({file:e,sourceUrl:t,ua:r,proxy:s,noCache:a,noFlow:u,ignoreFailedRemoteFile:o,notifyTitle:l});return i==="localFirst"?m.unshift(n):i==="remoteFirst"&&m.push(n),m}if(fY(e)==="local"&&!cI(e.mergeSources))return e.content;let h=await lI({file:e,sourceUrl:e.url,ua:r,proxy:s,noCache:a,noFlow:u,ignoreFailedRemoteFile:o,notifyTitle:l});return e.mergeSources==="localFirst"?h.unshift(e.content):e.mergeSources==="remoteFirst"&&h.push(e.content),h}async function dY(e,t={}){let r={},n=fI(e);if(n==="none")return Lt.yaml.safeDump(r);if(cY.includes(n)){let i=await dI(e,t);if(e?.mode!=="proxy")return hI(i);let o=Pg(i).map(s=>Lt.parse(s)).flat();if(o.length===0)throw new Error(`\u6587\u4EF6 ${e.name} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);r.proxies=Lt.produce(o,"mihomo","internal",{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy})}else r.proxies=await Ra({type:n,name:e?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy},noFlow:t.noFlow});return Lt.yaml.safeDump(r)}async function Ra({type:e,name:t,platform:r,url:n,ua:i,content:o,mergeSources:s,ignoreFailedRemoteSub:a,ignoreFailedRemoteFile:u,produceType:l,produceOpts:h={},subscription:m,file:p,awaitCustomCache:d,$options:v,proxy:g,noCache:y,noFlow:w,all:E,includeRaw:_}){if(r=r||"JSON",["subscription","sub"].includes(e)){let C;if(t){let S=Q.read(tm);if(C=ri(S,t),!C)throw new Error(`\u627E\u4E0D\u5230\u8BA2\u9605 ${t}`)}else if(m)C=m;else throw new Error("\u672A\u63D0\u4F9B\u8BA2\u9605\u540D\u79F0\u6216\u8BA2\u9605\u6570\u636E");let F=Fg(a,C.ignoreFailedRemoteSub),H=w||C.noFlow,K=[];try{let S;if(o&&!["localFirst","remoteFirst"].includes(s))S=o,K=o;else if(n){let R={},O=await Promise.all(n.split(/[\r\n]+/).map(T=>T.trim()).filter(T=>T.length).map(async T=>{try{return await ci(T,i||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return R[T]=N,Q.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Zu(T)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(T=>T.result??T),K=O.map(T=>T.raw??T),Object.keys(R).length>0){let T=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${dp(R)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;hp({mode:F,message:T,notify:()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,T)}})}s==="localFirst"?(S.unshift(o),K.unshift(o)):s==="remoteFirst"&&(S.push(o),K.push(o))}else if(C.source==="local"&&!["localFirst","remoteFirst"].includes(C.mergeSources))S=C.content,K=C.content;else{let R={},O=await Promise.all(C.url.split(/[\r\n]+/).map(T=>T.trim()).filter(T=>T.length).map(async T=>{try{return await ci(T,i||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return R[T]=N,Q.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Zu(T)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(T=>T.result??T),K=O.map(T=>T.raw??T),Object.keys(R).length>0){let T=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${dp(R)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;hp({mode:F,message:T,notify:()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,T)}})}C.mergeSources==="localFirst"?(S.unshift(C.content),K.unshift(C.content)):C.mergeSources==="remoteFirst"&&(S.push(C.content),K.push(C.content))}if(l==="raw"){let R=JSON.stringify((Array.isArray(S)?S:[S]).flat());return _?{result:R,raw:Array.isArray(K)?K:[K]}:R}let I=(Array.isArray(S)?S:[S]).map(R=>Lt.parse(R)).flat();if(I.forEach(R=>{R._subName=C.name,R._subDisplayName=C.displayName}),I=await Lt.process(I,C.process||[],r,{[C.name]:C},v,K,{noFlow:H}),I.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let q={};for(let R of I){if(q[R.name]){Q.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${R.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}q[R.name]=!0}let L=Lt.produce(I,r,l,h);return _?{result:L,raw:Array.isArray(K)?K:[K]}:L}catch(S){if(!qf(F))throw S;Ig({mode:F,error:S,notify:q=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,`\u{1F914} \u539F\u56E0\uFF1A${q.message??q}`)}}),Q.error(`\u8BA2\u9605 ${C.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${S.message??S}`);let I=nA({platform:r,produceType:l,produceOpts:h});return _?{result:I,raw:Array.isArray(K)?K:[K]}:I}}else if(["collection","col"].includes(e)){let C=Q.read(tm),F=Q.read(Ky),H=ri(F,t);if(!H)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let K=[...H.subscriptions],S=H.subscriptionTags;Array.isArray(S)&&S.length>0&&C.forEach(R=>{Array.isArray(R.tag)&&R.tag.length>0&&!K.includes(R.name)&&R.tag.some(O=>S.includes(O))&&K.push(R.name)});let I=Fg(a,H.ignoreFailedRemoteSub),q=w||H.noFlow,L={};try{let R={},O={},T=0;if(await Promise.all(K.map(async Y=>{let V=ri(C,Y),X=Fg(V.ignoreFailedRemoteSub),te=V.passThroughUA,ae=V.ua;te&&(Q.info(`\u8BA2\u9605\u5F00\u542F\u4E86\u900F\u4F20 User-Agent, \u4F7F\u7528\u8BF7\u6C42\u7684 User-Agent: ${i}`),ae=i);try{Q.info(`\u6B63\u5728\u5904\u7406\u5B50\u8BA2\u9605\uFF1A${V.name}...`);let me,he;if(V.source==="local"&&!["localFirst","remoteFirst"].includes(V.mergeSources))me=V.content,he=V.content;else{let Ie={},se=await Promise.all(V.url.split(/[\r\n]+/).map(pe=>pe.trim()).filter(pe=>pe.length).map(async pe=>{try{return await ci(pe,ae,void 0,g||V.proxy||H.proxy,void 0,void 0,y||V.noCache,!0,{returnRaw:!0,noFlow:q||V.noFlow})}catch(Fe){return Ie[pe]=Fe,Q.error(`\u8BA2\u9605 ${V.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Zu(pe)} \u53D1\u751F\u9519\u8BEF: ${Fe}`),""}}));if(me=se.map(pe=>pe.result??pe),he=se.map(pe=>pe.raw??pe),Object.keys(Ie).length>0){let pe=`\u8BA2\u9605 ${V.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${dp(Ie)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;hp({mode:X,message:pe,notify:()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${V.name}`,pe)}})}V.mergeSources==="localFirst"?(me.unshift(V.content),he.unshift(V.content)):V.mergeSources==="remoteFirst"&&(me.push(V.content),he.push(V.content))}let De=(Array.isArray(me)?me:[me]).map(Ie=>Lt.parse(Ie)).flat();De.forEach(Ie=>{Ie._subName=V.name,Ie._subDisplayName=V.displayName,Ie._collectionName=H.name,Ie._collectionDisplayName=H.displayName});let Pe=Array.isArray(he)?he:[he];De=await Lt.process(De,V.process||[],r,{[V.name]:V,_collection:H,$options:v},void 0,Pe,{noFlow:q||V.noFlow}),R[Y]=De,L[Y]=Pe,T++,Q.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${V.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(T/K.length).toFixed(1)}% `)}catch(me){if(T++,qf(X)){Ig({mode:X,error:me,notify:he=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${V.name}`,`\u{1F914} \u539F\u56E0\uFF1A${he.message??he}`)}}),Q.error(`\u8BA2\u9605 ${V.name} \u5728\u7EC4\u5408\u8BA2\u9605\u5904\u7406\u4E2D\u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${me.message??me}`),R[Y]=[],L[Y]=[];return}O[Y]=me,L[Y]=void 0,Q.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${V.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${me}\uFF01\u8FDB\u5EA6--${100*(T/K.length).toFixed(1)}%`)}})),Object.keys(O).length>0){let Y=`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(O).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`,V=()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,Y)};Object.keys(R).length>0&&qf(I)?(Object.keys(O).forEach(te=>{L[te]=[]}),Bg(I)&&V()):hp({mode:I,message:Y,notify:V})}let N=Array.prototype.concat.apply([],K.map(Y=>R[Y]||[]));if(N.forEach(Y=>{Y._collectionName=H.name,Y._collectionDisplayName=H.displayName}),N=await Lt.process(N,H.process||[],r,{_collection:H},v,L,{noFlow:q}),N.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let P={};for(let Y of N){if(P[Y.name]){Q.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${Y.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}P[Y.name]=!0}let M=Lt.produce(N,r,l,h);return _?{result:M,raw:L}:M}catch(R){if(!qf(I))throw R;Ig({mode:I,error:R,notify:T=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,`\u{1F914} \u539F\u56E0\uFF1A${T.message??T}`)}}),Q.error(`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${R.message??R}`);let O=nA({platform:r,produceType:l,produceOpts:h});return _?{result:O,raw:L}:O}}else if(e==="rule"){let C=Q.read(w8),F=ri(C,t);if(!F)throw new Error(`\u627E\u4E0D\u5230\u89C4\u5219 ${t}`);let H=[];for(let K=0;K<F.urls.length;K++){let S=F.urls[K];Q.info(`\u6B63\u5728\u5904\u7406URL\uFF1A${S}\uFF0C\u8FDB\u5EA6--${100*((K+1)/F.urls.length).toFixed(1)}% `);try{let{body:I}=await ci(S),q=Em.parse(I);H=H.concat(q)}catch(I){Q.error(`\u5904\u7406\u5206\u6D41\u8BA2\u9605\u4E2D\u7684URL: ${S}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${I}! \u8BE5\u8BA2\u9605\u5DF2\u88AB\u8DF3\u8FC7\u3002`)}}return H=await Em.process(H,[{type:"Remove Duplicate Filter"}]),Em.produce(H,r)}else if(e==="file"){let C=Q.read(Ic),F=uI(p||ri(C,t));if(!F)throw new Error(`\u627E\u4E0D\u5230\u6587\u4EF6 ${t}`);let H="";if(al(F)?H=await dY(F,{url:n,ua:i,content:o,mergeSources:s,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}):H=await dI(F,{url:n,ua:i,content:o,mergeSources:s,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}),l==="raw")return JSON.stringify(Pg(H));let K=Pg(H),S=hI(K),I=Array.isArray(F.process)&&F.process.length>0?await Lt.process({$files:K,$content:S,$options:v,$file:F},F.process,void 0,void 0,void 0,void 0,{noFlow:w}):{$content:S,$files:K,$options:v};return I.$content=xg(I?.$content??""),(E?I:I?.$content)??""}}var Nge=B(x());function iA(){return po(()=>vu("stream/promises"))}var pI=$g.find(e=>e.name==="Clash Pre-processor"),oA=new Map;function pY(e=""){let t=`${e}`.trim();return t?new RegExp(t,"i"):null}function mY(e,t,r){if(!t||!r||typeof e!="string"||!/^https?:\/\//i.test(e))return e;let n=`${t}/`;if(e.startsWith(n))return e;let i;try{i=pY(r)}catch(o){return Q.error(`GitHub \u52A0\u901F\u4EE3\u7406\u5339\u914D\u6B63\u5219\u65E0\u6548: ${o.message??o}`),e}return i?.test(e)?(Q.info(`GitHub \u52A0\u901F\u4EE3\u7406\u547D\u4E2D\u4E0B\u8F7D\u94FE\u63A5: ${e}`),`${t}/${e}`):e}function gY(e){return Zu(e)}async function jf(e,{ageSecretKey:t,preprocess:r,url:n}){let i=t?await Cg(e,t):e,o=i;if(r)try{let s=pI.test(i);s&&(i=pI.parse(i,!0,s))}catch(s){Q.error(`Clash Pre-processor error: ${s}`)}if(r)try{let s=Lt.parse(i);if(!Array.isArray(s)||s.length===0)return{result:i,raw:o,shouldCache:!1,cacheReason:`URL ${n} \u4E0D\u5305\u542B\u6709\u6548\u8282\u70B9, \u4E0D\u7F13\u5B58`}}catch(s){return{result:i,raw:o,shouldCache:!1,cacheReason:`URL ${n} \u5C1D\u8BD5\u89E3\u6790\u8282\u70B9\u5931\u8D25 ${s.message??s}, \u4E0D\u7F13\u5B58`}}return{result:i,raw:o,shouldCache:!0}}function pp(e,t){return t?{result:e.result,raw:e.raw}:e.result}function aA(e,t){return t?{result:e,raw:e}:e}async function ci(rawUrl="",ua,timeout,customProxy,skipCustomCache,awaitCustomCache,noCache,preprocess,options={}){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 explicitAgeSecretKey=options&&typeof options=="object"?options?.[Jb]||options?.ageSecretKey:void 0,returnRaw=options&&typeof options=="object"&&options.returnRaw,ageSecretKey=explicitAgeSecretKey||$arguments?.[Jb],{isNode,isStash,isLoon,isShadowRocket,isQX}=Qs(),{githubProxy,githubProxyRegex,defaultProxy,defaultUserAgent,defaultTimeout,cacheThreshold:defaultCacheThreshold}=Q.read(pr)||{},cacheThreshold=defaultCacheThreshold||1024,proxy=customProxy||defaultProxy;Q.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY"));let userAgent=ua||defaultUserAgent||"clash.meta/v1.19.34",customHeaders;if($arguments?.headers)try{let e=JSON.parse($arguments?.headers);if(e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length>0){let t={"user-agent":userAgent};for(let r in e)t[r.toLowerCase()]=e[r];customHeaders=t}}catch(e){Q.error(`\u89E3\u6790\u81EA\u5B9A\u4E49 headers \u5931\u8D25: ${e}`)}let requestTimeout=timeout||defaultTimeout||8e3;url=mY(url,githubProxy,githubProxyRegex);let safeUrl=gY(url),id=Ur(`${customHeaders?JSON.stringify(customHeaders):userAgent}${url}`);$arguments?.cacheKey===!0&&(Q.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=Q.read(customCacheKey),t=Hr.get(id);if(!noCache&&!$arguments?.noCache&&t)return Q.info(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl}
|
||
\u5B58\u5728\u6709\u6548\u7684\u5E38\u89C4\u7F13\u5B58
|
||
\u4F7F\u7528\u5E38\u89C4\u7F13\u5B58\u4EE5\u907F\u514D\u91CD\u590D\u8BF7\u6C42`),pp(await jf(t,{ageSecretKey,preprocess,url:safeUrl}),returnRaw);if(e){if(awaitCustomCache){Q.info(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl}
|
||
\u672C\u6B21\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u66F4\u65B0\u7F13\u5B58`);try{await ci(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess,options)}catch(r){Q.error(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl} \u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`),Q.info("\u4F7F\u7528\u4E50\u89C2\u7F13\u5B58\u7684\u6570\u636E\u5237\u65B0\u7F13\u5B58, \u9632\u6B62\u540E\u7EED\u8BF7\u6C42"),Hr.set(id,e)}}else Q.info(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl}
|
||
\u672C\u6B21\u8FD4\u56DE\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}
|
||
\u5E76\u8FDB\u884C\u8BF7\u6C42 \u5C1D\u8BD5\u5F02\u6B65\u66F4\u65B0\u7F13\u5B58`),ci(rawUrl.replace(/(\?|&)cacheKey=.*?(&|$)/,""),ua,timeout,proxy,!0,void 0,void 0,preprocess,options).catch(r=>{Q.error(`\u4E50\u89C2\u7F13\u5B58: URL ${safeUrl} \u5F02\u6B65\u66F4\u65B0\u7F13\u5B58\u53D1\u751F\u9519\u8BEF ${r.message??r}`)});return pp(await jf(e,{ageSecretKey,preprocess,url:safeUrl}),returnRaw)}}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"?rm:Ic,n=ri(Q.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return aA(e==="module"?n.content:await Ra({type:"file",name:t,noFlow:options?.noFlow}),returnRaw)}catch(t){throw Q.error(`Error when loading ${e}: ${url.split("#")[0]}.
|
||
Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let e=mo();return aA(e.readFileSync(url.split("#")[0],"utf8"),returnRaw)}catch(e){throw Q.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&&oA.has(id))return pp(await jf(await oA.get(id),{ageSecretKey,preprocess,url:safeUrl}),returnRaw);let http=wo({headers:{...customHeaders||{"User-Agent":userAgent},...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,rawResult,cached=Hr.get(id);if(!noCache&&!$arguments?.noCache&&cached)Q.info(`\u4F7F\u7528\u7F13\u5B58: ${safeUrl}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),rawResult=cached,result=await jf(cached,{ageSecretKey,preprocess,url:safeUrl}),customCacheKey&&(Q.info(`URL ${safeUrl}
|
||
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),Q.write(cached,customCacheKey));else{let e=$arguments?.insecure?isNode?{strictSSL:!1}:{insecure:!0}:void 0;Q.info(`Downloading...
|
||
${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent}`}
|
||
Timeout: ${requestTimeout}
|
||
Proxy: ${proxy}
|
||
Insecure: ${!!e}
|
||
Preprocess: ${preprocess}
|
||
URL: ${safeUrl}`);try{let{body:t,headers:r,statusCode:n}=await vf(()=>http.get({url,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?ya(proxy):{},...e||{}}),"download");if(Q.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let o=Nc(r);o&&Dd.set(id,o,$arguments?.headersCacheTtl?$arguments?.headersCacheTtl*1e3:void 0)}if(t.replace(/\s/g,"").length===0)throw new Error(new Error("\u8FDC\u7A0B\u8D44\u6E90\u5185\u5BB9\u4E3A\u7A7A"));result=await jf(t,{ageSecretKey,preprocess,url:safeUrl});let i=!0;if(cacheThreshold){let o=t.length/1024;o>cacheThreshold&&(Q.info(`\u8D44\u6E90\u5927\u5C0F ${o.toFixed(2)} KB \u8D85\u8FC7\u4E86 ${cacheThreshold} KB, \u4E0D\u7F13\u5B58`),i=!1)}result.shouldCache||(Q.error(result.cacheReason),i=!1),i&&(Hr.set(id,t,$arguments?.cacheTtl?$arguments?.cacheTtl*1e3:void 0),customCacheKey&&(Q.info(`URL ${safeUrl}
|
||
\u5199\u5165\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),Q.write(t,customCacheKey))),rawResult=t}catch(t){if(customCacheKey){let n=Q.read(customCacheKey);if(n)return Q.info(`\u65E0\u6CD5\u4E0B\u8F7D URL ${safeUrl}: ${t.message??t}
|
||
\u4F7F\u7528\u81EA\u5B9A\u4E49\u7F13\u5B58 ${$arguments?.cacheKey}`),pp(await jf(n,{ageSecretKey,preprocess,url:safeUrl}),returnRaw)}let r=`\u65E0\u6CD5\u4E0B\u8F7D URL ${safeUrl}: ${t.message??t}`;throw Q.error(r),new Error(r)}}return $arguments?.validCheck&&!$arguments?.noFlow&&!options?.noFlow&&await ym(wf(await wm(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl,$arguments.flowHeaders))),isNode||oA.set(id,rawResult),pp(result,returnRaw)}async function mI(url,file){let undici=eval("require('undici')"),fs=mo(),{pipeline}=iA(),{Agent,interceptors,request}=undici;Q.info(`Downloading file...
|
||
URL: ${url}
|
||
File: ${file}`);let{body,statusCode}=await request(url,{dispatcher:new Agent().compose(interceptors.redirect({maxRedirections:3,throwOnMaxRedirect:!0}))});if(statusCode!==200)throw new Error(`Failed to download file from ${url}`);let fileStream=fs.createWriteStream(file);return await pipeline(body,fileStream),Q.info(`File downloaded from ${url} to ${file}`),file}var cve=B(x());var i2e=B(x());var cA=class{constructor(){Q.read(Pc)||Q.write("{}",Pc);try{this.resourceCache=JSON.parse(Q.read(Pc))}catch(t){Q.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Pc} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},Q.write("{}",Pc)}this._cleanup()}_cleanup(t,r){let n=uA(r)??0,i=!1,o=Date.now();Object.entries(this.resourceCache).forEach(s=>{let[a,u]=s;(!u.time||u.time<o+n)&&(!t||a.startsWith(t))&&(delete this.resourceCache[a],i=!0)}),i&&this._persist()}revokeAll(){this.resourceCache={},this._persist()}_persist(){Q.write(JSON.stringify(this.resourceCache),Pc)}gettime(t){let r=this.resourceCache[t]&&this.resourceCache[t].time;return r&&new Date().getTime()<=r?this.resourceCache[t].time:null}get(t,r,n){let i=uA(r)??0,o=this.resourceCache[t],s=o&&o.time;if(s){if(Date.now()+i<=s)return o.data;n&&(delete this.resourceCache[t],this._persist())}return null}set(t,r,n){let i=uA(n)??wY();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function uA(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function wY(){let t=(Q.read(pr)||{})?.scriptCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:1728e5}var lA=new cA;var a2e=B(x());function kg(e,t){return[...Array(e).keys()].map(()=>t)}var f2e=B(x());var fA={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["EXP","BAND"],"\u{1F1E6}\u{1F1F8}":["AS","ASM"],"\u{1F1E6}\u{1F1F4}":["AO","AGO"],"\u{1F1E7}\u{1F1F8}":["BS","BHS"],"\u{1F1E7}\u{1F1E7}":["BB","BRB"],"\u{1F1E7}\u{1F1F2}":["BM","BMU"],"\u{1F1E7}\u{1F1FC}":["BW","BWA"],"\u{1F1E7}\u{1F1FB}":["BV","BVT"],"\u{1F1E7}\u{1F1FF}":["BZ","BLZ"],"\u{1F1EE}\u{1F1F4}":["IO","IOT"],"\u{1F1F8}\u{1F1E7}":["SB","SLB"],"\u{1F1FB}\u{1F1EC}":["VG","VGB"],"\u{1F1E7}\u{1F1EE}":["BI","BDI"],"\u{1F1E8}\u{1F1F2}":["CM","CMR"],"\u{1F1E8}\u{1F1FB}":["CV","CPV"],"\u{1F1F0}\u{1F1FE}":["KY","CYM"],"\u{1F1F9}\u{1F1E9}":["TD","TCD"],"\u{1F1E8}\u{1F1FD}":["CX","CXR"],"\u{1F1E8}\u{1F1E8}":["CC","CCK"],"\u{1F1F0}\u{1F1F2}":["KM","COM"],"\u{1F1FE}\u{1F1F9}":["YT","MYT"],"\u{1F1E8}\u{1F1EC}":["CG","COG"],"\u{1F1E8}\u{1F1E9}":["CD","COD"],"\u{1F1E8}\u{1F1F0}":["CK","COK"],"\u{1F1E8}\u{1F1FA}":["CU","CUB"],"\u{1F1E7}\u{1F1EF}":["BJ","BEN"],"\u{1F1E9}\u{1F1F2}":["DM","DMA"],"\u{1F1E9}\u{1F1F4}":["DO","DOM"],"\u{1F1F8}\u{1F1FB}":["SV","SLV"],"\u{1F1EC}\u{1F1F6}":["GQ","GNQ"],"\u{1F1EA}\u{1F1F9}":["ET","ETH"],"\u{1F1EA}\u{1F1F7}":["ER","ERI"],"\u{1F1EB}\u{1F1F4}":["FO","FRO"],"\u{1F1EB}\u{1F1F0}":["FK","FLK"],"\u{1F1EC}\u{1F1F8}":["GS","SGS"],"\u{1F1EB}\u{1F1EF}":["FJ","FJI"],"\u{1F1E6}\u{1F1FD}":["AX","ALA"],"\u{1F1EB}\u{1F1FD}":["FX"],"\u{1F1EC}\u{1F1EB}":["GF","GUF"],"\u{1F1F5}\u{1F1EB}":["PF","PYF"],"\u{1F1F9}\u{1F1EB}":["TF","ATF"],"\u{1F1E9}\u{1F1EF}":["DJ","DJI"],"\u{1F1EC}\u{1F1E6}":["GA","GAB"],"\u{1F1EC}\u{1F1F2}":["GM","GMB"],"\u{1F1F5}\u{1F1F8}":["PS","PSE"],"\u{1F1EC}\u{1F1ED}":["GH","GHA"],"\u{1F1EC}\u{1F1EE}":["GI","GIB"],"\u{1F1F0}\u{1F1EE}":["KI","KIR"],"\u{1F1EC}\u{1F1E9}":["GD","GRD"],"\u{1F1EC}\u{1F1F5}":["GP","GLP"],"\u{1F1EC}\u{1F1FC}":["GW","GNB"],"\u{1F1EC}\u{1F1F3}":["GN","GIN"],"\u{1F1EC}\u{1F1FE}":["GY","GUY"],"\u{1F1ED}\u{1F1F9}":["HT","HTI"],"\u{1F1ED}\u{1F1F2}":["HM","HMD"],"\u{1F1ED}\u{1F1F3}":["HN","HND"],"\u{1F1E8}\u{1F1EE}":["CI","CIV"],"\u{1F1EF}\u{1F1F2}":["JM","JAM"],"\u{1F1F0}\u{1F1FC}":["KW","KWT"],"\u{1F1F1}\u{1F1E7}":["LB","LBN"],"\u{1F1F1}\u{1F1F7}":["LR","LBR"],"\u{1F1F1}\u{1F1FE}":["LY","LBY"],"\u{1F1F1}\u{1F1EE}":["LI","LIE"],"\u{1F1F2}\u{1F1EC}":["MG","MDG"],"\u{1F1F2}\u{1F1FC}":["MW","MWI"],"\u{1F1F2}\u{1F1FB}":["MV","MDV"],"\u{1F1F2}\u{1F1F6}":["MQ","MTQ"],"\u{1F1F2}\u{1F1F7}":["MR","MRT"],"\u{1F1F2}\u{1F1FA}":["MU","MUS"],"\u{1F1F2}\u{1F1E8}":["MC","MCO"],"\u{1F1F2}\u{1F1EA}":["ME","MNE"],"\u{1F1F2}\u{1F1F8}":["MS","MSR"],"\u{1F1F2}\u{1F1FF}":["MZ","MOZ"],"\u{1F1F3}\u{1F1E6}":["NA","NAM"],"\u{1F1F3}\u{1F1F7}":["NR","NRU"],"\u{1F1E8}\u{1F1FC}":["CW","CUW"],"\u{1F1F8}\u{1F1FD}":["SX","SXM"],"\u{1F1E7}\u{1F1F6}":["BQ","BES"],"\u{1F1F3}\u{1F1E8}":["NC","NCL"],"\u{1F1FB}\u{1F1FA}":["VU","VUT"],"\u{1F1F3}\u{1F1EE}":["NI","NIC"],"\u{1F1F3}\u{1F1EA}":["NE","NER"],"\u{1F1F3}\u{1F1FA}":["NU","NIU"],"\u{1F1F3}\u{1F1EB}":["NF","NFK"],"\u{1F1FA}\u{1F1F2}":["UM","UMI"],"\u{1F1EB}\u{1F1F2}":["FM","FSM"],"\u{1F1F2}\u{1F1ED}":["MH","MHL"],"\u{1F1F5}\u{1F1FC}":["PW","PLW"],"\u{1F1F5}\u{1F1F3}":["PN","PCN"],"\u{1F1F9}\u{1F1F1}":["TL","TLS"],"\u{1F1F7}\u{1F1FC}":["RW","RWA"],"\u{1F1E7}\u{1F1F1}":["BL","BLM"],"\u{1F1F8}\u{1F1ED}":["SH","SHN"],"\u{1F1F0}\u{1F1F3}":["KN","KNA"],"\u{1F1E6}\u{1F1EE}":["AI","AIA"],"\u{1F1F1}\u{1F1E8}":["LC","LCA"],"\u{1F1F2}\u{1F1EB}":["MF","MAF"],"\u{1F1F5}\u{1F1F2}":["PM","SPM"],"\u{1F1FB}\u{1F1E8}":["VC","VCT"],"\u{1F1F8}\u{1F1F2}":["SM","SMR"],"\u{1F1F8}\u{1F1F9}":["ST","STP"],"\u{1F1F8}\u{1F1F3}":["SN","SEN"],"\u{1F1F8}\u{1F1E8}":["SC","SYC"],"\u{1F1F8}\u{1F1F8}":["SS","SSD"],"\u{1F1F8}\u{1F1E9}":["SD","SDN"],"\u{1F1EA}\u{1F1ED}":["EH","ESH"],"\u{1F1F8}\u{1F1F7}":["SR","SUR"],"\u{1F1F8}\u{1F1EF}":["SJ","SJM"],"\u{1F1F8}\u{1F1FF}":["SZ","SWZ"],"\u{1F1F8}\u{1F1FE}":["SY","SYR"],"\u{1F1F9}\u{1F1EF}":["TJ","TJK"],"\u{1F1F9}\u{1F1F0}":["TK","TKL"],"\u{1F1F9}\u{1F1F4}":["TO","TON"],"\u{1F1F9}\u{1F1F9}":["TT","TTO"],"\u{1F1F9}\u{1F1F2}":["TM","TKM"],"\u{1F1F9}\u{1F1E8}":["TC","TCA"],"\u{1F1F9}\u{1F1FB}":["TV","TUV"],"\u{1F1FA}\u{1F1EC}":["UG","UGA"],"\u{1F1EC}\u{1F1EC}":["GG","GGY"],"\u{1F1EF}\u{1F1EA}":["JE","JEY"],"\u{1F1F9}\u{1F1FF}":["TZ","TZA"],"\u{1F1E7}\u{1F1EB}":["BF","BFA"],"\u{1F1FA}\u{1F1FF}":["UZ","UZB"],"\u{1F1FC}\u{1F1EB}":["WF","WLF"],"\u{1F1FE}\u{1F1EA}":["YE","YEM"],"\u{1F1FF}\u{1F1F2}":["ZM","ZMB"],"\u{1F1FD}\u{1F1F0}":["XK"],"\u{1F1FA}\u{1F1F3}":["UN"],"\u{1F1F8}\u{1F1F1}":["SL","SLE"],"\u{1F1F2}\u{1F1F5}":["MP","MNP"],"\u{1F1F8}\u{1F1F4}":["SO","SOM"],"\u{1F1E6}\u{1F1F6}":["AQ","ATA"],"\u{1F1E6}\u{1F1EC}":["AG","ATG"],"\u{1F1EC}\u{1F1F1}":["GL","GRL"],"\u{1F1FF}\u{1F1FC}":["ZW","ZWE"],"\u{1F1E6}\u{1F1FC}":["AW","ABW"],"\u{1F1F2}\u{1F1F1}":["ML","MLI"],"\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{1F1EB}":["CF","CAF"],"\u{1F1E8}\u{1F1ED}":["CH","CHE"],"\u{1F1E8}\u{1F1F1}":["CL","CHL"],"\u{1F1E8}\u{1F1F4}":["CO","COL"],"\u{1F1E8}\u{1F1F7}":["CR","CRI"],"\u{1F1E8}\u{1F1FE}":["CY","CYP"],"\u{1F1E8}\u{1F1FF}":["CZ","CZE"],"\u{1F1E9}\u{1F1EA}":["DE","DEU"],"\u{1F1E9}\u{1F1F0}":["DK","DNK"],"\u{1F1E9}\u{1F1FF}":["DZ","DZA"],"\u{1F1EA}\u{1F1E8}":["EC","ECU"],"\u{1F1EA}\u{1F1EA}":["EE","EST"],"\u{1F1EA}\u{1F1EC}":["EG","EGY"],"\u{1F1EA}\u{1F1F8}":["ES","ESP"],"\u{1F1EA}\u{1F1FA}":["EU"],"\u{1F1EB}\u{1F1EE}":["FI","FIN"],"\u{1F1EB}\u{1F1F7}":["FR","FRA"],"\u{1F1EC}\u{1F1E7}":["GB","GBR","UK"],"\u{1F1EC}\u{1F1EA}":["GE","GEO"],"\u{1F1EC}\u{1F1F7}":["GR","GRC"],"\u{1F1EC}\u{1F1F9}":["GT","GTM"],"\u{1F1EC}\u{1F1FA}":["GU","GUM"],"\u{1F1ED}\u{1F1F0}":["HK","HKG","HKT","HKBN","HGC","WTT","CMI"],"\u{1F1ED}\u{1F1F7}":["HR","HRV"],"\u{1F1ED}\u{1F1FA}":["HU","HUN"],"\u{1F1EE}\u{1F1F6}":["IQ","IRQ"],"\u{1F1EF}\u{1F1F4}":["JO","JOR"],"\u{1F1EF}\u{1F1F5}":["JP","JPN","TYO"],"\u{1F1F0}\u{1F1EA}":["KE","KEN"],"\u{1F1F0}\u{1F1EC}":["KG","KGZ"],"\u{1F1F0}\u{1F1ED}":["KH","KHM"],"\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{1F1F8}":["LS","LSO"],"\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{1F1F4}\u{1F1F2}":["OM","OMN"],"\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{1F1F6}\u{1F1E6}":["QA","QAT"],"\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{1F1FC}\u{1F1F8}":["WS","WSM"],"\u{1F1F8}\u{1F1EA}":["SE","SWE"],"\u{1F1F8}\u{1F1EC}":["SG","SGP"],"\u{1F1F8}\u{1F1EE}":["SI","SVN"],"\u{1F1F8}\u{1F1F0}":["SK","SVK"],"\u{1F1F9}\u{1F1EC}":["TG","TGO"],"\u{1F1F9}\u{1F1ED}":["TH","THA"],"\u{1F1F9}\u{1F1F3}":["TN","TUN"],"\u{1F1F9}\u{1F1F7}":["TR","TUR"],"\u{1F1F9}\u{1F1FC}":["TW","TWN","CHT","HINET","ROC"],"\u{1F1FA}\u{1F1E6}":["UA","UKR"],"\u{1F1FA}\u{1F1F8}":["US","USA","LAX","SFO","SJC"],"\u{1F1FA}\u{1F1FE}":["UY","URY"],"\u{1F1FB}\u{1F1E6}":["VA","VAT"],"\u{1F1FB}\u{1F1EA}":["VE","VEN"],"\u{1F1FB}\u{1F1EE}":["VI","VIR"],"\u{1F1FB}\u{1F1F3}":["VN","VNM"],"\u{1F1FF}\u{1F1E6}":["ZA","ZAF","JNB"],"\u{1F1E8}\u{1F1F3}":["CN","CHN","BACK"]};function Kf(e){let t={"\u{1F3F3}\uFE0F\u200D\u{1F308}":["\u6D41\u91CF","\u65F6\u95F4","\u8FC7\u671F","Bandwidth","Expire"],"\u{1F1E6}\u{1F1F8}":["\u7F8E\u5C5E\u8428\u6469\u4E9A"],"\u{1F1E6}\u{1F1F4}":["\u5B89\u54E5\u62C9"],"\u{1F1E7}\u{1F1F8}":["\u5DF4\u54C8\u9A6C"],"\u{1F1E7}\u{1F1E7}":["\u5DF4\u5DF4\u591A\u65AF"],"\u{1F1E7}\u{1F1F2}":["\u767E\u6155\u5927"],"\u{1F1E7}\u{1F1FC}":["\u535A\u8328\u74E6\u7EB3"],"\u{1F1E7}\u{1F1FB}":["\u5E03\u97E6\u5C9B"],"\u{1F1E7}\u{1F1FF}":["\u4F2F\u5229\u5179"],"\u{1F1EE}\u{1F1F4}":["\u82F1\u5C5E\u5370\u5EA6\u6D0B\u9886\u5730"],"\u{1F1F8}\u{1F1E7}":["\u6240\u7F57\u95E8\u7FA4\u5C9B"],"\u{1F1FB}\u{1F1EC}":["\u82F1\u5C5E\u7EF4\u5C14\u4EAC\u7FA4\u5C9B"],"\u{1F1E7}\u{1F1EE}":["\u5E03\u9686\u8FEA"],"\u{1F1E8}\u{1F1F2}":["\u5580\u9EA6\u9686"],"\u{1F1E8}\u{1F1FB}":["\u4F5B\u5F97\u89D2"],"\u{1F1F0}\u{1F1FE}":["\u5F00\u66FC\u7FA4\u5C9B"],"\u{1F1F9}\u{1F1E9}":["\u4E4D\u5F97"],"\u{1F1E8}\u{1F1FD}":["\u5723\u8BDE\u5C9B"],"\u{1F1E8}\u{1F1E8}":["\u79D1\u79D1\u65AF\uFF08\u57FA\u6797\uFF09\u7FA4\u5C9B"],"\u{1F1F0}\u{1F1F2}":["\u79D1\u6469\u7F57"],"\u{1F1FE}\u{1F1F9}":["\u9A6C\u7EA6\u7279"],"\u{1F1E8}\u{1F1EC}":["\u521A\u679C\uFF08\u5E03\uFF09"],"\u{1F1E8}\u{1F1E9}":["\u521A\u679C\uFF08\u91D1\uFF09"],"\u{1F1E8}\u{1F1F0}":["\u5E93\u514B\u7FA4\u5C9B"],"\u{1F1E8}\u{1F1FA}":["\u53E4\u5DF4"],"\u{1F1E7}\u{1F1EF}":["\u8D1D\u5B81"],"\u{1F1E9}\u{1F1F2}":["\u591A\u7C73\u5C3C\u514B"],"\u{1F1E9}\u{1F1F4}":["\u591A\u7C73\u5C3C\u52A0"],"\u{1F1F8}\u{1F1FB}":["\u8428\u5C14\u74E6\u591A"],"\u{1F1EC}\u{1F1F6}":["\u8D64\u9053\u51E0\u5185\u4E9A"],"\u{1F1EA}\u{1F1F9}":["\u57C3\u585E\u4FC4\u6BD4\u4E9A"],"\u{1F1EA}\u{1F1F7}":["\u5384\u7ACB\u7279\u91CC\u4E9A"],"\u{1F1EB}\u{1F1F4}":["\u6CD5\u7F57\u7FA4\u5C9B"],"\u{1F1EB}\u{1F1F0}":["\u798F\u514B\u5170\u7FA4\u5C9B"],"\u{1F1EC}\u{1F1F8}":["\u5357\u4E54\u6CBB\u4E9A\u548C\u5357\u6851\u5A01\u5947\u7FA4\u5C9B"],"\u{1F1EB}\u{1F1EF}":["\u6590\u6D4E"],"\u{1F1E6}\u{1F1FD}":["\u5965\u5170\u7FA4\u5C9B"],"\u{1F1EB}\u{1F1FD}":["\u6CD5\u56FD\u672C\u571F"],"\u{1F1EC}\u{1F1EB}":["\u6CD5\u5C5E\u572D\u4E9A\u90A3"],"\u{1F1F5}\u{1F1EB}":["\u6CD5\u5C5E\u6CE2\u5229\u5C3C\u897F\u4E9A"],"\u{1F1F9}\u{1F1EB}":["\u6CD5\u5C5E\u5357\u90E8\u548C\u5357\u6781\u9886\u5730"],"\u{1F1E9}\u{1F1EF}":["\u5409\u5E03\u63D0"],"\u{1F1EC}\u{1F1E6}":["\u52A0\u84EC"],"\u{1F1EC}\u{1F1F2}":["\u5188\u6BD4\u4E9A"],"\u{1F1F5}\u{1F1F8}":["\u5DF4\u52D2\u65AF\u5766"],"\u{1F1EC}\u{1F1ED}":["\u52A0\u7EB3"],"\u{1F1EC}\u{1F1EE}":["\u76F4\u5E03\u7F57\u9640"],"\u{1F1F0}\u{1F1EE}":["\u57FA\u91CC\u5DF4\u65AF"],"\u{1F1EC}\u{1F1E9}":["\u683C\u6797\u7EB3\u8FBE"],"\u{1F1EC}\u{1F1F5}":["\u74DC\u5FB7\u7F57\u666E"],"\u{1F1EC}\u{1F1FE}":["\u572D\u4E9A\u90A3"],"\u{1F1ED}\u{1F1F9}":["\u6D77\u5730"],"\u{1F1ED}\u{1F1F2}":["\u8D6B\u5FB7\u5C9B\u548C\u9EA6\u514B\u5510\u7EB3\u7FA4\u5C9B"],"\u{1F1ED}\u{1F1F3}":["\u6D2A\u90FD\u62C9\u65AF"],"\u{1F1E8}\u{1F1EE}":["\u79D1\u7279\u8FEA\u74E6"],"\u{1F1EF}\u{1F1F2}":["\u7259\u4E70\u52A0"],"\u{1F1F0}\u{1F1FC}":["\u79D1\u5A01\u7279"],"\u{1F1F1}\u{1F1E7}":["\u9ECE\u5DF4\u5AE9"],"\u{1F1F1}\u{1F1F7}":["\u5229\u6BD4\u91CC\u4E9A"],"\u{1F1F1}\u{1F1FE}":["\u5229\u6BD4\u4E9A"],"\u{1F1F1}\u{1F1EE}":["\u5217\u652F\u6566\u58EB\u767B"],"\u{1F1F2}\u{1F1EC}":["\u9A6C\u8FBE\u52A0\u65AF\u52A0"],"\u{1F1F2}\u{1F1FC}":["\u9A6C\u62C9\u7EF4"],"\u{1F1F2}\u{1F1FB}":["\u9A6C\u5C14\u4EE3\u592B"],"\u{1F1F2}\u{1F1F6}":["\u9A6C\u63D0\u5C3C\u514B"],"\u{1F1F2}\u{1F1F7}":["\u6BDB\u91CC\u5854\u5C3C\u4E9A"],"\u{1F1F2}\u{1F1FA}":["\u6BDB\u91CC\u6C42\u65AF"],"\u{1F1F2}\u{1F1E8}":["\u6469\u7EB3\u54E5"],"\u{1F1F2}\u{1F1EA}":["\u9ED1\u5C71"],"\u{1F1F2}\u{1F1F8}":["\u8499\u7279\u585E\u62C9\u7279"],"\u{1F1F2}\u{1F1FF}":["\u83AB\u6851\u6BD4\u514B"],"\u{1F1F3}\u{1F1E6}":["\u7EB3\u7C73\u6BD4\u4E9A"],"\u{1F1F3}\u{1F1F7}":["\u7459\u9C81"],"\u{1F1E8}\u{1F1FC}":["\u5E93\u62C9\u7D22"],"\u{1F1F8}\u{1F1FD}":["\u8377\u5C5E\u5723\u9A6C\u4E01"],"\u{1F1E7}\u{1F1F6}":["\u8377\u5170\u52A0\u52D2\u6BD4\u533A"],"\u{1F1F3}\u{1F1E8}":["\u65B0\u5580\u91CC\u591A\u5C3C\u4E9A"],"\u{1F1FB}\u{1F1FA}":["\u74E6\u52AA\u963F\u56FE"],"\u{1F1F3}\u{1F1EE}":["\u5C3C\u52A0\u62C9\u74DC"],"\u{1F1F3}\u{1F1EA}":["\u5C3C\u65E5\u5C14"],"\u{1F1F3}\u{1F1FA}":["\u7EBD\u57C3"],"\u{1F1F3}\u{1F1EB}":["\u8BFA\u798F\u514B\u5C9B"],"\u{1F1FA}\u{1F1F2}":["\u7F8E\u56FD\u672C\u571F\u5916\u5C0F\u5C9B\u5C7F"],"\u{1F1EB}\u{1F1F2}":["\u5BC6\u514B\u7F57\u5C3C\u897F\u4E9A\u8054\u90A6"],"\u{1F1F2}\u{1F1ED}":["\u9A6C\u7ECD\u5C14\u7FA4\u5C9B"],"\u{1F1F5}\u{1F1FC}":["\u5E15\u52B3"],"\u{1F1F5}\u{1F1F3}":["\u76AE\u7279\u51EF\u6069\u7FA4\u5C9B"],"\u{1F1F9}\u{1F1F1}":["\u4E1C\u5E1D\u6C76"],"\u{1F1F7}\u{1F1FC}":["\u5362\u65FA\u8FBE"],"\u{1F1E7}\u{1F1F1}":["\u5723\u5DF4\u6CF0\u52D2\u7C73"],"\u{1F1F8}\u{1F1ED}":["\u5723\u8D6B\u52D2\u62FF"],"\u{1F1F0}\u{1F1F3}":["\u5723\u57FA\u8328\u548C\u5C3C\u7EF4\u65AF"],"\u{1F1E6}\u{1F1EE}":["\u5B89\u572D\u62C9"],"\u{1F1F1}\u{1F1E8}":["\u5723\u5362\u897F\u4E9A"],"\u{1F1F2}\u{1F1EB}":["\u6CD5\u5C5E\u5723\u9A6C\u4E01"],"\u{1F1F5}\u{1F1F2}":["\u5723\u76AE\u57C3\u5C14\u548C\u5BC6\u514B\u9686"],"\u{1F1FB}\u{1F1E8}":["\u5723\u6587\u68EE\u7279\u548C\u683C\u6797\u7EB3\u4E01\u65AF"],"\u{1F1F8}\u{1F1F2}":["\u5723\u9A6C\u529B\u8BFA"],"\u{1F1F8}\u{1F1F9}":["\u5723\u591A\u7F8E\u548C\u666E\u6797\u897F\u6BD4"],"\u{1F1F8}\u{1F1F3}":["\u585E\u5185\u52A0\u5C14"],"\u{1F1F8}\u{1F1E8}":["\u585E\u820C\u5C14"],"\u{1F1F8}\u{1F1F8}":["\u5357\u82CF\u4E39"],"\u{1F1F8}\u{1F1E9}":["\u82CF\u4E39"],"\u{1F1EA}\u{1F1ED}":["\u897F\u6492\u54C8\u62C9"],"\u{1F1F8}\u{1F1F7}":["\u82CF\u91CC\u5357"],"\u{1F1F8}\u{1F1EF}":["\u65AF\u74E6\u5C14\u5DF4\u548C\u626C\u9A6C\u5EF6"],"\u{1F1F8}\u{1F1FF}":["\u65AF\u5A01\u58EB\u5170"],"\u{1F1F8}\u{1F1FE}":["\u53D9\u5229\u4E9A"],"\u{1F1F9}\u{1F1EF}":["\u5854\u5409\u514B\u65AF\u5766"],"\u{1F1F9}\u{1F1F0}":["\u6258\u514B\u52B3"],"\u{1F1F9}\u{1F1F4}":["\u6C64\u52A0"],"\u{1F1F9}\u{1F1F9}":["\u7279\u7ACB\u5C3C\u8FBE\u548C\u591A\u5DF4\u54E5"],"\u{1F1F9}\u{1F1F2}":["\u571F\u5E93\u66FC\u65AF\u5766"],"\u{1F1F9}\u{1F1E8}":["\u7279\u514B\u65AF\u548C\u51EF\u79D1\u65AF\u7FA4\u5C9B"],"\u{1F1F9}\u{1F1FB}":["\u56FE\u74E6\u5362"],"\u{1F1FA}\u{1F1EC}":["\u4E4C\u5E72\u8FBE"],"\u{1F1EC}\u{1F1EC}":["\u6839\u897F\u5C9B"],"\u{1F1EF}\u{1F1EA}":["\u6CFD\u897F\u5C9B"],"\u{1F1F9}\u{1F1FF}":["\u5766\u6851\u5C3C\u4E9A"],"\u{1F1E7}\u{1F1EB}":["\u5E03\u57FA\u7EB3\u6CD5\u7D22"],"\u{1F1FA}\u{1F1FF}":["\u4E4C\u5179\u522B\u514B\u65AF\u5766"],"\u{1F1FC}\u{1F1EB}":["\u74E6\u5229\u65AF\u548C\u5BCC\u56FE\u7EB3"],"\u{1F1FE}\u{1F1EA}":["\u4E5F\u95E8"],"\u{1F1FF}\u{1F1F2}":["\u8D5E\u6BD4\u4E9A"],"\u{1F1FD}\u{1F1F0}":["\u79D1\u7D22\u6C83"],"\u{1F1FA}\u{1F1F3}":["\u8054\u5408\u56FD"],"\u{1F1F8}\u{1F1F1}":["\u585E\u62C9\u5229\u6602"],"\u{1F1F2}\u{1F1F5}":["\u5317\u9A6C\u91CC\u4E9A\u7EB3","Northern Mariana Islands","Saipan","\u585E\u73ED"],"\u{1F1F8}\u{1F1F4}":["Somalia","\u7D22\u9A6C\u91CC","\u6469\u52A0\u8FEA\u6C99","Mogadishu"],"\u{1F1E6}\u{1F1F6}":["Antarctica","\u5357\u6781\u6D32","\u5357\u6781"],"\u{1F1E6}\u{1F1EC}":["Antigua and Barbuda","\u5B89\u63D0\u74DC\u548C\u5DF4\u5E03\u8FBE"],"\u{1F1EC}\u{1F1F1}":["Greenland","\u683C\u9675\u5170\u5C9B","\u683C\u9675\u5170"],"\u{1F1FF}\u{1F1FC}":["Zimbabwe","\u6D25\u5DF4\u5E03\u97E6"],"\u{1F1E6}\u{1F1FC}":["Aruba","\u963F\u9C81\u5DF4"],"\u{1F1F2}\u{1F1F1}":["Mali","\u9A6C\u91CC"],"\u{1F1E6}\u{1F1E9}":["Andorra","\u5B89\u9053\u5C14"],"\u{1F1E6}\u{1F1EA}":["United Arab Emirates","\u963F\u8054\u914B","\u8FEA\u62DC","Dubai"],"\u{1F1E6}\u{1F1EB}":["Afghanistan","\u963F\u5BCC\u6C57"],"\u{1F1E6}\u{1F1F1}":["Albania","\u963F\u5C14\u5DF4\u5C3C\u4E9A","\u963F\u723E\u5DF4\u5C3C\u4E9E"],"\u{1F1E6}\u{1F1F2}":["Armenia","\u4E9A\u7F8E\u5C3C\u4E9A"],"\u{1F1E6}\u{1F1F7}":["Argentina","\u963F\u6839\u5EF7"],"\u{1F1E6}\u{1F1F9}":["Austria","\u5965\u5730\u5229","\u5967\u5730\u5229","\u7EF4\u4E5F\u7EB3"],"\u{1F1FC}\u{1F1F8}":["Samoa","\u8428\u6469\u4E9A","\u85A9\u6469\u4E9E"],"\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{1F1EB}":["Central African Republic","\u4E2D\u975E\u5171\u548C\u56FD","\u4E2D\u975E"],"\u{1F1E8}\u{1F1ED}":["Switzerland","\u745E\u58EB","\u82CF\u9ECE\u4E16","Zurich"],"\u{1F1E8}\u{1F1F1}":["Chile","\u667A\u5229"],"\u{1F1E8}\u{1F1F4}":["Colombia","\u54E5\u4F26\u6BD4\u4E9A"],"\u{1F1E8}\u{1F1F7}":["Costa Rica","\u54E5\u65AF\u8FBE\u9ECE\u52A0"],"\u{1F1E8}\u{1F1FE}":["Cyprus","\u585E\u6D66\u8DEF\u65AF"],"\u{1F1E8}\u{1F1FF}":["Czechia","\u6377\u514B","Czech","Czech Republic"],"\u{1F1E9}\u{1F1EA}":["German","\u5FB7\u56FD","\u5FB7\u570B","\u4EAC\u5FB7","\u6EEC\u5FB7","\u5EE3\u5FB7","\u6CAA\u5FB7","\u5E7F\u5FB7","\u6CD5\u5170\u514B\u798F","Frankfurt","\u5FB7\u610F\u5FD7"],"\u{1F1E9}\u{1F1F0}":["Denmark","\u4E39\u9EA6","\u4E39\u9EA5"],"\u{1F1E9}\u{1F1FF}":["Algeria","\u963F\u5C14\u53CA\u5229\u4E9A","\u963F\u723E\u53CA\u5229\u4E9E"],"\u{1F1EA}\u{1F1E8}":["Ecuador","\u5384\u74DC\u591A\u5C14"],"\u{1F1EA}\u{1F1EA}":["Estonia","\u7231\u6C99\u5C3C\u4E9A"],"\u{1F1EA}\u{1F1EC}":["Egypt","\u57C3\u53CA"],"\u{1F1EA}\u{1F1F8}":["Spain","\u897F\u73ED\u7259"],"\u{1F1EA}\u{1F1FA}":["European Union","\u6B27\u76DF","\u6B27\u7F57\u5DF4","\u6B27\u6D32\u8054\u76DF"],"\u{1F1EB}\u{1F1EE}":["Finland","\u82AC\u5170","\u82AC\u862D","\u8D6B\u5C14\u8F9B\u57FA"],"\u{1F1EB}\u{1F1F7}":["France","\u6CD5\u56FD","\u6CD5\u570B","\u5DF4\u9ECE"],"\u{1F1EC}\u{1F1E7}":["Great Britain","\u82F1\u56FD","England","United Kingdom","\u4F26\u6566","\u82F1","London"],"\u{1F1EC}\u{1F1EA}":["Georgia","\u683C\u9C81\u5409\u4E9A","\u683C\u9B6F\u5409\u4E9E"],"\u{1F1EC}\u{1F1F7}":["Greece","\u5E0C\u814A","\u5E0C\u81D8"],"\u{1F1EC}\u{1F1FA}":["Guam","\u5173\u5C9B","\u95DC\u5CF6"],"\u{1F1EC}\u{1F1F9}":["Guatemala","\u5371\u5730\u9A6C\u62C9"],"\u{1F1ED}\u{1F1F0}":["Hongkong","\u9999\u6E2F","Hong Kong","HongKong","HONG KONG","\u6DF1\u6E2F","\u6CAA\u6E2F","\u547C\u6E2F","\u7A57\u6E2F","\u4EAC\u6E2F","\u6E2F"],"\u{1F1ED}\u{1F1F7}":["Croatia","\u514B\u7F57\u5730\u4E9A","\u514B\u7F85\u5730\u4E9E"],"\u{1F1ED}\u{1F1FA}":["Hungary","\u5308\u7259\u5229"],"\u{1F1EE}\u{1F1F6}":["Iraq","\u4F0A\u62C9\u514B","\u5DF4\u683C\u8FBE","Baghdad"],"\u{1F1EF}\u{1F1F4}":["Jordan","\u7EA6\u65E6"],"\u{1F1EF}\u{1F1F5}":["Japan","\u65E5\u672C","\u4E1C\u4EAC","\u5927\u962A","\u57FC\u7389","\u6CAA\u65E5","\u7A57\u65E5","\u5DDD\u65E5","\u4E2D\u65E5","\u6CC9\u65E5","\u676D\u65E5","\u6DF1\u65E5","\u8FBD\u65E5","\u5E7F\u65E5","\u5927\u5742","Osaka","Tokyo"],"\u{1F1F0}\u{1F1EA}":["Kenya","\u80AF\u5C3C\u4E9A"],"\u{1F1F0}\u{1F1EC}":["Kyrgyzstan","\u5409\u5C14\u5409\u65AF\u65AF\u5766"],"\u{1F1F0}\u{1F1ED}":["Cambodia","\u67EC\u57D4\u5BE8"],"\u{1F1F0}\u{1F1F5}":["North Korea","\u671D\u9C9C"],"\u{1F1F0}\u{1F1F7}":["Korea","\u97E9\u56FD","\u97D3\u570B","\u97E9","\u97D3","\u9996\u5C14","\u6625\u5DDD","Chuncheon","Seoul"],"\u{1F1F0}\u{1F1FF}":["Kazakhstan","\u54C8\u8428\u514B\u65AF\u5766","\u54C8\u8428\u514B"],"\u{1F1EE}\u{1F1E9}":["Indonesia","\u5370\u5C3C","\u5370\u5EA6\u5C3C\u897F\u4E9A","\u96C5\u52A0\u8FBE"],"\u{1F1EE}\u{1F1EA}":["Ireland","\u7231\u5C14\u5170","\u611B\u723E\u862D","\u90FD\u67CF\u6797"],"\u{1F1EE}\u{1F1F1}":["Israel","\u4EE5\u8272\u5217"],"\u{1F1EE}\u{1F1F2}":["Isle of Man","\u9A6C\u6069\u5C9B","\u99AC\u6069\u5CF6"],"\u{1F1EE}\u{1F1F3}":["India","\u5370\u5EA6","\u5B5F\u4E70","MFumbai","Mumbai"],"\u{1F1EE}\u{1F1F7}":["Iran","\u4F0A\u6717"],"\u{1F1EE}\u{1F1F8}":["Iceland","\u51B0\u5C9B","\u51B0\u5CF6"],"\u{1F1EE}\u{1F1F9}":["Italy","\u610F\u5927\u5229","\u7FA9\u5927\u5229","\u7C73\u5170","Nachash"],"\u{1F1F1}\u{1F1F0}":["Sri Lanka","\u65AF\u91CC\u5170\u5361","\u65AF\u91CC\u862D\u5361"],"\u{1F1F1}\u{1F1E6}":["Laos","\u8001\u631D","\u8001\u64BE"],"\u{1F1F1}\u{1F1F8}":["Lesotho","\u83B1\u7D22\u6258"],"\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{1F1F4}\u{1F1F2}":["Oman","\u963F\u66FC","\u9A6C\u65AF\u5580\u7279"],"\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{1F1EC}\u{1F1FC}":["\u51E0\u5185\u4E9A\u6BD4\u7ECD"],"\u{1F1EC}\u{1F1F3}":["\u51E0\u5185\u4E9A"],"\u{1F1F5}\u{1F1FE}":["Paraguay","\u5DF4\u62C9\u572D"],"\u{1F1F6}\u{1F1E6}":["Qatar","\u5361\u5854\u5C14","\u5361\u5854\u723E"],"\u{1F1F7}\u{1F1F4}":["Romania","\u7F57\u9A6C\u5C3C\u4E9A"],"\u{1F1F7}\u{1F1F8}":["Serbia","\u585E\u5C14\u7EF4\u4E9A"],"\u{1F1F7}\u{1F1EA}":["R\xE9union","\u7559\u5C3C\u6C6A","\u6CD5\u5C5E\u7559\u5C3C\u6C6A"],"\u{1F1F7}\u{1F1FA}":["Russia","\u4FC4\u7F57\u65AF","\u4FC4\u56FD","\u4FC4\u7F85\u65AF","\u4F2F\u529B","\u83AB\u65AF\u79D1","\u5723\u5F7C\u5F97\u5821","\u897F\u4F2F\u5229\u4E9A","\u4EAC\u4FC4","\u676D\u4FC4","\u5EE3\u4FC4","\u6EEC\u4FC4","\u5E7F\u4FC4","\u6CAA\u4FC4","Moscow"],"\u{1F1F8}\u{1F1E6}":["Saudi","\u6C99\u7279\u963F\u62C9\u4F2F","\u6C99\u7279","Riyadh","\u5229\u96C5\u5F97"],"\u{1F1F8}\u{1F1EA}":["Sweden","\u745E\u5178","\u65AF\u5FB7\u54E5\u5C14\u6469","Stockholm"],"\u{1F1F8}\u{1F1EC}":["Singapore","\u65B0\u52A0\u5761","\u72EE\u57CE","\u6CAA\u65B0","\u4EAC\u65B0","\u4E2D\u65B0","\u6CC9\u65B0","\u7A57\u65B0","\u6DF1\u65B0","\u676D\u65B0","\u5E7F\u65B0","\u5EE3\u65B0","\u6EEC\u65B0"],"\u{1F1F8}\u{1F1EE}":["Slovenia","\u65AF\u6D1B\u6587\u5C3C\u4E9A"],"\u{1F1F8}\u{1F1F0}":["Slovakia","\u65AF\u6D1B\u4F10\u514B"],"\u{1F1F9}\u{1F1EC}":["Togo","\u591A\u54E5","\u6D1B\u7F8E","Lom\xE9","Lome"],"\u{1F1F9}\u{1F1ED}":["Thailand","\u6CF0\u56FD","\u6CF0\u570B","\u66FC\u8C37"],"\u{1F1F9}\u{1F1F3}":["Tunisia","\u7A81\u5C3C\u65AF"],"\u{1F1F9}\u{1F1F7}":["Turkey","\u571F\u8033\u5176","\u4F0A\u65AF\u5766\u5E03\u5C14","Istanbul"],"\u{1F1F9}\u{1F1FC}":["Taiwan","\u53F0\u6E7E","\u81FA\u7063","\u53F0\u7063","\u4E2D\u83EF\u6C11\u570B","\u4E2D\u534E\u6C11\u56FD","\u53F0\u5317","\u53F0\u4E2D","\u65B0\u5317","\u5F70\u5316","\u53F0","\u81FA","Taipei","Tai Wan"],"\u{1F1FA}\u{1F1E6}":["Ukraine","\u4E4C\u514B\u5170","\u70CF\u514B\u862D"],"\u{1F1FB}\u{1F1EE}":["United States Virgin Islands","US Virgin Islands","USVI","\u7F8E\u5C5E\u7EF4\u5C14\u4EAC\u7FA4\u5C9B","\u7F8E\u5C6C\u7DAD\u723E\u4EAC\u7FA4\u5CF6"],"\u{1F1FA}\u{1F1F8}":["United States","\u7F8E\u56FD","America","\u7F8E","\u4EAC\u7F8E","\u6CE2\u7279\u5170","\u8FBE\u62C9\u65AF","\u4FC4\u52D2\u5188","Oregon","\u51E4\u51F0\u57CE","\u8D39\u5229\u8499","\u7845\u8C37","\u77FD\u8C37","\u62C9\u65AF\u7EF4\u52A0\u65AF","\u6D1B\u6749\u77F6","\u5723\u4F55\u585E","\u5723\u514B\u62C9\u62C9","\u897F\u96C5\u56FE","\u829D\u52A0\u54E5","\u6CAA\u7F8E","\u54E5\u4F26\u5E03","\u7EBD\u7EA6","New York","Los Angeles","San Jose","Sillicon Valley","Michigan","\u4FC4\u4EA5\u4FC4","Ohio","\u9A6C\u7EB3\u8428\u65AF","Manassas","\u5F17\u5409\u5C3C\u4E9A","Virginia"],"\u{1F1FA}\u{1F1FE}":["Uruguay","\u4E4C\u62C9\u572D"],"\u{1F1FB}\u{1F1E6}":["Vatican","Vatican City","Holy See","\u68B5\u8482\u5188","\u68B5\u8482\u5CA1"],"\u{1F1FB}\u{1F1EA}":["Venezuela","\u59D4\u5185\u745E\u62C9"],"\u{1F1FB}\u{1F1F3}":["Vietnam","\u8D8A\u5357","\u80E1\u5FD7\u660E"],"\u{1F1FF}\u{1F1E6}":["South Africa","\u5357\u975E"],"\u{1F1E8}\u{1F1F3}":["China","\u4E2D\u56FD","\u4E2D\u570B","\u56DE\u56FD","\u56DE\u570B","\u56FD\u5185","\u570B\u5167","\u534E\u4E1C","\u534E\u897F","\u534E\u5357","\u534E\u5317","\u534E\u4E2D","\u6C5F\u82CF","\u5317\u4EAC","\u4E0A\u6D77","\u5E7F\u5DDE","\u6DF1\u5733","\u676D\u5DDE","\u5F90\u5DDE","\u9752\u5C9B","\u5B81\u6CE2","\u9547\u6C5F"]},r=e.match(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/)?.[0]||"\u{1F3F4}\u200D\u2620\uFE0F";for(let n of Object.keys(t))if(t[n].some(o=>RegExp(`${o}`,"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(fA))if(fA[n].some(o=>RegExp(`(^|[^a-zA-Z])${o}([^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 gI(e){return fA[Kf(e)]?.[0]}function mp(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴☠️|🏳️🌈/g,"").trim()}var Rg=class{constructor({country,asn}={}){if(Q.env.isNode){let Reader=eval('require("@maxmind/geoip2-node")').Reader,fs=mo(),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 H2e=B(x());var zf=B(FI());var F2e=B(x());function bA(){return po(()=>vu("dgram"))}var x2e=B(x());function AA(){return po(()=>vu("net"))}var k2e=B(x());function SA(){return po(()=>vu("tls"))}var cl=B(oa());var BI=53,DY=853,vp=2;function _A({domain:e,type:t="A",edns:r}){let n=[];return r&&n.push({type:"OPT",name:".",udpPayloadSize:4096,flags:0,options:[{code:"CLIENT_SUBNET",ip:r,sourcePrefixLength:_r(r)?24:56,scopePrefixLength:0}]}),zf.default.encode({type:"query",id:0,flags:zf.default.RECURSION_DESIRED,questions:[{type:t,name:e}],additionals:n})}function CA(e){return e||8e3}function FY(e){return e?.replace(/^\[(.*)\]$/,"$1")}function BY(e){return _r(e)||Xt(e)}function IY(e,t=BI){if(!e)return t;let r=Number(e);if(!Number.isInteger(r)||r<1||r>65535)throw new Error("\u81EA\u5B9A\u4E49 DNS \u7AEF\u53E3\u53F7\u5E94\u4E3A 1-65535 \u7684\u6574\u6570");return r}function xY(e,t){if(e.username||e.password||e.pathname&&e.pathname!=="/"||e.search||e.hash)throw new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${t}`)}function $Y(e,t){try{let r=t?e:`udp://${Xt(e)?`[${e}]`:e}`,n=new URL(r);xY(n,e);let i=FY(n.hostname);if(!i)throw new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${e}`);return{protocol:t||"udp",host:i,port:IY(n.port,t==="tls"?DY:BI)}}catch(r){throw r?.message?.includes("\u81EA\u5B9A\u4E49 DNS")?r:new Error(`\u81EA\u5B9A\u4E49 DNS \u5730\u5740\u683C\u5F0F\u65E0\u6548: ${e}`)}}function PY(e){let t=`${e||""}`.trim();if(!t)throw new Error("\u81EA\u5B9A\u4E49 DNS \u4E0D\u80FD\u4E3A\u7A7A");if(/^https?:\/\//i.test(t))return{protocol:"doh",url:t};let r=t.match(/^([a-z][a-z\d+.-]*):\/\//i)?.[1],n=r?.toLowerCase();if(n&&!["udp","tcp","tls"].includes(n))throw new Error(`\u81EA\u5B9A\u4E49 DNS \u4E0D\u652F\u6301 ${r} \u534F\u8BAE`);return $Y(t,n)}async function DA({url:e,domain:t,type:r="A",timeout:n,edns:i,skipCertVerify:o}){let s=_A({domain:t,type:r,edns:i}),u=cl.Buffer.from(s).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),l=await Q.http.get({url:`${e}?dns=${encodeURIComponent(u)}`,headers:{Accept:"application/dns-message"},"binary-mode":!0,encoding:null,timeout:n,insecure:o===!0});return zf.default.decode(cl.Buffer.from(Q.env.isQX?l.bodyBytes:l.body))}async function kY({server:e,domain:t,type:r="A",timeout:n,edns:i}){let o=bA(),s=_A({domain:t,type:r,edns:i});return new Promise((a,u)=>{let l=!1,h=o.createSocket(Xt(e.host)?"udp6":"udp4"),m=setTimeout(()=>{d(new Error("DNS UDP query timeout"))},CA(n));function p(){clearTimeout(m),h.removeAllListeners();try{h.close()}catch{}}function d(v,g){l||(l=!0,p(),v?u(v):a(g))}h.on("error",v=>d(v)),h.on("message",v=>{try{d(null,zf.default.decode(v))}catch(g){d(g)}}),h.send(s,e.port,e.host,v=>{v&&d(v)})})}async function RY({server:e,domain:t,type:r="A",timeout:n,edns:i,skipCertVerify:o}){let s=e.protocol==="tls"?SA():AA(),a=e.protocol==="tls"?"TLS":"TCP",u=_A({domain:t,type:r,edns:i}),l=cl.Buffer.alloc(vp);l.writeUInt16BE(u.length,0);let h=cl.Buffer.concat([l,u]);return new Promise((m,p)=>{let d=!1,v=cl.Buffer.alloc(0),g,y=e.protocol==="tls"?s.connect({host:e.host,port:e.port,servername:BY(e.host)?void 0:e.host,rejectUnauthorized:o===!0?!1:void 0}):s.createConnection({host:e.host,port:e.port});function w(){y.removeAllListeners(),y.destroy()}function E(_,C){d||(d=!0,w(),_?p(_):m(C))}y.setTimeout(CA(n),()=>{E(new Error(`DNS ${a} query timeout`))}),y.on(e.protocol==="tls"?"secureConnect":"connect",()=>{y.write(h)}),y.on("error",_=>E(_)),y.on("end",()=>{E(new Error(`DNS ${a} connection ended before response`))}),y.on("data",_=>{try{if(v=cl.Buffer.concat([v,_]),g==null&&v.length>=vp&&(g=v.readUInt16BE(0)),g!=null&&v.length>=g+vp){let C=v.slice(vp,g+vp);E(null,zf.default.decode(C))}}catch(C){E(C)}})})}async function Ng({url:e,domain:t,type:r="A",timeout:n,edns:i,skipCertVerify:o}){let s=`${e||""}`.trim(),a=s.match(/^([a-z][a-z\d+.-]*):\/\//i)?.[1].toLowerCase(),u=["http","https"].includes(a);if(!Q.env.isLoon&&(["auto","system"].includes(s.toLowerCase())||["h3","quic"].includes(a)))throw new Error("auto/system \u548C DoH3/DoQ \u4EC5\u652F\u6301 Loon Build \u2265 988");if(Q.env.isLoon&&s&&(!a||["udp","h3","quic"].includes(a))){if(typeof $dns>"u"||typeof $dns?.query!="function")throw new Error("Loon DNS API \u9700\u8981 Loon Build \u2265 988");let h=s.replace(/^udp:\/\//i,""),m=await new Promise((p,d)=>{$dns.query({domain:t,...s.toLowerCase()==="auto"?{}:{server:h},timeout:CA(n)},(v,g)=>{v?d(Object.assign(new Error(v.message),v)):p(g)})});return{...m,answers:m.answers?.map(({value:p,...d})=>({...d,data:p}))}}if(s&&!Q.env.isNode&&!u&&(!a||["udp","tcp","tls"].includes(a)))throw new Error("DoT \u548C TCP DNS \u4EC5\u652F\u6301 Node.js; UDP DNS \u652F\u6301 Node.js \u6216 Loon Build \u2265 988");let l=PY(e);if(l.protocol==="doh")return DA({url:l.url,domain:t,type:r,timeout:n,edns:i,skipCertVerify:o});if(!Q.env.isNode)throw new Error("DoT \u548C TCP DNS \u4EC5\u652F\u6301 Node.js; UDP DNS \u652F\u6301 Node.js \u6216 Loon Build \u2265 988");return["tcp","tls"].includes(l.protocol)?RY({server:l,domain:t,type:r,timeout:n,edns:i,skipCertVerify:o}):kY({server:l,domain:t,type:r,timeout:n,edns:i})}var Wf=B(Va());var z2e=B(x());var II="2.44.31";var{isNode:xI,isQX:OY,isLoon:NY,isSurge:LY,isStash:UY,isShadowRocket:HY,isLanceX:MY,isEgern:qY,isGUIforCores:jY}=Qs(),Lo="Node";xI?Lo="Node":OY?Lo="QX":NY?Lo="Loon":UY?Lo="Stash":HY?Lo="Shadowrocket":qY?Lo="Egern":LY?Lo="Surge":MY?Lo="LanceX":jY&&(Lo="GUI.for.Cores");var ll={},KY={};try{if(typeof $environment<"u"&&(ll.env=$environment),typeof $loon<"u"&&(ll.loon=$loon),typeof $script<"u"&&(ll.script=$script),typeof $Plugin<"u"&&(ll.plugin=$Plugin),xI){ll.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)&&(ll.node.env[e]=env[e])}}catch(e){}var Lg={backend:Lo,version:II,feature:KY,meta:ll};var xA="Response Transformer";function $A(e){return e===xA}function yp(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function RI(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(Ge(r[n]))if(n.endsWith("!")){let i=yp(n.slice(0,-1));e[i]=r[n]}else{let i=yp(n);e[i]||Object.assign(e,{[i]:{}}),RI(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=yp(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=yp(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=yp(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function VY({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>Ug(e,r))}}function Ug(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=>Ug(r,t));case"OR":return e.child.some(r=>Ug(r,t));case"NOT":return!Ug(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function zY(e){return{name:"Quick Setting Operator",func:i=>{if(t(e.useless)){let a=MI().func(i);i=i.filter((u,l)=>a[l]&&u.port>0&&u.port<=65535)}let o=r(e.ecn,t(e.ecn));return i.map(s=>(s.udp=t(e.udp,s.udp),s.tfo=t(e.tfo,s.tfo),s["fast-open"]=t(e.tfo,s["fast-open"]),s["skip-cert-verify"]=t(e.scert,s["skip-cert-verify"]),s.type==="vmess"&&(s.aead=t(e["vmess aead"],s.aead)),["snell","anytls","trusttunnel"].includes(s.type)&&(s.reuse=t(e.reuse,s.reuse)),o!==void 0&&s.type!=="direct"&&s.type!=="external"&&(s.ecn=o),s["block-quic"]=r(e["block-quic"],s["block-quic"]),s["ip-version"]=n(e["ip-version"],s["ip-version"]),s))}};function t(i,o){switch(i){case"ENABLED":return!0;case"DISABLED":return!1;default:return o}}function r(i,o){switch(i){case"auto":case"on":case"off":return i;default:return o}}function n(i,o){switch(i){case void 0:case null:case"":case"DEFAULT":return o;default:return i}}}function GY({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=mp(n.name);else{let i=Kf(n.name);n.name=mp(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 WY(e){let{action:t,template:r,link:n,position:i,field:o}={action:"rename",template:"0 1 2 3 4 5 6 7 8 9",link:"-",position:"back",field:["name"],...e};return{name:"Handle Duplicate Operator",func:s=>{if(t==="delete"){let a={};return s.filter(u=>{let l=o.map(h=>Wf.default.get(u,h,"-")).join("_");return a[l]?!1:(a[l]=!0,!0)})}else if(t==="rename"){let a=r.split(" "),u={},l=0;s.forEach(m=>{let p=o.map(d=>Wf.default.get(m,d,"-")).join("_");typeof u[p]>"u"?u[p]=1:u[p]++,l=Math.max(u[p].toString().length,l)});let h={};return s.map(m=>{let p=o.map(d=>Wf.default.get(m,d,"-")).join("_");if(u[p]>1){typeof h[p]>"u"&&(h[p]=1);let d="",v=h[p]++,g=0;for(;v>0;)d=a[v%10]+d,v=parseInt(v/10),g++;for(;g++<l;)d=a[0]+d;i==="front"?m.name=d+n+m.name:i==="back"&&(m.name=m.name+n+d)}return m})}}}}function YY(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 bX(t);default:throw new Error("Unknown sort option: "+e)}}}}function XY(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=>{let i=r.map(s=>kA(s)),o=new Map;return n.sort((s,a)=>{let u=$I(i,s.name,o),l=$I(i,a.name,o);return u&&!l?-1:l&&!u?1:u&&l?u<l?-1:1:t==="original"?0:t==="desc"?s.name<a.name?1:-1:s.name<a.name?-1:1})}}}function $I(e,t,r){if(e.length===0)return null;let n=r.get(t);if(n!==void 0)return n;let i=null;for(let o=0;o<e.length;o++)if(e[o].test(t)){i=o+1;break}return typeof t=="string"&&r.set(t,i),i}function TI(e){return{name:"Regex Rename Operator",func:t=>t.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(kA(n,"g"),i).trim();return r})}}function ZY(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:TI(t).func}}function JY(e,t,r,n,i,o){return o.source=n,o.env=Lg,{name:"Script Operator",func:async s=>{let a=s;if(al(a?.$file))try{let u=ks.safeLoad(e),l;if(a?.$content)try{l=ks.safeLoad(a?.$content)}catch(h){Q.error(h.message??h)}if(typeof u!="object")throw new Error("patch is not an object");return a.$content=Lt.yaml.safeDump(RI(l||{},u)),a}catch{}return await(async function(){a=Yf("operator",e,r,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=s;return await(async function(){a=Yf("operator",`async function operator(input = [], targetPlatform, context) {
|
||
if (input && (input.$files || input.$content)) {
|
||
let { $content, $files, $options, $file } = input
|
||
if (['mihomoConfig', 'mihomoProfile'].includes($file?.type)) {
|
||
${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 || {}))
|
||
}
|
||
} 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)(s,t,o)})(),a}}}var OI="Add Proxies From Subscription Operator";function QY(e){if(!e)return{};let t=ks.safeLoad(e);return Ge(t)?t:{}}function eX(e){return Array.isArray(e?.proxies)?e.proxies:[]}function tX({sourceType:e="subscription",sourceName:t,includeUnsupportedProxy:r,position:n="replace"}={},i={}){let o=async s=>{if(!al(s?.$file))return s;let a=QY(s.$content),u=eX(a),l=await Ra({type:e,name:t,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0,"include-unsupported-proxy":r},noFlow:i.noFlow});switch(n){case"front":a.proxies=[...l,...u];break;case"back":a.proxies=[...u,...l];break;case"replace":default:a.proxies=l;break}return s.$content=Lt.yaml.safeDump(a),s};return{name:OI,func:o,nodeFunc:o}}function rX(e){let t,r;try{let n=e.split(":");r=parseInt(n[2],16);let i=parseInt(n[3],16),o=parseInt(n[4],16),s=i>>8,a=i&255,u=o>>8,l=o&255;if(t=`${s}.${a}.${u}.${l}`,r<=0||r>65535)throw new Error(`Invalid port number: ${r}`);if(!_r(t))throw new Error(`Invalid IP address: ${t}`)}catch(n){Q.error(`IP4P \u89E3\u6790\u5931\u8D25: ${n}`)}return{server:t,port:r}}var nX=10,sX=2,PI=20;function iX(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return nX;let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Error("\u57DF\u540D\u89E3\u6790\u5E76\u53D1\u6570\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return t}function NI(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return sX;let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Error("\u591A DNS \u5E76\u53D1\u6570\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return t}function oX(e,t){if(!(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")){let i=Number(e);if(!Number.isInteger(i)||i<1)throw new Error("DNS \u8D85\u65F6\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return i}if(typeof t>"u"||t===null||typeof t=="string"&&t.trim()==="")return 8e3;let n=Number(t);return!isFinite(n)||n<=0?8e3:n}function aX(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return;let t=Number(e);if(!Number.isInteger(t)||t<1)throw new Error("\u57DF\u540D\u89E3\u6790\u7F13\u5B58\u65F6\u957F\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return t*1e3}function PA(e){let t=`${e||""}`.split(/\r?\n/).map(r=>r.trim()).filter(r=>r);if(t.length===0)throw new Error("\u81EA\u5B9A\u4E49 DNS \u4E0D\u80FD\u4E3A\u7A7A");return t}function uX(e){return PA(e).join(`
|
||
`)}async function cX(e,t,r){let n=0,i=Math.min(t,e.length),o=Array.from({length:i},async()=>{for(;n<e.length;){let s=e[n];n+=1,await r(s)}});await Promise.all(o)}async function lX(e,t,r){return new Promise((n,i)=>{let o=0,s=0,a=0,u=!1,l=[],h=Math.min(t,e.length);function m(){!u&&a===e.length&&i(new Error(l.length>0?l.join("; "):"No answers"))}function p(){if(!u){for(;s<h&&o<e.length;){let d=e[o];o+=1,s+=1,Promise.resolve().then(()=>r(d)).then(v=>{s-=1,a+=1,!u&&(u=!0,n({result:v,resolverUrl:d}))}).catch(v=>{s-=1,a+=1,l.push(`${d}: ${v}`),p(),m()})}m()}}p()})}function IA(e,t,r,n,i){switch(e){case"Custom":return Ur(`CUSTOM:${i?"INSECURE:":""}${n}:${t}:${r}`);case"Google":return Ur(`GOOGLE:${t}:${r}`);case"IP-API":return Ur(`IP-API:${t}`);case"Cloudflare":return Ur(`CLOUDFLARE:${t}:${r}`);case"Ali":return Ur(`ALI:${t}:${r}`);case"Tencent":return Ur(`TENCENT:${t}:${r}`)}}function fX(e,t,r,n,i,o){if(n==="disabled")return null;let s=IA(e,t,r,i,o),a=s?Hr.get(s):null;return e==="Custom"?UI(a):a}function FA(e,t){if(e!=="Custom"||!t)return"";let r=`${t}`.split(/\r?\n/).map(n=>n.trim()).filter(n=>n);return r.length<=1?` via ${t}`:` via ${r.length} custom DNS`}function hX(e,t){if(e!=="Custom"||!t)return t||"";let r=`${t}`.split(/\r?\n/).map(n=>n.trim()).filter(n=>n);return r.length<=1?t:`${r.length} custom DNS`}function LI(e,t){return e&&typeof e=="object"&&Object.defineProperty(e,"_resolverUrl",{value:t,enumerable:!1,configurable:!0}),e}function dX(e,t){return{result:e,resolverUrl:t}}function UI(e){return e&&typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.result)?LI(e.result,e.resolverUrl):e}function kI(e){return e&&typeof e=="object"?e._resolverUrl:null}var Hg={Custom:async function(e,t,r,n,i,o,s,a,u){let l=PA(o),h=l.join(`
|
||
`),m=NI(a),p=Ur(`CUSTOM:${s?"INSECURE:":""}${h}:${e}:${t}`),d=UI(Hr.get(p));if(!r&&d)return d;let v=t==="IPv6"?"AAAA":"A",g=async E=>{let _=await Ng({url:E,domain:e,type:v,timeout:n,edns:i,skipCertVerify:s}),{answers:C}=_;if(!Array.isArray(C)||C.length===0)throw new Error("No answers");let F=C.filter(H=>H?.type===v).map(H=>H?.data).filter(H=>H);if(F.length===0)throw new Error("No answers");return F},{result:y,resolverUrl:w}=l.length===1?{result:await g(l[0]),resolverUrl:l[0]}:await lX(l,m,g);return Hr.set(p,dX(y,w),u),LI(y,w)},Google:async function(e,t,r,n,i,o,s,a,u){let l=Ur(`GOOGLE:${e}:${t}`),h=Hr.get(l);if(!r&&h)return h;let m=t==="IPv6"?"AAAA":"A",p=await Ng({url:"https://8.8.4.4/dns-query",domain:e,type:m,timeout:n,edns:i}),{answers:d}=p;if(!Array.isArray(d)||d.length===0)throw new Error("No answers");let v=d.filter(g=>g?.type===m).map(g=>g?.data).filter(g=>g);if(v.length===0)throw new Error("No answers");return Hr.set(l,v,u),v},"IP-API":async function(e,t,r,n,i,o,s,a,u){if(["IPv6"].includes(t))throw new Error(`\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9 IP-API \u4E0D\u652F\u6301 ${t}`);let l=Ur(`IP-API:${e}`),h=Hr.get(l);if(!r&&h)return h;let m=await Q.http.get({url:`http://ip-api.com/json/${encodeURIComponent(e)}?lang=zh-CN`,timeout:n}),p=JSON.parse(m.body);if(p.status!=="success")throw new Error(`Status is ${p.status}`);if(!p.query||p.query===0)throw new Error("No answers");let d=[p.query];if(d.length===0)throw new Error("No answers");return Hr.set(l,d,u),d},Cloudflare:async function(e,t,r,n,i,o,s,a,u){let l=Ur(`CLOUDFLARE:${e}:${t}`),h=Hr.get(l);if(!r&&h)return h;let m=t==="IPv6"?"AAAA":"A",p=await Ng({url:"https://1.0.0.1/dns-query",domain:e,type:m,timeout:n,edns:i}),{answers:d}=p;if(!Array.isArray(d)||d.length===0)throw new Error("No answers");let v=d.filter(g=>g?.type===m).map(g=>g?.data).filter(g=>g);if(v.length===0)throw new Error("No answers");return Hr.set(l,v,u),v},Ali:async function(e,t,r,n,i,o,s,a,u){let l=Ur(`ALI:${e}:${t}`),h=Hr.get(l);if(!r&&h)return h;let m=await Q.http.get({url:`http://223.6.6.6/resolve?edns_client_subnet=${i}/${_r(i)?24:56}&name=${encodeURIComponent(e)}&type=${t==="IPv6"?"AAAA":"A"}&short=1`,headers:{accept:"application/dns-json"},timeout:n}),p=JSON.parse(m.body);if(!Array.isArray(p)||p.length===0)throw new Error("No answers");let d=p;if(d.length===0)throw new Error("No answers");return Hr.set(l,d,u),d},Tencent:async function(e,t,r,n,i,o,s,a,u){let l=Ur(`TENCENT:${e}:${t}`),h=Hr.get(l);if(!r&&h)return h;let p=(await Q.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(v=>v.split(",")[0]);if(p.length===0||String(p)==="0")throw new Error("No answers");let d=p;if(d.length===0)throw new Error("No answers");return Hr.set(l,d,u),d}};function HI({provider:e,type:t,filter:r,cache:n,url:i,tlsSkipCertVerify:o,timeout:s,cacheTtl:a,edns:u,concurrency:l,dnsConcurrency:h}){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:m}=Q.read(pr)||{},p=oX(s,m),d=aX(a),v=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",g=Hg[e];if(!g)throw new Error(`\u627E\u4E0D\u5230\u57DF\u540D\u89E3\u6790\u670D\u52A1\u63D0\u4F9B\u65B9: ${e}`);let y=u||"223.6.6.6";if(!fl(y))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");let w=iX(l),E=e==="Custom"?uX(i):i,_=e==="Custom"?PA(E).length:1,C=e==="Custom"?NI(h):1,F=w*Math.min(C,_),H=e==="Custom"&&(o===!0||o==="enabled");return F>PI&&Q.warn(`\u57DF\u540D\u89E3\u6790\u603B\u5E76\u53D1\u6570\u4E0A\u9650 ${F} \u8D85\u8FC7\u5EFA\u8BAE\u503C ${PI}, \u53EF\u80FD\u5BFC\u81F4\u4EE3\u7406 App TCP \u8FDE\u63A5\u6570\u6FC0\u589E`),Q.info(`Domain Resolver: [${t}] ${e} ${y||""} ${hX(e,E)}${H?" tlsSkipCertVerify=enabled":""} concurrency=${w}${e==="Custom"?` dnsConcurrency=${C}`:""}`),{name:"Resolve Domain Operator",func:async K=>{K.forEach((L,R)=>{!L["_no-resolve"]&&L["no-resolve"]&&(K[R]["_no-resolve"]=L["no-resolve"])});let S={},I=[...new Map(K.filter(L=>!fl(L.server)&&!L["_no-resolve"]).map(L=>{let R=IA(e,L.server,v,E,H);return[R,{id:R,domain:L.server}]})).values()],q=[];return I.forEach(({id:L,domain:R})=>{let O=fX(e,R,v,n,E,H);if(O){S[L]=O;let T=e==="Custom"&&kI(O)||E;Q.info(`Using cached resolved domain: ${R}${FA(e,T)} \u279F ${O}`)}else q.push({id:L,domain:R})}),await cX(q,w,async({id:L,domain:R})=>{try{let O=await g(R,v,n==="disabled",p,y,E,H,C,d);S[L]=O;let T=e==="Custom"&&kI(O)||E;Q.info(`Successfully resolved domain: ${R}${FA(e,T)} \u279F ${O}`)}catch(O){Q.error(`Failed to resolve domain: ${R}${FA(e,E)} with resolver [${e}]: ${O}`)}}),K.forEach(L=>{if(!L["_no-resolve"]){let R=IA(e,L.server,v,E,H);if(R&&S[R]){L._resolved_ips=S[R];let O=Array.isArray(S[R])?S[R][Math.floor(Math.random()*S[R].length)]:S[R];if(v==="IPv6"&&Xt(O)){try{O=new mm.Address6(O).correctForm()}catch(T){Q.error(`Failed to parse IPv6 address: ${O}: ${T}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(O)){L._IP4P=O;let{server:T,port:N}=rX(O);T&&N?(L._domain=L.server,L.server=T,L.port=N,L.resolved=!0,L._IPv4=L.server,fl(L._IP)||(L._IP=L.server)):L.resolved||(L.resolved=!1)}else L._domain=L.server,L.server=O,L.resolved=!0,L[`_${v}`]=L.server,fl(L._IP)||(L._IP=L.server)}else L._domain=L.server,L.server=O,L.resolved=!0,L[`_${v}`]=L.server,fl(L._IP)||(L._IP=L.server)}else L.resolved||(L.resolved=!1)}}),K.filter(L=>r==="removeFailed"?fl(L.server)||L["_no-resolve"]||L.resolved:r==="IPOnly"?fl(L.server):r==="IPv4Only"?_r(L.server):r==="IPv6Only"?Xt(L.server):!0)}}}function fl(e){return _r(e)||Xt(e)}HI.resolver=Hg;function BA(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function MI(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!BA(t.cipher))return!1;if(t.password&&!BA(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&&!BA(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function pX(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(o=>{let s=Kf(o.name),a=t.some(u=>n[u]===s);return r?a:!a})}}function mX({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(o=>kA(o).test(n.name));return t?i:!i})}}function kA(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function gX(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 o=t.some(s=>i.type===s);return r?o:!o})}}function vX(e,t,r,n,i,o){return o.source=n,o.env=Lg,{name:"Script Filter",func:async s=>{let a=kg(s.length,!0);return await(async function(){a=Yf("filter",e,r,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=kg(s.length,!0);return await(async function(){a=Yf("filter",`async function filter(input = [], targetPlatform, context) {
|
||
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)(s,t,o)})(),a}}}function wX(e,t,r,n,i,o){return o.source=n,o.env=Lg,{name:xA,func:async s=>{let a=s;return await(async function(){a=Yf("transformFunction",e,r,i)(s,o)})(),a},shortcutFunc:async s=>{let a=s;return await(async function(){a=Yf("transformFunction",`async function transformFunction(res = {}, context) {
|
||
let $res = res
|
||
${e}
|
||
return $res
|
||
}`,r,i)(s,o)})(),a}}}var Ep={"Useless Filter":MI,"Region Filter":pX,"Regex Filter":mX,"Type Filter":gX,"Script Filter":vX,"Conditional Filter":VY,"Quick Setting Operator":zY,"Flag Operator":GY,"Sort Operator":YY,"Regex Sort Operator":XY,"Regex Rename Operator":TI,"Regex Delete Operator":ZY,"Script Operator":JY,[OI]:tX,[xA]:wX,"Handle Duplicate Operator":WY,"Resolve Domain Operator":HI};async function qI(e,t){let r=t;try{let n=await e.func(r);n&&(r=n)}catch(n){let i="",o=`${n.message??n}`;o.includes("$res is not defined")||(Q.error(`Cannot apply ${e.name}(function transformFunction)! Reason: ${n}`),i=`\u6267\u884C function transformFunction \u5931\u8D25 ${o}; `);try{let s=await e.shortcutFunc(r);s&&(r=s)}catch(s){Q.error(`Cannot apply ${e.name}(shortcut script)! Reason: ${s}`);let a="",u=`${s.message??s}`;throw i&&u===o?(a="",i=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u811A\u672C\u5931\u8D25 ${u}`,new Error(`\u54CD\u5E94\u4FEE\u6539 ${i}${a}`)}}return r}async function yX(e,t){let r=kg(t.length,!0);try{r=await e.func(t)}catch(n){let i="",o=`${n.message??n}`;o.includes("$server is not defined")?i="":(Q.error(`Cannot apply filter ${e.name}(function filter)! Reason: ${n}`),i=`\u6267\u884C function filter \u5931\u8D25 ${o}; `);try{r=await e.nodeFunc(t)}catch(s){Q.error(`Cannot apply filter ${e.name}(shortcut script)! Reason: ${s}`);let a="",u=`${s.message??s}`;throw i&&u===o?(a="",i=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u8FC7\u6EE4\u811A\u672C \u5931\u8D25 ${u}`,new Error(`\u811A\u672C\u8FC7\u6EE4 ${i}${a}`)}}return t.filter((n,i)=>r[i])}async function EX(e,t){let r=AX(t);try{let n=await e.func(r);n&&(r=n)}catch(n){let i="",o=`${n.message??n}`;o.includes("$server is not defined")||o.includes("$content is not defined")||o.includes("$files is not defined")||r?.$files||r?.$content?i="":(Q.error(`Cannot apply operator ${e.name}(function operator)! Reason: ${n}`),i=`\u6267\u884C function operator \u5931\u8D25 ${o}; `);try{let s=await e.nodeFunc(r);s&&(r=s)}catch(s){Q.error(`Cannot apply operator ${e.name}(shortcut script)! Reason: ${s}`);let a="",u=`${s.message??s}`;throw i&&u===o?(a="",i=`\u6267\u884C\u5931\u8D25 ${o}`):a=`\u6267\u884C\u5FEB\u6377\u811A\u672C \u5931\u8D25 ${u}`,new Error(`\u811A\u672C\u64CD\u4F5C ${i}${a}`)}}return r}async function jI(e,t){if(e.name.indexOf("Filter")!==-1)return yX(e,t);if(e.name.indexOf("Operator")!==-1)return EX(e,t)}function bX(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 AX(e){return JSON.parse(JSON.stringify(e))}function Yf(name,script,$arguments,$options){let flowUtils={getFlowField:Nc,getFlowHeaders:wm,parseFlowHeaders:wf,flowTransfer:Bd,validCheck:ym,getRmainingDays:Z8,normalizeFlowHeader:J8};return Q.env.isLoon?new Function("$arguments","$options","$substore","lodash","$persistentStore","$httpClient","$notification","ProxyUtils","yaml","Buffer","b64d","b64e","DOMAIN_RESOLVERS","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
|
||
return ${name}`)($arguments,$options,Q,Wf.default,$persistentStore,$httpClient,$notification,Lt,Lt.yaml,Lt.Buffer,Lt.Base64.decode,Lt.Base64.encode,Hg,lA,flowUtils,Ra,eval('typeof require !== "undefined"')?vu:void 0):new Function("$arguments","$options","$substore","lodash","ProxyUtils","yaml","Buffer","b64d","b64e","DOMAIN_RESOLVERS","scriptResourceCache","flowUtils","produceArtifact","require",`${script}
|
||
return ${name}`)($arguments,$options,Q,Wf.default,Lt,Lt.yaml,Lt.Buffer,Lt.Base64.decode,Lt.Base64.encode,Hg,lA,flowUtils,Ra,eval('typeof require !== "undefined"')?vu:void 0)}var Dye=B(x());var Rve=B(x()),s9=B(Va());var gve=B(x()),zI=B(Va());var We=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){le(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}};function le(e,t){let r=zI.default.get(e,t);return typeof r<"u"&&r!==null}function Mg(e){let{network:t,flow:r,encryption:n}=e,i=e["reality-opts"],o=!!(e.tls||i);return t==="ws"&&i?!1:t==="grpc"?o&&!r:r?qe(n)&&n.trim()!=="none"||o&&!["ws","xhttp"].includes(t):!0}function qg(e,t){return e.type!=="trusttunnel"||!le(e,"client-random-auth-key")||["surge","surgemac","json"].includes(t.toLowerCase())?!0:(Q.error(`Target platform ${t} does not support client-random-auth-key for TrustTunnel proxy ${e.name||`${e.server}:${e.port}`}. Proxy has been filtered.`),!1)}function Xf(e){let t=typeof e?.network=="string"?e.network.trim().toLowerCase():e?.network;return e?.type==="ss"&&e?.tls===!0&&!le(e,"plugin")&&(!le(e,"network")||t==="tcp")}function bp(e){if(typeof e=="boolean")return Number(e);if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true")return 1;if(t==="false")return 0;if(/^\d+$/.test(t))return parseInt(t,10)}return e}function GI(e){return!!bp(e)}function Zf(e,t){if(e?.type!=="ss"||e?.plugin!=="v2ray-plugin")return!0;let r=typeof e?.["plugin-opts"]?.mode=="string"?e["plugin-opts"].mode.trim().toLowerCase():e?.["plugin-opts"]?.mode;return t.includes(r)}function KI(e,t){if(e?.plugin!=="shadow-tls"||!e["plugin-opts"])return;let r=e["plugin-opts"],n=!!r.password||r.version!=null&&Number(r.version)!==0;return e["shadow-tls-opts"]={password:r.password,version:r.version},r.host!=null&&(e[t]=r.host),r.alpn!=null&&(e.alpn=r.alpn),delete e.plugin,delete e["plugin-opts"],n}function jg(e){if(["vmess","vless","trojan","anytls"].includes(e.type)&&KI(e,"sni")&&["vmess","vless"].includes(e.type)&&(e.tls=!0),e.type==="vless"&&e.network==="xhttp"){let t=e["xhttp-opts"]?.["download-settings"];KI(t,"servername")&&(t.tls=!0)}}function RA(e,t){if(e==null)return;let r=`${e}`.trim();if(!/^\d+$/.test(r))return;let n=parseInt(r,10);if(!(n<0||n>t))return n}function WI(e,t){if(e==null)return null;let r=`${e}`.trim();if(!r)return null;let[,n=r,i]=/^(.*?)(?:\/(\d+))?$/.exec(r)||[],o=`${n}`.trim().replace(/^\[/,"").replace(/\]$/,""),s=t==="ipv4";return(s?_r(o):Xt(o))?{address:o,cidr:RA(i,s?32:128)}:null}function VI(e,t){let{addressKey:r,cidrKey:n,family:i,defaultCIDR:o}=t,s=WI(e[r],i);if(!s){(e[r]==null||`${e[r]}`.trim().length===0)&&delete e[n];return}e[r]=s.address;let a=RA(e[n],o);e[n]=a??s.cidr??o}function Ap(e={}){return VI(e,{addressKey:"ip",cidrKey:"ip-cidr",family:"ipv4",defaultCIDR:32}),VI(e,{addressKey:"ipv6",cidrKey:"ipv6-cidr",family:"ipv6",defaultCIDR:128}),e}function bs(e={},t="ipv4"){let r=t==="ipv6"?{addressKey:"ipv6",cidrKey:"ipv6-cidr",defaultCIDR:128}:{addressKey:"ip",cidrKey:"ip-cidr",defaultCIDR:32},n=WI(e[r.addressKey],t);if(!n)return;let i=RA(e[r.cidrKey],r.defaultCIDR);return`${n.address}/${i??n.cidr??r.defaultCIDR}`}function Uo(e,t,r={}){return e=e.map(n=>{if(!Object.hasOwn(n,"ecn"))return n;let i={...n};return delete i.ecn,i}),t==="internal"?e:r.prettyYaml||r["pretty-yaml"]?xg(ks.safeDump({proxies:e},{lineWidth:-1})):`proxies:
|
||
`+e.map(n=>" - "+JSON.stringify(n)+`
|
||
`).join("")}var yve=B(x());var hl="_dns",TA="_force-query",OA="_sockopt",YI="https://dns.alidns.com/dns-query";function Kg(e){if(typeof e!="string")return;let t=/^([A-Za-z0-9+/]+|[A-Za-z0-9_-]+)(={0,2})$/.exec(e.trim());if(!t)return;let[,r,n]=t,i=(4-r.length%4)%4;if(!(i===3||n&&n.length!==i))return r.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat(i)}function XI(e){if(!qe(e))return;if(!e.includes("://"))return{type:"config",config:e};let t=e.split("+");if(t.length===1&&qe(t[0]))return{type:"dns",dns:t[0]};if(t.length===2&&qe(t[0])&&qe(t[1]))return{type:"dns",queryServerName:t[0],dns:t[1]}}function NA(e){return XI(e)!=null}function Vg(e){return["none","half","full"].includes(e)}function LA(e){return typeof e=="boolean"?e:typeof e=="number"&&Number.isInteger(e)&&e!==0}function zg({echConfigList:e,echForceQuery:t,echSockopt:r}={}){let n=XI(e);if(!n)return;let i={enable:!0};return n.type==="config"?i.config=n.config:(i[hl]=n.dns,n.queryServerName&&(i["query-server-name"]=n.queryServerName)),Vg(t)&&(i[TA]=t),Ge(r)&&(i[OA]=r),i}function UA(e,t,{dnsFieldPath:r="ech-opts._dns",warnDefaultDns:n}={}){let i={};if(Ge(e)){if(!LA(e.enable))return i;let o=e["query-server-name"];return qe(e.config)?i.echConfigList=e.config:qe(e[hl])?i.echConfigList=qe(o)?`${o}+${e[hl]}`:e[hl]:qe(o)&&(i.echConfigList=`${o}+${YI}`,n?.({defaultDns:YI,dnsFieldPath:r,queryServerName:o})),i.echConfigList&&Vg(e[TA])&&(i.echForceQuery=e[TA]),i.echConfigList&&Ge(e[OA])&&(i.echSockopt=e[OA]),i}return qe(t)&&(i.echConfigList=t),i}function HA(e,t,r){return UA(e,t,r).echConfigList}var _ve=B(x()),JI=B(Va());var bve=B(x());function MA(e,{allowZeroLowerBound:t=!0,allowZeroUpperBound:r=!0}={}){if(typeof e!="string"&&typeof e!="number")return;let n=h=>{let m=h.trim();if(!/^\+?\d+$/.test(m))return;let p=parseInt(m,10);return Number.isSafeInteger(p)?p:void 0},o=`${e}`.trim().split("-"),s=t?0:1,a=r?0:1;if(o.length===1){let h=n(o[0]),m=Math.max(s,a);return h>=m?{lowerBound:h,upperBound:h}:void 0}if(o.length!==2)return;let u=n(o[0]),l=n(o[1]);if(!(u==null||l==null))return u>=s&&l>=a&&l>=u?{lowerBound:u,upperBound:l}:void 0}function SX(e){return MA(e,{allowZeroUpperBound:!1})}function ZI(e){return MA(e,{allowZeroLowerBound:!1,allowZeroUpperBound:!1})}function Ho(e){let t=SX(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Jf(e){let t=ZI(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?`${n}`:`${r}-${n}`}function dl(e){let t=ZI(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Ls(e){let t=MA(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Xn(e,{allowNegative:t=!0}={}){if(typeof e=="number"&&Number.isFinite(e)&&Number.isSafeInteger(e))return!t&&e<0?void 0:e;if(typeof e!="string")return;let r=e.trim();if(!(t?/^[+-]?\d+$/:/^\+?\d+$/).test(r))return;let i=parseInt(r,10);if(Number.isSafeInteger(i)&&!(!t&&i<0))return i}var Qf={path:"path",host:"host",mode:"mode","padding-bytes":"x-padding-bytes","padding-obfs":"x-padding-obfs-mode","padding-key":"x-padding-key","padding-header":"x-padding-header","padding-placement":"x-padding-placement","padding-method":"x-padding-method","uplink-method":"uplink-http-method","session-placement":"session-placement","session-key":"session-key","session-table":"session-table","session-length":"session-length","seq-placement":"seq-placement","seq-key":"seq-key","uplink-data-placement":"uplink-data-placement","uplink-data-key":"uplink-data-key","uplink-chunk-size":"uplink-chunk-size","no-grpc-header":"no-grpc-header","max-each-post-bytes":"sc-max-each-post-bytes","min-posts-interval":"sc-min-posts-interval-ms","xmux-max-concurrency":"reuse-settings.max-concurrency","xmux-max-connections":"reuse-settings.max-connections","xmux-max-reuse-times":"reuse-settings.c-max-reuse-times","xmux-max-request-times":"reuse-settings.h-max-request-times","xmux-max-reusable-secs":"reuse-settings.h-max-reusable-secs","xmux-keep-alive":"reuse-settings.h-keep-alive-period"};function QI(e,t,r){if(!Object.prototype.hasOwnProperty.call(Qf,t))return;let n=Qf[t],i=r;switch(t){case"padding-obfs":case"no-grpc-header":if(r!=="true"&&r!=="false")return;i=r==="true";break;case"uplink-chunk-size":i=Ls(r)??r;break;case"max-each-post-bytes":i=dl(r)??r;break;case"min-posts-interval":i=Ho(r)??r;break;case"xmux-keep-alive":i=Xn(r)??r;break}JI.default.set(e,n,i)}var Dve=B(x()),Gg="auto",_X=[Gg,"none","zero","aes-128-gcm","chacha20-poly1305"],CX=[Gg,"aes-128-gcm","chacha20-poly1305","none"],DX=["none","chacha20-poly1305"],FX={"chacha20-ietf-poly1305":"chacha20-poly1305"};function e9(e){return e==null?"":`${e}`.trim().toLowerCase()}function qA(e){return FX[e]||e}function jr(e,t=_X,{acceptAliases:r=!0,fallback:n=Gg}={}){let i=e9(e);if(!i)return n;let o=t.map(e9);if(o.includes(i))return qA(i);let s=qA(i),a=o.map(qA);return r&&a.includes(s)?s:n}function Sp(e){return jr(e,CX)}function t9(e){return jr(e,DX,{fallback:"chacha20-poly1305"})}function r9(e){let t=Sp(e);return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}function n9(e){let t=jr(e,["aes-128-gcm","chacha20-poly1305"]);if(t!==Gg)return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}var Wg="Surge",eh=class extends Error{constructor(t){super(t),this.name="SurgeUnsupportedProxyError"}};function Rn(e){return new eh(e)}var BX={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function Mo(e){if(typeof e!="string")return e;let t=e.trim(),r=t[0];return(r==='"'||r==="'")&&t[t.length-1]===r?t.slice(1,-1):t}function Vi(e){return`"${String(Mo(e))}"`}function pl(e){return e!=null&&`${e}`.trim().length>0}function fn(e,t){let r=t.type==="direct",n=!["wireguard","wireguard-surge"].includes(t.type),i=t["ip-version"],o=Mo(t.tos);if(o!=null&&(!/^(?:\d+|0x[\da-f]+)$/i.test(o)||Number(o)>255))throw new Error("Surge tos must be an integer between 0 and 255");let s={"ip-version":BX[i]??i,"no-error-alert":r?void 0:t["no-error-alert"],tfo:t.tfo??t["fast-open"],"test-url":t["test-url"],"test-timeout":t["test-timeout"],"test-udp":t["test-udp"],hybrid:t.hybrid,tos:o,"allow-other-interface":n?t["allow-other-interface"]:void 0,interface:n?t.interface??t["interface-name"]:void 0,"dns-follow-interface":n?t["dns-follow-interface"]:void 0,"block-quic":t["block-quic"],ecn:r?void 0:t.ecn,"underlying-proxy":r?void 0:t["underlying-proxy"]};for(let[a,u]of Object.entries(s)){if(u==null)continue;let l=typeof u=="string"&&u.includes(",")?Vi(u):u;e.append(`,${a}=${l}`)}}function jA(e,t){if(pl(t.ports)){if(pl(Mo(t["underlying-proxy"])))throw new Error("Surge port-hopping cannot be combined with underlying-proxy");e.append(`,port-hopping="${String(t.ports).replace(/,/g,";")}"`)}pl(t["hop-interval"])&&e.append(`,port-hopping-interval=${t["hop-interval"]}`)}function i9(e){return(Array.isArray(e)?e:Mo(`${e||""}`).split(",")).filter(r=>r!=null).map(r=>String(Mo(r)).trim()).filter(r=>r!=="").join(",")}function o9(e,t){let r=i9(t.alpn);r&&e.append(`,alpn="${r}"`)}function a9(e,t){if(t.network==="h3"||["tuic","hysteria2","masque-surge"].includes(t.type))return;let r=t._surge_client_fingerprint??t["client-fingerprint"];if(typeof r!="string")return;let n=r.trim().toLowerCase();if(!["auto","none","apple-26","chromium-155"].includes(n)){let i=n.replace(/^hello/,"").split(/[-_]/,1)[0].replace(/([a-z])\d+$/,"$1");if(["chrome","edge","android","360","qq"].includes(i))n="chromium-155";else if(["safari","ios"].includes(i))n="apple-26";else if(["firefox","golang","random","randomized","randomizedalpn","randomizednoalpn"].includes(i))n="auto";else return}e.append(`,client-fingerprint=${n}`)}function IX(e){return i9(e?.["plugin-opts"]?.alpn??e?.alpn)}function za(e,t,r=!1){if(t.plugin!=="shadow-tls"||!t["plugin-opts"])return;let n=t["plugin-opts"].password,i=t["plugin-opts"].host,o=t["plugin-opts"].version;if(!n)return;if(e.append(`,shadow-tls-password="${n}"`),i&&e.append(`,shadow-tls-sni=${i}`),o){if(o<2)throw Rn(`shadow-tls version ${o} is not supported`);e.append(`,shadow-tls-version=${o}`)}let s=IX(t);s&&e.append(`,alpn="${s}"`),r&&e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function zi(e,t,r=!0){if(!r)return;e.appendIfPresent(`,server-cert-fingerprint-sha256=${t["tls-fingerprint"]}`,"tls-fingerprint"),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),e.appendIfPresent(`,server-cert-verify-name=${Vi(t["name-cert-verify"])}`,"name-cert-verify"),t.plugin!=="shadow-tls"&&o9(e,t),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify");let n=le(t,"keystore-client-cert")?t["keystore-client-cert"]:t["client-cert"];(le(t,"keystore-client-cert")||le(t,"client-cert"))&&e.append(`,client-cert=${Vi(n)}`),a9(e,t);let i=Ge(t["ech-opts"])?t["ech-opts"]:void 0;if((i?LA(i.enable):qe(t._echConfigList))&&!t["reality-opts"]){let s=Kg(i?i.config:t._echConfigList);if(!s)throw Rn("Surge ECH requires an inline ECHConfigList in base64 or base64url");e.append(`,ech-config=${s}`)}}function xX(e,t){let r=le(t,"keystore-private-key")?t["keystore-private-key"]:t["private-key"];(le(t,"keystore-private-key")||le(t,"private-key"))&&e.append(`,private-key=${Vi(r)}`)}function u9(e){if(!le(e,"max-streams"))return;let t=Number(Mo(e["max-streams"]));!Number.isInteger(t)||t<=3||Q.warn(`Surge ${e.type} proxy ${e.name}: max-streams=${t} is greater than 3. Too many streams sharing one TCP connection may hurt performance.`)}function $X(e){return le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path")}function PX(e){return Number(e.version)===6&&$X(e)}function th(){return{produce:(t,r,n={})=>{if(t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"]&&!["vmess","trojan","vless"].includes(t.type))throw Rn(`Platform ${Wg} does not support network ${t.network} with http upgrade`);switch(t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return kX(t);case"trojan":return RX(t);case"vmess":case"vless":return UX(t,n["include-unsupported-proxy"]);case"http":return jX(t);case"h2-connect":return LX(t);case"direct":return KX(t);case"socks5":return VX(t);case"snell":return GX(t);case"tuic":return WX(t);case"wireguard-surge":return c9(t);case"hysteria2":return XX(t);case"ssh":return qX(t);case"trusttunnel":return OX(t);case"masque-surge":return NX(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return YX(t);if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw Rn(`Platform ${Wg} does not support proxy type ${t.type} with network or REALITY`);return TX(t)}throw Rn(`Platform ${Wg} does not support proxy type: ${t.type}`)}}}function kX(e){let t=new We(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 Rn(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password"),le(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 Rn(`plugin ${e.plugin} is not supported`)}return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),za(t,e,!0),fn(t,e),t.toString()}function RX(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),zA(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),zi(t,e),za(t,e),fn(t,e),t.toString()}function TX(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),zi(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),fn(t,e),t.toString()}function OX(e){let t=new We(e);if(t.append(`${e.name}=trust-tunnel,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),le(e,"client-random-auth-key")){let r=Mo(e["client-random-auth-key"]);if(typeof r!="string"||!/^[0-9a-f]+$/i.test(r))throw new Error("TrustTunnel client-random-auth-key must be a hex string");t.append(`,client-random-auth-key=${r}`)}return KA(t,e),u9(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),e.network==="h3"&&t.append(",h3=true"),zi(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),fn(t,e),t.toString()}function NX(e){let t=new We(e);return t.append(`${e.name}=masque,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),jA(t,e),zi(t,e),fn(t,e),t.toString()}function LX(e){let t=new We(e);return t.append(`${e.name}=h2-connect,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),KA(t,e),u9(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),zi(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),za(t,e),fn(t,e),t.toString()}function UX(e,t){let r=e.type==="vless",n=new We(e);if(n.append(`${e.name}=${e.type},${e.server},${e.port}`),n.appendIfPresent(`,username=${e.uuid}`,"uuid"),!r){let i=n9(e.cipher);i&&n.append(`,encrypt-method=${i}`)}if(r)HX(n,e);else{zA(n,e,t);let i=le(e,"aead")?e.aead:e.alterId===0;n.append(`,vmess-aead=${i}`),n.appendIfPresent(`,tls=${e.tls}`,"tls"),zi(n,e,!!e.tls)}return za(n,e),fn(n,e),n.toString()}function HX(e,t){let r=t.network??"tcp",n=t["reality-opts"],i=t.tls||n;if(!["tcp","raw","none","ws","grpc","xhttp"].includes(r))throw Rn(`VLESS network ${r} is unsupported`);if(t.encryption&&/[,\r\n"']/.test(t.encryption))throw Rn("VLESS encryption contains unsupported characters");if(!Mg(t))throw Rn("Unsupported VLESS transport, TLS or flow combination");if(r==="ws")zA(e,t);else if(r==="grpc"){e.append(",grpc=true");let o=t["grpc-opts"];for(let[s,a]of[["grpc-service-name",o?.["grpc-service-name"]],["grpc-mode",o?.["_grpc-type"]],["grpc-authority",o?.["_grpc-authority"]]])a&&e.append(`,${s}=${a}`)}else r==="xhttp"&&MX(e,t);t.flow&&e.append(`,flow=${t.flow}`),t.encryption&&e.append(`,encryption=${t.encryption}`),n?(e.append(`,reality-public-key=${n["public-key"]}`),n["short-id"]&&e.append(`,reality-short-id=${n["short-id"]}`),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),o9(e,t),a9(e,t)):(e.appendIfPresent(`,tls=${t.tls}`,"tls"),zi(e,t,!!i))}function MX(e,t){let r=t["xhttp-opts"];if(r?.["download-settings"])throw Rn("VLESS XHTTP download-settings are unsupported");e.append(",xhttp=true");let n=Ge(r?.headers)?Object.entries(r.headers):[],i=r?.host??n.find(([a])=>/^host$/i.test(a))?.[1];for(let[a,u]of Object.entries(Qf)){let l=a==="host"?i:s9.default.get(r,u);if(l==null)continue;let h=String(l),m=Mo(h);if(!m&&a!=="session-table")continue;if(/[\r\n]/.test(h)||m.includes('"'))throw Rn(`VLESS xhttp-${a} contains unsupported characters`);let p=!m||/[,'\s]/.test(m)?Vi(m):m;e.append(`,xhttp-${a}=${p}`)}let o=n.filter(([a])=>!/^host$/i.test(a));if(o.some(([a,u])=>/[,="':|\r\n]/.test(a)||/[\r\n]/.test(String(u))))throw Rn("VLESS xhttp-headers contain unsupported characters");let s=VA(Object.fromEntries(o),"|");s&&e.append(`,xhttp-headers=${Vi(s)}`)}function qX(e){let t=new We(e);return t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),xX(t,e),t.appendIfPresent(`,idle-timeout=${e["idle-timeout"]}`,"idle-timeout"),t.appendIfPresent(`,server-fingerprint="${e["server-fingerprint"]}"`,"server-fingerprint"),fn(t,e),t.toString()}function jX(e){let t=new We(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),KA(t,e),zi(t,e,!!e.tls),za(t,e),fn(t,e),t.toString()}function KX(e){let t=new We(e);return t.append(`${e.name}=direct`),fn(t,e),t.toString()}function VX(e){let t=new We(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),zi(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),za(t,e),fn(t,e),t.toString()}function KA(e,t){let r=zX(t.headers);qe(r)&&e.append(`,headers=${Vi(r)}`)}function zX(e){return VA(e,";")}function VA(e,t){return!e||typeof e!="object"?"":Object.entries(e).filter(([r,n])=>qe(r)&&n!=null).map(([r,n])=>`${r}:${Vi(n)}`).join(t)}function GX(e){if(PX(e))return Q.error(`Platform ${Wg} does not support Snell version ${e.version} with obfs`),"";let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk="${e.psk}"`,"psk"),Number(e.version)===6&&t.appendIfPresent(`,mode=${e.mode}`,"mode"),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"),za(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),fn(t,e),t.toString()}function WX(e){let t=new We(e),r=e.type;return(!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"),jA(t,e),zi(t,e),za(t,e),fn(t,e),t.toString()}function YX(e){let t=Array.isArray(e.peers)&&e.peers.length>0?e.peers:[e],{ip:r,ipv6:n}=Ap({ip:e["self-ip"]??e.ip??t[0].ip,ipv6:e["self-ip-v6"]??e.ipv6??t[0].ipv6}),i=qe(e["private-key-keystore-name"])?"private-key-keystore-name":"private-key",o=e[i];if(!pl(o)||!r&&!n)throw new Error("Surge WireGuard requires a local address and either private-key or private-key-keystore-name");let s=e["listen-port"];if(s!=null&&(!/^\d+$/.test(`${s}`.trim())||s<1||s>65535))throw new Error("Surge WireGuard listen-port must be between 1 and 65535");let a=vt(e["section-name"],e.name).trim(),u=c9({...e,"section-name":a,"underlying-proxy":s==null?e["underlying-proxy"]:void 0}),l=new We(e);l.append(`# > WireGuard Proxy ${e.name}
|
||
# ${u}
|
||
# > WireGuard Section ${e.name}
|
||
[WireGuard ${a}]
|
||
${i} = ${o}`),r&&l.append(`
|
||
self-ip = ${r}`),n&&l.append(`
|
||
self-ip-v6 = ${n}`);let h=e["dns-server"]??e.dns,m=Array.isArray(h)?h.join(", "):h;qe(m)&&l.append(`
|
||
dns-server = ${m}`),l.appendIfPresent(`
|
||
mtu = ${e.mtu}`,"mtu"),le(e,"prefer-ipv6")?l.append(`
|
||
prefer-ipv6 = ${e["prefer-ipv6"]}`):["ipv6-prefer","prefer-v6"].includes(e["ip-version"])&&l.append(`
|
||
prefer-ipv6 = true`);let p=e["allow-peer-access"]??e["accept-incoming"];s==null&&p!=null&&l.append(`
|
||
allow-peer-access = ${p}`),l.appendIfPresent(`
|
||
listen-port = ${s}`,"listen-port");let d=t.length===1?e:{},v=t.length===1&&s==null&&(p==null||/^false$/i.test(`${p}`.trim()))?[r&&"0.0.0.0/0",n&&"::/0"].filter(Boolean).join(","):void 0;for(let g of t){let y=g["allowed-ips"]??d["allowed-ips"],w=Mo(Array.isArray(y)?y.join(","):y)||v;if(!pl(g["public-key"])||!w)throw new Error("Surge WireGuard peers require public-key and allowed-ips");let E=g.endpoint;if(!qe(E)&&qe(g.server)&&pl(g.port)){let H=g.server.trim();E=`${Xt(H)?`[${H}]`:H}:${g.port}`}if(!qe(E)&&s==null)throw new Error("Surge WireGuard peers require endpoint without listen-port");let _=Mo(g["client-id"]??g.reserved);Array.isArray(_)?_=_.join("/"):/^[\da-f]{6}$/i.test(_)&&(_=`0x${_}`);let C={"public-key":g["public-key"],"allowed-ips":Vi(w),endpoint:E,keepalive:g["persistent-keepalive"]??g.keepalive??g["persistent-keepalive-interval"]??e["persistent-keepalive"]??e.keepalive,"client-id":_,"preshared-key":g["preshared-key"]??g["pre-shared-key"]??d["preshared-key"]??d["pre-shared-key"]},F=Object.entries(C).filter(([,H])=>pl(H)).map(([H,K])=>`${H} = ${K}`).join(", ");l.append(`
|
||
peer = (${F})`)}return l.toString()}function c9(e){let t=vt(e["section-name"])?.trim();if(!t)throw new Error("Surge WireGuard requires section-name");let r=t.includes(",")?Vi(t):t,n=new We(e);return n.append(`${e.name}=wireguard,section-name=${r}`),fn(n,e),n.toString()}function XX(e){let t={salamander:"salamander-password",gecko:"gecko-password"}[e.obfs];if(e["obfs-password"]&&!t)throw Rn("only salamander and gecko obfs are supported");let r=new We(e);return r.append(`${e.name}=hysteria2,${e.server},${e.port}`),r.appendIfPresent(`,password="${e.password}"`,"password"),jA(r,e),e["obfs-password"]&&t&&r.append(`,${t}="${e["obfs-password"]}"`),zi(r,e),za(r,e),r.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),fn(r,e),r.toString()}function zA(e,t,r){if(le(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),le(t,"ws-opts")&&(t["ws-opts"]["v2ray-http-upgrade"]&&e.append(",ws-http-upgrade=true"),e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),le(t,"ws-opts.headers"))){let n=t["ws-opts"].headers,i=VA(n,"|");qe(i)&&e.append(`,ws-headers=${Vi(i)}`)}}else if(r&&["http"].includes(t.network))Q.info(`Include Unsupported Proxy: network ${t.network} -> tcp`);else{if(["tcp"].includes(t.network)&&t["reality-opts"])throw Rn("reality is unsupported");if(!["tcp"].includes(t.network))throw Rn(`network ${t.network} is unsupported`)}}var Jve=B(x());var Kve=B(x()),d9=B(oa());var Ove=B(x());function GA(e){try{return decodeURIComponent(`${e}`.replace(/\+/g,"%20"))}catch{return e}}function Yg(e){let t=e.indexOf("=");return t===-1?{key:GA(e),value:""}:{key:GA(e.slice(0,t)),value:GA(e.slice(t+1))}}function li(e){if(!/^\d+$/.test(`${e}`))return null;let t=parseInt(`${e}`,10);return Number.isSafeInteger(t)?t:null}function As(e,t){let r=e==null?"":`${e}`,n=r.indexOf("?");if(n===-1)return{path:r,value:""};let i=r.slice(0,n),o=r.slice(n+1),s=[],a="";for(let u of o.split("&")){if(u==="")continue;let l=Yg(u);if(l.key===t){a===""&&l.value!==""&&(a=l.value);continue}s.push(u)}return{path:s.length>0?`${i}?${s.join("&")}`:i,value:a}}function ml(e,t){let r=e==null?"":`${e}`,n=r.indexOf("?");if(n===-1)return"";let i=r.slice(n+1);for(let o of i.split("&")){if(o==="")continue;let s=Yg(o);if(s.key===t&&s.value!=="")return s.value}return""}function WA(e,t){let r=ml(e,t),n=li(r);return n==null?{value:"",parsed:null}:{value:r,parsed:n}}function ZX(e,t,r){let n=e.includes("?")?e.endsWith("?")||e.endsWith("&")?"":"&":"?";return`${e}${n}${encodeURIComponent(t)}=${encodeURIComponent(`${r}`)}`}function YA(e,t,r){let n=e==null||e===""?"/":`${e}`,{path:i}=As(n,t);return ZX(i,t,r)}function Qu(e){let t=e?.path;if(!e)return;let{value:r,parsed:n}=WA(t,"ed");if(e["v2ray-http-upgrade"]){r!==""&&(e.path=As(t,"ed").path,e["v2ray-http-upgrade-fast-open"]=!0,(e["_v2ray-http-upgrade-ed"]==null||`${e["_v2ray-http-upgrade-ed"]}`=="")&&(e["_v2ray-http-upgrade-ed"]=r)),delete e["early-data-header-name"],delete e["max-early-data"];return}r!==""&&(e.path=As(t,"ed").path,e["early-data-header-name"]==null&&(e["early-data-header-name"]="Sec-WebSocket-Protocol"),e["max-early-data"]==null&&(e["max-early-data"]=n))}function ec(e){e&&delete e["_v2ray-http-upgrade-ed"]}var JX={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function l9(e,t,r){if(!Ge(t)||!qe(t[hl]))return;let n=qe(t["query-server-name"])?t["query-server-name"]:"\u8FD9\u91CC\u662F query-server-name";Q.warn(`mihomo \u4E0D\u652F\u6301\u5728 ech-opts \u4E2D\u914D\u7F6E ECH DNS. \u5982\u9700\u8DDF\u8282\u70B9 ECH \u914D\u7F6E\u4E00\u81F4, \u8BF7\u5728 mihomo \u914D\u7F6E\u6587\u4EF6\u91CC\u8BBE\u7F6E dns["nameserver-policy"]["${n}"] = ["${t[hl]}"].`)}function QX(e,t){t!=="internal"&&(l9(e,e["ech-opts"],"ech-opts"),l9(e,e["xhttp-opts"]?.["download-settings"]?.["ech-opts"],"xhttp-opts.download-settings.ech-opts"))}function Us(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>{if(!qg(s,"Mihomo"))return!1;if(i["include-unsupported-proxy"])return!0;if(s.type==="h2-connect")return Q.error(`mihomo does not support HTTP/2 CONNECT proxy type. Proxy ${s.name} has been filtered.`),!1;if(s.type==="masque-surge")return Q.error(`mihomo does not support Surge MASQUE proxy type. Proxy ${s.name} has been filtered.`),!1;if(eZ(s)&&s.type==="trusttunnel")return Q.error(`mihomo does not support headers for TrustTunnel proxy ${s.name}. Proxy has been filtered.`),!1;if(Zf(s,["websocket"])){if(s.type==="snell"&&!tZ(s))return!1;if(f9(s)&&(!["ss","snell","vmess","vless","trojan","anytls"].includes(s.type)||!XA(h9(s),["ss","snell"].includes(s.type)?[1,2,3]:[0,1,2,3])))return!1;if(s.type==="vless"&&s.network==="xhttp"&&f9(s["xhttp-opts"]?.["download-settings"])&&!XA(h9(s["xhttp-opts"]["download-settings"]),[0,1,2,3]))return!1;if(rZ(s))return Q.error(`Platform Mihomo does not support Snell shadow-tls with obfs for proxy ${s.name}. Proxy has been filtered.`),!1;if(["juicity","naive"].includes(s.type))return!1;if(["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))return!1;if(["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"]))return!1;if(!["vless"].includes(s.type)&&["xhttp"].includes(s.network))return!1}else return!1;return!0}).map(s=>{if(QX(s,n),jg(s),s["reality-opts"]&&!s["client-fingerprint"]&&(s["client-fingerprint"]="chrome"),s.type==="vmess")le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=jr(s.cipher);else if(s.type==="tuic")le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!le(s,"version")&&(s.version=5);else if(s.type==="hysteria")le(s,"auth_str")&&!le(s,"auth-str")&&(s["auth-str"]=s.auth_str),le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo);else if(s.type==="wireguard")s.keepalive=s.keepalive??s["persistent-keepalive"],s["persistent-keepalive"]=s.keepalive,s["preshared-key"]=s["preshared-key"]??s["pre-shared-key"],s["pre-shared-key"]=s["preshared-key"],s.ip=bs(s,"ipv4"),s.ipv6=bs(s,"ipv6");else if(s.type==="vless"){if(le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.network==="xhttp"&&s["xhttp-opts"]?.["download-settings"]){let a=s["xhttp-opts"]["download-settings"];s.tls&&a.tls&&s["reality-opts"]&&!a["reality-opts"]&&(a["reality-opts"]={"public-key":""})}}else["anytls"].includes(s.type)&&s.reuse!=null&&!s.reuse&&(s["disable-reuse"]=!0,delete s.reuse);if(le(s,"plugin-opts.mux")&&(s["plugin-opts"].mux=GI(s["plugin-opts"].mux)),s.type==="snell"){let a=Number(s.version??1);s.version!=null&&Number.isInteger(a)&&(s.version=a),a<3&&delete s.udp,a<6&&delete s.mode;let u=ZA(s);u&&(s["obfs-opts"]={...u,mode:"shadow-tls"},delete s.plugin,delete s["plugin-opts"])}if(["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),Qu(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive","masque","shadowquic"].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"],le(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"],delete s["ip-cidr"],delete s["ipv6-cidr"],n!=="internal"||i["delete-underscore-fields"]){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];ec(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s["ip-version"]&&(s["ip-version"]=JX[s["ip-version"]]||s["ip-version"]),s});return Uo(o,n,i)}}}function eZ(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function XA(e,t){if(e==null)return!0;let r=typeof e=="string"?e.trim():`${e}`;if(!r)return!1;let n=Number(r);return Number.isInteger(n)&&t.includes(n)}function tZ(e){if(!XA(e.version,[0,1,2,3,4,5,6]))return!1;let t=Number(e.version)===6,{psk:r,mode:n,"obfs-opts":i}=e,o=["","shadow-tls","restls","jls"];t||o.push("http","tls");let s;if(typeof r!="string"&&!Number.isFinite(r))s="missing or invalid PSK";else if(i!=null&&!Ge(i))s="obfs-opts must be a mapping";else if(!o.includes(i?.mode??""))s="unsupported obfs-opts.mode";else if(t){let a=d9.Buffer.byteLength(String(r),"utf8");a<12||a>255?s="PSK must be 12 to 255 UTF-8 bytes":["","default","unshaped","unsafe-raw"].includes(n??"")||(s="unsupported mode")}return s?(Q.error(`Mihomo Snell proxy ${e.name} has been filtered. ${s}.`),!1):!0}function f9(e){return!!ZA(e)}function rZ(e){return e?.type==="snell"&&e?.plugin==="shadow-tls"&&(le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path"))}function h9(e){return ZA(e)?.version}function ZA(e){if(e?.plugin==="shadow-tls"&&e?.["plugin-opts"])return e["plugin-opts"];if(e?.type==="snell"&&e?.["obfs-opts"]?.mode==="shadow-tls")return e["obfs-opts"]}var m9="SurgeMac",g9=th();function _p(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return v9(t);default:{if(n.mihomoExternal||t._mihomoExternal)return p9(t,r,n)||"";try{return g9.produce(t,r,n)}catch(i){if(n.useMihomoExternal&&i instanceof eh){let o=p9(t,r,n)||"";if(!o)throw i;return Q.log(`${t.name} is not supported on ${m9}, try to use mihomo(SurgeMac - External Proxy Program) instead`),o}throw i instanceof eh?new Error(`${i.message}. 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`):i}}}}}}function v9(e){let t=new We(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(`,udp-relay=${e.udp}`,"udp"),fn(t,e),t.toString()}function p9(e,t,r){let n=Us().produce([e],"internal")?.[0];if(n){let i=r?.localPort||e._localPort||65535,o=!["ipv4","v4-only"].includes(e["ip-version"]),s={enable:!0,ipv6:o,"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"]},a=r?.merge||e._merge,u;if(a){let l={name:e.name,type:"socks5",server:"127.0.0.1",port:i,udp:!0};u=g9.produce(l,"socks5",r),r._merged=r._merged||{name:r?.mergeName||e._mergeName||"mihomo merged",exec:r?.exec||e._exec||"/usr/local/bin/mihomo",config:{ipv6:o,mode:"global",dns:s,proxies:[],"proxy-groups":[{name:"GLOBAL",type:"fallback",proxies:[]}],listeners:[]}};let h=`${i}`;r._merged.config.listeners.push({name:`socks5-${i}`,type:"socks",port:i,listen:"127.0.0.1",udp:!0,proxy:h}),r._merged.config["proxy-groups"][0].proxies.push(h),r._merged.config.proxies.push({...n,name:h});let m=r?.config||e._config;m&&(r._merged.configOverride={...r._merged.configOverride||{},...m})}else{let l={name:e.name,type:"external",udp:!0,exec:r?.exec||e._exec||"/usr/local/bin/mihomo","local-port":i,args:["-config",bt.encode(JSON.stringify({"mixed-port":i,ipv6:o,mode:"global",dns:s,proxies:[{...n,name:"proxy"}],"proxy-groups":[{name:"GLOBAL",type:"select",proxies:["proxy"]}],...r?.config||e._config||{}}))],addresses:[]};nZ(e.server)?l.addresses.push(e.server):Q.warn(`Platform ${m9}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),u=v9(l)}return r.localPort=i-1,u}}function nZ(e){return _r(e)||Xt(e)}var swe=B(x());function Xg(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>i["include-unsupported-proxy"]?!0:!["ss","ssr","vmess","vless","socks5","http","snell","trojan","wireguard"].includes(s.type)||s.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305"].includes(s.cipher)||s.type==="snell"&&s.version>=4||s.type==="vless"&&(typeof s.flow<"u"||s["reality-opts"])||["ws"].includes(s.network)&&s["ws-opts"]?.["v2ray-http-upgrade"]?!1:s["underlying-proxy"]||s["dialer-proxy"]?(Q.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"?(le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=Sp(s.cipher)):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"&&le(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),Qu(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s.fingerprint=s["tls-fingerprint"]),delete s["tls-fingerprint"],le(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"],delete s["ip-cidr"],delete s["ipv6-cidr"],n!=="internal"){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];ec(s[`${s.network}-opts`])}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 Uo(o,n,i)}}}var fwe=B(x());function Zg(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>{if(i["include-unsupported-proxy"])return!0;if(!["ss","ssr","vmess","socks5","http","snell","trojan","tuic","vless","wireguard","hysteria","hysteria2","ssh","juicity","anytls","tailscale","trusttunnel","masque","mieru"].includes(s.type)||s.type==="ss"&&!["aes-128-gcm","aes-192-gcm","aes-256-gcm","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","rc4-md5","chacha20-ietf","xchacha20","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher)||s.type==="snell"&&s.version>6)return!1;if(Zf(s,["websocket"])){if(["vless"].includes(s.type)&&s["reality-opts"]&&s.network&&!["tcp"].includes(s.network))return!1;if(["anytls"].includes(s.type)&&s.network&&(!["tcp"].includes(s.network)||["tcp"].includes(s.network)&&s["reality-opts"]))return!1;if(!["vless"].includes(s.type)&&["xhttp"].includes(s.network))return!1;if(["ws"].includes(s.network)&&s["ws-opts"]?.["v2ray-http-upgrade"])return!1}else return!1;return!0}).map(s=>{if(s.type==="vmess"?(le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=Sp(s.cipher)):s.type==="tuic"?(le(s,"alpn")?s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]:s.alpn=["h3"],le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),(!s.token||s.token.length===0)&&!le(s,"version")&&(s.version=5)):s.type==="hysteria"?(le(s,"auth_str")&&!le(s,"auth-str")&&(s["auth-str"]=s.auth_str),le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),le(s,"down")&&!le(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),le(s,"up")&&!le(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),le(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),le(s,"up-speed")&&(s["up-speed"]=`${s["up-speed"]}`.match(/\d+/)?.[0]||0)):s.type==="hysteria2"?(le(s,"password")&&!le(s,"auth")&&(s.auth=s.password,delete s.password),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo,delete s.tfo),le(s,"down")&&!le(s,"down-speed")&&(s["down-speed"]=s.down,delete s.down),le(s,"up")&&!le(s,"up-speed")&&(s["up-speed"]=s.up,delete s.up),le(s,"down-speed")&&(s["down-speed"]=`${s["down-speed"]}`.match(/\d+/)?.[0]||0),le(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"&&le(s,"sni")&&(s.servername=s.sni,delete s.sni),["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),Qu(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].includes(s.type)&&delete s.tls,s["tls-fingerprint"]&&(s["server-cert-fingerprint"]=s["tls-fingerprint"]),delete s["tls-fingerprint"],s["underlying-proxy"]&&(s["dialer-proxy"]=s["underlying-proxy"]),delete s["underlying-proxy"],le(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"],delete s["ip-cidr"],delete s["ipv6-cidr"],n!=="internal"){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];ec(s[`${s.network}-opts`])}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 Uo(o,n,i)}}}var Awe=B(x()),S9=B(oa()),_9=B(Va());var pwe=B(x()),JA=B(Va());var w9={"padding-bytes":"x-padding-bytes","padding-obfs-mode":"x-padding-obfs-mode","padding-placement":"x-padding-placement","padding-key":"x-padding-key","padding-header":"x-padding-header","padding-method":"x-padding-method"},y9={"session-id-placement":"session-placement","session-id-key":"session-key"},QA={"xmux-max-concurrency":"reuse-settings.max-concurrency","xmux-max-connections":"reuse-settings.max-connections","xmux-max-reuse-times":"reuse-settings.c-max-reuse-times","xmux-http-max-requests":"reuse-settings.h-max-request-times","xmux-http-max-reusable-secs":"reuse-settings.h-max-reusable-secs","xmux-http-keepalive-secs":"reuse-settings.h-keep-alive-period"},sZ={server:"server",port:"port",host:"host",path:"path",alpn:"alpn","over-tls":"tls",sni:"servername","skip-cert-verify":"skip-cert-verify","tls-profile":"_loon_tls_profile","tls-cert-sha256":"fingerprint","tls-pubkey-sha256":"tls-pubkey-sha256","public-key":"reality-opts.public-key","short-id":"reality-opts.short-id",...QA,...w9,...y9},Cp={mode:"mode","uplink-method":"uplink-http-method","min-post-interval-ms":"sc-min-posts-interval-ms","max-post-bytes":"sc-max-each-post-bytes","uplink-data-placement":"uplink-data-placement","uplink-data-key":"uplink-data-key","uplink-chunk-size":"uplink-chunk-size",...w9,"no-grpc-header":"no-grpc-header",...y9,"session-id-table":"session-table","session-id-length":"session-length","seq-placement":"seq-placement","seq-key":"seq-key",...QA,...Object.fromEntries(Object.entries(sZ).map(([e,t])=>[`download-${e}`,`download-settings.${t}`]))};function E9(e){if(e)for(let t of["","download-"]){let r=o=>JA.default.get(e,Cp[`${t}${o}`]);for(let o of Object.keys(QA)){let s=r(o);if(s==null)continue;let a=o==="xmux-http-keepalive-secs",u=a?Xn(s):Ls(s);if(u==null||a&&u<-1){let l=a?"an integer of at least -1":"a non-negative integer or a valid non-negative integer range";throw new Error(`Loon xhttp-${t}${o} must be ${l}`)}}let n=r("xmux-max-concurrency"),i=r("xmux-max-connections");if(Ho(n)!=null&&Ho(i)!=null){let o=`xhttp-${t}xmux`;throw new Error(`Loon ${o}-max-concurrency and ${o}-max-connections cannot both be positive`)}}}function b9(e,t,r){if(t==="header"||t==="download-header"){let n=r.indexOf(":");if(n<=0)return;let i=r.slice(0,n).trim();if(!i||/^host$/i.test(i))return;let o=t==="header"?e:e["download-settings"]??={};o.headers={...o.headers,[i]:r.slice(n+1).trim()};return}if(Object.prototype.hasOwnProperty.call(Cp,t)){switch(t.replace(/^download-/,"")){case"padding-obfs-mode":case"no-grpc-header":case"over-tls":case"skip-cert-verify":if(r!=="true"&&r!=="false")return;r=r==="true";break;case"min-post-interval-ms":case"max-post-bytes":case"uplink-chunk-size":r=Ls(r)??r;break;case"port":case"xmux-http-keepalive-secs":r=Xn(r)??r;break;case"alpn":r=[r];break}JA.default.set(e,Cp[t],r)}}var Dp="Loon",Hs={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function eS(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${Dp} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return oZ(t);case"ssr":return aZ(t);case"snell":return uZ(t);case"trojan":return cZ(t);case"vmess":return fZ(t,n["include-unsupported-proxy"]);case"vless":return dZ(t,n["include-unsupported-proxy"]);case"http":return pZ(t);case"socks5":return mZ(t);case"wireguard":return vZ(t);case"tailscale":return gZ(t);case"hysteria2":return yZ(t);case"mieru":return wZ(t)}if(t.type==="anytls"){if(t.network&&!["tcp"].includes(t.network))throw new Error(`Platform ${Dp} does not support proxy type ${t.type} with network ${t.network}`);return lZ(t)}throw new Error(`Platform ${Dp} does not support proxy type: ${t.type}`)};return{produce:(t,r,n={})=>{let i=e(t,r,n),o=t["server-dns"];return Array.isArray(o)&&o.length>0?`${i},server-dns="${o.join(",")}"`:i}}}function tc(e,t){let r=B9(t);r&&e.append(`,tls-profile=${r}`)}function gl(e,t,r=!1){let n=r?F9(t):D9(t);n&&e.append(`,alpn="${n}"`)}function Ga(e,t=!1){let r=String(e);if(/["\r\n]/.test(r))throw new Error("Unsupported characters in Loon option");return t||!r||/[,\s]/.test(r)?`"${r}"`:r}function tS(e,t){let r=t["xhttp-opts"],n=r?.["download-settings"];if(n?.plugin||n?.["shadow-tls-opts"])throw new Error("Loon XHTTP download-settings do not support plugins");E9(r);let i=r;if(n){let o=vt(n.server)??vt(t.server);if(o==null)throw new Error("Loon xhttp-download-server requires a server address");let s=Xn(n.port??t.port);if(s==null||s<1||s>65535)throw new Error("Loon xhttp-download-port must be an integer from 1 to 65535");let a=n["reality-opts"],u=!!vt(a?.["public-key"]);if(a&&!u)throw new Error("Loon XHTTP download REALITY requires a non-blank public-key");if(u&&[!1,"false"].includes(n.tls))throw new Error("Loon XHTTP download REALITY conflicts with xhttp-download-over-tls=false");let l=F9(n,!0),h=n.fingerprint??n["tls-fingerprint"],m=n["tls-pubkey-sha256"],p=n["skip-cert-verify"];if(u&&(h||m||[!0,"true"].includes(p)))throw new Error("Loon XHTTP download REALITY conflicts with skip-cert-verify=true or TLS certificate fingerprints");i={...r,"download-settings":{...n,server:o.trim(),port:s,host:A9(n),alpn:l||void 0,servername:n.servername??n.sni,fingerprint:u?void 0:h,"tls-pubkey-sha256":u?void 0:m,"skip-cert-verify":u?void 0:p,_loon_tls_profile:B9(n)}}}e.append(",transport=xhttp");for(let[o,s]of[["path",r?.path],["host",A9(r)]])s!=null&&e.append(`,${o}=${Ga(s)}`);for(let[o,s]of Object.entries(Cp)){let a=_9.default.get(i,s);a!=null&&e.append(`,xhttp-${o}=${Ga(a)}`)}for(let[o,s]of[["xhttp-header",r?.headers],["xhttp-download-header",n?.headers]])if(Ge(s))for(let[a,u]of Object.entries(s))/^host$/i.test(a)||u==null||e.append(`,${o}=${Ga(`${a}: ${u}`,!0)}`)}function A9(e){if(e?.host!=null)return e.host;if(Ge(e?.headers))return Object.entries(e.headers).find(([t])=>/^host$/i.test(t))?.[1]}function iZ(e){let t=e?.["plugin-opts"]?.alpn??e?.alpn;return(Array.isArray(t)?t:`${t||""}`.split(",")).map(n=>`${n}`.trim()).filter(n=>n!=="").join(",")}function C9(e,t){if(t.plugin!=="shadow-tls"||!t["plugin-opts"])return;let r=t["plugin-opts"].password,n=t["plugin-opts"].host,i=t["plugin-opts"].version;if(!r)return;if(e.append(`,shadow-tls-password=${r}`),n&&e.append(`,shadow-tls-sni=${n}`),i){if(i<2)throw new Error(`shadow-tls version ${i} is not supported`);e.append(`,shadow-tls-version=${i}`)}tc(e,t);let o=iZ(t);o&&e.append(`,alpn="${o}"`),e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function Jg(e,t){e.appendIfPresent(`,sni=${t.sni}`,"sni"),e.appendIfPresent(`,public-key="${t["reality-opts"]["public-key"]}"`,"reality-opts.public-key"),e.appendIfPresent(`,short-id=${t["reality-opts"]["short-id"]}`,"reality-opts.short-id")}function D9(e){return(Array.isArray(e.alpn)?e.alpn:`${e.alpn||""}`.split(",")).map(r=>`${r}`.trim()).filter(r=>r!=="").join(",")}function F9(e,t=!1){let r=D9(e);if(!r)return r;if(r.includes(",")){let s=t?" download":"";throw new Error(`Loon XHTTP${s} supports only a single ALPN`)}let n=!!e["reality-opts"]?.["public-key"],i=!t&&e.type==="trojan"||[!0,"true"].includes(e.tls),o=n?["h2"]:i?["http/1.1","h2","h3"]:["http/1.1"];if(!o.includes(r)){let s=t?"xhttp-download-alpn":"XHTTP alpn";throw new Error(`Loon ${s} must be ${o.join(" or ")} for the configured security`)}return r}function B9(e){let t=`${e._loon_tls_profile||""}`.trim();if(["global","default","safari-ios18","safari-ios-26","chrome","chrome147"].includes(t))return t;let r=`${e["client-fingerprint"]||""}`.trim();if(e["reality-opts"]?.["support-x25519mlkem768"])return["safari","ios"].includes(r)?"safari-ios-26":"chrome147";switch(r){case"chrome":return"chrome";case"safari":case"ios":return"safari-ios18"}}function oZ(e){let t=new We(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}"`),le(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`)}C9(t,e),e["udp-over-tcp"]&&(e["udp-over-tcp-version"]===2?e.plugin==="obfs"?Q.error(`Platform ${Dp} shadowsocks udp-over-tcp does not support obfs`):t.append(",udp-over-tcp=true"):Q.error(`Platform ${Dp} shadowsocks only supports udp-over-tcp-version 2`)),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 aZ(e){let t=new We(e);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"),C9(t,e),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 uZ(e){let t=Number(e.version);if(![4,5].includes(t))throw new Error(`Loon does not support Snell version ${e.version??1}`);if(e.psk==null||e.psk==="")throw new Error("Missing Snell PSK");let r=e["obfs-opts"];if(e.plugin||r?.mode&&!["none","http"].includes(r.mode))throw new Error("Loon Snell only supports HTTP obfs");let n=new We(e);n.append(`${e.name}=snell,${e.server},${e.port},${Ga(e.psk,!0)},version=${t}`),r?.mode==="http"&&(n.append(",obfs=http"),r.host!=null&&n.append(`,obfs-host=${Ga(r.host)}`),r.path!=null&&n.append(`,obfs-uri=${Ga(r.path)}`)),n.appendIfPresent(`,udp=${e.udp}`,"udp");let i=e["block-quic"];(i==="on"||i==="off")&&n.append(`,block-quic=${i==="on"}`);let o=Hs[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${o}`,"ip-version"),n.toString()}function cZ(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=new We(e);if(n.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,le(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(r)tS(n,e);else throw new Error(`network ${e.network} is unsupported`);n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),tc(n,e),gl(n,e,r),t?Jg(n,e):(n.appendIfPresent(`,${r?"sni":"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 lZ(e){let t=!!e["reality-opts"],r=new We(e);r.append(`${e.name}=anytls,${e.server},${e.port},"${e.password}"`);for(let i of["idle-session-timeout","max-stream-count"])le(e,i)&&Number.isInteger(e[i])&&r.append(`,${i}=${e[i]}`);r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),tc(r,e),gl(r,e),t?Jg(r,e):(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")),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 fZ(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=r9(e.cipher),i=new We(e);if(i.append(`${e.name}=vmess,${e.server},${e.port},${n},"${e.uuid}"`),e.network==="tcp"&&delete e.network,le(e,"network"))if(e.network==="ws")i.append(",transport=ws"),i.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),i.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){i.append(",transport=http");let a=e["http-opts"]?.path,u=e["http-opts"]?.headers?.Host;i.appendIfPresent(`,path=${Array.isArray(a)?a[0]:a}`,"http-opts.path"),i.appendIfPresent(`,host=${Array.isArray(u)?u[0]:u}`,"http-opts.headers.Host")}else if(r)tS(i,e);else throw new Error(`network ${e.network} is unsupported`);else i.append(",transport=tcp");i.appendIfPresent(`,over-tls=${e.tls}`,"tls"),i.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),(e.tls||t)&&tc(i,e),(e.tls||t||r)&&gl(i,e,r),t?Jg(i,e):(i.appendIfPresent(`,${r?"sni":"tls-name"}=${e.sni}`,"sni"),i.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),i.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"));let o=e.alterId;if(le(e,"aead")&&(o=e.aead?0:1),r&&(o??=0,Number(o)!==0))throw new Error("VMess XHTTP requires AEAD");i.append(`,alterId=${o}`),i.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?i.append(",block-quic=true"):e["block-quic"]==="off"&&i.append(",block-quic=false"),e.udp&&i.append(",udp=true");let s=Hs[e["ip-version"]]||e["ip-version"];return i.appendIfPresent(`,ip-mode=${s}`,"ip-version"),i.toString()}function hZ(e,t){if(!t||t==="none")return;let[r,n,i,...o]=t.split("."),s=/^(-?\d+)-(-?\d+)-(-?\d+)$/,a=o.findIndex(h=>!s.test(h));if(r!=="mlkem768x25519plus"||!["native","xorpub","random"].includes(n)||!["0rtt","1rtt"].includes(i)||!o[a])throw new Error("Unsupported VLESS encryption format");let u=o.slice(0,a);for(let[h,m]of u.entries()){let[,p,d,v]=s.exec(m).map(Number);if(h===0&&(p!==100||d<35||v<35))throw new Error("Loon VLESS encryption-padding first group requires probability 100 and lengths of at least 35");if(p<0||p>100||d<0||d>v||!Number.isSafeInteger(v))throw new Error("Loon VLESS encryption-padding requires probabilities from 0 to 100 and ordered non-negative integer bounds")}let l=o.slice(a).join(".");e.append(`,encryption-mode=${n},encryption-rtt=${i}`),e.append(`,encryption-public-keys=${Ga(l)}`),u.length&&e.append(`,encryption-padding=${Ga(u.join("."))}`)}function dZ(e){let t=!!e.flow,r=e["reality-opts"],n=!!vt(r?.["public-key"]),i=e.network==="xhttp",o=(e.network??"tcp")==="tcp",s=n||[!0,"true"].includes(e.tls),a=e.encryption&&e.encryption!=="none";if(r&&!n)throw new Error("Loon VLESS REALITY requires a non-blank public-key");if(t&&!["xtls-rprx-vision","xtls-rprx-vision-udp443"].includes(e.flow))throw new Error(`VLESS flow(${e.flow}) is not supported`);if(t&&!a&&(!o||!s))throw new Error("Loon VLESS Vision without encryption requires TCP with TLS or REALITY");let u=new We(e);if(u.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,le(e,"network"))if(e.network==="ws")u.append(",transport=ws"),u.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),u.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){u.append(",transport=http");let h=e["http-opts"]?.path,m=e["http-opts"]?.headers?.Host;u.appendIfPresent(`,path=${Array.isArray(h)?h[0]:h}`,"http-opts.path"),u.appendIfPresent(`,host=${Array.isArray(m)?m[0]:m}`,"http-opts.headers.Host")}else if(i)tS(u,e);else throw new Error(`network ${e.network} is unsupported`);else u.append(",transport=tcp");u.appendIfPresent(`,over-tls=${e.tls}`,"tls"),u.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),(e.tls||n||t)&&tc(u,e),(e.tls||n||t||i)&&gl(u,e,i),hZ(u,e.encryption),t&&u.append(`,flow=${e.flow}`),n?Jg(u,e):(u.appendIfPresent(`,${i?"sni":"tls-name"}=${e.sni}`,"sni"),u.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),u.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256")),u.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),e["block-quic"]==="on"?u.append(",block-quic=true"):e["block-quic"]==="off"&&u.append(",block-quic=false"),e.udp&&u.append(",udp=true");let l=Hs[e["ip-version"]]||e["ip-version"];return u.appendIfPresent(`,ip-mode=${l}`,"ip-version"),u.toString()}function pZ(e){let t=new We(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"),e.tls&&(tc(t,e),gl(t,e)),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 mZ(e){let t=new We(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"),e.tls&&(tc(t,e),gl(t,e)),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 gZ(e){let t=new We(e);t.append(`${e.name}=tailscale`);let r=e["exit-node"];r==="auto:any"&&(r="auto"),r===""&&(r="none");let n={"control-url":e["control-url"],"auth-key":e["auth-key"],hostname:e.hostname,"exit-node":r};for(let[s,a]of Object.entries(n)){if(!a)continue;let u=s==="control-url"||s==="auth-key"||/[,\s]/.test(a);t.append(`,${s}=${u?`"${a}"`:a}`)}for(let s of["accept-routes","accept-dns","magic-dns","path-mode","mtu","idle-session-timeout","udp"])t.appendIfPresent(`,${s}=${e[s]}`,s);let i=Hs[e["ip-version"]]||e["ip-version"];t.appendIfPresent(`,ip-mode=${i}`,"ip-version");let o=e["block-quic"];return(o==="on"||o==="off")&&t.append(`,block-quic=${o==="on"}`),t.toString()}function vZ(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 We(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(a=>Xt(a));let s=e.dns.find(a=>_r(a));s||(s=e.dns.find(a=>!_r(a)&&!Xt(a))),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 o=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${o}`,"ip-version"),e["block-quic"]==="on"?t.append(",block-quic=true"):e["block-quic"]==="off"&&t.append(",block-quic=false"),t.toString()}function wZ(e){if(e.transport&&String(e.transport).toUpperCase()!=="TCP")throw new Error("Loon Mieru requires TCP transport");if(e.tls||e["reality-opts"])throw new Error("Loon Mieru does not support TLS or REALITY");let t=vt(e.server)?.trim();if(!t)throw new Error("Loon Mieru requires a server");let r=String(e.port??"").trim(),n=Number(r);if(!/^\d+$/.test(r)||n<1||n>65535)throw new Error("Loon Mieru port must be an integer from 1 to 65535");let i=[e.username,e.password].map(m=>String(m??""));if(i.some(m=>!m||S9.Buffer.byteLength(m,"utf8")>64))throw new Error("Loon Mieru username and password must each be 1-64 UTF-8 bytes");let o=new We(e),s=Xt(t)?`[${t}]`:t,[a,u]=i.map(m=>Ga(m,!0));o.append(`${e.name}=mieru,${s},${n},${a},${u}`),e.udp&&o.append(",udp=true");let l=e["block-quic"];["on","off",!0,!1].includes(l)&&o.append(`,block-quic=${l==="on"||l===!0}`);let h=Hs[e["ip-version"]]||e["ip-version"];return o.appendIfPresent(`,ip-mode=${h}`,"ip-version"),o.toString()}function yZ(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new We(e);t.append(`${e.name}=Hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,"${e.password}"`,"password"),le(e,"ports")&&`${e.ports}`.trim().length>0&&t.append(`,server-ports="${e.ports}"`),le(e,"hop-interval")&&`${e["hop-interval"]}`.trim().length>0&&t.append(`,hop-interval=${e["hop-interval"]}`),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"),tc(t,e),gl(t,e),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"),[!0,"true","on"].includes(e.ecn)?t.append(",ecn=true"):[!1,"false","off"].includes(e.ecn)&&t.append(",ecn=false");let r=Hs[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}var Pwe=B(x());function EZ(e,{excludeHost:t=!1}={}){if(!Ge(e))return;let r={};for(let[n,i]of Object.entries(e))typeof i=="string"&&(t&&/^host$/i.test(n)||(r[n]=i));return Object.keys(r).length>0?r:void 0}function bZ(e,t){let r=e2(e?.["_v2ray-http-upgrade-ed"]);if(r!=="")return r;let n=e2(As(t||"/","ed").value);return n!==""?n:2560}function Qg(e,t){return t?.["v2ray-http-upgrade-fast-open"]?YA(e||"/","ed",bZ(t,e)):e}function rS(e,t){let r=t?.["max-early-data"],n=e2(r);if(n==="")return r!=null&&`${r}`!=""?e==null?e:As(e,"ed").path:e;let i=t?.["early-data-header-name"];return i&&i!=="Sec-WebSocket-Protocol"?e==null?e:As(e,"ed").path:YA(e||"/","ed",n)}function e2(e){return e==null||`${e}`==""||li(e)==null?"":`${e}`}function AZ(e){return Xn(e)}function SZ(e){return Ls(e)}function I9({defaultDns:e,dnsFieldPath:t,echOptsPath:r,proxyName:n,queryServerName:i}){let o=n||"\u672A\u547D\u540D\u8282\u70B9";Q.warn(`URI ECH: \u8282\u70B9 "${o}" \u7684 ${r} \u5DF2\u5F00\u542F\u4E14\u8BBE\u7F6E query-server-name="${i}", \u4F46\u672A\u8BBE\u7F6E ${t}; \u5DF2\u4F7F\u7528\u9ED8\u8BA4 DNS ${e}. \u5982\u9700\u81EA\u5B9A\u4E49, \u8BF7\u8BBE\u7F6E ${t}.`)}function t2(e,t={}){return e==="h2"?t.host??t.headers?.host??t.headers?.Host:e==="xhttp"?t.host??t.headers?.Host??t.headers?.host:t.headers?.Host??t.headers?.host??t.host}function _Z(e){if(!Ge(e))return;let t={},r={"max-connections":"maxConnections","max-concurrency":"maxConcurrency","c-max-reuse-times":"cMaxReuseTimes","h-max-request-times":"hMaxRequestTimes","h-max-reusable-secs":"hMaxReusableSecs"};for(let[i,o]of Object.entries(r)){let s=Ls(e[i]);s!=null&&(t[o]=typeof s=="number"?`${s}`:s)}let n=AZ(e["h-keep-alive-period"]);return n!=null&&(t.hKeepAlivePeriod=n),Object.keys(t).length>0?t:void 0}function x9(e,t,{excludeHostHeader:r=!0,xmuxTarget:n="root"}={}){if(!Ge(e)||!Ge(t))return;let i=EZ(t.headers,{excludeHost:r});if(i&&(e.headers=i),t["no-grpc-header"]===!0&&(e.noGRPCHeader=!0),t["x-padding-bytes"]&&(e.xPaddingBytes=t["x-padding-bytes"]),t["x-padding-obfs-mode"]===!0&&(e.xPaddingObfsMode=!0),t["x-padding-key"]&&(e.xPaddingKey=t["x-padding-key"]),t["x-padding-header"]&&(e.xPaddingHeader=t["x-padding-header"]),t["x-padding-placement"]&&(e.xPaddingPlacement=t["x-padding-placement"]),t["x-padding-method"]&&(e.xPaddingMethod=t["x-padding-method"]),t["uplink-http-method"]&&(e.uplinkHTTPMethod=t["uplink-http-method"]),t["session-placement"]&&(e.sessionIDPlacement=t["session-placement"]),t["session-key"]&&(e.sessionIDKey=t["session-key"]),typeof t["session-table"]=="string"&&(e.sessionIDTable=t["session-table"]),t["session-length"]!=null){let a=dl(t["session-length"]);a!=null&&(e.sessionIDLength=a)}t["seq-placement"]&&(e.seqPlacement=t["seq-placement"]),t["seq-key"]&&(e.seqKey=t["seq-key"]),t["uplink-data-placement"]&&(e.uplinkDataPlacement=t["uplink-data-placement"]),t["uplink-data-key"]&&(e.uplinkDataKey=t["uplink-data-key"]);let o=SZ(t["uplink-chunk-size"]);if(o!=null&&(e.uplinkChunkSize=o),t["sc-max-each-post-bytes"]!=null){let a=dl(t["sc-max-each-post-bytes"]);a!=null&&(e.scMaxEachPostBytes=a)}if(t["sc-min-posts-interval-ms"]!=null){let a=Ho(t["sc-min-posts-interval-ms"]);a!=null&&(e.scMinPostsIntervalMs=a)}let s=_Z(t["reuse-settings"]);s&&(n==="extra"?e.extra={...Ge(e.extra)?e.extra:{},xmux:s}:e.xmux=s)}function CZ(e,t={},r={}){if(!Ge(e))return;let n=typeof e.network=="string"?e.network.toLowerCase():"",i=n==="xhttp"||n==="splithttp"?"xhttp":void 0,o={};e.server&&(o.address=e.server);let s=Xn(e.port,{allowNegative:!1});s!=null&&(o.port=s);let a=Ge(e["reality-opts"])?e["reality-opts"]:void 0;a?o.security="reality":e.tls&&(o.security="tls");let u={};e.servername&&(u.serverName=e.servername),e["client-fingerprint"]&&(u.fingerprint=e["client-fingerprint"]),e["skip-cert-verify"]&&(u.allowInsecure=!0),e.alpn&&(u.alpn=Array.isArray(e.alpn)?e.alpn:[e.alpn]);let l=UA(e["ech-opts"],void 0,{dnsFieldPath:"xhttp-opts.download-settings.ech-opts._dns",warnDefaultDns:v=>I9({...v,echOptsPath:"xhttp-opts.download-settings.ech-opts",proxyName:r.name})});if(l.echConfigList&&(u.echConfigList=l.echConfigList),l.echForceQuery&&(u.echForceQuery=l.echForceQuery),l.echSockopt&&(u.echSockopt=rc(l.echSockopt)),Object.keys(u).length>0&&(o.tlsSettings=u),a){let v={};e.servername&&(v.serverName=e.servername),e["client-fingerprint"]&&(v.fingerprint=e["client-fingerprint"]),a["public-key"]&&(v.publicKey=a["public-key"]),a["short-id"]&&(v.shortId=a["short-id"]),Object.keys(v).length>0&&(o.realitySettings=v)}let h={},m=e.path??t.path;m&&(h.path=m);let p=t2("xhttp",e)??t2("xhttp",t);p&&(h.host=p);let d=e.mode??t.mode;if(d&&(h.mode=d),x9(h,e,{excludeHostHeader:!0,xmuxTarget:"extra"}),Object.keys(h).length>0&&(o.xhttpSettings=h),!(Object.keys(o).length===0&&i==null))return{...o.address!=null?{address:o.address}:{},network:i||"xhttp",...o.port!=null?{port:o.port}:{},...o.security!=null?{security:o.security}:{},...o.tlsSettings!=null?{tlsSettings:o.tlsSettings}:{},...o.realitySettings!=null?{realitySettings:o.realitySettings}:{},...o.xhttpSettings!=null?{xhttpSettings:o.xhttpSettings}:{}}}function DZ(e){let t=e["xhttp-opts"]||{},r={};x9(r,t,{excludeHostHeader:!0,xmuxTarget:"root"});let n=CZ(t["download-settings"],t,e);return n&&(r.downloadSettings=n),Object.keys(r).length>0?r:void 0}function rc(e){if(Array.isArray(e))return e.map(rc);if(Ge(e)){let t={};for(let[r,n]of Object.entries(e))t[r]=rc(n);return t}return e}function FZ(e,t){return e==null?rc(t):Array.isArray(e)||Array.isArray(t)?rc(e):Ge(e)&&Ge(t)?$9(e,t):rc(e)}function $9(e,t){let r=Ge(e)?rc(e):{};if(!Ge(t))return r;for(let[n,i]of Object.entries(t)){if(!Object.prototype.hasOwnProperty.call(r,n)){r[n]=rc(i);continue}r[n]=FZ(r[n],i)}return r}function P9(e){if(typeof e=="string")return e;if(Ge(e))return JSON.stringify(e)}function BZ(e){let t=P9(e._extra);if(t!=null)return t;if(e.network!=="xhttp")return e._extra||"";let r=DZ(e),n=$9(r,e._extra_unsupported);return Object.keys(n).length>0?JSON.stringify(n):""}function nS(e){let t="none",r=e["reality-opts"],n="",i="",o="";if(r){t="reality";let V=e["reality-opts"]?.["public-key"];if(V){i=`&pbk=${encodeURIComponent(V)}`;let ae=e["reality-opts"]["support-x25519mlkem768"];ae&&(i+=`&support-x25519mlkem768=${encodeURIComponent(ae)}`)}let X=e["reality-opts"]?.["short-id"];X&&(n=`&sid=${encodeURIComponent(X)}`);let te=e["reality-opts"]?.["_spider-x"];te&&(o=`&spx=${encodeURIComponent(te)}`)}else e.tls&&(t="tls");let s="";e.alpn&&(s=`&alpn=${encodeURIComponent(Array.isArray(e.alpn)?e.alpn:e.alpn.join(","))}`);let a="";e["skip-cert-verify"]&&(a="&allowInsecure=1");let u="";e._h2&&(u="&h2=1");let l="";e["tls-fingerprint"]&&(l=`&pcs=${encodeURIComponent(e["tls-fingerprint"])}`);let h="",m=Array.isArray(e._vcn)?e._vcn.join(","):e["name-cert-verify"];(Array.isArray(e._vcn)||m)&&(h=`&vcn=${encodeURIComponent(m)}`);let p="",d=HA(e["ech-opts"],e._echConfigList,{dnsFieldPath:"ech-opts._dns",warnDefaultDns:V=>I9({...V,echOptsPath:"ech-opts",proxyName:e.name})});d&&(p=`&ech=${encodeURIComponent(d)}`);let v="";e.sni&&(v=`&sni=${encodeURIComponent(e.sni)}`);let g="";e["client-fingerprint"]&&(g=`&fp=${encodeURIComponent(e["client-fingerprint"])}`);let y="";e.flow&&(y=`&flow=${encodeURIComponent(e.flow)}`);let w="",E=BZ(e);E&&(w=`&extra=${encodeURIComponent(E)}`);let _="",C=P9(e._finalmask);C&&(_=`&fm=${encodeURIComponent(C)}`);let F="";["xhttp"].includes(e.network)&&e[`${e.network}-opts`]?.mode?F=`&mode=${encodeURIComponent(e[`${e.network}-opts`].mode)}`:e._mode&&(F=`&mode=${encodeURIComponent(e._mode)}`);let H="";e._pqv&&(H=`&pqv=${encodeURIComponent(e._pqv)}`);let K="";e.encryption&&(K=`&encryption=${encodeURIComponent(e.encryption)}`);let S=e.network;e.network==="ws"&&e["ws-opts"]?.["v2ray-http-upgrade"]?S="httpupgrade":e.network==="http"?S="tcp":e.network==="h2"&&(S="http");let I=`&type=${encodeURIComponent(S)}`;if(e.network==="http"&&(I+="&headerType=http"),["grpc"].includes(e.network)){I+=`&mode=${encodeURIComponent(e[`${e.network}-opts`]?.["_grpc-type"]||"gun")}`;let V=e[`${e.network}-opts`]?.["_grpc-authority"];V&&(I+=`&authority=${encodeURIComponent(V)}`)}let q=e[`${e.network}-opts`]||{},L=e.network==="ws"&&q?.["v2ray-http-upgrade"],R=q?.[`${e.network}-service-name`],O=q?.path,T=t2(e.network,q),N=e2(e["ws-opts"]?.["max-early-data"]);Array.isArray(O)&&(O=O[0]),L&&q?.["v2ray-http-upgrade-fast-open"]?O=Qg(O,q):e.network==="ws"&&e["ws-opts"]?.["max-early-data"]!=null&&O&&(O=As(O,"ed").path),O&&(I+=`&path=${encodeURIComponent(O)}`),T&&(I+=`&host=${encodeURIComponent(Array.isArray(T)?T[0]:T)}`),R&&(I+=`&serviceName=${encodeURIComponent(R)}`),e.network==="http"&&e["http-opts"]?.method&&(I+=`&method=${encodeURIComponent(e["http-opts"].method)}`),e.network==="kcp"&&(e.seed&&(I+=`&seed=${encodeURIComponent(e.seed)}`),e.headerType&&(I+=`&headerType=${encodeURIComponent(e.headerType)}`)),e.network==="ws"&&!L&&N!==""&&(I+=`&ed=${encodeURIComponent(N)}`);let P=e["ws-opts"]?.["early-data-header-name"];P&&(L||e["ws-opts"]?.["max-early-data"]==null||P!=="Sec-WebSocket-Protocol")&&(I+=`&eh=${encodeURIComponent(P)}`);let M="",Y;switch(e["packet-encoding"]!=null?Y=`${e["packet-encoding"]}`.trim().toLowerCase():e.xudp?Y="xudp":e["packet-addr"]?Y="packetaddr":e.udp===!0&&(Y=""),Y){case"":M="&packetEncoding=none";break;case"packetaddr":M="&packetEncoding=packet";break;case"xudp":M="&packetEncoding=xudp";break}return`vless://${e.uuid}@${e.server}:${e.port}?security=${encodeURIComponent(t)}${I}${M}${s}${a}${l}${h}${p}${u}${v}${g}${y}${n}${o}${i}${F}${w}${_}${H}${K}#${encodeURIComponent(e.name)}`}function rh(){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(["tuic","hysteria","hysteria2","juicity","trusttunnel"].includes(r.type)&&delete r.tls,!["vmess"].includes(r.type)&&r.server&&Xt(r.server)&&(r.server=`[${r.server}]`),r.type){case"socks5":n=`socks://${encodeURIComponent(bt.encode(`${r.username??""}:${r.password??""}`))}@${r.server}:${r.port}#${r.name}`;break;case"ss":let i=`${r.cipher}:${r.password}`;n=`ss://${r.cipher?.startsWith("2022-blake3-")?`${encodeURIComponent(r.cipher)}:${encodeURIComponent(r.password)}`:bt.encode(i)}@${r.server}:${r.port}${r.plugin?"/":""}`;let o="";if(r.plugin){o+="&plugin=";let se=r["plugin-opts"];switch(r.plugin){case"obfs":o+=encodeURIComponent(`simple-obfs;obfs=${se.mode}${se.host?";obfs-host="+se.host:""}`);break;case"v2ray-plugin":let pe=bp(se.mux);o+=encodeURIComponent(`v2ray-plugin;obfs=${se.mode};mode=${se.mode}${se.host?";obfs-host="+se.host:""}${se.host?";host="+se.host:""}${se.path?";path="+se.path:""}${se.tls?";tls":""}${se.sni?";sni="+se.sni:""}${se["skip-cert-verify"]?";skip-cert-verify="+se["skip-cert-verify"]:""}${pe!=null?";mux="+pe:""}`);break;case"shadow-tls":o+=encodeURIComponent(`shadow-tls;host=${se.host};password=${se.password};version=${se.version}`);break;default:throw new Error(`Unsupported plugin option: ${r.plugin}`)}}r["udp-over-tcp"]&&(o+="&uot=1"),r.tfo&&(o+="&tfo=1"),o+=`&udp=${r.udp?1:0}`;let s="";if(r.network){let se=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(se="httpupgrade"),s=`&type=${encodeURIComponent(se)}`,["grpc"].includes(r.network)){let Oe=r[`${r.network}-opts`]?.[`${r.network}-service-name`],pt=r[`${r.network}-opts`]?.["_grpc-authority"];Oe&&(s+=`&serviceName=${encodeURIComponent(Oe)}`),pt&&(s+=`&authority=${encodeURIComponent(pt)}`),s+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let pe=r[`${r.network}-opts`]||{},Fe=r.network==="ws"&&pe?.["v2ray-http-upgrade"],Te=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Te)&&(Te=Te[0]),Fe?Te=Qg(Te,pe):r.network==="ws"&&(Te=rS(Te,pe)),Te&&(s+=`&path=${encodeURIComponent(Te)}`),Ve&&(s+=`&host=${encodeURIComponent(Array.isArray(Ve)?Ve[0]:Ve)}`)}let a="";r["client-fingerprint"]&&(a=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let u="";r.alpn&&(u=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let l=r["reality-opts"],h="",m="",p="",d=r.tls?"&security=tls":"",v="",g=r._extra&&(l||r.network==="xhttp")?`&extra=${encodeURIComponent(r._extra)}`:"";if(l){d="&security=reality";let se=r["reality-opts"]?.["public-key"];se&&(m=`&pbk=${encodeURIComponent(se)}`);let pe=r["reality-opts"]?.["short-id"];pe&&(h=`&sid=${encodeURIComponent(pe)}`);let Fe=r["reality-opts"]?.["_spider-x"];Fe&&(p=`&spx=${encodeURIComponent(Fe)}`),r._mode&&(v=`&mode=${encodeURIComponent(r._mode)}`)}r.tls&&(o+=`&sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}`),o+=`${s}${u}${a}${d}${h}${m}${p}${v}${g}#${encodeURIComponent(r.name)}`,n+=o.replace(/^&/,"?");break;case"ssr":n=`${r.server}:${r.port}:${r.protocol}:${r.cipher}:${r.obfs}:${bt.encode(r.password)}/`,n+=`?remarks=${bt.encode(r.name)}${r["obfs-param"]?"&obfsparam="+bt.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protoparam="+bt.encode(r["protocol-param"]):""}`,n="ssr://"+bt.encode(n);break;case"vmess":if(r["reality-opts"]||r._finalmask){if(r.aead===!1||r.aead!==!0&&Number(r.alterId||0)!==0)throw new Error("VMess query URI format cannot represent non-AEAD authentication (alterId must be 0)");n=nS({...r,server:Xt(r.server)?`[${r.server}]`:r.server,network:r.network||"tcp",encryption:jr(r.cipher),flow:void 0}).replace(/^vless:\/\//,"vmess://");break}let y="",w=r.network||"tcp";if(r.network==="http"?(w="tcp",y="http"):r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(w="httpupgrade"),n={v:"2",ps:r.name,add:r.server,port:`${r.port}`,id:r.uuid,aid:`${r.alterId||0}`,scy:jr(r.cipher),net:w,type:y,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 se=r[`${r.network}-opts`]||{},pe=r.network==="ws"&&se?.["v2ray-http-upgrade"],Fe=se?.path,Te=t2(r.network,se);["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`]):(Array.isArray(Fe)&&(Fe=Fe[0]),pe?Fe=Qg(Fe,se):r.network==="ws"&&(Fe=rS(Fe,se)),Fe&&(n.path=Fe),Te&&(n.host=Array.isArray(Te)?r.network==="h2"?Te.join(","):Te[0]:Te))}n="vmess://"+bt.encode(JSON.stringify(n));break;case"vless":n=nS(r);break;case"trojan":let E="";if(r.network){let se=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(se="httpupgrade"),E=`&type=${encodeURIComponent(se)}`,["grpc"].includes(r.network)){let Oe=r[`${r.network}-opts`]?.[`${r.network}-service-name`],pt=r[`${r.network}-opts`]?.["_grpc-authority"];Oe&&(E+=`&serviceName=${encodeURIComponent(Oe)}`),pt&&(E+=`&authority=${encodeURIComponent(pt)}`),E+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let pe=r[`${r.network}-opts`]||{},Fe=r.network==="ws"&&pe?.["v2ray-http-upgrade"],Te=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Te)&&(Te=Te[0]),Fe?Te=Qg(Te,pe):r.network==="ws"&&(Te=rS(Te,pe)),Te&&(E+=`&path=${encodeURIComponent(Te)}`),Ve&&(E+=`&host=${encodeURIComponent(Array.isArray(Ve)?Ve[0]:Ve)}`)}let _="";r["client-fingerprint"]&&(_=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let C="";r["tls-fingerprint"]&&(C=`&pcs=${encodeURIComponent(r["tls-fingerprint"])}`);let F="",H=Array.isArray(r._vcn)?r._vcn.join(","):r["name-cert-verify"];(Array.isArray(r._vcn)||H)&&(F=`&vcn=${encodeURIComponent(H)}`);let K="";r.alpn&&(K=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let S=r["reality-opts"],I="",q="",L="",R="",O="",T="";if(S){R="&security=reality";let se=r["reality-opts"]?.["public-key"];se&&(q=`&pbk=${encodeURIComponent(se)}`);let pe=r["reality-opts"]?.["short-id"];pe&&(I=`&sid=${encodeURIComponent(pe)}`);let Fe=r["reality-opts"]?.["_spider-x"];Fe&&(L=`&spx=${encodeURIComponent(Fe)}`),r._extra&&(T=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(O=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${encodeURIComponent(r.password)}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${E}${K}${_}${C}${F}${R}${I}${q}${L}${O}${T}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let N=[];r["hop-interval"]&&N.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&N.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&N.push("insecure=1"),r.obfs&&(N.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&N.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&N.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&N.push(`mport=${r.ports}`),r["tls-fingerprint"]&&N.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&N.push("fastopen=1");let P=HA(r["ech-opts"]);P&&N.push(`ech=${encodeURIComponent(P)}`),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${N.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let M=[];Object.keys(r).forEach(se=>{if(!["name","type","server","port"].includes(se)){let pe=se.replace(/-/,"_");["alpn"].includes(se)?r[se]&&M.push(`${pe}=${encodeURIComponent(Array.isArray(r[se])?r[se][0]:r[se])}`):["skip-cert-verify"].includes(se)?r[se]&&M.push("insecure=1"):["tfo","fast-open"].includes(se)?r[se]&&!M.includes("fastopen=1")&&M.push("fastopen=1"):["ports"].includes(se)?M.push(`mport=${r[se]}`):["auth-str"].includes(se)?M.push(`auth=${r[se]}`):["up"].includes(se)?M.push(`upmbps=${r[se]}`):["down"].includes(se)?M.push(`downmbps=${r[se]}`):["_obfs"].includes(se)?M.push(`obfs=${r[se]}`):["obfs"].includes(se)?M.push(`obfsParam=${r[se]}`):["sni"].includes(se)?M.push(`peer=${r[se]}`):r[se]&&!/^_/i.test(se)&&M.push(`${pe}=${encodeURIComponent(r[se])}`)}}),n=`hysteria://${r.server}:${r.port}?${M.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let se=[];Object.keys(r).forEach(pe=>{if(!["name","type","uuid","password","server","port","tls"].includes(pe)){let Fe=pe.replace(/-/,"_");["alpn"].includes(pe)?r[pe]&&se.push(`${Fe}=${encodeURIComponent(Array.isArray(r[pe])?r[pe][0]:r[pe])}`):["skip-cert-verify"].includes(pe)?r[pe]&&se.push("allow_insecure=1"):["tfo","fast-open"].includes(pe)?r[pe]&&!se.includes("fast_open=1")&&se.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(pe)&&r[pe]?se.push(`${Fe.replace(/-/g,"_")}=1`):["congestion-controller"].includes(pe)?se.push(`congestion_control=${r[pe]}`):r[pe]&&!/^_/i.test(pe)&&se.push(`${Fe.replace(/-/g,"_")}=${encodeURIComponent(r[pe])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${se.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":n=nS({...r,uuid:encodeURIComponent(r.password),network:r.network||"tcp"}).replace("vless","anytls");let Y=[];Object.keys(r).forEach(se=>{if(!["name","type","password","server","port","tls"].includes(se)){let pe=se.replace(/-/,"_");["alpn"].includes(se)?r[se]&&Y.push(`${pe}=${encodeURIComponent(Array.isArray(r[se])?r[se][0]:r[se])}`):["skip-cert-verify"].includes(se)?r[se]&&Y.push("insecure=1"):["udp"].includes(se)?r[se]&&Y.push("udp=1"):r[se]&&!/^_|client-fingerprint/i.test(se)&&["number","string","boolean"].includes(typeof r[se])&&Y.push(`${pe.replace(/-/g,"_")}=${encodeURIComponent(r[se])}`)}});let V=n.split("?"),X=V[0],te={};V.length>1&&V[1].split("#")[0].split("&").forEach(Fe=>{let[Te,Ve]=Fe.split("=");Te&&(te[Te]=Ve)}),Y.forEach(se=>{let[pe,Fe]=se.split("=");pe&&(te[pe]=Fe)});let ae=Object.keys(te).map(se=>`${se}=${te[se]}`).join("&"),me=n.match(/#(.*)$/),he=me?`#${me[1]}`:"";n=`${X}?${ae}${he}`;break;case"mieru":{let se=r["port-range"]||r.port,pe=encodeURIComponent(r.username??""),Fe=encodeURIComponent(r.password??"");if(!r.server||!se||!pe||!Fe)throw new Error("Mieru URI requires a server, port and credentials");let Te=[`port=${encodeURIComponent(se)}`,`protocol=${encodeURIComponent(r.transport||"TCP")}`,`profile=${encodeURIComponent(r.name||r.server)}`];for(let Ve of["multiplexing","handshake-mode","traffic-pattern"])r[Ve]&&Te.push(`${Ve}=${encodeURIComponent(r[Ve])}`);n=`mierus://${pe}:${Fe}@${r.server}?${Te.join("&")}`;break}case"wireguard":let De=[];Object.keys(r).forEach(se=>{["name","type","server","port","ip","ipv6","ip-cidr","ipv6-cidr","private-key"].includes(se)||(["public-key"].includes(se)?De.push(`publickey=${encodeURIComponent(r[se])}`):["udp"].includes(se)?r[se]&&De.push(`${se}=1`):r[se]&&!/^_/i.test(se)&&De.push(`${se}=${encodeURIComponent(r[se])}`))});let Pe=bs(r,"ipv4"),Ie=bs(r,"ipv6");Pe&&Ie?De.push(`address=${encodeURIComponent(`${Pe},${Ie}`)}`):Pe?De.push(`address=${encodeURIComponent(Pe)}`):Ie&&De.push(`address=${encodeURIComponent(Ie)}`),n=`wireguard://${encodeURIComponent(r["private-key"])}@${r.server}:${r.port}/?${De.join("&")}#${encodeURIComponent(r.name)}`;break}return n}}}var Nwe=B(x());var IZ=rh();function Fp(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(IZ.produce(i))}catch(o){Q.error(`Cannot produce proxy: ${i.name}
|
||
Reason: ${o}`)}}),bt.encode(n.join(`
|
||
`))}}}var Mwe=B(x()),sS=B(oa());var r2="QX";function xZ(e){return(Array.isArray(e)?e:`${e}`.split(",")).map(r=>`${r}`.trim()).filter(Boolean).map(r=>{let n=sS.Buffer.from(r,"utf8");if(n.length>255)throw new Error("QX ALPN protocol exceeds 255 bytes");return`${n.length.toString(16).padStart(2,"0")}${n.toString("hex")}`}).join("")||void 0}function Wa(e,t){if(le(t,"tls-alpn")){e.append(`,tls-alpn=${t["tls-alpn"]}`);return}let r=le(t,"alpn")&&xZ(t.alpn);r&&e.append(`,tls-alpn=${r}`)}function Bp(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${r2} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return $Z(t);case"ssr":return PZ(t);case"trojan":return kZ(t);case"vmess":return RZ(t);case"http":return LZ(t);case"socks5":return UZ(t);case"vless":return TZ(t);case"anytls":return OZ(t);case"hysteria2":return NZ(t);case"mieru":return HZ(t)}throw new Error(`Platform ${r2} does not support proxy type: ${t.type}`)};return{produce:(t,r,n={})=>{let i=e(t,r,n);if(t.flow&&t.flow!=="xtls-rprx-vision")throw new Error(`Platform ${r2} does not support flow ${t.flow}`);return t["reality-opts"]&&(t["reality-opts"]["public-key"]&&(i=`${i},reality-base64-pubkey=${t["reality-opts"]["public-key"]}`),t["reality-opts"]["short-id"]&&(i=`${i},reality-hex-shortid=${t["reality-opts"]["short-id"]}`)),i}}}function iS(e){return["http","vmess-http","vemss-http","shadowsocks-http"].includes(e._qx_obfs_http)?e._qx_obfs_http:"http"}function Ya(e,t){let r=le(t,"name-cert-verify")?"name-cert-verify":"skip-cert-verify";e.appendIfPresent(`,tls-verification=${t["name-cert-verify"]??!t["skip-cert-verify"]}`,r)}function $Z(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t),i=Xf(e);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}`),Zn(e)&&(e.tls=!0),i)r(",obfs=over-tls"),le(e,"sni")?r(`,obfs-host=${e.sni}`):n(`,obfs-host=${e.servername}`,"servername");else if(le(e,"plugin")){if(e.plugin==="obfs"){let o=e["plugin-opts"];o.mode==="http"?r(`,obfs=${iS(e)}`):r(`,obfs=${o.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(Zn(e)||e.plugin==="v2ray-plugin"&&e["plugin-opts"]?.tls)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(t,e),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"),Ya(t,e),i||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 PZ(e){let t=new We(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 kZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),le(e,"network")){if(e.network==="ws")Zn(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 if(!["tcp"].includes(e.network))throw new Error(`network ${e.network} is unsupported`)}return e.network!=="ws"&&Zn(e)&&r(",over-tls=true"),Zn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(t,e),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"),Ya(t,e),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 RZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);r(`vmess=${e.server}:${e.port}`);let i=t9(e.cipher);if(r(`,method=${i}`),r(`,password=${e.uuid}`),Zn(e)&&(e.tls=!0),le(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(`,obfs=${iS(e)}`);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 o=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(o)?o[0]:o}`,`${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 Zn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(t,e),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"),Ya(t,e),n(`,tls-host=${e.sni}`,"sni")),le(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 TZ(e){if(e.encryption&&e.encryption!=="none")throw new Error("VLESS encryption is not supported");let t=new We(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}`),Zn(e)&&(e.tls=!0),le(e,"network")){if(e.network==="ws")e.tls?r(",obfs=wss"):r(",obfs=ws");else if(e.network==="http")r(`,obfs=${iS(e)}`);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 o=e[`${e.network}-opts`]?.path,s=e[`${e.network}-opts`]?.headers?.Host;n(`,obfs-uri=${Array.isArray(o)?o[0]:o}`,`${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 Zn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(t,e),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"),Ya(t,e),n(`,tls-host=${e.sni}`,"sni")),n(`,vless-flow=${e.flow}`,"flow"),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 OZ(e){let t=e.network?.trim().toLowerCase();if(t&&t!=="tcp")throw new Error(`Platform ${r2} does not support AnyTLS with transport ${e.network}`);let r=new We(e),n=r.append.bind(r),i=r.appendIfPresent.bind(r);return n(`anytls=${e.server}:${e.port}`),n(`,password=${e.password}`),e.tls=!0,n(",over-tls=true"),i(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(r,e),i(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),i(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),i(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Ya(r,e),i(`,tls-host=${e.sni}`,"sni"),i(`,fast-open=${e.tfo}`,"tfo"),i(`,udp-relay=${e.udp}`,"udp"),r.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),n(`,tag=${e.name}`),r.toString()}function NZ(e){let t=e.obfs||"salamander";if(!["salamander","gecko"].includes(t))throw new Error("QX Hysteria 2 only supports Salamander and Gecko obfuscation");let r=new We(e);r.append(`hysteria2=${e.server}:${e.port}`),r.appendIfPresent(`,password=${e.password}`,"password");let n=String(e.ports||"").trim();n&&r.append(`,port-hopping=${n.replace(/;/g,",")}`);let i=Number(e["hop-interval"]);if(Number.isInteger(i)&&i>=5&&i<=3600&&r.append(`,port-hopping-interval=${i}`),le(e,"obfs-password")){let s=String(e["obfs-password"]);if(sS.Buffer.byteLength(s,"utf8")<4)throw new Error(`QX Hysteria 2 ${t}-password must be at least 4 bytes`);r.append(`,${t}-password=${s}`)}else if(t==="gecko")throw new Error("QX Hysteria 2 Gecko obfuscation requires gecko-password");r.appendIfPresent(`,tls-host=${e.sni}`,"sni"),r.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(r,e),r.appendIfPresent(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),r.appendIfPresent(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),r.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Ya(r,e);let o=String(e.down).match(/^\s*(\d+)/)?.[1];return o&&r.append(`,download-bandwidth=${o}`),r.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),r.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r.append(`,tag=${e.name}`),r.toString()}function LZ(e){let t=new We(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"),Zn(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Zn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(t,e),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"),Ya(t,e),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 UZ(e){let t=new We(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"),Zn(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Zn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(t,e),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"),Ya(t,e),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 HZ(e){let t=new We(e);return t.append(`mieru=${e.server}:${e.port}`),t.appendIfPresent(`,username=${e.username}`,"username"),t.appendIfPresent(`,password=${e.password}`,"password"),Zn(e)&&(e.tls=!0),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),Zn(e)&&(t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Wa(t,e),t.appendIfPresent(`,tls-no-session-ticket=${e["tls-no-session-ticket"]}`,"tls-no-session-ticket"),t.appendIfPresent(`,tls-no-session-reuse=${e["tls-no-session-reuse"]}`,"tls-no-session-reuse"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),Ya(t,e),t.appendIfPresent(`,tls-host=${e.sni}`,"sni")),t.appendIfPresent(`,fast-open=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),e.udp===!0&&t.append(",udp-over-tcp=true"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),t.append(`,tag=${e.name}`),t.toString()}function Zn(e){return e.tls}var Gwe=B(x());function Ip(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>{if(i["include-unsupported-proxy"])return!0;if(Zf(s,["websocket","quic","http2","mkcp","grpc"])){if(s.type==="snell"&&![1,2,3,4,5,6].includes(s.version))return!1;if(MZ(s))return Q.error(`Platform Shadowrocket does not support Snell shadow-tls with obfs for proxy ${s.name}. Proxy has been filtered.`),!1;if(["tailscale","sudoku","naive","openvpn","gost-relay","shadowquic","zerotier","masque-surge","easytier"].includes(s.type))return!1;if(["xhttp"].includes(s.network))return Q.warn("VLESS XHTTP \u7ED3\u6784\u590D\u6742, Shadowrocket \u53EF\u80FD\u65E0\u6CD5\u5B8C\u5168\u517C\u5BB9"),!0}else return!1;return!0}).map(s=>{if(jg(s),s.type==="vmess"?(le(s,"aead")&&(s.aead&&(s.alterId=0),delete s.aead),le(s,"sni")&&(s.servername=s.sni,delete s.sni),s.cipher=jr(s.cipher)):s.type==="tuic"?(le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo),(!s.token||s.token.length===0)&&!le(s,"version")&&(s.version=5)):s.type==="hysteria"?(le(s,"auth_str")&&!le(s,"auth-str")&&(s["auth-str"]=s.auth_str),le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(s,"fast-open")&&(s["fast-open"]=s.tfo)):s.type==="hysteria2"?(le(s,"alpn")&&(s.alpn=Array.isArray(s.alpn)?s.alpn:[s.alpn]),le(s,"tfo")&&!le(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.ip=bs(s,"ipv4"),s.ipv6=bs(s,"ipv6")):s.type==="snell"?(s.version<3&&delete s.udp,s.plugin==="shadow-tls"&&s["plugin-opts"]&&(s["obfs-opts"]={mode:"shadow-tls",host:s["plugin-opts"].host,password:s["plugin-opts"].password,version:s["plugin-opts"].version},s["plugin-opts"].alpn&&(s["obfs-opts"].alpn=s["plugin-opts"].alpn),delete s.plugin,delete s["plugin-opts"])):s.type==="vless"?le(s,"sni")&&(s.servername=s.sni,delete s.sni):s.type==="ss"?Xf(s)&&le(s,"sni")&&(s.servername=s.sni):["anytls"].includes(s.type)&&s.reuse!=null&&!s.reuse&&(s["disable-reuse"]=!0,delete s.reuse),["vmess","vless"].includes(s.type)&&s.network==="http"){let a=s["http-opts"]?.path;le(s,"http-opts.path")&&!Array.isArray(a)&&(s["http-opts"].path=[a]);let u=s["http-opts"]?.headers?.Host;le(s,"http-opts.headers.Host")&&!Array.isArray(u)&&(s["http-opts"].headers.Host=[u])}if(["vmess","vless"].includes(s.type)&&s.network==="h2"){let a=s["h2-opts"]?.path;le(s,"h2-opts.path")&&Array.isArray(a)&&(s["h2-opts"].path=a[0]);let u=s["h2-opts"]?.host??s["h2-opts"]?.headers?.host??s["h2-opts"]?.headers?.Host;(le(s,"h2-opts.host")||le(s,"h2-opts.headers.host")||le(s,"h2-opts.headers.Host"))&&(s["h2-opts"].host=Array.isArray(u)?u:[u]),s["h2-opts"]?.headers&&(delete s["h2-opts"].headers.host,delete s["h2-opts"].headers.Host,Object.keys(s["h2-opts"].headers).length===0&&delete s["h2-opts"].headers)}if(["ws"].includes(s.network)){let a=`${s.network}-opts`;s[a]=s[a]||{},s[a].path||(s[a].path="/"),Qu(s[a])}if(s["plugin-opts"]?.tls&&le(s,"skip-cert-verify")&&(s["plugin-opts"]["skip-cert-verify"]=s["plugin-opts"]["skip-cert-verify"]||s["skip-cert-verify"]),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","naive"].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"],le(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"],delete s["ip-cidr"],delete s["ipv6-cidr"],n!=="internal"){for(let a in s)(s[a]==null||/^_/i.test(a))&&delete s[a];ec(s[`${s.network}-opts`])}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 Uo(o,n,i)}}}function MZ(e){return e?.type==="snell"&&e?.plugin==="shadow-tls"&&(le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path"))}var Jwe=B(x()),R9=B(Va());var xp="Surfboard";function vl(e){return e!=null&&`${e}`.trim().length>0}function wl(e,t,r=!0){r&&(e.appendIfPresent(`,server-cert-fingerprint-sha256=${t["tls-fingerprint"]}`,"tls-fingerprint"),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify"))}function n2(){return{produce:t=>{if(t.type!=="vless"&&t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${xp} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return zZ(t);case"trojan":return GZ(t);case"vmess":return WZ(t);case"vless":return YZ(t);case"http":return XZ(t);case"snell":return VZ(t);case"tuic":return qZ(t);case"socks5":return ZZ(t);case"hysteria2":return jZ(t);case"wireguard-surge":return JZ(t)}if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw new Error(`Platform ${xp} does not support proxy type ${t.type} with network or REALITY`);return KZ(t)}throw new Error(`Platform ${xp} does not support proxy type: ${t.type}`)}}}function qZ(e){if(e.token?.length)throw new Error(`Platform ${xp} does not support proxy type ${e.type} v4`);let t=new We(e);return t.append(`${e.name}=tuic-v5,${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),vl(e.alpn)&&t.append(`,alpn="${Array.isArray(e.alpn)?e.alpn.join(","):e.alpn}"`),vl(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),vl(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),wl(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function jZ(e){if(e.obfs&&e.obfs!=="salamander"||e["obfs-password"]&&e.obfs!=="salamander")throw new Error("Surfboard Hysteria2 only supports salamander obfs");let t=new We(e);return t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),vl(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),vl(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),e["obfs-password"]&&t.append(`,salamander-password="${e["obfs-password"]}"`),wl(t,e),t.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function KZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),wl(t,e),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function VZ(e){if(le(e,"version")&&![1,2,3,4,5].includes(Number(e.version)))throw new Error(`Platform ${xp} does not support snell version ${e.version}`);let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk="${e.psk}"`,"psk"),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"),e.version>=3&&t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function zZ(e){let t=new We(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","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(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password"),le(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.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function GZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),T9(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),wl(t,e),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function WZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),T9(t,e),le(e,"aead")?t.append(`,vmess-aead=${e.aead}`):t.append(`,vmess-aead=${e.alterId===0}`),t.appendIfPresent(`,tls=${e.tls}`,"tls"),wl(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function YZ(e){if(!vl(e.uuid))throw new Error("VLESS username is missing");if(e.flow&&!["xtls-rprx-vision","xtls-rprx-vision-udp443"].includes(e.flow))throw new Error("Unsupported VLESS flow");if(!Mg(e))throw new Error("Unsupported VLESS transport, TLS or flow combination");let t=new We(e);t.append(`${e.name}=vless,${e.server},${e.port}`);let r=(s,a)=>{if(a==null)return;let u=String(a),l=!u||/[,;"'\s\\]/.test(u)?`"${u.replace(/["\\]/g,"\\$&")}"`:u;t.append(`,${s}=${l}`)};r("username",e.uuid);let n=e.network??"tcp";if(n==="ws"){let s=e["ws-opts"];r("ws",!0),s?.["v2ray-http-upgrade"]&&r("ws-http-upgrade",!0),r("ws-path",s?.path),r("ws-headers",k9(Object.entries(s?.headers??{})))}else if(n==="grpc"){let s=e["grpc-opts"];r("grpc",!0),r("grpc-service-name",s?.["grpc-service-name"]),r("grpc-mode",s?.["_grpc-type"]),r("grpc-authority",s?.["_grpc-authority"])}else if(n==="xhttp"){let s=e["xhttp-opts"];if(s?.["download-settings"])throw new Error("VLESS XHTTP download-settings are unsupported");r("xhttp",!0);let a=Object.entries(s?.headers??{}),u=s?.host??a.find(([l])=>/^host$/i.test(l))?.[1];for(let[l,h]of Object.entries(Qf))r(`xhttp-${l}`,l==="host"?u:R9.default.get(s,h));r("xhttp-headers",k9(a.filter(([l])=>!/^host$/i.test(l))))}else if(!["tcp","raw","none"].includes(n))throw new Error(`VLESS network ${n} is unsupported`);e.flow&&r("flow",e.flow),e.encryption&&r("encryption",e.encryption);let i=e["reality-opts"];i?(r("reality-public-key",i["public-key"]),r("reality-short-id",i["short-id"])):(r("tls",e.tls),e.tls&&(r("server-cert-fingerprint-sha256",e["tls-fingerprint"]),r("server-cert-verify-name",e["name-cert-verify"]),r("skip-cert-verify",e["skip-cert-verify"]))),(e.tls||i)&&(r("sni",e.sni),vl(e.alpn)&&r("alpn",e.alpn)),r("udp-relay",e.udp),r("block-quic",e["block-quic"]),r("underlying-proxy",e["underlying-proxy"]);let o=t.toString();if(/[\r\n]/.test(o))throw new Error("VLESS proxy contains a line break");return o}function k9(e){let t=[];for(let[r,n]of e){if(n==null)continue;let i=String(n);if(r.includes("|")||i.includes("|"))throw new Error('VLESS header names and values cannot contain "|"');t.push(`${r}:${i}`)}return t.join("|")||void 0}function XZ(e){let t=new We(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"),wl(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function ZZ(e){let t=new We(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"),wl(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function JZ(e){let t=new We(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function T9(e,t){if(le(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),le(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),le(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,n=Object.keys(r).map(i=>{let o=r[i];return["Host"].includes(i)&&(o=`"${o}"`),`${i}:${o}`}).join("|");qe(n)&&e.append(`,ws-headers=${n}`)}}else{if(["tcp"].includes(t.network)&&t["reality-opts"])throw new Error("reality is unsupported");if(!["tcp"].includes(t.network))throw new Error(`network ${t.network} is unsupported`)}}var oye=B(x()),N9=B(oa());var QZ={ipv4:"ipv4_only",ipv6:"ipv6_only","v4-only":"ipv4_only","v6-only":"ipv6_only","ipv4-prefer":"prefer_ipv4","ipv6-prefer":"prefer_ipv6","prefer-v4":"prefer_ipv4","prefer-v6":"prefer_ipv6"},hn=(e,t)=>{let r=QZ[e["ip-version"]];e._dns_server&&r&&(t.domain_resolver={server:e._dns_server,strategy:r})},dn=(e,t)=>{e._domain_resolver&&(typeof e._domain_resolver=="string"?t.domain_resolver={...t.domain_resolver??{},server:e._domain_resolver}:t.domain_resolver={...t.domain_resolver??{},...e._domain_resolver})},eJ=e=>{let t=e["control-http-client"];return t==null?!1:typeof t=="string"?t.trim()!=="":Ge(t)?Object.values(t).some(r=>r!=null&&r!==""):!0},pn=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},Gi=(e,t)=>{if(["tcp","udp"].includes(e._network)){t.network=e._network;return}e.udp===!1&&(t.network="tcp")},Jn=(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},Wi=(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))))},aS=(e,t)=>{let r={type:"ws",headers:{}};if(e["ws-opts"]){let{path:n="",headers:i={},"max-early-data":o,"early-data-header-name":s}=e["ws-opts"];if(r.early_data_header_name=s,r.max_early_data=o?parseInt(o,10):void 0,n!==""&&(r.path=`${n}`),Object.keys(i).length>0){let a={};for(let l of Object.keys(i)){let h=i[l];h!==""&&(Array.isArray(h)||(h=[`${h}`]),h.length>0&&(a[l]=h))}let{Host:u}=a;if(u.length===1)for(let l of`Host:${u[0]}`.split(`
|
||
`)){let[h,m]=l.split(":");m.trim()!==""&&(a[h.trim()]=m.trim().split(","))}r.headers=a}}if(e["ws-headers"]){let n={};for(let o of Object.keys(e["ws-headers"])){let s=e["ws-headers"][o];s!==""&&(Array.isArray(s)||(s=[`${s}`]),s.length>0&&(n[o]=s))}let{Host:i}=n;if(i.length===1)for(let o of`Host:${i[0]}`.split(`
|
||
`)){let[s,a]=o.split(":");a.trim()!==""&&(n[s.trim()]=a.trim().split(","))}for(let o of Object.keys(n))r.headers[o]=n[o]}if(e["ws-path"]&&e["ws-path"]!==""&&(r.path=`${e["ws-path"]}`),r.path){let{value:n,parsed:i}=WA(r.path,"ed");n!==""&&(r.path=As(r.path,"ed").path,r.early_data_header_name="Sec-WebSocket-Protocol",r.max_early_data=i)}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},L9=(e,t)=>{let r={type:"http",headers:{}};if(e["http-opts"]){let{method:n="",path:i="",headers:o={}}=e["http-opts"];n!==""&&(r.method=n),Array.isArray(i)?r.path=`${i[0]}`:i!==""&&(r.path=`${i}`);for(let s of Object.keys(o)){let a=o[s];if(a!==""){if(s.toLowerCase()==="host"){let u=a;Array.isArray(u)||(u=`${u}`.split(",").map(l=>l.trim())),u.length>0&&(r.host=u);continue}Array.isArray(a)||(a=`${a}`.split(",").map(u=>u.trim())),a.length>0&&(r.headers[s]=a)}}}if(e["http-host"]&&e["http-host"]!==""){let n=e["http-host"];Array.isArray(n)||(n=`${n}`.split(",").map(i=>i.trim())),n.length>0&&(r.host=n)}if(e["http-path"]&&e["http-path"]!==""){let n=e["http-path"];Array.isArray(n)?r.path=`${n[0]}`:n!==""&&(r.path=`${n}`)}t.tls.insecure&&(t.tls.server_name=r.host[0]),r.host?.length===1&&(r.host=r.host[0]);for(let n of Object.keys(r.headers)){let i=r.headers[n];i.length===1&&(r.headers[n]=i[0])}t.transport=r},U9=(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(o=>o.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},uS=(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},tJ=(e,t)=>{let r=Array.isArray(e)?e:[e],n=[];for(let i of r){let o=`${i}`.trim().replace(/\\r\\n/g,`
|
||
`).replace(/\\n/g,`
|
||
`);if(o!=="")for(let s of o.split(/\r?\n/)){let a=s.trim();a!==""&&n.push(a)}}if(n.length!==0)return n.some(i=>/^-----BEGIN [A-Za-z0-9 -]+-----$/.test(i))?n:[`-----BEGIN ${t}-----`,...n,`-----END ${t}-----`]},rJ=["chrome","firefox","edge","safari","360","qq","ios","android","random","randomized"],H9=e=>{let t=`${e||""}`.trim().toLowerCase();if(rJ.includes(t))return t},M9=(e,t)=>{let r=t.tls;if(e.ca&&(r.certificate_path=`${e.ca}`),e.ca_str&&(r.certificate=[e.ca_str]),e["ca-str"]&&(r.certificate=[e["ca-str"]]),e._certificate&&(r.certificate=e._certificate),e._certificate_path&&(r.certificate_path=e._certificate_path),r.reality?.enabled){(e._certificate_sha256?.length||e._certificate_public_key_sha256?.length)&&Q.warn(`Platform sing-box: certificate_sha256 and certificate_public_key_sha256 are ignored by Reality for proxy ${e.name}`);return}e._certificate_public_key_sha256&&(r.certificate_public_key_sha256=e._certificate_public_key_sha256);let n=r.certificate?.length||r.certificate_path;if(e._certificate_sha256!=null)r.certificate_sha256=e._certificate_sha256;else if((e.fingerprint||e["tls-fingerprint"])&&!n&&!r.certificate_public_key_sha256?.length){let i=`${e.fingerprint||e["tls-fingerprint"]}`.trim().replace(/:/g,"");if(!/^[0-9a-f]{64}$/i.test(i))throw new Error(`Platform sing-box: invalid SHA-256 certificate fingerprint for proxy ${e.name}`);r.certificate_sha256=[N9.Buffer.from(i,"hex").toString("base64")]}if(n&&(r.certificate_sha256?.length||r.certificate_public_key_sha256?.length))throw new Error(`Platform sing-box: certificate_sha256 or certificate_public_key_sha256 conflicts with certificate or certificate_path for proxy ${e.name}`)},Xa=(e,t)=>{if(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["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"]!==""){let r=H9(e["client-fingerprint"]);r&&(t.tls.utls={...t.tls.utls,enabled:!0,fingerprint:r})}if(e._ech&&Ge(e._ech))t.tls.ech=e._ech;else if(e["ech-opts"]&&Ge(e["ech-opts"])){t.tls.ech=t.tls.ech||{},t.tls.ech.enabled=e["ech-opts"].enable;let r=e["ech-opts"].config;if(Array.isArray(r)||typeof r=="string"){let n=tJ(r,"ECH CONFIGS");n&&(t.tls.ech.config=n)}t.tls.ech.query_server_name=e["ech-opts"]["query-server-name"],t.tls.ech.config_path=e["ech-opts"]["config-path"],t.tls.ech.fragment=e["ech-opts"].fragment,t.tls.ech.fragment_fallback_delay=e["ech-opts"]["fragment-fallback-delay"],t.tls.ech.record_fragment=e["ech-opts"]["record-fragment"]}e._curve_preferences&&Array.isArray(e._curve_preferences)&&(t.tls.curve_preferences=e._curve_preferences),e._fragment&&(t.tls.fragment=!!e._fragment),e._fragment_fallback_delay&&(t.tls.fragment_fallback_delay=e._fragment_fallback_delay),e._record_fragment&&(t.tls.record_fragment=!!e._record_fragment),e._client_certificate&&(t.tls.client_certificate=e._client_certificate),e._client_certificate_path&&(t.tls.client_certificate_path=e._client_certificate_path),e._client_key&&(t.tls.client_key=e._client_key),e._client_key_path&&(t.tls.client_key_path=e._client_key_path),t.tls.enabled?M9(e,t):delete t.tls},nJ=(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";e.username&&(t.user=e.username),e.password&&(t.password=e.password);let r=e["private-key"]||e.privateKey;return r&&(t[r.includes("PRIVATE KEY")?"private_key":"private_key_path"]=r),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),Jn(e,t),pn(e,t),hn(e,t),dn(e,t),t},sJ=(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),Jn(e,t),pn(e,t),Xa(e,t),hn(e,t),dn(e,t),t},iJ=(e={})=>{let t={tag:e.name,type:"socks",server:e.server,server_port:parseInt(`${e.port}`,10),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={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),e["fast-open"]&&(t.udp_fragment=!0),Gi(e,t),Jn(e,t),pn(e,t),hn(e,t),dn(e,t),t},oJ=(e={})=>{let t=s2(e),r={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:i2(e)};return e.uot&&(r.udp_over_tcp=!0),e["udp-over-tcp"]&&(r.udp_over_tcp={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2}),Gi(e,r),Wi(e.smux,r),{type:"ss-with-st",ssPart:r,stPart:oS(e,t)}},i2=(e={})=>`${e.name}_shadowtls`,s2=(e={})=>{if(e.plugin==="shadow-tls"&&e["plugin-opts"])return e["plugin-opts"];if(e.type==="snell"&&e["obfs-opts"]?.mode==="shadow-tls")return{host:e["obfs-opts"].host,password:e["obfs-opts"].password,version:e["obfs-opts"].version,alpn:e["obfs-opts"].alpn}},O9=e=>{if(typeof e=="string")return e.split(",").map(t=>t.trim()).filter(t=>t!=="");if(Array.isArray(e))return e},oS=(e={},t)=>{if(!t)throw new Error("shadow-tls plugin options are missing");let r=H9(e["client-fingerprint"]),n={tag:i2(e),type:"shadowtls",server:e.server,server_port:parseInt(`${e.port}`,10),version:t.version,password:t.password,tls:{enabled:!0,server_name:t.host}};if(e["skip-cert-verify"]&&(n.tls.insecure=!0),r&&(n.tls.utls={enabled:!0,fingerprint:r}),n.server_port<0||n.server_port>65535)throw"\u7AEF\u53E3\u503C\u975E\u6CD5";let i=O9(t.alpn)??O9(e.alpn);return i&&(n.tls.alpn=i),M9(e,n),e["fast-open"]===!0&&(n.udp_fragment=!0),Jn(e,n),pn(e,n),hn(e,n),dn(e,n),n},aJ=(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),Gi(e,t),Jn(e,t),pn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),e.plugin){let r=[];e.plugin==="obfs"&&(t.plugin="obfs-local",t.plugin_opts="",e["obfs-host"]&&(e["plugin-opts"].host=e["obfs-host"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"mode":r.push(`obfs=${e["plugin-opts"].mode}`);break;case"host":r.push(`obfs-host=${e["plugin-opts"].host}`);break;default:r.push(`${n}=${e["plugin-opts"][n]}`);break}})),e.plugin==="v2ray-plugin"&&(t.plugin="v2ray-plugin",e["ws-host"]&&(e["plugin-opts"].host=e["ws-host"]),e["ws-path"]&&(e["plugin-opts"].path=e["ws-path"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"tls":e["plugin-opts"].tls&&r.push("tls");break;case"host":r.push(`host=${e["plugin-opts"].host}`);break;case"path":r.push(`path=${e["plugin-opts"].path}`);break;case"headers":r.push(`headers=${JSON.stringify(e["plugin-opts"].headers)}`);break;case"mux":{let i=bp(e["plugin-opts"].mux);i&&(t.multiplex={enabled:!0}),r.push(`mux=${i}`);break}default:r.push(`${n}=${e["plugin-opts"][n]}`)}})),t.plugin_opts=r.join(";")}return t},uJ=(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),Gi(e,t),Jn(e,t),pn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},cJ=e=>{if(e==null)return;let t=`${e}`.trim();return/^\d+$/.test(t)?parseInt(t,10):NaN},lJ=(e={},t=!1)=>{let r=cJ(e.version),n=s2(e),i=t?[1,2,3,4,5,6]:[4,5,6];if(r!=null&&(!i.includes(r)||Number.isNaN(r)))throw new Error(`Platform sing-box does not support snell version ${e.version}`);let o=!t&&r===5?4:r,s={tag:e.name,type:"snell",server:e.server,server_port:parseInt(`${e.port}`,10),psk:e.psk};if(s.server_port<0||s.server_port>65535)throw"invalid port";return o!=null&&(s.version=o),(e.userkey||e._userkey)&&(s.userkey=e.userkey||e._userkey),o===6?(e.mode&&(s.mode=e.mode),t&&e["quic-proxy-mode"]&&(s.quic_proxy_mode=!!e["quic-proxy-mode"])):(e["obfs-opts"]?.mode&&e["obfs-opts"].mode!=="shadow-tls"&&(s.obfs_mode=e["obfs-opts"].mode),e["obfs-opts"]?.host&&e["obfs-opts"]?.mode!=="shadow-tls"&&(s.obfs_host=e["obfs-opts"].host)),e.reuse&&(r==null||r>=4)&&(s.reuse=!0),Gi(e,s),n?(s.detour=i2(e),delete s.server,delete s.server_port):(e["fast-open"]&&(s.udp_fragment=!0),Jn(e,s),pn(e,s),hn(e,s),dn(e,s)),s},fJ=["","packetaddr","xudp"],hJ=e=>{let t=`${e}`.trim().toLowerCase();if(fJ.includes(t))return t},q9=(e,t)=>{if(e["packet-encoding"]!=null){let r=hJ(e["packet-encoding"]);r!=null&&(t.packet_encoding=r)}else e.xudp?t.packet_encoding="xudp":e["packet-addr"]&&(t.packet_encoding="packetaddr")},dJ=(e,t)=>{q9(e,t),e["global-padding"]!=null&&(t.global_padding=!!e["global-padding"]),e["authenticated-length"]!=null&&(t.authenticated_length=!!e["authenticated-length"])},pJ=(e={})=>{let t={tag:e.name,type:"vmess",server:e.server,server_port:parseInt(`${e.port}`,10),uuid:e.uuid,security:jr(e.cipher),alter_id:parseInt(`${e.alterId}`,10),tls:{enabled:!1,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";return dJ(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&aS(e,t),e.network==="h2"&&U9(e,t),e.network==="http"&&L9(e,t),e.network==="grpc"&&uS(e,t),Gi(e,t),Jn(e,t),pn(e,t),Xa(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},mJ=(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 q9(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&aS(e,t),e.network==="h2"&&U9(e,t),e.network==="http"&&L9(e,t),e.network==="grpc"&&uS(e,t),Gi(e,t),Jn(e,t),pn(e,t),Wi(e.smux,t),Xa(e,t),hn(e,t),dn(e,t),t},gJ=(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"&&uS(e,t),e.network==="ws"&&aS(e,t),Gi(e,t),Jn(e,t),pn(e,t),Xa(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},vJ=(e={})=>{let t={tag:e.name,type:"naive",server:e.server,server_port:parseInt(`${e.port}`,10),tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";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={enabled:!0,version:!e["udp-over-tcp-version"]||e["udp-over-tcp-version"]===1?1:2});let r=parseInt(`${e["insecure-concurrency"]}`,10);return Number.isInteger(r)&&r>=0&&(t.insecure_concurrency=r),e["extra-headers"]&&(t.extra_headers=e["extra-headers"]),e.quic&&(t.quic=!!e.quic),e["quic-congestion-control"]&&(t.quic_congestion_control=e["quic-congestion-control"]),e["fast-open"]&&(t.udp_fragment=!0),Jn(e,t),pn(e,t),Xa(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t.tls?.insecure&&(Q.info("Platform sing-box: insecure is not supported on naive outbound"),delete t.tls.insecure),t},wJ=(e={})=>{let t={tag:e.name,type:"hysteria",server:e.server,server_port:parseInt(`${e.port}`,10),disable_mtu_discovery:!1,tls:{enabled:!0,server_name:e.server,insecure:!1}};if(t.server_port<0||t.server_port>65535)throw"invalid port";e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(n=>{let i=n.replace(/\s*-\s*/g,":");return i.includes(":")?i:`${i}:${i}`})),e.auth_str&&(t.auth_str=`${e.auth_str}`),e["auth-str"]&&(t.auth_str=`${e["auth-str"]}`),e["fast-open"]&&(t.udp_fragment=!0);let r=new RegExp("^[0-9]+[ ]*[KMGT]*[Bb]ps$");return r.test(`${e.up}`)&&!`${e.up}`.endsWith("Mbps")?t.up=`${e.up}`:t.up_mbps=parseInt(`${e.up}`,10),r.test(`${e.down}`)&&!`${e.down}`.endsWith("Mbps")?t.down=`${e.down}`:t.down_mbps=parseInt(`${e.down}`,10),e.obfs&&(t.obfs=e.obfs),e.recv_window_conn&&(t.recv_window_conn=e.recv_window_conn),e["recv-window-conn"]&&(t.recv_window_conn=e["recv-window-conn"]),e.recv_window&&(t.recv_window=e.recv_window),e["recv-window"]&&(t.recv_window=e["recv-window"]),e.disable_mtu_discovery&&(typeof e.disable_mtu_discovery=="boolean"?t.disable_mtu_discovery=e.disable_mtu_discovery:e.disable_mtu_discovery===1&&(t.disable_mtu_discovery=!0)),Gi(e,t),Xa(e,t),pn(e,t),Jn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},yJ=(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";if(e["hop-interval"]&&(t.hop_interval=/^\d+$/.test(e["hop-interval"])?`${e["hop-interval"]}s`:e["hop-interval"]),e.ports&&(t.server_ports=e.ports.split(/\s*,\s*/).map(r=>{let n=r.replace(/\s*-\s*/g,":");return n.includes(":")?n:`${n}:${n}`})),e.up&&(t.up_mbps=parseInt(`${e.up}`,10)),e.down&&(t.down_mbps=parseInt(`${e.down}`,10)),["salamander","gecko"].includes(e.obfs)&&(t.obfs.type=e.obfs),e.obfs==="gecko"){let r=e["obfs-min-packet-size"],n=e["obfs-max-packet-size"],i=r!=null&&`${r}`!="",o=n!=null&&`${n}`!="";if(i||o){let s=i?li(`${r}`.trim()):void 0,a=o?li(`${n}`.trim()):void 0,u=a!=null?Math.min(a,2048):a,l=s??512,h=u??1200;o&&a!=null&&a>2048&&Q.warn(`Gecko obfs max packet size for proxy ${e.name} exceeds 2048, clamped to 2048: ${n}`),i&&(s==null||s<=0)||o&&(a==null||a<=0)||h<l?Q.error(`Invalid obfs packet size for proxy ${e.name}: min=${r} max=${n}`):(i&&(t.obfs.min_packet_size=s),o&&(t.obfs.max_packet_size=u))}}return e["obfs-password"]&&(t.obfs.password=e["obfs-password"]),t.obfs.type||delete t.obfs,e["bbr-profile"]&&(t.bbr_profile=e["bbr-profile"]),e["disable-chrome-parrot"]&&(t.disable_chrome_parrot=!!e["disable-chrome-parrot"]),Gi(e,t),Xa(e,t),Jn(e,t),pn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},EJ=(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`),Gi(e,t),Jn(e,t),pn(e,t),Xa(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},bJ=(e={},t=!1)=>{let r={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 e["client-metadata"]&&(r.client_metadata=`${e["client-metadata"]}`),/^\d+$/.test(e["idle-session-check-interval"])&&(r.idle_session_check_interval=`${e["idle-session-check-interval"]}s`),/^\d+$/.test(e["idle-session-timeout"])&&(r.idle_session_timeout=`${e["idle-session-timeout"]}s`),/^\d+$/.test(e["min-idle-session"])&&(r.min_idle_session=parseInt(`${e["min-idle-session"]}`,10)),e["disable-reuse"]!=null&&(r.disable_reuse=!!e["disable-reuse"]),pn(e,r),Xa(e,r),hn(e,r),dn(e,r),r},AJ=(e={})=>{let t=eJ(e),r=li(e._listen_port),n={tag:e.name,type:"tailscale",listen_port:r!=null&&r<=65535?r:void 0,taildrop_directory:typeof e._taildrop_directory=="string"?e._taildrop_directory:void 0,on_demand:typeof e._on_demand=="boolean"?e._on_demand:void 0,control_http_client:e["control-http-client"],udp_timeout:e["udp-timeout"],state_directory:e["state-dir"]||e["state-directory"],auth_key:e["auth-key"],control_url:e["control-url"],ephemeral:e.ephemeral,hostname:e.hostname,accept_routes:e["accept-routes"],exit_node:e["exit-node"],exit_node_allow_lan_access:e["exit-node-allow-lan-access"],advertise_routes:Array.isArray(e["advertise-routes"])?e["advertise-routes"]:void 0,advertise_exit_node:e["advertise-exit-node"],advertise_tags:Array.isArray(e["advertise-tags"])?e["advertise-tags"]:void 0,relay_server_static_endpoints:Array.isArray(e["relay-server-static-endpoints"])?e["relay-server-static-endpoints"]:void 0,system_interface:e["system-interface"],system_interface_name:e["system-interface-name"]};return/^\d+$/.test(e["system-interface-mtu"])&&(n.system_interface_mtu=parseInt(`${e["system-interface-mtu"]}`,10)),/^\d+$/.test(e["relay-server-port"])&&(n.relay_server_port=parseInt(`${e["relay-server-port"]}`,10)),t||(pn(e,n),hn(e,n),dn(e,n)),Ge(e["ssh-server"])?n.ssh_server={enabled:e["ssh-server"].enabled!==!1,disable_pty:e["ssh-server"]["disable-pty"],disable_sftp:e["ssh-server"]["disable-sftp"],disable_forwarding:e["ssh-server"]["disable-forwarding"]}:e["ssh-server"]&&(n.ssh_server=!!e["ssh-server"]),n},SJ=(e={})=>{let t=["ipv4","ipv6"].map(o=>bs(e,o)).filter(o=>o),r=li(e._listen_port),n=li(e._udp_nat_max),i={system:!!e.system,name:typeof e._name=="string"?e._name:void 0,listen_port:r!=null&&r<=65535?r:void 0,on_demand:typeof e._on_demand=="boolean"?e._on_demand:void 0,mtu:e.mtu?parseInt(`${e.mtu}`,10):void 0,udp_timeout:e["udp-timeout"],udp_nat_max:n!=null&&n<=4294967295?n:void 0,workers:e.workers?parseInt(`${e.workers}`,10):void 0,tag:e.name,type:"wireguard",server:e.server,server_port:parseInt(`${e.port}`,10),address:t,private_key:e["private-key"],peer_public_key:e["public-key"],pre_shared_key:e["pre-shared-key"],reserved:[]};for(let o of["udp_mapping","udp_filtering"])["endpoint_independent","address_dependent","address_and_port_dependent"].includes(e[`_${o}`])&&(i[o]=e[`_${o}`]);if(i.server_port<0||i.server_port>65535)throw"invalid port";if(e["fast-open"]&&(i.udp_fragment=!0),typeof e.reserved=="string")i.reserved=e.reserved;else if(Array.isArray(e.reserved))for(let o of e.reserved)i.reserved.push(o);else delete i.reserved;if((!Array.isArray(e.peers)||e.peers.length===0)&&(e.peers=[{}]),e.peers&&e.peers.length>0){i.peers=[];for(let o of e.peers){let s,a;o.server&&o.port?(s=o.server,a=parseInt(`${o.port}`,10)):(s=i.server,a=parseInt(`${i.server_port}`,10));let u=o["allowed-ips"]||o.allowed_ips||e["allowed-ips"]||e.allowed_ips;typeof u=="string"&&(u=u.split(",").map(h=>h.trim()).filter(Boolean)),(!Array.isArray(u)||u.length===0)&&(u=["0.0.0.0/0",...e.ipv6?["::/0"]:[]]);let l={address:s,port:a,persistent_keepalive_interval:o["persistent-keepalive-interval"]?parseInt(`${o["persistent-keepalive-interval"]}`,10):void 0,public_key:o["public-key"]||o.public_key||i.peer_public_key,pre_shared_key:o["pre-shared-key"]||o.pre_shared_key||i.pre_shared_key,allowed_ips:u,reserved:[]};if(typeof o.reserved=="string")l.reserved.push(o.reserved);else if(Array.isArray(o.reserved))for(let h of o.reserved)l.reserved.push(h);else delete l.reserved;(!Array.isArray(l.reserved)||l.reserved.length===0)&&(l.reserved=i.reserved),i.peers.push(l)}}return Jn(e,i),pn(e,i),Wi(e.smux,i),hn(e,i),dn(e,i),delete i.server,delete i.server_port,delete i.pre_shared_key,delete i.peer_public_key,delete i.reserved,i};function o2(){return{type:"ALL",produce:(r,n,i={})=>{let o=[],s=new Map(r.filter(u=>u?.plugin==="shadow-tls"&&u?.["plugin-opts"]).map(u=>[u,{plugin:u.plugin,"plugin-opts":u["plugin-opts"]?JSON.parse(JSON.stringify(u["plugin-opts"])):void 0,"obfs-opts":u["obfs-opts"]?JSON.parse(JSON.stringify(u["obfs-opts"])):void 0}]));if(Us().produce(r,"internal",{"include-unsupported-proxy":!0}).map(u=>{let l=o.length;try{let h=s.get(u);h&&(u.plugin=h.plugin,u["plugin-opts"]=h["plugin-opts"],h["obfs-opts"]?u["obfs-opts"]=h["obfs-opts"]:delete u["obfs-opts"]);let m=s2(u),p=!!(m&&(m.password||m.version!=null&&Number(m.version)!==0)),d;if(p&&["vmess","vless","trojan"].includes(u.type)){if(u["reality-opts"])throw new Error(`Platform sing-box cannot chain ShadowTLS with Reality for proxy ${u.name}`);if(["vmess","vless"].includes(u.type)&&u.network==="h2")throw new Error(`Platform sing-box cannot chain ShadowTLS with network h2 for proxy ${u.name}`);if(u.type==="vless"&&u.flow==="xtls-rprx-vision")throw new Error(`Platform sing-box cannot chain ShadowTLS with flow xtls-rprx-vision for proxy ${u.name}`);let v=m.version,g=typeof v=="string"&&v.trim()===""?NaN:Number(v??0),y=g===0?2:g;if(!Number.isInteger(y)||![1,2,3].includes(y))throw new Error(`Platform sing-box does not support shadow-tls version ${v} for proxy ${u.name}`);d=oS(u,{...m,version:y})}if(u.type==="anytls"&&p)throw new Error("Platform sing-box cannot replace AnyTLS TLS with ShadowTLS");if(["xhttp"].includes(u.network))throw new Error(`Platform sing-box does not support network: ${u.network}`);switch(u.type){case"ssh":o.push(nJ(u));break;case"http":o.push(sJ(u));break;case"socks5":if(u.tls)throw new Error(`Platform sing-box does not support proxy type: ${u.type} with tls`);o.push(iJ(u));break;case"ss":if(u.plugin==="shadow-tls"){let{ssPart:v,stPart:g}=oJ(u);o.push(v),o.push(g)}else o.push(aJ(u));break;case"ssr":if(i["include-unsupported-proxy"])o.push(uJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type}`);break;case"snell":{o.push(lJ(u,i["include-unsupported-proxy"]));let v=s2(u);v&&o.push(oS(u,v));break}case"vmess":if(!u.network||["tcp","ws","grpc","h2","http"].includes(u.network))o.push(pJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with network ${u.network}`);break;case"vless":if(u.encryption&&u.encryption!=="none")throw new Error("VLESS encryption is not supported");if(!u.flow||["xtls-rprx-vision"].includes(u.flow))o.push(mJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with flow ${u.flow}`);break;case"trojan":if(!u.flow)o.push(gJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with flow ${u.flow}`);break;case"naive":o.push(vJ(u));break;case"hysteria":o.push(wJ(u));break;case"hysteria2":o.push(yJ(u,i["include-unsupported-proxy"]));break;case"tuic":if(!u.token||u.token.length===0)o.push(EJ(u));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":o.push(SJ(u));break;case"anytls":o.push(bJ(u,i["include-unsupported-proxy"]));break;case"tailscale":o.push(AJ(u));break;default:throw new Error(`Platform sing-box does not support proxy type: ${u.type}`)}if(d){let v=o[l];v.detour=i2(u),delete v.tls,o.push(d)}if(i["include-unsupported-proxy"]&&u["name-cert-verify"])for(let v=l;v<o.length;v++){let g=o[v];g.tls&&(g.tls.certificate_server_name=u["name-cert-verify"])}}catch(h){o.length=l,Q.error(h.message??h)}}),n==="internal")return o;let a=o.reduce((u,l)=>(["wireguard","tailscale"].includes(l.type)?u.endpoints.push(l):u.outbounds.push(l),u),{outbounds:[],endpoints:[]});return JSON.stringify(a,null,2)}}}var fye=B(x());var _J={dual:"dual_stack",ipv4:"v4_only",ipv6:"v6_only","v4-only":"v4_only","v6-only":"v6_only","ipv4-prefer":"v4_prefer","ipv6-prefer":"v6_prefer","prefer-v4":"v4_prefer","prefer-v6":"v6_prefer"};function a2(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>!["http","https","socks5","ss","ssr","trojan","hysteria2","vless","vmess","tuic","wireguard","anytls","ssh","snell"].includes(s.type)||s.type==="ss"&&(s.plugin==="obfs"&&!["http","tls"].includes(s["plugin-opts"]?.mode)||!["chacha20-ietf-poly1305","chacha20-poly1305","aes-256-gcm","aes-128-gcm","none","tbale","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher))||s.type==="vmess"&&(!["h2","http","ws","tcp","grpc"].includes(s.network)&&s.network||!z9(s))||s.type==="trojan"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="vless"&&(!["h2","http","ws","tcp","grpc"].includes(s.network)&&s.network||!z9(s)||typeof s.flow<"u"&&!["xtls-rprx-vision",""].includes(s.flow))||s.type==="tuic"&&s.token&&s.token.length!==0||s.type==="snell"&&G9(s.version)===null||s.type==="ssr"&&!BJ(s)||["anytls"].includes(s.type)&&s.network&&!["tcp"].includes(s.network)?!1:!(["ws"].includes(s.network)&&s["ws-opts"]?.["v2ray-http-upgrade"])).map(s=>{let a=s;try{let u={...s},l;s.tls&&!s.sni&&(s.sni=s.server);let h=s.prev_hop||s["underlying-proxy"]||s["dialer-proxy"]||s.detour;if(s.type==="http")s={type:s.tls?"https":"http",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,...j9(s)?{headers:s.headers}:{},tfo:fi(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:yl(s)}:{}};else if(s.type==="https")s={type:"https",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,...j9(s)?{headers:s.headers}:{},tfo:fi(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:yl(s)};else if(s.type==="socks5")s={type:s.tls?"socks5_tls":"socks5",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,tfo:fi(s),udp_relay:Za(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:yl(s)}:{}};else if(s.type==="ss"){if(s={type:"shadowsocks",name:s.name,method:s.cipher==="chacha20-ietf-poly1305"?"chacha20-poly1305":s.cipher,server:s.server,port:s.port,password:s.password,tfo:fi(s),udp_relay:Za(s)},le(u,"plugin")){if(u.plugin==="obfs")s.obfs=u["plugin-opts"].mode,s.obfs_host=u["plugin-opts"].host,s.obfs_uri=u["plugin-opts"].path;else if(!["shadow-tls"].includes(u.plugin))throw new Error(`plugin ${u.plugin} is not supported`)}}else if(s.type==="ssr")s={type:"shadowsocksr",name:s.name,method:Y9(s.cipher),server:s.server,port:s.port,password:s.password,protocol:$p(s.protocol),protocol_param:s["protocol-param"],obfs:$p(s.obfs),obfs_param:s["obfs-param"],tfo:fi(s),udp_relay:Za(s)};else if(s.type==="hysteria2")s={type:"hysteria2",name:s.name,server:s.server,port:s.port,auth:s.password,...le(s,"up")?{bandwidth:parseInt(`${s.up}`.match(/\d+/)?.[0]||0,10)}:{},tfo:fi(s),udp_relay:Za(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]},u["obfs-password"]&&u.obfs=="salamander"&&(s.obfs="salamander",s.obfs_password=u["obfs-password"]);else if(s.type==="tuic")s={type:"tuic",name:s.name,server:s.server,port:s.port,uuid:s.uuid,password:s.password,sni:s.sni,alpn:Array.isArray(s.alpn)?s.alpn:[s.alpn||"h3"],skip_tls_verify:s["skip-cert-verify"],port_hopping:s.ports,port_hopping_interval:s["hop-interval"]};else if(s.type==="trojan")s.network==="ws"&&(s.websocket={path:s["ws-opts"]?.path,host:s["ws-opts"]?.headers?.Host}),s={type:"trojan",name:s.name,server:s.server,port:s.port,password:s.password,tfo:fi(s),udp_relay:Za(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:yl(s),websocket:s.websocket};else if(s.type==="anytls")s={type:"anytls",name:s.name,server:s.server,port:s.port,password:s.password,tfo:fi(s),udp_relay:Za(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:yl(s)};else if(s.type==="vmess"){let p=jr(s.cipher);s.network==="ws"?s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}}:s.network==="http"?s.transport={http1:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:s.network==="h2"?s.transport={http2:{method:s["h2-opts"]?.method,path:Array.isArray(s["h2-opts"]?.path)?s["h2-opts"]?.path[0]:s["h2-opts"]?.path,headers:W9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=V9(s):(s.network==="tcp"||!s.network)&&s.tls&&(s.transport={tls:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}});let d=!1;(le(s,"aead")&&!s.aead||le(s,"alterId")&&s.alterId!==0)&&(d=!0),s={type:"vmess",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:p,tfo:fi(s),legacy:d,udp_relay:Za(s),transport:s.transport}}else if(s.type==="vless"){if(s.encryption&&s.encryption!=="none")throw new Error("VLESS encryption is not supported");s.network==="ws"?s.transport={[s.tls?"wss":"ws"]:{path:s["ws-opts"]?.path,headers:{Host:s["ws-opts"]?.headers?.Host},sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0}}:s.network==="http"?s.transport={http1:{method:s["http-opts"]?.method,path:Array.isArray(s["http-opts"]?.path)?s["http-opts"]?.path[0]:s["http-opts"]?.path,headers:{Host:Array.isArray(s["http-opts"]?.headers?.Host)?s["http-opts"]?.headers?.Host[0]:s["http-opts"]?.headers?.Host},skip_tls_verify:s["skip-cert-verify"]}}:s.network==="h2"?s.transport={http2:{method:s["h2-opts"]?.method,path:Array.isArray(s["h2-opts"]?.path)?s["h2-opts"]?.path[0]:s["h2-opts"]?.path,headers:W9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=V9(s):(s.network==="tcp"||!s.network)&&(s.transport={[s.tls?"tls":"tcp"]:{sni:s.tls?s.sni:void 0,skip_tls_verify:s.tls?s["skip-cert-verify"]:void 0,reality:yl(s)}},l=s.flow,l===""&&(l=void 0)),s={type:"vless",name:s.name,server:s.server,port:s.port,user_id:s.uuid,security:s.cipher,tfo:fi(s),udp_relay:Za(s),transport:s.transport,flow:l}}else if(s.type==="wireguard")Array.isArray(s.peers)&&s.peers.length>0&&(s.server=s.peers[0].server,s.port=s.peers[0].port,s.ip=s.peers[0].ip,s.ipv6=s.peers[0].ipv6,s["public-key"]=s.peers[0]["public-key"],s["preshared-key"]=s.peers[0]["pre-shared-key"],s["allowed-ips"]=s.peers[0]["allowed-ips"],s.reserved=s.peers[0].reserved),s={type:"wireguard",name:s.name,local_ipv4:bs(s,"ipv4"),local_ipv6:bs(s,"ipv6"),server:s.server,port:s.port,private_key:s["private-key"],peer_public_key:s["public-key"],preshared_key:s["preshared-key"]??s["pre-shared-key"],reserved:s.reserved?Array.isArray(s.reserved)?s.reserved:s.reserved.split(/\s*\/\s*/).map(p=>p.trim()).filter(p=>p.length>0):void 0,dns_servers:s.dns?Array.isArray(s.dns)?s.dns:s.dns.split(/\s*,\s*/).map(p=>p.trim()).filter(p=>p.length>0):void 0,mtu:s.mtu,keepalive:s.keepalive};else if(s.type==="ssh")s={type:"ssh",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,private_key:s["private-key"],host_keys:s["host-key"],tfo:fi(s)};else if(s.type==="snell"){let p=G9(s.version);s={type:"snell",name:s.name,server:s.server,port:s.port,psk:s.psk,version:p,...p==null||p>=3?{udp_relay:Za(s)}:{},reuse:s.reuse,obfs:s["obfs-opts"]?.mode||s.obfs,obfs_host:s["obfs-opts"]?.host||s["obfs-host"]||s.obfs_host,tfo:fi(s)}}if(["http","https","socks5","ss","ssr","trojan","vless","vmess","anytls","ssh","snell"].includes(u.type)&&["shadow-tls"].includes(u.plugin)&&u["plugin-opts"]){if(u["plugin-opts"].version!=3)throw new Error(`shadow-tls version ${u["plugin-opts"].version} is not supported`);s.shadow_tls={password:u["plugin-opts"].password,sni:u["plugin-opts"].host}}let m=$J(u);if(m&&(PJ(u,s)&&(s.fingerprint_sha256=m),kJ(s.transport,m)),["socks5","ss","ssr","trojan","vless","vmess","wireguard","tuic","hysteria2","anytls","ssh","snell"].includes(u.type)&&(["on","true",!0,"1",1].includes(u["block-quic"])?s.block_quic=!0:["off","false",!1,"0",0].includes(u["block-quic"])&&(s.block_quic=!1)),["ss","ssr"].includes(u.type)&&s.shadow_tls&&u["udp-port"]>0&&u["udp-port"]<=65535&&(s.udp_port=u["udp-port"]),u["ip-version"]&&(s.ip_version=_J[u["ip-version"]]||u["ip-version"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],s.transport){for(let p in s.transport)p!=="grpc"&&(Object.keys(s.transport[p]).length===0||Object.values(s.transport[p]).every(d=>d==null))&&delete s.transport[p];Object.keys(s.transport).length===0&&delete s.transport}if(n!=="internal")for(let p in s)(s[p]==null||/^_/i.test(p))&&delete s[p];return{[s.type]:{...s,type:void 0,prev_hop:h}}}catch(u){return Q.error(`Cannot produce proxy: ${s.name}
|
||
Reason: ${u}`),null}}).filter(Boolean);return Uo(o,n,i)}}}function j9(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function fi(e){return!!(e.tfo??e["fast-open"])}function Za(e){return e.udp??e.udp_relay}function K9(e){if(e!=null&&!(typeof e=="string"&&e.length===0))return e}function yl(e){let t=e?.["reality-opts"];if(!t)return;let r={},n=K9(t["public-key"]),i=K9(t["short-id"]);return n!=null&&(r.public_key=n),i!=null&&(r.short_id=i),Object.keys(r).length>0?r:void 0}function V9(e){return{grpc:{service_name:e["grpc-opts"]?.["grpc-service-name"],sni:e.sni,reality:yl(e),skip_tls_verify:e["skip-cert-verify"]}}}function z9(e){if(e.network!=="grpc")return!0;let t=e["grpc-opts"]?.["_grpc-type"];return t==null?!0:`${t}`.trim().toLowerCase()==="gun"}function G9(e){if(e==null)return;let t=`${e}`.trim();return/^[1-5]$/.test(t)?parseInt(t,10):null}var CJ=["none","dummy","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","chacha20","chacha20-ietf","xchacha20"],DJ=["origin","auth_sha1_v4","auth_aes128_md5","auth_aes128_sha1","auth_chain_a","auth_chain_b"],FJ=["plain","http_simple","http_post","random_head","tls1.2_ticket_auth","tls1.2_ticket_fastauth"];function $p(e){if(e==null)return;let t=`${e}`.trim().toLowerCase();return t.length>0?t:void 0}function Y9(e){let t=$p(e);return t==="plain"?"none":t}function BJ(e){if(!CJ.includes(Y9(e.cipher)))return!1;let t=$p(e.protocol);if(t!=null&&!DJ.includes(t))return!1;let r=$p(e.obfs);return r==null||FJ.includes(r)}function IJ(e,...t){for(let r of t){let n=cS(e?.[r]);if(n)return n}}function xJ(e){return cS(e?.host)||IJ(e?.headers,"host","Host")}function W9(e){let t={};if(e?.headers&&typeof e.headers=="object"&&!Array.isArray(e.headers))for(let[n,i]of Object.entries(e.headers)){if(/^host$/i.test(n))continue;let o=cS(i);o!=null&&(t[n]=o)}let r=xJ(e);return r&&(t.Host=r),Object.keys(t).length>0?t:void 0}function cS(e){if(Array.isArray(e))return e[0];if(e!=null)return e}function $J(e){let t=e?.["tls-fingerprint"];if(typeof t!="string")return;let r=t.trim();return r.length>0?r:void 0}function PJ(e,t){return["anytls","https","hysteria2","trojan","tuic"].includes(e.type)||e.type==="socks5"&&t.type==="socks5_tls"||e.type==="http"&&t.type==="https"}function kJ(e,t){if(e)for(let r of["grpc","http2","tls","wss"])e[r]&&(e[r].fingerprint_sha256=t)}function X9(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var Z9={qx:Bp(),QX:Bp(),QuantumultX:Bp(),surge:th(),Surge:th(),SurgeMac:_p(),Loon:eS(),Clash:Xg(),clash:Xg(),meta:Us(),clashmeta:Us(),"clash.meta":Us(),"Clash.Meta":Us(),ClashMeta:Us(),mihomo:Us(),Mihomo:Us(),uri:rh(),URI:rh(),v2:Fp(),v2ray:Fp(),V2Ray:Fp(),json:X9(),JSON:X9(),stash:Zg(),Stash:Zg(),shadowrocket:Ip(),Shadowrocket:Ip(),ShadowRocket:Ip(),surfboard:n2(),Surfboard:n2(),singbox:o2(),"sing-box":o2(),egern:a2(),Egern:a2()};var nbe=B(x());var kEe=B(x()),nx=B(g2());var qQ=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 shadowTLS = {};
|
||
const xhttpOpts = { mode: "auto" };
|
||
let xhttpEnabled = false;
|
||
let clientFingerprint;
|
||
let echConfig;
|
||
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 (obfs.httpUpgrade) $set(proxy, "ws-opts.v2ray-http-upgrade", true);
|
||
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 (shadowTLS.password && !shadowTLS.version) {
|
||
shadowTLS.version = 2;
|
||
}
|
||
if (shadowTLS.password) {
|
||
if (shadowTLS.version < 2) {
|
||
throw new Error("shadow-tls version " + shadowTLS.version + " is not supported");
|
||
}
|
||
proxy.plugin = "shadow-tls";
|
||
proxy["plugin-opts"] = {
|
||
host: shadowTLS.host,
|
||
password: shadowTLS.password,
|
||
version: shadowTLS.version,
|
||
};
|
||
if (proxy.alpn) {
|
||
$set(proxy, "plugin-opts.alpn", proxy.alpn);
|
||
delete proxy.alpn;
|
||
}
|
||
}
|
||
}
|
||
function stripQuotes(value) {
|
||
const trimmed = value.trim();
|
||
const quote = trimmed[0];
|
||
if (
|
||
(quote === '"' || quote === "'") &&
|
||
trimmed[trimmed.length - 1] === quote
|
||
) {
|
||
return trimmed.slice(1, -1);
|
||
}
|
||
|
||
return trimmed;
|
||
}
|
||
function isQuotedEscape(text, index) {
|
||
return text[index] === "\\" &&
|
||
(text[index + 1] === '"' || text[index + 1] === "\\");
|
||
}
|
||
function unescapeQuotedValue(value) {
|
||
return value.replace(/\\(["\\])/g, "$1");
|
||
}
|
||
function readQuotedHeaderKey(text, start) {
|
||
const quote = text[start];
|
||
const withEscapes = proxy.type === "vless" && quote === '"';
|
||
let index = start + 1;
|
||
let hasKey = false;
|
||
|
||
while (index < text.length) {
|
||
const char = text[index];
|
||
if (withEscapes && isQuotedEscape(text, index)) {
|
||
hasKey = true;
|
||
index += 2;
|
||
continue;
|
||
}
|
||
if (char === quote) {
|
||
return hasKey ? index + 1 : -1;
|
||
}
|
||
|
||
hasKey = true;
|
||
index++;
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
function startsWithQuotedHeaderKey(text) {
|
||
const trimmed = text.trim();
|
||
if (trimmed[0] !== '"' && trimmed[0] !== "'") return false;
|
||
|
||
const index = readQuotedHeaderKey(trimmed, 0);
|
||
if (index === -1) return false;
|
||
|
||
let cursor = index;
|
||
while (cursor < trimmed.length && /\s/.test(trimmed[cursor])) cursor++;
|
||
return trimmed[cursor] === ":";
|
||
}
|
||
function stripOuterHeadersQuotes(headers) {
|
||
const trimmed = headers.trim();
|
||
const quote = trimmed[0];
|
||
|
||
if (
|
||
(quote === '"' || quote === "'") &&
|
||
trimmed[trimmed.length - 1] === quote &&
|
||
!startsWithQuotedHeaderKey(trimmed)
|
||
) {
|
||
return trimmed.slice(1, -1);
|
||
}
|
||
|
||
return trimmed;
|
||
}
|
||
function isHeaderKeyStart(text, start) {
|
||
let index = start;
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
|
||
if (text[index] === '"' || text[index] === "'") {
|
||
index = readQuotedHeaderKey(text, index);
|
||
if (index === -1) return false;
|
||
} else {
|
||
const keyStart = index;
|
||
while (
|
||
index < text.length &&
|
||
/[!#$%&'*+\-.^_|~0-9A-Za-z]/.test(text[index])
|
||
)
|
||
index++;
|
||
if (index === keyStart) return false;
|
||
}
|
||
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
return text[index] === ":";
|
||
}
|
||
function isOptionStart(text, start) {
|
||
let index = start;
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
|
||
const keyStart = index;
|
||
while (index < text.length && /[0-9A-Za-z-]/.test(text[index])) index++;
|
||
if (index === keyStart) return false;
|
||
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
return text[index] === "=";
|
||
}
|
||
function isHeaderValueQuoteEnd(text, index, pairSeparator, allowCommaEnd, containerQuote) {
|
||
let cursor = index + 1;
|
||
while (cursor < text.length && /\s/.test(text[cursor])) cursor++;
|
||
|
||
if (cursor >= text.length) return true;
|
||
if (allowCommaEnd && text[cursor] === "," && isOptionStart(text, cursor + 1)) {
|
||
return true;
|
||
}
|
||
if (text[cursor] === pairSeparator && isHeaderKeyStart(text, cursor + 1)) {
|
||
return true;
|
||
}
|
||
if (containerQuote && text[cursor] === containerQuote) {
|
||
let next = cursor + 1;
|
||
while (next < text.length && /\s/.test(text[next])) next++;
|
||
return next >= text.length || text[next] === ",";
|
||
}
|
||
|
||
return false;
|
||
}
|
||
function findHeaderSeparator(pair) {
|
||
let quote = "";
|
||
|
||
for (let index = 0; index < pair.length; index++) {
|
||
const char = pair[index];
|
||
|
||
if (quote) {
|
||
if (char === quote) {
|
||
quote = "";
|
||
}
|
||
continue;
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
quote = char;
|
||
continue;
|
||
}
|
||
|
||
if (char === ":") {
|
||
return index;
|
||
}
|
||
}
|
||
|
||
return -1;
|
||
}
|
||
function readUnquotedHeadersEnd(text, start, pairSeparator) {
|
||
let index = start;
|
||
let quote = "";
|
||
let quoteRole = "";
|
||
let seenSeparator = false;
|
||
|
||
while (index < text.length) {
|
||
const char = text[index];
|
||
|
||
if (quote) {
|
||
if (char === quote) {
|
||
if (
|
||
quoteRole === "key" ||
|
||
isHeaderValueQuoteEnd(text, index, pairSeparator, true)
|
||
) {
|
||
quote = "";
|
||
quoteRole = "";
|
||
}
|
||
}
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
quote = char;
|
||
quoteRole = seenSeparator ? "value" : "key";
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === ":" && !seenSeparator) {
|
||
seenSeparator = true;
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === pairSeparator && isHeaderKeyStart(text, index + 1)) {
|
||
seenSeparator = false;
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === ",") break;
|
||
index++;
|
||
}
|
||
|
||
return index;
|
||
}
|
||
function readQuotedHeadersEnd(text, start, pairSeparator) {
|
||
const quote = text[start];
|
||
const withEscapes = proxy.type === "vless";
|
||
let index = start + 1;
|
||
let innerQuote = "";
|
||
let quoteRole = "";
|
||
let seenSeparator = false;
|
||
|
||
while (index < text.length) {
|
||
const char = text[index];
|
||
if (withEscapes && isQuotedEscape(text, index)) {
|
||
index += 2;
|
||
continue;
|
||
}
|
||
|
||
if (innerQuote) {
|
||
if (char === innerQuote) {
|
||
if (
|
||
quoteRole === "key" ||
|
||
isHeaderValueQuoteEnd(text, index, pairSeparator, false, quote)
|
||
) {
|
||
innerQuote = "";
|
||
quoteRole = "";
|
||
}
|
||
}
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === quote) {
|
||
let cursor = index + 1;
|
||
while (cursor < text.length && /\s/.test(text[cursor])) cursor++;
|
||
if (cursor >= text.length || text[cursor] === ",") {
|
||
return index + 1;
|
||
}
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
innerQuote = char;
|
||
quoteRole = seenSeparator ? "value" : "key";
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === ":" && !seenSeparator) {
|
||
seenSeparator = true;
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (char === pairSeparator && isHeaderKeyStart(text, index + 1)) {
|
||
seenSeparator = false;
|
||
index++;
|
||
continue;
|
||
}
|
||
index++;
|
||
}
|
||
|
||
return text.length;
|
||
}
|
||
function readHeadersEnd(text, start, pairSeparator) {
|
||
let index = start;
|
||
while (index < text.length && /\s/.test(text[index])) index++;
|
||
|
||
if (
|
||
(text[index] === '"' || text[index] === "'") &&
|
||
!startsWithQuotedHeaderKey(text.slice(index))
|
||
) {
|
||
return readQuotedHeadersEnd(text, index, pairSeparator);
|
||
}
|
||
|
||
return readUnquotedHeadersEnd(text, start, pairSeparator);
|
||
}
|
||
function splitHeaders(headers, pairSeparator, withEscapes) {
|
||
const result = [];
|
||
let start = 0;
|
||
let quote = "";
|
||
let quoteRole = "";
|
||
let seenSeparator = false;
|
||
|
||
for (let index = 0; index < headers.length; index++) {
|
||
const char = headers[index];
|
||
if (withEscapes && isQuotedEscape(headers, index)) {
|
||
index++;
|
||
continue;
|
||
}
|
||
|
||
if (quote) {
|
||
if (char === quote) {
|
||
if (
|
||
quoteRole === "key" ||
|
||
isHeaderValueQuoteEnd(headers, index, pairSeparator, false)
|
||
) {
|
||
quote = "";
|
||
quoteRole = "";
|
||
}
|
||
}
|
||
continue;
|
||
}
|
||
|
||
if (char === '"' || char === "'") {
|
||
quote = char;
|
||
quoteRole = seenSeparator ? "value" : "key";
|
||
continue;
|
||
}
|
||
|
||
if (char === ":" && !seenSeparator) {
|
||
seenSeparator = true;
|
||
continue;
|
||
}
|
||
|
||
if (char === pairSeparator && isHeaderKeyStart(headers, index + 1)) {
|
||
result.push(headers.slice(start, index));
|
||
start = index + 1;
|
||
seenSeparator = false;
|
||
}
|
||
}
|
||
|
||
result.push(headers.slice(start));
|
||
return result;
|
||
}
|
||
function parseHeaders(headers, pairSeparator) {
|
||
const result = {};
|
||
const trimmed = headers.trim();
|
||
const content = stripOuterHeadersQuotes(trimmed);
|
||
const withEscapes = proxy.type === "vless" && content !== trimmed;
|
||
splitHeaders(content, pairSeparator, withEscapes).forEach((pair) => {
|
||
const index = findHeaderSeparator(pair);
|
||
if (index === -1) return;
|
||
|
||
const key = stripQuotes(pair.slice(0, index));
|
||
const value = stripQuotes(pair.slice(index + 1));
|
||
|
||
if (key) {
|
||
result[key] = withEscapes ? unescapeQuotedValue(value) : value;
|
||
}
|
||
});
|
||
return result;
|
||
}
|
||
function normalizeVmessSecurity(security) {
|
||
const normalized = String(security || "").trim().toLowerCase();
|
||
const supported = ["aes-128-gcm", "chacha20-ietf-poly1305"];
|
||
if (!supported.includes(normalized)) return "auto";
|
||
return normalized === "chacha20-ietf-poly1305" ? "chacha20-poly1305" : normalized;
|
||
}
|
||
function parseAlpn(value) {
|
||
return stripQuotes(value)
|
||
.split(",")
|
||
.map((item) => item.trim())
|
||
.filter((item) => item !== "");
|
||
}
|
||
}
|
||
|
||
start = (masque/anytls/shadowsocks/vmess/vless/trojan/h2_connect/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/trust_tunnel/direct/external) {
|
||
if (
|
||
["auto", "none", "apple-26", "chromium-155"].includes(clientFingerprint) &&
|
||
proxy.network !== "h3" &&
|
||
(proxy.tls || proxy.type === "trojan")
|
||
) {
|
||
proxy._surge_client_fingerprint = clientFingerprint;
|
||
if (clientFingerprint === "apple-26") proxy["client-fingerprint"] = "ios";
|
||
if (clientFingerprint === "chromium-155") proxy["client-fingerprint"] = "chrome";
|
||
}
|
||
if (
|
||
echConfig !== undefined &&
|
||
(proxy.tls || ["trojan", "tuic", "hysteria2"].includes(proxy.type))
|
||
) {
|
||
if (proxy["reality-opts"]) error("ECH cannot be combined with REALITY");
|
||
// Preserve malformed ECH for export validation so another parser cannot discard it.
|
||
const config = options.normalizeInlineEchConfigList(echConfig) ?? echConfig;
|
||
proxy["ech-opts"] = { enable: true, config };
|
||
}
|
||
return proxy;
|
||
}
|
||
|
||
shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/udp_relay/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/udp_port/proxy_policy_parameter/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_http_upgrade/ws_path/ws_headers/vmess_method/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "vmess";
|
||
proxy.cipher = proxy.cipher || "auto";
|
||
// 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();
|
||
}
|
||
vless = tag equals vless_address (vless_username/vless_option/reality_option/ws/ws_http_upgrade/ws_path/ws_headers/grpc/grpc_service_name/grpc_mode/grpc_authority/xhttp/xhttp_headers/xhttp_option/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy["packet-encoding"] = "xudp";
|
||
if (proxy["reality-opts"] && proxy["reality-opts"]["public-key"]) proxy.tls = true;
|
||
if (xhttpEnabled) {
|
||
proxy.network = "xhttp";
|
||
proxy["xhttp-opts"] = xhttpOpts;
|
||
} else {
|
||
handleWebsocket();
|
||
}
|
||
handleShadowTLS();
|
||
}
|
||
vless_address = "vless" address { proxy.type = "vless"; }
|
||
trojan = tag equals "trojan" address (passwordk/ws/ws_http_upgrade/ws_path/ws_headers/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "trojan";
|
||
handleWebsocket();
|
||
handleShadowTLS();
|
||
}
|
||
https = tag equals "https" address (username password)? (usernamek passwordk)? (headers/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "http";
|
||
proxy.tls = true;
|
||
handleShadowTLS();
|
||
}
|
||
h2_connect = tag equals "h2-connect" address (username password)? (usernamek passwordk)? (headers/max_streams/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "h2-connect";
|
||
proxy.tls = true;
|
||
handleShadowTLS();
|
||
}
|
||
http = tag equals "http" address (username password)? (usernamek passwordk)? (headers/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "http";
|
||
handleShadowTLS();
|
||
}
|
||
ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "ssh";
|
||
handleShadowTLS();
|
||
}
|
||
snell = tag equals ("snell"i/"opensnell"i) address (snell_version/snell_mode/snell_psk/obfs/obfs_host/obfs_uri/udp_relay/reuse/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/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/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/proxy_policy_parameter/others)* {
|
||
proxy.type = "tuic";
|
||
handleShadowTLS();
|
||
}
|
||
tuic_v5 = tag equals "tuic-v5" address (alpn/passwordk/uuidk/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/proxy_policy_parameter/others)* {
|
||
proxy.type = "tuic";
|
||
proxy.version = 5;
|
||
handleShadowTLS();
|
||
}
|
||
wireguard = tag equals "wireguard" (section_name/common_policy_parameter/proxy_only_parameter/ignored_policy_parameter)* {
|
||
if (!proxy["section-name"]) error("WireGuard requires section-name");
|
||
proxy.type = "wireguard-surge";
|
||
}
|
||
hysteria2 = tag equals "hysteria2" address (sni/cert_verify_name/alpn/tls_verification/client_cert/ech_config/passwordk/tls_fingerprint/download_bandwidth/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/salamander_password/gecko_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "hysteria2";
|
||
handleShadowTLS();
|
||
}
|
||
socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "socks5";
|
||
handleShadowTLS();
|
||
}
|
||
socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
|
||
proxy.type = "socks5";
|
||
proxy.tls = true;
|
||
handleShadowTLS();
|
||
}
|
||
anytls = tag equals "anytls" address (passwordk/reuse/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/proxy_policy_parameter/others)* {
|
||
proxy.type = "anytls";
|
||
proxy.tls = true;
|
||
}
|
||
trust_tunnel = tag equals "trust-tunnel" address (usernamek/passwordk/client_random_auth_key/headers/max_streams/reuse/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/h3/proxy_policy_parameter/others)* {
|
||
proxy.type = "trusttunnel";
|
||
proxy.tls = true;
|
||
}
|
||
masque = tag equals "masque" address (usernamek/passwordk/port_hopping/port_hopping_interval/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/udp_relay/proxy_policy_parameter/others)* {
|
||
proxy.type = "masque-surge";
|
||
proxy.tls = true;
|
||
}
|
||
|
||
direct = tag equals "direct"i (common_policy_parameter/interface_parameter/udp_relay/ignored_policy_parameter)* {
|
||
proxy.type = "direct";
|
||
}
|
||
|
||
external = tag equals "external" (external_exec/external_local_port/external_arg/external_address/udp_relay/proxy_policy_parameter/ignored_policy_parameter)* {
|
||
proxy.type = "external";
|
||
proxy.args = proxy.args || [];
|
||
proxy.addresses = proxy.addresses || [];
|
||
}
|
||
external_exec = comma "exec" equals value:quoted_value { if (proxy.exec === undefined) proxy.exec = value; }
|
||
external_local_port = comma "local-port" equals value:quoted_value { if (proxy["local-port"] === undefined) proxy["local-port"] = value; }
|
||
external_arg = comma "args" equals value:quoted_value {
|
||
proxy.args = proxy.args || [];
|
||
proxy.args.push(value);
|
||
}
|
||
external_address = comma "addresses" equals value:quoted_value {
|
||
proxy.addresses = proxy.addresses || [];
|
||
proxy.addresses.push(value);
|
||
}
|
||
|
||
proxy_policy_parameter = common_policy_parameter / interface_parameter / proxy_only_parameter
|
||
common_policy_parameter = ip_version / hybrid / tfo / fast_open / tos / block_quic / test_url / test_timeout / test_udp
|
||
interface_parameter = interface / allow_other_interface / dns_follow_interface
|
||
proxy_only_parameter = no_error_alert / ecn / underlying_proxy
|
||
ignored_policy_parameter = comma [^=,]+ equals quoted_value
|
||
|
||
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 = comma "port-hopping" equals value:(
|
||
'"' _ list:port_hopping_list _ '"' { return list; }
|
||
/ "'" _ list:port_hopping_list _ "'" { return list; }
|
||
/ port_hopping_list
|
||
) &(_ ("," / !.)) { proxy.ports = value.replace(/\s+/g, "").replace(/;/g, ","); }
|
||
port_hopping_list = $(port_hopping_range (_ [,;] _ port_hopping_range)*)
|
||
port_hopping_range = [0-9]+ ("-" [0-9]+)?
|
||
port_hopping_interval = comma "port-hopping-interval" equals match:$[0-9]+ { proxy["hop-interval"] = parseInt(match.trim()); }
|
||
|
||
username = & {
|
||
let j = peg$currPos;
|
||
let start, end;
|
||
let first = true;
|
||
while (j < input.length) {
|
||
if (input[j] === ',') {
|
||
if (first) {
|
||
start = j + 1;
|
||
first = false;
|
||
} else {
|
||
end = j;
|
||
break;
|
||
}
|
||
}
|
||
j++;
|
||
}
|
||
const match = input.substring(start, end);
|
||
if (match.indexOf("=") === -1) {
|
||
$.username = match;
|
||
peg$currPos = end;
|
||
return true;
|
||
}
|
||
} { proxy.username = $.username.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
password = comma match:[^,]+ { proxy.password = match.join("").replace(/^"(.*)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
|
||
tls = comma "tls" equals flag:bool { proxy.tls = flag; }
|
||
sni = comma "sni" equals match:[^,]+ {
|
||
const sni = match.join("").replace(/^"(.*)"$/, '$1');
|
||
if (sni === "off") {
|
||
proxy["disable-sni"] = true;
|
||
} else {
|
||
proxy.sni = sni;
|
||
}
|
||
}
|
||
cert_verify_name = comma "server-cert-verify-name" equals match:[^,]+ { proxy["name-cert-verify"] = stripQuotes(match.join("")); }
|
||
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(); }
|
||
client_fingerprint = comma "client-fingerprint" equals value:quoted_value { clientFingerprint = value.trim().toLowerCase(); }
|
||
client_cert = comma "client-cert" equals match:[^,]+ { proxy["keystore-client-cert"] = stripQuotes(match.join("")); }
|
||
ech_config = comma "ech-config" equals value:quoted_value { echConfig = value; }
|
||
|
||
snell_psk = comma "psk" equals value:quoted_value { proxy.psk = value; }
|
||
snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); }
|
||
snell_mode = comma "mode" equals match:[^,]+ {
|
||
const mode = stripQuotes(match.join("")).trim();
|
||
if (["default", "unshaped", "unsafe-raw"].includes(mode)) {
|
||
proxy.mode = mode;
|
||
}
|
||
}
|
||
|
||
usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
vmess_uuid = comma "username" equals match:[^,]+ { proxy.uuid = match.join(""); }
|
||
vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; }
|
||
// shortcut: keep text IDs as given, convert them to UUIDv5 when a target requires it.
|
||
vless_username = comma "username" equals value:quoted_value { proxy.uuid = value.trim(); }
|
||
vless_option = comma key:("flow"/"encryption") equals value:quoted_value { proxy[key] = value.trim(); }
|
||
reality_option = comma "reality-" key:("public-key"/"short-id") equals value:quoted_value { $set(proxy, "reality-opts." + key, value.trim()); }
|
||
client_random_auth_key = comma "client-random-auth-key" equals value:$[^,]* { proxy["client-random-auth-key"] = stripQuotes(value); }
|
||
|
||
method = comma "encrypt-method" equals cipher:cipher {
|
||
proxy.cipher = cipher;
|
||
}
|
||
vmess_method = comma "encrypt-method" equals cipher:$[^,]+ {
|
||
proxy.cipher = normalizeVmessSecurity(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 { if (flag) obfs.type = "ws"; }
|
||
ws_http_upgrade = comma "ws-http-upgrade" equals flag:bool { obfs.httpUpgrade = flag; }
|
||
ws_headers = comma "ws-headers" equals value:pipe_headers { obfs["ws-headers"] = value; }
|
||
pipe_headers = & {
|
||
const start = peg$currPos;
|
||
const index = readHeadersEnd(input, start, "|");
|
||
|
||
$.headers = input.substring(start, index);
|
||
peg$currPos = index;
|
||
return $.headers.trim().length > 0;
|
||
} { return parseHeaders($.headers, "|"); }
|
||
ws_path = comma "ws-path" equals path:(vless_quoted_value / value:uri { return stripQuotes(value); }) { obfs.path = path; }
|
||
grpc = comma "grpc" equals flag:bool { if (flag) proxy.network = "grpc"; }
|
||
grpc_service_name = comma "grpc-service-name" equals value:quoted_value { $set(proxy, "grpc-opts.grpc-service-name", value.trim()); }
|
||
grpc_mode = comma "grpc-mode" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-type", value.trim()); }
|
||
grpc_authority = comma "grpc-authority" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-authority", value.trim()); }
|
||
xhttp = comma "xhttp" equals flag:bool { xhttpEnabled = flag; }
|
||
xhttp_headers = comma "xhttp-headers" equals value:pipe_headers {
|
||
for (const key of Object.keys(value)) {
|
||
if (/^host$/i.test(key)) delete value[key];
|
||
}
|
||
xhttpOpts.headers = value;
|
||
}
|
||
xhttp_option = comma "xhttp-" key:$[a-z0-9-]+ equals value:quoted_value {
|
||
options.setSurgeXhttpOption(xhttpOpts, key, value.trim());
|
||
}
|
||
headers = comma "headers" equals & {
|
||
const start = peg$currPos;
|
||
const index = readHeadersEnd(input, start, ";");
|
||
|
||
$.headers = input.substring(start, index);
|
||
peg$currPos = index;
|
||
return $.headers.trim().length > 0;
|
||
} { proxy.headers = parseHeaders($.headers, ";"); }
|
||
|
||
obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; }
|
||
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); };
|
||
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:policy_bool { proxy.tfo = flag; }
|
||
reuse = comma "reuse" equals flag:bool { proxy.reuse = flag; }
|
||
ecn = comma "ecn" equals mode:policy_toggle { if (mode !== undefined) proxy.ecn = mode; }
|
||
tfo = comma "tfo" equals flag:policy_bool { proxy.tfo = flag; }
|
||
ip_version = comma "ip-version" equals value:quoted_value { proxy["ip-version"] = value.trim(); }
|
||
section_name = comma "section-name" equals value:quoted_value { proxy["section-name"] = value.trim(); }
|
||
no_error_alert = comma "no-error-alert" equals value:quoted_value { proxy["no-error-alert"] = value.trim(); }
|
||
underlying_proxy = comma "underlying-proxy" equals value:quoted_value { proxy["underlying-proxy"] = value.trim(); }
|
||
download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); }
|
||
test_url = comma "test-url" equals value:quoted_value { proxy["test-url"] = value.trim(); }
|
||
test_udp = comma "test-udp" equals value:quoted_value { proxy["test-udp"] = value.trim(); }
|
||
test_timeout = comma "test-timeout" equals value:quoted_value {
|
||
const seconds = value.trim();
|
||
if (/^(?:\d+(?:\.\d*)?|\.\d+)$/.test(seconds)) proxy["test-timeout"] = Number(seconds);
|
||
}
|
||
max_streams = comma "max-streams" equals match:quoted_integer { proxy["max-streams"] = match; }
|
||
quoted_integer = '"' match:$[0-9]+ '"' { return parseInt(match.trim()); } / "'" match:$[0-9]+ "'" { return parseInt(match.trim()); } / match:$[0-9]+ { return parseInt(match.trim()); }
|
||
tos = comma "tos" equals value:quoted_value {
|
||
const text = value.trim();
|
||
proxy.tos = /^(?:\d+|0x[\da-f]+)$/i.test(text) ? Number(text) : text;
|
||
}
|
||
interface = comma "interface" equals value:quoted_value { proxy.interface = value.trim(); }
|
||
allow_other_interface = comma "allow-other-interface" equals flag:policy_bool { proxy["allow-other-interface"] = flag; }
|
||
dns_follow_interface = comma "dns-follow-interface" equals flag:policy_bool { proxy["dns-follow-interface"] = flag; }
|
||
hybrid = comma "hybrid" equals mode:policy_toggle { if (mode !== undefined) proxy.hybrid = mode; }
|
||
policy_bool = value:quoted_value &{ return /^(?:true|false)$/.test(value.trim()); } { return value.trim() === "true"; }
|
||
policy_toggle = value:quoted_value {
|
||
const mode = value.trim();
|
||
if (mode === "true" || mode === "false") return mode === "true";
|
||
if (["auto", "on", "off"].includes(mode)) return mode;
|
||
}
|
||
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"] = stripQuotes(match.join("")); }
|
||
server_fingerprint = comma "server-fingerprint" equals match:[^,]+ { proxy["server-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
block_quic = comma "block-quic" equals value:quoted_value { proxy["block-quic"] = value.trim(); }
|
||
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]+ { shadowTLS.version = parseInt(match.trim()); }
|
||
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { shadowTLS.host = match.join(""); }
|
||
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { shadowTLS.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
token = comma "token" equals match:[^,]+ { proxy.token = match.join(""); }
|
||
alpn = comma "alpn" equals match:quoted_value {
|
||
const values = parseAlpn(match);
|
||
if (values.length > 0) proxy.alpn = values;
|
||
}
|
||
h3 = comma "h3" equals flag:bool { if (flag) proxy.network = "h3"; }
|
||
quoted_value
|
||
= '"' value:$(("\\" ('"' / "\\") / [^"])*) '"' &(_ ("," / !.)) { return proxy.type === "vless" ? unescapeQuotedValue(value) : value; }
|
||
/ '"' match:$[^"]* '"' { return match; }
|
||
/ "'" match:$[^']* "'" { return proxy.type === "vless" ? unescapeQuotedValue(match) : match; }
|
||
/ value:uri { return value.trim(); }
|
||
vless_quoted_value = &{ return proxy.type === "vless"; } value:quoted_value { return value.trim(); }
|
||
uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); }
|
||
salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); proxy.obfs = 'salamander'; }
|
||
gecko_password = comma "gecko-password" equals match:[^,]+ { proxy['obfs-password'] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); proxy.obfs = 'gecko'; }
|
||
|
||
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
|
||
comma = _ "," _
|
||
equals = _ "=" _
|
||
_ = [ \r\t]*
|
||
bool = b:("true"/"false") { return b === "true" }
|
||
others = comma [^=,]+ equals [^=,]+
|
||
`,IS;function Kr(){if(!IS){let e=nx.default.generate(qQ);IS={parse:t=>e.parse(t,{normalizeInlineEchConfigList:Kg,setSurgeXhttpOption:QI})}}return IS}var OEe=B(x()),sx=B(g2());var jQ=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 xhttpOpts = {};
|
||
const vlessEncryption = {};
|
||
const shadowTLS = {};
|
||
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);
|
||
} else if (transport.type === "xhttp") {
|
||
if (proxy.type === "vmess" && proxy.alterId !== 0) {
|
||
throw new Error("VMess XHTTP requires AEAD");
|
||
}
|
||
proxy.network = "xhttp";
|
||
proxy.udp ??= false;
|
||
if (transport.path != null) xhttpOpts.path = transport.path;
|
||
if (transport.host != null) xhttpOpts.host = transport.host;
|
||
const download = xhttpOpts["download-settings"];
|
||
if (download) {
|
||
download.tls ??= Boolean(download["reality-opts"]?.["public-key"]);
|
||
const fingerprint = loonClientFingerprint(download._loon_tls_profile);
|
||
if (fingerprint) download["client-fingerprint"] = fingerprint;
|
||
}
|
||
proxy["xhttp-opts"] = xhttpOpts;
|
||
}
|
||
}
|
||
|
||
function handleShadowTLS() {
|
||
if (shadowTLS.password) {
|
||
if (shadowTLS.version < 2) {
|
||
throw new Error("shadow-tls version " + shadowTLS.version + " is not supported");
|
||
}
|
||
proxy.plugin = "shadow-tls";
|
||
proxy["plugin-opts"] = {
|
||
host: shadowTLS.host,
|
||
password: shadowTLS.password,
|
||
version: shadowTLS.version,
|
||
};
|
||
if (proxy.alpn) {
|
||
$set(proxy, "plugin-opts.alpn", proxy.alpn);
|
||
delete proxy.alpn;
|
||
}
|
||
}
|
||
}
|
||
|
||
function normalizeVmessSecurity(security) {
|
||
const normalized = String(security || "").trim().toLowerCase();
|
||
const supported = ["none", "auto", "aes-128-gcm", "chacha20-ietf-poly1305"];
|
||
if (!supported.includes(normalized)) return "auto";
|
||
return normalized === "chacha20-ietf-poly1305" ? "chacha20-poly1305" : normalized;
|
||
}
|
||
|
||
function loonClientFingerprint(tlsProfile) {
|
||
switch (String(tlsProfile || "").trim()) {
|
||
case "chrome":
|
||
case "chrome147":
|
||
return "chrome";
|
||
case "safari-ios18":
|
||
case "safari-ios-26":
|
||
return "ios";
|
||
}
|
||
}
|
||
}
|
||
|
||
start = (shadowsocksr/shadowsocks/vmess/vless/trojan/https/http/socks5/hysteria2/anytls/tailscale/snell/mieru) {
|
||
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/tls_profile/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/others)*{
|
||
proxy.type = "ssr";
|
||
// handle ssr obfs
|
||
proxy.obfs = obfs.type;
|
||
handleShadowTLS();
|
||
}
|
||
shadowsocks = tag equals "shadowsocks"i address method password (obfs_typev obfs_hostv)? (obfs_ss/obfs_host/obfs_uri/fast_open/udp_relay/udp_port/tls_profile/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/ip_mode/block_quic/udp_over_tcp/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);
|
||
}
|
||
handleShadowTLS();
|
||
}
|
||
vmess = tag equals "vmess"i address vmess_method uuid (xhttp_transport/transport/transport_host/transport_path/xhttp_option/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/vmess_alterId/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* {
|
||
proxy.type = "vmess";
|
||
proxy.cipher = proxy.cipher || "auto";
|
||
proxy.alterId = proxy.alterId || 0;
|
||
handleTransport();
|
||
}
|
||
vless = tag equals "vless"i address uuid (xhttp_transport/transport/transport_host/transport_path/xhttp_option/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/flow/vless_encryption/public_key/short_id/block_quic/others)* {
|
||
proxy.type = "vless";
|
||
const { mode, rtt, padding, "public-keys": publicKeys } = vlessEncryption;
|
||
if (mode && mode !== "none") {
|
||
if (!publicKeys) throw new Error("VLESS encryption requires public keys");
|
||
proxy.encryption = ["mlkem768x25519plus", mode, rtt || "0rtt", padding, publicKeys].filter(Boolean).join(".");
|
||
}
|
||
handleTransport();
|
||
}
|
||
trojan = tag equals "trojan"i address password (xhttp_transport/transport/transport_host/transport_path/xhttp_option/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/others)* {
|
||
proxy.type = "trojan";
|
||
handleTransport();
|
||
}
|
||
anytls = tag equals "anytls"i address password (transport/transport_host/transport_path/over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/public_key/short_id/block_quic/idle_session_check_interval/idle_session_timeout/min_idle_session/max_stream_count/others)* {
|
||
proxy.type = "anytls";
|
||
handleTransport();
|
||
}
|
||
hysteria2 = tag equals "hysteria2"i address password (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/udp_relay/fast_open/download_bandwidth/server_ports/hop_interval/salamander_password/ecn/ip_mode/block_quic/others)* {
|
||
proxy.type = "hysteria2";
|
||
}
|
||
https = tag equals "https"i address (username password)? (tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "http";
|
||
proxy.tls = true;
|
||
}
|
||
http = tag equals "http"i address (username password)? (fast_open/udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "http";
|
||
}
|
||
socks5 = tag equals "socks5"i address (username password)? (over_tls/tls_name/sni/tls_verification/tls_cert_sha256/tls_pubkey_sha256/tls_profile/alpn/fast_open/udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "socks5";
|
||
}
|
||
tailscale = tag equals "tailscale"i (tailscale_string/tailscale_bool/tailscale_mtu/idle_session_timeout/udp_relay/block_quic/others)* {
|
||
proxy.type = "tailscale";
|
||
if (proxy["exit-node"] === "auto") proxy["exit-node"] = "auto:any";
|
||
if (proxy["exit-node"] === "none") proxy["exit-node"] = "";
|
||
}
|
||
snell = tag equals ("snell"i/"opensnell"i) address snell_positional_psk? (snell_psk/snell_version/snell_obfs/obfs_host/obfs_uri/udp_relay/ip_mode/block_quic/others)* {
|
||
if (!proxy.psk) throw new Error("Missing Snell PSK");
|
||
proxy.type = "snell";
|
||
proxy.version ??= 4;
|
||
proxy.udp ??= false;
|
||
if (obfs.type === "http") {
|
||
proxy["obfs-opts"] = { mode: obfs.type, host: obfs.host, path: obfs.path };
|
||
}
|
||
}
|
||
mieru = tag equals "mieru"i address comma user:option_value comma pass:option_value (udp_relay/ip_mode/block_quic/others)* {
|
||
proxy.type = "mieru";
|
||
proxy.transport = "TCP";
|
||
proxy.username = user;
|
||
proxy.password = pass;
|
||
proxy.udp ??= false;
|
||
}
|
||
|
||
tailscale_string = comma key:("auth-key"/"control-url"/"hostname"/"exit-node"/"path-mode"/"ip-mode") equals value:(
|
||
'"' match:$[^"]* '"' { return match; }
|
||
/ match:$[^,"]* { return match.trim(); }
|
||
) {
|
||
if (value !== "" || key === "exit-node") {
|
||
proxy[key === "ip-mode" ? "ip-version" : key] = value;
|
||
}
|
||
}
|
||
tailscale_bool = comma key:("accept-routes"/"accept-dns"/"magic-dns") equals flag:bool { proxy[key] = flag; }
|
||
tailscale_mtu = comma "mtu" equals match:$[0-9]+ { proxy.mtu = Number(match); }
|
||
|
||
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;
|
||
}
|
||
vmess_method = comma cipher:$[^,]+ {
|
||
proxy.cipher = normalizeVmessSecurity(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 value:option_value { obfs.host = value; }
|
||
obfs_uri = comma "obfs-uri" equals value:option_value { obfs.path = value; }
|
||
|
||
snell_positional_psk = comma psk:quoted_value { proxy.psk = psk; }
|
||
snell_psk = comma "psk" equals psk:option_value { proxy.psk = psk; }
|
||
snell_version = comma "version" equals version:$[0-9]+ { proxy.version = Number(version); }
|
||
snell_obfs = comma ("obfs-name"/"obfs") equals type:("none"/"http") { obfs.type = type; }
|
||
|
||
transport = comma "transport" equals type:("tcp"/"ws"/"http") { transport.type = type; }
|
||
transport_host = comma "host" equals value:option_value { transport.host = value; }
|
||
transport_path = comma "path" equals value:option_value { transport.path = value; }
|
||
|
||
xhttp_transport = comma "transport" equals "xhttp" { transport.type = "xhttp"; }
|
||
xhttp_option = comma "xhttp-" key:$[a-z0-9-]+ equals value:option_value {
|
||
options.setLoonXhttpOption(xhttpOpts, key, value);
|
||
}
|
||
|
||
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]+ { shadowTLS.version = parseInt(match.trim()); }
|
||
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { shadowTLS.host = match.join(""); }
|
||
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { shadowTLS.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
|
||
|
||
over_tls = comma "over-tls" equals flag:bool { proxy.tls = flag; }
|
||
tls_name = comma sni:("tls-name") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
sni = comma "sni" equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
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'); }
|
||
tls_profile = comma "tls-profile" equals match:[^,]+ {
|
||
const tlsProfile = match.join("").replace(/^"(.*)"$/, '$1').trim();
|
||
proxy["_loon_tls_profile"] = tlsProfile;
|
||
const clientFingerprint = loonClientFingerprint(tlsProfile);
|
||
if (clientFingerprint) proxy["client-fingerprint"] = clientFingerprint;
|
||
}
|
||
alpn = comma "alpn" equals match:option_value {
|
||
const values = match
|
||
.split(",")
|
||
.map((item) => item.trim())
|
||
.filter((item) => item !== "");
|
||
if (values.length > 0) proxy.alpn = values;
|
||
}
|
||
|
||
flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
vless_encryption = comma "encryption-" key:("mode"/"rtt"/"public-keys"/"padding") equals value:option_value {
|
||
vlessEncryption[key] = value;
|
||
}
|
||
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 value:option_value { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = value; }
|
||
|
||
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(""); }
|
||
server_ports = comma "server-ports" equals '"' match:$[^"]+ '"' { proxy.ports = match.trim().replace(/\s*-\s*/g, "-").replace(/\s*,\s*/g, ","); }
|
||
hop_interval = comma "hop-interval" equals match:$[0-9]+ { proxy["hop-interval"] = parseInt(match, 10); }
|
||
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"; }
|
||
|
||
idle_session_check_interval = comma "idle-session-check-interval" equals match:$[0-9]+ { proxy["idle-session-check-interval"] = parseInt(match.trim()); }
|
||
idle_session_timeout = comma "idle-session-timeout" equals match:$[0-9]+ { proxy["idle-session-timeout"] = parseInt(match.trim()); }
|
||
min_idle_session = comma "min-idle-session" equals match:$[0-9]+ { proxy["min-idle-session"] = parseInt(match.trim()); }
|
||
max_stream_count = comma "max-stream-count" equals match:$[0-9]+ { proxy["max-stream-count"] = parseInt(match.trim()); }
|
||
|
||
udp_over_tcp = comma "udp-over-tcp" equals flag:bool { proxy["udp-over-tcp"] = true; proxy["udp-over-tcp-version"] = 2; }
|
||
|
||
server_dns = comma "server-dns" equals value:(
|
||
'"' match:$[^"]* '"' { return match; }
|
||
/ $(!(comma [a-zA-Z0-9_-]+ equals) [^"])*
|
||
) {
|
||
proxy["server-dns"] = value.split(",").map((item) => item.trim()).filter(Boolean);
|
||
}
|
||
|
||
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
|
||
quoted_value = '"' match:$[^"]* '"' { return match; }
|
||
option_value = quoted_value / match:$[^,"]* { return match.trim(); }
|
||
comma = _ "," _
|
||
equals = _ "=" _
|
||
_ = [ \r\t]*
|
||
bool = b:("true"/"false") { return b === "true" }
|
||
others = server_dns / (comma [^=,]+ equals [^=,]+)
|
||
`,xS;function Ss(){if(!xS){let e=sx.default.generate(jQ);xS={parse:t=>e.parse(t,{setLoonXhttpOption:b9})}}return xS}var LEe=B(x()),PS=B(oa()),ix=B(g2());function KQ(e){if(typeof e!="string")return;let t=e.trim().replace(/:/g,"");if(!t||t.length%2||/[^0-9a-f]/i.test(t))return;let r=PS.Buffer.from(t,"hex"),n=[];for(let i=0;i<r.length;){let o=r[i++];if(!o||i+o>r.length)return;n.push(r.subarray(i,i+o).toString("utf8")),i+=o}return n}var VQ=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 $ = {};
|
||
let mieruUdpOverTcp = false;
|
||
|
||
function setQxHttpObfs(type) {
|
||
// Preserve the original QX http-obfs token for round-trip output,
|
||
// including the upstream "vemss-http" typo that appears in QX
|
||
// examples.
|
||
proxy._qx_obfs_http = type;
|
||
obfs.type = "http";
|
||
return type;
|
||
}
|
||
|
||
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;
|
||
// Some QX share links use obfs-host as the TLS server name for
|
||
// plain over-tls TCP nodes instead of the explicit tls-host field.
|
||
// Accept it as a compatibility alias, but do not override tls-host.
|
||
if (obfs.host && !proxy.sni) {
|
||
proxy.sni = obfs.host;
|
||
}
|
||
} 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/anytls/mieru/hysteria2/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/reality_base64_pubkey/reality_hex_shortid/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/reality_base64_pubkey/reality_hex_shortid/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') {
|
||
proxy.tls = true;
|
||
if (obfs.host) {
|
||
proxy.sni = obfs.host;
|
||
}
|
||
}
|
||
if (obfs.type && obfs.type !== 'over-tls') {
|
||
$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_vmess/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/reality_base64_pubkey/reality_hex_shortid/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_vless/obfs_host/obfs_uri/udp_relay/udp_over_tcp/fast_open/aead/server_check_url/reality_base64_pubkey/reality_hex_shortid/vless_flow/others)* {
|
||
proxy.type = "vless";
|
||
proxy.cipher = proxy.cipher || "none";
|
||
handleObfs();
|
||
}
|
||
|
||
anytls = "anytls" equals address
|
||
(password/over_tls/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/tag/udp_relay/fast_open/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
proxy.type = "anytls";
|
||
proxy.tls = true;
|
||
}
|
||
|
||
mieru = "mieru" 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/udp_relay/mieru_udp_over_tcp/fast_open/server_check_url/reality_base64_pubkey/reality_hex_shortid/others)* {
|
||
proxy.type = "mieru";
|
||
proxy.udp = proxy.udp === true && mieruUdpOverTcp;
|
||
}
|
||
|
||
hysteria2 = "hysteria2" equals address
|
||
(password/tls_host/tls_pubkey_sha256/tls_alpn/tls_no_session_ticket/tls_no_session_reuse/tls_fingerprint/tls_verification/udp_relay/download_bandwidth/hysteria2_obfs_password/port_hopping/port_hopping_interval/server_check_url/tag/others)* {
|
||
proxy.type = "hysteria2";
|
||
proxy.tls = true;
|
||
}
|
||
|
||
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/reality_base64_pubkey/reality_hex_shortid/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/reality_base64_pubkey/reality_hex_shortid/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:$((!next_parameter .)+) { proxy.password = password.trim(); }
|
||
next_parameter = "," _ [^=,]+ equals
|
||
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"); } }
|
||
mieru_udp_over_tcp = comma "udp-over-tcp" equals raw:$[^,]* {
|
||
const value = raw.trim();
|
||
if (value !== "true" && value !== "false") {
|
||
throw new Error("mieru udp-over-tcp must be true or false");
|
||
}
|
||
mieruUdpOverTcp = value === "true";
|
||
}
|
||
|
||
download_bandwidth = comma "download-bandwidth" equals value:$[^,]+ { proxy.down = value.trim(); }
|
||
hysteria2_obfs_password = comma type:("salamander"/"gecko") "-password" equals value:$((!next_parameter .)*) {
|
||
if (proxy.obfs && proxy.obfs !== type) {
|
||
throw new Error("QX Hysteria 2 cannot combine salamander-password and gecko-password");
|
||
}
|
||
const password = value.trim();
|
||
if (options.byteLength(password, "utf8") < 4) {
|
||
throw new Error("QX Hysteria 2 " + type + "-password must be at least 4 bytes");
|
||
}
|
||
proxy.obfs = type;
|
||
proxy["obfs-password"] = password;
|
||
}
|
||
port_hopping = comma "port-hopping" equals ports:$(hopping_port (comma hopping_port)*) {
|
||
proxy.ports = ports.replace(/\s/g, "");
|
||
}
|
||
hopping_port = [0-9]+ (_ "-" _ [0-9]+)?
|
||
port_hopping_interval = comma "port-hopping-interval" equals interval:$[0-9]+ {
|
||
const seconds = Number(interval);
|
||
if (seconds >= 5 && seconds <= 3600) {
|
||
proxy["hop-interval"] = seconds;
|
||
}
|
||
}
|
||
|
||
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 sni:("tls-host") equals match:[^,]+ { proxy.sni = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
tls_verification = comma "tls-verification" equals raw:$[^,]+ {
|
||
const value = raw.trim();
|
||
if (value === "true" || value === "false") {
|
||
proxy["skip-cert-verify"] = value !== "true";
|
||
} else {
|
||
proxy["name-cert-verify"] = value;
|
||
}
|
||
}
|
||
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:("tls"/"wss"/"ws"/"over-tls") { obfs.type = type; return type; }
|
||
/ type:("http"/"vmess-http"/"vemss-http"/"shadowsocks-http") {
|
||
// QX accepts multiple http-obfs spellings for ss/vmess/vless; keep
|
||
// the original token so QX output can round-trip it unchanged.
|
||
return setQxHttpObfs(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_vmess = comma "obfs" equals (
|
||
type:("wss"/"ws"/"over-tls") { obfs.type = type; return type; }
|
||
/ type:("http"/"vmess-http"/"vemss-http"/"shadowsocks-http") {
|
||
// QX accepts multiple http-obfs spellings for ss/vmess/vless; keep
|
||
// the original token so QX output can round-trip it unchanged.
|
||
return setQxHttpObfs(type);
|
||
}
|
||
);
|
||
obfs_vless = comma "obfs" equals (
|
||
type:("wss"/"ws"/"over-tls") { obfs.type = type; return type; }
|
||
/ type:("http"/"vmess-http"/"vemss-http"/"shadowsocks-http") {
|
||
// QX accepts multiple http-obfs spellings for ss/vmess/vless; keep
|
||
// the original token so QX output can round-trip it unchanged.
|
||
return setQxHttpObfs(type);
|
||
}
|
||
);
|
||
|
||
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||
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; }
|
||
|
||
reality_base64_pubkey = comma "reality-base64-pubkey" equals param:$[^=,]+ {
|
||
$set(proxy, "reality-opts.public-key", param);
|
||
}
|
||
reality_hex_shortid = comma "reality-hex-shortid" equals param:$[^=,]+ {
|
||
$set(proxy, "reality-opts.short-id", param);
|
||
}
|
||
|
||
vless_flow = comma "vless-flow" equals param:$[^=,]+ { proxy["flow"] = param; }
|
||
server_check_url = comma "server_check_url" equals param:$[^,]+ { proxy["test-url"] = param.trim(); }
|
||
|
||
uri = $[^,]+
|
||
|
||
tag = comma "tag" equals tag:[^=,]+ { proxy.name = tag.join(""); }
|
||
others = comma [^=,]+ equals [^=,]+
|
||
comma = _ "," _
|
||
equals = _ "=" _
|
||
_ = [ \r\t]*
|
||
bool = b:("true"/"false") { return b === "true" }
|
||
`,$S;function pi(){if(!$S){let e=ix.default.generate(VQ);$S={parse(t,r){let n=e.parse(t,{...r,byteLength:PS.Buffer.byteLength}),i=KQ(n["tls-alpn"]);return i&&(n.alpn=i),n}}}return $S}var qEe=B(x());var zQ=new Set(["__proto__","constructor","prototype"]),kS;function Qa(e,t,r){if(Object(e)!==e)return e;if(Array.isArray(t)||(t=t.toString().match(/[^.[\]]+/g)||[]),t.some(n=>zQ.has(n)))throw new Error("Unsafe property path");return t.slice(0,-1).reduce((n,i,o)=>Object.prototype.hasOwnProperty.call(n,i)&&Object(n[i])===n[i]?n[i]:n[i]=Math.abs(t[o+1])>>0===+t[o+1]?[]:{},e)[t[t.length-1]]=r,e}function v2(e){if(e!=null)return/(TRUE)|1/i.test(e)}function ox(e){return li(e)!=null}function RS(e){try{return decodeURIComponent(e)}catch{return e}}function GQ(e){let t={},r=e.match(/^trojan:\/\/([^@]+)@(\[[^\]]+\]|[^/?#]+):(\d+)(?:\/)?(?:\?([^#]*))?(?:#(.*))?$/);if(!r)throw new Error("Invalid trojan url");let[,n,i,o,s,a]=r,u=i.replace(/^\[|\]$/g,"");if((i.startsWith("[")||i.includes(":"))&&!Xt(u))throw new Error(`Invalid server: ${i}`);if(t.type="trojan",t.password=RS(n),t.server=i,t.port=Number(o),!Number.isSafeInteger(t.port)||t.port<1||t.port>65535)throw new Error(`Invalid port: ${o}`);t.name=a?RS(a):`${i}:${o}`;let l={};if(s)for(let h of s.split("&")){let m=h.indexOf("="),p=m===-1?h:h.slice(0,m);l[p]=m===-1?!0:RS(h.slice(m+1))}if(t["skip-cert-verify"]=v2(l.allowInsecure),t.sni=l.sni||l.peer,t["client-fingerprint"]=l.fp??l["client-fingerprint"],t["tls-fingerprint"]=l.pcs,t._vcn=l.vcn?.split(",").map(h=>h.trim()).filter(Boolean),t["name-cert-verify"]=t._vcn?.[0],l.alpn&&(t.alpn=l.alpn.split(",")),v2(l.ws)&&(t.network="ws",Qa(t,"ws-opts.path",l.wspath)),l.type){let h=!1,m="",p="";if(t.network=l.type,t.network==="httpupgrade"&&(t.network="ws",h=!0),t.network==="grpc")t["grpc-opts"]={"grpc-service-name":l.serviceName,"_grpc-type":l.mode,"_grpc-authority":l.authority};else{if(l.path){let d=l.path;if(t.network==="ws"){let v=ml(d,"ed");ox(v)&&(d=As(d,"ed").path,h?m=v:p=v)}Qa(t,`${t.network}-opts.path`,d)}l.host&&Qa(t,`${t.network}-opts.headers.Host`,l.host),h?(m=m||(ox(l.ed)?String(l.ed):""),Qa(t,"ws-opts.v2ray-http-upgrade",!0),m&&(Qa(t,"ws-opts.v2ray-http-upgrade-fast-open",!0),Qa(t,"ws-opts._v2ray-http-upgrade-ed",m))):t.network==="ws"&&p&&(Qa(t,"ws-opts.max-early-data",li(p)),Qa(t,"ws-opts.early-data-header-name","Sec-WebSocket-Protocol"))}if(l.security==="reality"){let d={};l.pbk&&(d["public-key"]=l.pbk),l.sid&&(d["short-id"]=l.sid),l.spx&&(d["_spider-x"]=l.spx),l.mode&&(t._mode=l.mode),l.extra&&(t._extra=l.extra),Object.keys(d).length&&Qa(t,"reality-opts",d)}}return t.udp=v2(l.udp),t.tfo=v2(l.tfo),t}function TS(){return kS||(kS={parse:GQ}),kS}var US=B(LS());var qo=B(Va());function HS(e){let[t,r,n]=/^(.*?)(?:#(.*?))?$/.exec(e);return{content:r,fragment:n!=null?decodeURIComponent(n):void 0}}function WQ(e){let t=e.indexOf(":");if(t!==-1)return[decodeURIComponent(e.slice(0,t)),decodeURIComponent(e.slice(t+1))].join(":");let r=decodeURIComponent(e);return r.includes(":")?r:bt.decode(r)}function MS(e){return e==null||!/^\d+$/.test(`${e}`)?!1:Number.isSafeInteger(parseInt(`${e}`,10))}function qS(e){let t=ml(e,"ed");return MS(t)?{path:As(e,"ed").path,ed:t}:{path:e,ed:""}}function jS(e){let t=`${e}`;if(!/^\d+$/.test(t))throw new Error(`bad WebSocket max early data size: ${e}`);let r=parseInt(t,10);if(!Number.isSafeInteger(r))throw new Error(`bad WebSocket max early data size: ${e}`);return r}function KS(e){if(Array.isArray(e))return e.flatMap(r=>KS(r)||[]);if(typeof e!="string")return e==null?void 0:[e];let t=e.split(",").map(r=>r.trim()).filter(Boolean);return t.length>0?t:void 0}function YQ(e){if(e==null)return null;let t=`${e}`.trim();if(!t)return null;let[,r=t,n]=/^(.*?)(?:\/(\d+))?$/.exec(t)||[],i=`${r}`.trim().replace(/^\[/,"").replace(/\]$/,""),o=(s,a)=>{if(s==null||!/^\d+$/.test(s))return;let u=parseInt(s,10);if(!(u<0||u>a))return u};return _r(i)?{family:"ipv4",address:i,cidr:o(n,32)}:Xt(i)?{family:"ipv6",address:i,cidr:o(n,128)}:null}function XQ(){return{name:"URI PROXY Parser",test:n=>/^(socks5\+tls|socks5|http|https):\/\//.test(n),parse:n=>{let[i,o,s,a,u,l,h,m,p]=n.match(/^(socks5|http|http)(\+tls|s)?:\/\/(?:(.*?):(.*?)@)?(.*?)(?::(\d+?))?\/?(\?.*?)?(?:#(.*?))?$/);if(h)h=parseInt(h,10);else{if(s)h=443;else if(o==="http")h=80;else throw Q.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);Q.info(`port is not present in line: ${n}, set to ${h}`)}let d={name:p!=null?decodeURIComponent(p):`${o} ${l}:${h}`,type:o,tls:!!s,server:l,port:h,username:a!=null?decodeURIComponent(a):void 0,password:u!=null?decodeURIComponent(u):void 0};if(s&&m){let v=ml(m,"fp")||ml(m,"client-fingerprint");v&&(d["client-fingerprint"]=v)}return d}}}function ZQ(){return{name:"URI SOCKS Parser",test:n=>/^socks:\/\//.test(n),parse:n=>{let[i,o,s,a,u,l,h]=n.match(/^(socks)?:\/\/(?:(.*)@)?(.*?)(?::(\d+?))?(\?.*?)?(?:#(.*?))?$/);if(u)u=parseInt(u,10);else throw Q.error(`port is not present in line: ${n}`),new Error(`port is not present in line: ${n}`);let m,p;if(s){let v=bt.decode(decodeURIComponent(s)).split(":");m=v[0],p=v[1]}return{name:h!=null?decodeURIComponent(h):`${o} ${a}:${u}`,type:"socks5",server:a,port:u,username:m,password:p}}}}function JQ(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let{content:i,fragment:o}=HS(n.split("ss://")[1]),s={type:"ss"},a=i.match(/@([^/?]*)(\/|\?|$)/),u=WQ(i.split("@")[0]),l="";if(a)i.includes("?")&&(l=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let w=i.match(/^(.*)(\?.*)$/);i=w[1],l=w[2]}if(i=bt.decode(i),l){if(/(&|\?)v2ray-plugin=/.test(l)){let E=l.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];E&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(bt.decode(E)))}i=`${i}${l}`}u=i.match(/(^.*)@/)?.[1],a=i.match(/@([^/@]*)(\/|$)/)}let h={};for(let w of l.replace(/^\?/,"").split("&"))if(w){let[E,_]=w.split("="),C=_;C=decodeURIComponent(_),h[E]=C}if(s.tls=h.security&&h.security!=="none",s["skip-cert-verify"]=!!h.allowInsecure,s.sni=h.sni||h.peer,s["client-fingerprint"]=h.fp,s.alpn=h.alpn?decodeURIComponent(h.alpn).split(","):void 0,h.ws&&(s.network="ws",qo.default.set(s,"ws-opts.path",h.wspath)),h.type){let w,E="",_="";if(s.network=h.type,s.network==="httpupgrade"&&(s.network="ws",w=!0),["grpc"].includes(s.network))s[s.network+"-opts"]={"grpc-service-name":h.serviceName,"_grpc-type":h.mode,"_grpc-authority":h.authority};else{if(h.path){let C=h.path;if(s.network==="ws"){let F=qS(C);C=F.path,w?E=F.ed:_=F.ed}qo.default.set(s,s.network+"-opts.path",C)}h.host&&qo.default.set(s,s.network+"-opts.headers.Host",decodeURIComponent(h.host)),w?(E=E||(MS(h.ed)?`${h.ed}`:""),qo.default.set(s,s.network+"-opts.v2ray-http-upgrade",!0),E!==""&&(qo.default.set(s,s.network+"-opts.v2ray-http-upgrade-fast-open",!0),qo.default.set(s,s.network+"-opts._v2ray-http-upgrade-ed",E))):s.network==="ws"&&_!==""&&(qo.default.set(s,s.network+"-opts.max-early-data",jS(_)),qo.default.set(s,s.network+"-opts.early-data-header-name","Sec-WebSocket-Protocol"))}if(["reality"].includes(h.security)){let C={};h.pbk&&(C["public-key"]=h.pbk),h.sid&&(C["short-id"]=h.sid),h.spx&&(C["_spider-x"]=h.spx),h.mode&&(s._mode=h.mode),Object.keys(C).length>0&&qo.default.set(s,h.security+"-opts",C)}h.extra&&(s.network==="xhttp"||h.security==="reality")&&(s._extra=h.extra)}s.udp=![!1,0,"0","false","off"].includes(typeof h.udp=="string"?h.udp.toLowerCase():h.udp);let m=a[1],p=m.lastIndexOf(":");s.server=m.substring(0,p),s.port=`${m.substring(p+1)}`.match(/\d+/)?.[0];let d=u.match(/(^.*?):(.*$)/);s.cipher=d?.[1],s.password=d?.[2];let v=i.match(/[?&]plugin=([^&]+)/),g=i.match(/[?&]shadow-tls=([^&]+)/),y=i.match(/[?&]gost=([^&]+)/);if(v){let w=("plugin="+decodeURIComponent(v[1])).split(";"),E={};for(let _ of w){let C=_.indexOf("=");if(C===-1){_&&(E[_]=!0);continue}let F=_.slice(0,C),H=_.slice(C+1).replace(/\\=/g,"=");F&&(E[F]=H||!0)}switch(E.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:E.obfs,host:vt(E["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:vt(E.obfs)||vt(E.mode)||"websocket",host:vt(E["obfs-host"])||vt(E.host),path:vt(E.path),tls:wa(E.tls),sni:wa(E.sni),"skip-cert-verify":["1","true",1,!0].includes(E["skip-cert-verify"]),mux:/^\d+$/.test(E.mux)?parseInt(E.mux,10):void 0};break;case"shadow-tls":{s.plugin="shadow-tls";let _=vt(E.version);s["plugin-opts"]={host:vt(E.host),password:vt(E.password),version:_?parseInt(_,10):void 0};break}default:throw new Error(`Unsupported plugin option: ${E.plugin}`)}}if(g){let w=JSON.parse(bt.decode(g[1])),E=vt(w.version),_=vt(w.address),C=vt(w.port);s.plugin="shadow-tls",s["plugin-opts"]={host:vt(w.host),password:vt(w.password),version:E?parseInt(E,10):void 0},_&&(s.server=_),C&&(s.port=parseInt(C,10))}if(y){let w=JSON.parse(bt.decode(decodeURIComponent(y[1]))),E=vt(w.address),_=vt(w.port),C=vt(w.route),F=C?.trim().toLowerCase(),H=["ws","wss","websocket"].includes(F);s.plugin="gost-plugin",s["plugin-opts"]={mode:H?"websocket":C,host:vt(w.host),path:vt(w.path)},F==="wss"&&(s["plugin-opts"].tls=!0),E&&(s.server=E),_&&(s.port=parseInt(_,10))}return/(&|\?)uot=(1|true)/i.test(l)&&(s["udp-over-tcp"]=!0),/(&|\?)tfo=(1|true)/i.test(l)&&(s.tfo=!0),s.name=o??`SS ${s.server}:${s.port}`,s}}}function QQ(){return{name:"URI SSR Parser",test:n=>/^ssr:\/\//.test(n),parse:n=>{n=bt.decode(n.split("ssr://")[1]);let i=n.indexOf(":origin");i===-1&&(i=n.indexOf(":auth_"));let o=n.substring(0,i),s=o.substring(0,o.lastIndexOf(":")),a=o.substring(o.lastIndexOf(":")+1),u=n.substring(i+1).split("/?")[0].split(":"),l={type:"ssr",server:s,port:a,protocol:u[0],cipher:u[1],obfs:u[2],password:bt.decode(u[3])},h={};if(n=n.split("/?")[1].split("&"),n.length>1)for(let m of n){let[p,d]=m.split("=");d=d.trim(),d.length>0&&d!=="(null)"&&(h[p]=d)}return l={...l,name:h.remarks?bt.decode(h.remarks):l.server,"protocol-param":vt(bt.decode(h.protoparam||h.protocolparam||"").replace(/\s/g,"")),"obfs-param":vt(bt.decode(h.obfsparam||"").replace(/\s/g,""))},l}}}function eee(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{if(/^vmess:\/\/[^/?#]+@/.test(n))return VS().parse(n,"vmess");let{content:i,fragment:o}=HS(n.split("vmess://")[1]),s=bt.decode(i.replace(/\?.*?$/,""));if(/=\s*vmess/.test(s)){let a=s.split(",").map(h=>h.trim()),u={};for(let h of a)if(h.indexOf("=")!==-1){let[m,p]=h.split("=");u[m.trim()]=p.trim()}let l={name:a[0].split("=")[0].trim(),type:"vmess",server:a[1],port:a[2],cipher:jr(vt(a[3],"auto")),uuid:a[4].match(/^"(.*)"$/)[1],tls:u.obfs==="wss",udp:wa(u["udp-relay"]),tfo:wa(u["fast-open"]),"skip-cert-verify":gf(u["tls-verification"])?!u["tls-verification"]:void 0};if(gf(u.obfs))if(u.obfs==="ws"||u.obfs==="wss"){l.network="ws",l["ws-opts"].path=(vt(u["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let h=u["obfs-header"];h&&h.indexOf("Host")!==-1&&(h=h.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),qe(h)&&(l["ws-opts"].headers={Host:h})}else throw new Error(`Unsupported obfs: ${u.obfs}`);return qe(o)&&(l.name=o),l}else{let a={};try{a=JSON.parse(s)}catch{let[d,v,g]=/(^[^?]+?)\/?\?(.*)$/.exec(i);s=bt.decode(v);for(let F of g.split("&")){let[H,K]=F.split("="),S=K;S=decodeURIComponent(K),S.indexOf(",")===-1?a[H]=S:a[H]=S.split(",")}let[y,w,E,_,C]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(s);a.scy=w,a.id=E,a.port=C,a.add=_}let u=a.add,l=parseInt(wa(a.port),10),h={name:a.ps??a.remarks??a.remark??`VMess ${u}:${l}`,type:"vmess",server:u,port:l,cipher:jr(a.scy),uuid:a.id,alterId:parseInt(wa(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":gf(a.verify_cert)?!a.verify_cert:void 0};!h["skip-cert-verify"]&&gf(a.allowInsecure)&&(h["skip-cert-verify"]=/(TRUE)|1/i.test(a.allowInsecure)),h.tls&&(a.sni&&a.sni!==""?h.sni=a.sni:a.peer&&a.peer!==""&&(h.sni=a.peer));let m=!1;if(a.net==="ws"||a.obfs==="websocket"?h.network="ws":["http"].includes(a.obfs)||["http"].includes(a.type)?h.network="http":a.net==="http"?h.network="h2":["grpc","kcp","quic"].includes(a.net)?h.network=a.net:a.net==="httpupgrade"||h.network==="httpupgrade"?(h.network="ws",m=!0):(a.net==="h2"||h.network==="h2")&&(h.network="h2"),h.network){let p=a.host??a.obfsParam;try{let w=JSON.parse(p)?.Host;w&&(p=w)}catch{}let d=a.path,v="",g="";if(h.network==="ws"&&d){let y=qS(d);d=y.path,m?v=y.ed:g=y.ed}if(["ws"].includes(h.network)&&(d=d||"/"),h.network==="http"?(p&&(p=p.split(",").map(y=>y.trim()),p=Array.isArray(p)?p[0]:p),d?d=Array.isArray(d)?d[0]:d:d="/"):h.network==="h2"&&(d||(d="/")),d||p||["kcp","quic"].includes(h.network))if(["grpc"].includes(h.network))h[`${h.network}-opts`]={"grpc-service-name":vt(d),"_grpc-type":vt(a.type),"_grpc-authority":vt(a.authority)};else if(["kcp","quic"].includes(h.network))h[`${h.network}-opts`]={[`_${h.network}-type`]:vt(a.type),[`_${h.network}-host`]:vt(vt(p)),[`_${h.network}-path`]:vt(d)};else{let y={path:vt(d)},w=vt(p);if(h.network==="h2"){let E=KS(w);E&&(y.host=E)}else y.headers={Host:w};m?(y["v2ray-http-upgrade"]=!0,v=v||(MS(a.ed)?`${a.ed}`:""),v!==""&&(y["v2ray-http-upgrade-fast-open"]=!0,y["_v2ray-http-upgrade-ed"]=v)):h.network==="ws"&&g!==""&&(y["max-early-data"]=jS(g),y["early-data-header-name"]="Sec-WebSocket-Protocol"),h[`${h.network}-opts`]=y}else delete h.network}return h["client-fingerprint"]=a.fp??a["client-fingerprint"],h.alpn=a.alpn?a.alpn.split(","):void 0,qe(o)&&(h.name=o),h}}}}function VS(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:(n,i="vless")=>{let o=P=>{if(!Ge(P))return;let M={},Y={maxConnections:"max-connections",maxConcurrency:"max-concurrency",cMaxReuseTimes:"c-max-reuse-times",hMaxRequestTimes:"h-max-request-times",hMaxReusableSecs:"h-max-reusable-secs"};for(let[X,te]of Object.entries(Y)){let ae=Ls(P[X]);ae!=null&&(M[te]=typeof ae=="number"?`${ae}`:ae)}let V=Xn(P.hKeepAlivePeriod);return V!=null&&(M["h-keep-alive-period"]=V),Object.keys(M).length>0?M:void 0},s=P=>{if(!Ge(P))return;let M={};for(let[Y,V]of Object.entries(P))typeof V=="string"&&(M[Y]=V);return Object.keys(M).length>0?M:void 0},a=P=>{if(Array.isArray(P))return P.map(a);if(Ge(P)){let M={};for(let[Y,V]of Object.entries(P))M[Y]=a(V);return M}return P},u=P=>{if(Array.isArray(P))return P.map(u).filter(Y=>Y!==void 0);if(!Ge(P))return P;let M={};for(let[Y,V]of Object.entries(P)){let X=u(V);X!==void 0&&(M[Y]=X)}return Object.keys(M).length>0?M:void 0},l=(P,M,Y)=>{let V=u(a(Y));V!==void 0&&(P[M]=V)},h=P=>{if(P==null)return;if(!Ge(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))typeof V!="string"&&l(M,Y,V);return u(M)},m=(P,M)=>["maxConnections","maxConcurrency","cMaxReuseTimes","hMaxRequestTimes","hMaxReusableSecs"].includes(P)?Ls(M)!=null:P==="hKeepAlivePeriod"?Xn(M)!=null:!1,p=P=>{if(P==null)return;if(!Ge(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))m(Y,V)||l(M,Y,V);return u(M)},d=P=>{if(P==null)return;if(!Ge(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))switch(Y){case"headers":{let X=h(V);X!==void 0&&(M.headers=X);break}case"noGRPCHeader":case"xPaddingObfsMode":V!==!0&&l(M,Y,V);break;case"xPaddingBytes":Jf(V)==null&&l(M,Y,V);break;case"xPaddingKey":case"xPaddingHeader":case"xPaddingPlacement":case"xPaddingMethod":case"uplinkHTTPMethod":case"sessionIDPlacement":case"sessionPlacement":case"sessionIDKey":case"sessionKey":case"seqPlacement":case"seqKey":case"uplinkDataPlacement":case"uplinkDataKey":typeof V!="string"&&l(M,Y,V);break;case"sessionIDTable":typeof V!="string"&&l(M,Y,V);break;case"uplinkChunkSize":Ls(V)==null&&l(M,Y,V);break;case"scMaxEachPostBytes":Jf(V)==null&&l(M,Y,V);break;case"scMinPostsIntervalMs":Ho(V)==null&&l(M,Y,V);break;case"sessionIDLength":Jf(V)==null&&l(M,Y,V);break;case"xmux":{let X=p(V);X!==void 0&&(M.xmux=X);break}default:l(M,Y,V);break}return u(M)},v=P=>{if(P==null)return;if(!Ge(P))return a(P);let M={};Object.prototype.hasOwnProperty.call(P,"path")&&!qe(P.path)&&l(M,"path",P.path),Object.prototype.hasOwnProperty.call(P,"host")&&!qe(P.host)&&l(M,"host",P.host),Object.prototype.hasOwnProperty.call(P,"mode")&&!qe(P.mode)&&l(M,"mode",P.mode);let Y={};for(let[X,te]of Object.entries(P))["path","host","mode","extra"].includes(X)||(Y[X]=te);let V=d(Y);if(Ge(V)&&Object.assign(M,V),Object.prototype.hasOwnProperty.call(P,"extra")){let X=d(P.extra);X!==void 0&&(M.extra=X)}return u(M)},g=P=>{if(P==null)return;if(!Ge(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))switch(Y){case"address":qe(V)||l(M,Y,V);break;case"port":Xn(V,{allowNegative:!1})==null&&l(M,Y,V);break;case"security":{let X=typeof V=="string"?V.toLowerCase():"";["tls","reality"].includes(X)||l(M,Y,V);break}case"tlsSettings":{if(!Ge(V)){l(M,Y,V);break}let X={},te=NA(V.echConfigList);for(let[me,he]of Object.entries(V))switch(me){case"serverName":case"fingerprint":qe(he)||l(X,me,he);break;case"echConfigList":NA(he)||l(X,me,he);break;case"echForceQuery":(!te||!Vg(he))&&l(X,me,he);break;case"echSockopt":(!te||!Ge(he))&&l(X,me,he);break;case"alpn":Array.isArray(he)&&he.length>0&&he.every(De=>typeof De=="string"&&De!=="")||l(X,me,he);break;case"allowInsecure":he!==!0&&l(X,me,he);break;default:l(X,me,he);break}let ae=u(X);ae!==void 0&&(M.tlsSettings=ae);break}case"realitySettings":{if(!Ge(V)){l(M,Y,V);break}let X={};for(let[ae,me]of Object.entries(V))switch(ae){case"publicKey":case"shortId":case"serverName":case"fingerprint":qe(me)||l(X,ae,me);break;default:l(X,ae,me);break}let te=u(X);te!==void 0&&(M.realitySettings=te);break}case"xhttpSettings":{let X=v(V);X!==void 0&&(M.xhttpSettings=X);break}case"network":{let X=typeof V=="string"?V.toLowerCase():"";X!=="xhttp"&&X!=="splithttp"&&l(M,Y,V);break}default:l(M,Y,V);break}return u(M)},y=(P,{parsedDownloadSettings:M}={})=>{if(!Ge(P))return;let{downloadSettings:Y,...V}=P,X=d(V)||{};if(Object.prototype.hasOwnProperty.call(P,"downloadSettings")){let te=g(Y);te!==void 0&&(X.downloadSettings=te)}return u(X)},w=(P,M)=>{if(!Ge(P)||!Ge(M))return;let Y=s(M.headers);if(Y){let De={...P.headers||{}};for(let[Pe,Ie]of Object.entries(Y)){if(/^host$/i.test(Pe)){!Object.prototype.hasOwnProperty.call(De,"Host")&&!Object.prototype.hasOwnProperty.call(De,"host")&&(De.Host=Ie);continue}De[Pe]=Ie}Object.keys(De).length>0&&(P.headers=De)}M.noGRPCHeader===!0&&(P["no-grpc-header"]=!0);let V=Jf(M.xPaddingBytes);V!=null&&(P["x-padding-bytes"]=V),M.xPaddingObfsMode===!0&&(P["x-padding-obfs-mode"]=!0),qe(M.xPaddingKey)&&(P["x-padding-key"]=M.xPaddingKey),qe(M.xPaddingHeader)&&(P["x-padding-header"]=M.xPaddingHeader),qe(M.xPaddingPlacement)&&(P["x-padding-placement"]=M.xPaddingPlacement),qe(M.xPaddingMethod)&&(P["x-padding-method"]=M.xPaddingMethod),qe(M.uplinkHTTPMethod)&&(P["uplink-http-method"]=M.uplinkHTTPMethod),qe(M.sessionIDPlacement)?P["session-placement"]=M.sessionIDPlacement:qe(M.sessionPlacement)&&(P["session-placement"]=M.sessionPlacement),qe(M.sessionIDKey)?P["session-key"]=M.sessionIDKey:qe(M.sessionKey)&&(P["session-key"]=M.sessionKey),typeof M.sessionIDTable=="string"&&(P["session-table"]=M.sessionIDTable);let X=Jf(M.sessionIDLength);X!=null&&(P["session-length"]=X),qe(M.seqPlacement)&&(P["seq-placement"]=M.seqPlacement),qe(M.seqKey)&&(P["seq-key"]=M.seqKey),qe(M.uplinkDataPlacement)&&(P["uplink-data-placement"]=M.uplinkDataPlacement),qe(M.uplinkDataKey)&&(P["uplink-data-key"]=M.uplinkDataKey);let te=Ls(M.uplinkChunkSize);te!=null&&(P["uplink-chunk-size"]=te);let ae=dl(M.scMaxEachPostBytes);ae!=null&&(P["sc-max-each-post-bytes"]=ae);let me=Ho(M.scMinPostsIntervalMs);me!=null&&(P["sc-min-posts-interval-ms"]=me);let he=o(M.xmux);he&&(P["reuse-settings"]=he)},E=P=>{if(!Ge(P))return;let M={},Y=typeof P.network=="string"?P.network.toLowerCase():"";(Y==="xhttp"||Y==="splithttp")&&(M.network="xhttp"),qe(P.address)&&(M.server=P.address);let V=Xn(P.port,{allowNegative:!1});V!=null&&(M.port=V);let X=typeof P.security=="string"?P.security.toLowerCase():"";if((X==="tls"||X==="reality")&&(M.tls=!0),Ge(P.tlsSettings)){qe(P.tlsSettings.serverName)&&(M.servername=P.tlsSettings.serverName),qe(P.tlsSettings.fingerprint)&&(M["client-fingerprint"]=P.tlsSettings.fingerprint),Array.isArray(P.tlsSettings.alpn)&&P.tlsSettings.alpn.length>0&&P.tlsSettings.alpn.every(me=>typeof me=="string"&&me!=="")&&(M.alpn=P.tlsSettings.alpn),P.tlsSettings.allowInsecure===!0&&(M["skip-cert-verify"]=!0);let ae=zg({echConfigList:P.tlsSettings.echConfigList,echForceQuery:P.tlsSettings.echForceQuery,echSockopt:P.tlsSettings.echSockopt});ae&&(M["ech-opts"]=ae)}let te;return Ge(P.realitySettings)&&(te={},qe(P.realitySettings.publicKey)&&(te["public-key"]=P.realitySettings.publicKey),qe(P.realitySettings.shortId)&&(te["short-id"]=P.realitySettings.shortId),qe(P.realitySettings.serverName)&&(M.servername=P.realitySettings.serverName),qe(P.realitySettings.fingerprint)&&(M["client-fingerprint"]=P.realitySettings.fingerprint)),X==="reality"?M["reality-opts"]=te||{}:te&&Object.keys(te).length>0&&(M["reality-opts"]=te),Ge(P.xhttpSettings)&&(qe(P.xhttpSettings.path)&&(M.path=P.xhttpSettings.path),qe(P.xhttpSettings.host)&&(M.host=P.xhttpSettings.host),qe(P.xhttpSettings.mode)&&(M.mode=P.xhttpSettings.mode),w(M,P.xhttpSettings),Ge(P.xhttpSettings.extra)&&w(M,P.xhttpSettings.extra)),Object.keys(M).length>0?M:void 0};n=n.split(`${i}://`)[1];let _,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!C){let[P,M,Y]=/^(.*?)(\?.*?$)/.exec(n);n=`${bt.decode(M)}${Y}`,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),_=!0}let[F,H,K,S,I,q="",L]=C;_&&(H=H.replace(/^.*?:/g,"")),S=parseInt(`${S}`,10),H=decodeURIComponent(H),L!=null&&(L=decodeURIComponent(L));let R={type:i,name:L,server:K,port:S,uuid:H,udp:!0},O={};for(let P of q.split("&"))if(P){let[M,...Y]=P.split("=");O[M]=decodeURIComponent(Y.join("="))}if(R.name=L??O.remarks??O.remark??`${i==="vmess"?"VMess":"VLESS"} ${K}:${S}`,R.tls=O.security&&O.security!=="none",O.pbk&&(O.security="reality"),_&&/TRUE|1/i.test(O.tls)&&(R.tls=!0,O.security=O.security??"reality"),R.sni=O.sni||O.peer,R.flow=O.flow,!R.flow&&_&&O.xtls){let P=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][O.xtls];P&&(R.flow=P)}R["client-fingerprint"]=O.fp??O["client-fingerprint"],R.alpn=O.alpn?O.alpn.split(","):void 0,R["skip-cert-verify"]=/(TRUE)|1/i.test(O.allowInsecure)||i==="vless"&&O.allowInsecure==null&&O.insecure==="1",R._echConfigList=wa(O.ech);let T=zg({echConfigList:O.ech});switch(T&&(R["ech-opts"]=T),R["tls-fingerprint"]=wa(O.pcs),R._vcn=O.vcn?.split(",").map(P=>P.trim()).filter(Boolean),R["name-cert-verify"]=R._vcn?.[0],R._h2=/(TRUE)|1/i.test(O.h2),`${O.packetEncoding||""}`.trim().toLowerCase()){case"none":R["packet-encoding"]="";break;case"packet":R["packet-encoding"]="packetaddr";break;default:R["packet-encoding"]="xudp";break}if(["reality"].includes(O.security)){let P={};if(O.pbk){P["public-key"]=O.pbk;let M=O["support-x25519mlkem768"];["1","t","T","true","TRUE","True"].includes(M)&&(P["support-x25519mlkem768"]=!0)}O.sid&&(P["short-id"]=O.sid),O.spx&&(P["_spider-x"]=O.spx),Object.keys(P).length>0&&(R[`${O.security}-opts`]=P)}let N=!1;if(R.network=O.type||"tcp",R.network==="tcp"&&O.headerType==="http"?R.network="http":R.network==="http"?R.network="h2":R.network==="httpupgrade"&&(R.network="ws",N=!0),!O.type&&_&&O.obfs&&(R.network=O.obfs,["none"].includes(R.network)&&(R.network="tcp")),["websocket"].includes(R.network)?R.network="ws":i==="vless"&&R.network==="splithttp"&&(R.network="xhttp"),R.network&&!["tcp","none"].includes(R.network)){let P={},M="",Y=O.host??O.obfsParam;if(Y){if(O.obfsParam)try{let te=JSON.parse(Y);P.headers=te}catch{P.headers={Host:Y}}else P.headers={Host:Y};["xhttp"].includes(R.network)&&P.headers?.Host&&(P.host=P.headers.Host,delete P.headers.Host,Object.keys(P.headers).length===0&&delete P.headers);let X=P.headers?.Host??P.headers?.host;["h2"].includes(R.network)&&X&&(P.host=KS(X),delete P.headers.Host,delete P.headers.host,Object.keys(P.headers).length===0&&delete P.headers)}if(O.serviceName?P[`${R.network}-service-name`]=O.serviceName:_&&O.path&&(["ws","http","h2","xhttp"].includes(R.network)||(P[`${R.network}-service-name`]=O.path,delete O.path)),O.path){let X=O.path;if(R.network==="ws"){let te=qS(X);X=te.path,M=te.ed}P.path=X}else R.network==="h2"&&(P.path="/");R.network==="http"&&O.method&&(P.method=O.method),["grpc"].includes(R.network)&&(P["_grpc-type"]=O.mode||"gun",O.authority&&(P["_grpc-authority"]=O.authority)),N&&(P["v2ray-http-upgrade"]=!0);let V=M||O.ed;if(V){let X=jS(V);N?(P["v2ray-http-upgrade-fast-open"]=!0,P["_v2ray-http-upgrade-ed"]=`${V}`):R.network==="ws"&&(P["max-early-data"]=X,P["early-data-header-name"]=O.eh||"Sec-WebSocket-Protocol")}if(O.eh&&(R.network==="ws"||N)&&(P["early-data-header-name"]=O.eh),Object.keys(P).length>0&&(R[`${R.network}-opts`]=P),R.network==="kcp"&&(O.seed&&(R.seed=O.seed),R.headerType=O.headerType||"none"),O.extra&&!["xhttp"].includes(R.network)&&(R._extra=O.extra),["xhttp"].includes(R.network)){let X={},te;try{X=O.extra?JSON.parse(O.extra):{}}catch{Q.error(`Failed to parse extra field as JSON: ${O.extra}`),te=O.extra}let ae={...R[`${R.network}-opts`]||{}};O.mode&&(ae.mode=O.mode),w(ae,X);let me=E(X?.downloadSettings);me&&(ae["download-settings"]=me),Object.keys(ae).length>0&&(R[`${R.network}-opts`]=ae),te!=null&&(R._extra=te);let he=y(X,{parsedDownloadSettings:me});he&&(R._extra_unsupported=he)}else O.mode&&(R._mode=O.mode)}if(i==="vmess"?(R.cipher=jr(O.encryption),R.alterId=0,delete R.flow):O.encryption&&(R.encryption=O.encryption),O.pqv&&(R._pqv=O.pqv),O.fm)try{let P=JSON.parse(O.fm);R._finalmask=Ge(P)?P:O.fm}catch{R._finalmask=O.fm}return R}}}function tee(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{let i=VS().parse(n.replace("anytls","vless"));n=n.split(/anytls:\/\//)[1];let[o,s,a,u,l="",h]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);u=parseInt(`${u}`,10),isNaN(u)&&(u=443),s=decodeURIComponent(s),h!=null&&(h=decodeURIComponent(h)),h=h??`AnyTLS ${a}:${u}`;let m={...i,uuid:void 0,type:"anytls",name:h,server:a,port:u,password:s};for(let p of l.split("&"))if(p){let[d,v]=p.split("=");d=d.replace(/_/g,"-"),v=decodeURIComponent(v),["alpn"].includes(d)?m[d]=v?v.split(","):void 0:["insecure"].includes(d)?m["skip-cert-verify"]=/(TRUE)|1/i.test(v):["udp"].includes(d)?m[d]=/(TRUE)|1/i.test(v):Object.keys(m).includes(d)||(m[d]=v)}return["tcp"].includes(m.network)&&!m["reality-opts"]&&(delete m.network,delete m.security),m}}}function ree(){return{name:"URI Mieru Parser",test:n=>/^mierus:\/\//i.test(n),parse:n=>{let{content:i,fragment:o}=HS(n),s=/^mierus:\/\/([^:@/?]+):([^@/?]+)@(\[[^\]]+\]|[^:/?@\s]+)\/?\?(.+)$/i.exec(i);if(!s)throw new Error("Invalid Mieru URI");let[,a,u,l,h]=s,m=new Map;for(let y of h.split("&")){let{key:w,value:E}=Yg(y);m.has(w)||m.set(w,[]),m.get(w).push(E)}let p=m.get("port")||[],d=m.get("protocol")??m.get("transport")??[];if(p.length===0||p.length!==d.length)throw new Error("Mieru URI requires matching ports and protocols");let v=o||m.get("profile")?.[0]||l,g={type:"mieru",server:l,username:decodeURIComponent(a),password:decodeURIComponent(u)};for(let y of["multiplexing","handshake-mode","traffic-pattern"]){let w=m.get(y)?.[0];w&&(g[y]=w)}return p.map((y,w)=>{let E=d[w].toUpperCase(),[,_,C=_]=/^(\d+)(?:-(\d+))?$/.exec(y)||[],F=Number(_),H=Number(C);if(!(1<=F&&F<=H&&H<=65535)||E!=="TCP"&&E!=="UDP")throw new Error("Invalid Mieru port binding");let K={...g,name:p.length===1?v:`${v}:${y}/${E}`,transport:E};return y.includes("-")?K["port-range"]=y:K.port=F,K})}}}function nee(){return{name:"URI Hysteria2 Parser",test:n=>/^(hysteria2|hy2):\/\//.test(n),parse:n=>{n=n.split(/(hysteria2|hy2):\/\//)[2];let i,[o,s,a,u,l,h,m,p,d,v,g="",y]=/^(.*?)@(.*?)(:((\d+(-\d+)?)([,;]\d+(-\d+)?)*))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);/^\d+$/.test(l)?(l=parseInt(`${l}`,10),isNaN(l)&&(l=443)):l?(i=l,l=Cd(i)):l=443,s=decodeURIComponent(s),y!=null&&(y=decodeURIComponent(y)),y=y??`Hysteria2 ${a}:${l}`;let w={type:"hysteria2",name:y,server:a,port:l,ports:i,password:s},E={};for(let H of g.split("&"))if(H){let[K,S]=H.split("="),I=S;I=decodeURIComponent(S),E[K]=I}w.sni=E.sni,!w.sni&&E.peer&&(w.sni=E.peer),E.obfs&&E.obfs!=="none"&&(w.obfs=E.obfs),E.mport&&(w.ports=E.mport),w["obfs-password"]=E["obfs-password"],w["skip-cert-verify"]=/(TRUE)|1/i.test(E.insecure),w.tfo=/(TRUE)|1/i.test(E.fastopen),w["tls-fingerprint"]=E.pinSHA256;let _=E["hop-interval"]||E.hop_interval;_!=null&&(w["hop-interval"]=_);let C=E.keepalive;/^\d+$/.test(C)&&(w.keepalive=parseInt(`${C}`,10)),E.upmbps&&(w.up=E.upmbps),E.downmbps&&(w.down=E.downmbps);let F=zg({echConfigList:E.ech});return F&&(w["ech-opts"]=F),w}}}function see(){return{name:"URI Hysteria Parser",test:n=>/^(hysteria|hy):\/\//.test(n),parse:n=>{n=n.split(/(hysteria|hy):\/\//)[2];let[i,o,s,a,u,l="",h]=/^(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);a=parseInt(`${a}`,10),isNaN(a)&&(a=443),h!=null&&(h=decodeURIComponent(h)),h=h??`Hysteria ${o}:${a}`;let m={type:"hysteria",name:h,server:o,port:a},p={};for(let d of l.split("&"))if(d){let[v,g]=d.split("=");v=v.replace(/_/,"-"),g=decodeURIComponent(g),["alpn"].includes(v)?m[v]=g?g.split(","):void 0:["insecure"].includes(v)?m["skip-cert-verify"]=/(TRUE)|1/i.test(g):["auth"].includes(v)?m["auth-str"]=g:["mport"].includes(v)?m.ports=g:["obfsParam"].includes(v)?m.obfs=g:["upmbps"].includes(v)?m.up=g:["downmbps"].includes(v)?m.down=g:["obfs"].includes(v)?m._obfs=g||"":["fast-open","peer"].includes(v)?p[v]=g:Object.keys(m).includes(v)||(m[v]=g)}return!m.sni&&p.peer&&(m.sni=p.peer),!m["fast-open"]&&p.fastopen&&(m["fast-open"]=!0),m.protocol||(m.protocol="udp"),m}}}function iee(){return{name:"URI TUIC Parser",test:n=>/^tuic:\/\//.test(n),parse:n=>{n=n.split(/tuic:\/\//)[1];let[i,o,s,a,u="",l]=/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(n);o=decodeURIComponent(o);let[h,...m]=o.split(":"),p=m.join(":");a=parseInt(`${a}`,10),isNaN(a)&&(a=443),p=decodeURIComponent(p),l!=null&&(l=decodeURIComponent(l)),l=l??`TUIC ${s}:${a}`;let d={type:"tuic",name:l,server:s,port:a,password:p,uuid:h};for(let v of u.split("&"))if(v){let[g,y]=v.split("=");g=g.replace(/_/g,"-"),y=decodeURIComponent(y),["alpn"].includes(g)?d[g]=y?y.split(","):void 0:["allow-insecure","insecure"].includes(g)?d["skip-cert-verify"]=/(TRUE)|1/i.test(y):["fast-open"].includes(g)?d.tfo=!0:["disable-sni","reduce-rtt"].includes(g)?d[g]=/(TRUE)|1/i.test(y):g==="congestion-control"?(d["congestion-controller"]=y,delete d[g]):Object.keys(d).includes(g)||(d[g]=y)}return d}}}function oee(){return{name:"URI WireGuard Parser",test:n=>/^(wireguard|wg):\/\//.test(n),parse:n=>{n=n.split(/(wireguard|wg):\/\//)[2];let[i,o,s,a,u,l,h,m="",p]=/^((.*?)@)?(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);l=parseInt(`${l}`,10),isNaN(l)&&(l=51820),s=decodeURIComponent(s),p!=null&&(p=decodeURIComponent(p)),p=p??`WireGuard ${a}:${l}`;let d={type:"wireguard",name:p,server:a,port:l,"private-key":s,udp:!0};for(let v of m.split("&"))if(v){let g=v.indexOf("="),y,w;if(g===-1?(y=v,w=""):(y=v.slice(0,g),w=v.slice(g+1)),y=y.replace(/_/,"-"),w=decodeURIComponent(w),["reserved"].includes(y)){let E=w.split(",").map(_=>parseInt(_.trim(),10)).filter(_=>Number.isInteger(_));E.length===3&&(d[y]=E)}else if(["address","ip"].includes(y))w.split(",").map(E=>{let _=YQ(E);_&&(_.family==="ipv4"?(d.ip=_.address,typeof _.cidr<"u"&&(d["ip-cidr"]=_.cidr)):_.family==="ipv6"&&(d.ipv6=_.address,typeof _.cidr<"u"&&(d["ipv6-cidr"]=_.cidr)))});else if(["mtu"].includes(y)){let E=parseInt(w.trim(),10);Number.isInteger(E)&&(d[y]=E)}else/publickey/i.test(y)?d["public-key"]=w:/privatekey/i.test(y)?d["private-key"]=w:/^presharedkey$/i.test(y)?d["preshared-key"]=w:["udp"].includes(y)?d[y]=/(TRUE)|1/i.test(w):[...Object.keys(d),"flag"].includes(y)||(d[y]=w)}return d}}}function aee(){return{name:"URI Trojan Parser",test:n=>/^trojan:\/\//.test(n),parse:n=>{let[i,o]=n.split(/#(.+)/,2),s=/^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(i);s?.[2]||(i=i.replace(s[1],`${s[1]}:443`));let l=TS().parse(i);if(qe(o))try{l.name=decodeURIComponent(o)}catch(h){console.log(h)}return l}}}function uee(){return{name:"Clash Parser",test:n=>{let i;try{i=US.default.parse(n)}catch{i=ks.parse(n)}return!!i?.type},parse:n=>{let i;try{i=US.default.parse(n)}catch{i=ks.parse(n)}if(!["zerotier","shadowquic","gost-relay","openvpn","tailscale","easytier","trusttunnel","h2-connect","naive","anytls","mieru","masque","masque-surge","sudoku","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.servername&&(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.type==="vmess"&&(i.cipher=jr(i.cipher)),i}}}function cee(){return{name:"QX SS Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")===-1,parse:n=>pi().parse(n)}}function lee(){return{name:"QX SSR Parser",test:n=>/^shadowsocks\s*=/.test(n.split(",")[0].trim())&&n.indexOf("ssr-protocol")!==-1,parse:n=>pi().parse(n)}}function fee(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function hee(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function dee(){return{name:"QX AnyTLS Parser",test:n=>/^anytls\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function pee(){return{name:"QX Mieru Parser",test:n=>/^mieru\s*=/.test(n),parse:n=>pi().parse(n)}}function mee(){return{name:"QX Hysteria2 Parser",test:n=>/^hysteria2\s*=/.test(n),parse:n=>pi().parse(n)}}function gee(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function vee(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function wee(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function yee(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>Ss().parse(n)}}function Eee(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>Ss().parse(n)}}var ax=/^[^=,]*=\s*vmess\s*,[^,]*,[^,]*,[^,]*,\s*"/i;function bee(){return{name:"Loon VMess Parser",test:n=>ax.test(n),parse:n=>Ss().parse(n)}}function Aee(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function See(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function _ee(){return{name:"Loon AnyTLS Parser",test:n=>/^.*=\s*anytls/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Cee(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Dee(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Fee(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Bee(){return{name:"Loon Tailscale Parser",test:n=>/^[^=,]*=\s*tailscale\s*(?:,|$)/i.test(n),parse:n=>Ss().parse(n)}}function Iee(){return{name:"Loon Mieru Parser",test:n=>/^[^=,]*=\s*mieru\s*,/i.test(n),parse:n=>Ss().parse(n)}}function xee(){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 o=n.match(/,\s*?peers\s*?=\s*?\[\s*?\{\s*?(.+?)\s*?\}\s*?\]/i)?.[1],s=o.match(/(,|^)\s*?endpoint\s*?=\s*?"?(.+?):(\d+)"?\s*?(,|$)/i),a=s?.[2],u=parseInt(s?.[3],10),l=n.match(/(,|^)\s*?mtu\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];l&&(l=parseInt(l,10));let h=n.match(/(,|^)\s*?keepalive\s*?=\s*?"?(\d+?)"?\s*?(,|$)/i)?.[2];h&&(h=parseInt(h,10));let m=o.match(/(,|^)\s*?reserved\s*?=\s*?"?(\[\s*?.+?\s*?\])"?\s*?(,|$)/i)?.[2];m&&(m=JSON.parse(m));let p,d=n.match(/(?:^|,)\s*server-dns\s*=\s*(?:"([^"]*)"|([^"]*?))(?=\s*(?:,\s*[\w-]+\s*=|$))/i),v=n.match(/(,|^)\s*?dns\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],g=n.match(/(,|^)\s*?dnsv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2];(v||g)&&(p=[],v&&p.push(v),g&&p.push(g));let y=o.match(/(,|^)\s*?allowed-ips\s*?=\s*?"(.+?)"\s*?(,|$)/i)?.[2]?.split(",").map(H=>H.trim()),w=o.match(/(,|^)\s*?preshared-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],E=n.match(/(,|^)\s*?interface-ip\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],_=n.match(/(,|^)\s*?interface-ipv6\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],C=o.match(/(,|^)\s*?public-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],F={type:"wireguard",name:i,server:a,port:u,ip:E,ipv6:_,"private-key":n.match(/(,|^)\s*?private-key\s*?=\s*?"?(.+?)"?\s*?(,|$)/i)?.[2],"public-key":C,mtu:l,keepalive:h,reserved:m,"allowed-ips":y,"preshared-key":w,dns:p,"server-dns":(d?.[1]??d?.[2])?.split(",").map(H=>H.trim()).filter(Boolean),udp:!0,peers:[{server:a,port:u,ip:E,ipv6:_,"public-key":C,"pre-shared-key":w,"allowed-ips":y,reserved:m}]};return Array.isArray(F.dns)&&F.dns.length>0&&(F["remote-dns-resolve"]=!0),F}}}function $ee(){return{name:"Surge Direct Parser",test:n=>/^[^=,]*=\s*direct\s*$/i.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Pee(){return{name:"Surge AnyTLS Parser",test:n=>/^.*=\s*anytls/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function kee(){return{name:"Surge TrustTunnel Parser",test:n=>/^.*=\s*trust-tunnel/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Ree(){return{name:"Surge MASQUE Parser",test:n=>/^.*=\s*masque/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Tee(){return{name:"Surge HTTP/2 CONNECT Parser",test:n=>/^.*=\s*h2-connect/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Oee(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Nee(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Lee(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1&&!ax.test(n),parse:n=>Kr().parse(n)}}function Uee(){return{name:"Surge VLESS Parser",test:n=>/^.*=\s*vless\s*$/.test(n.split(",")[0])&&/,\s*username\s*=/.test(n),parse:n=>Kr().parse(n)}}function Hee(){return{name:"Surge Trojan Parser",test:n=>/^.*=\s*trojan/.test(n.split(",")[0])&&!/^[^=,]*=\s*trojan\s*,[^,]*,[^,]*,\s*"/.test(n),parse:n=>Kr().parse(n)}}var ux=/(^|,)\s*(fast-open|over-tls|tls-name|ip-mode|tls-cert-sha256|tls-pubkey-sha256|server-dns)\s*=/i;function Mee(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0])&&!ux.test(n),parse:n=>Kr().parse(n)}}function qee(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0])&&!ux.test(n),parse:n=>Kr().parse(n)}}function jee(){return{name:"Surge External Parser",test:n=>/^.*=\s*external/.test(n.split(",")[0]),parse:n=>{let i=Kr().parse(n);return i.addresses=i.addresses.map(o=>o.trim().replace(/^\[/,"").replace(/\]$/,"")).filter(Wee),i}}}function Kee(){return{name:"Snell Parser",test:n=>/^[^=,]*=\s*(?:snell|opensnell)\s*,/i.test(n),parse:n=>{let i=n.match(/(?:[^",]+|"[^"]*")+/g).slice(3),o=/^(?:(?:udp|obfs-name|ip-mode|server-dns)\s*=|block-quic\s*=\s*(?:true|false)$)/;return(i[0]?.trim().startsWith('"')||i.some(a=>o.test(a.trim()))?Ss():Kr()).parse(n)}}}function Vee(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function zee(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Gee(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Wee(e){return _r(e)||Xt(e)}var cx=[XQ(),ZQ(),JQ(),QQ(),eee(),VS(),iee(),oee(),see(),nee(),aee(),tee(),ree(),uee(),$ee(),Pee(),kee(),Ree(),Tee(),Oee(),Nee(),Lee(),Uee(),Hee(),Mee(),Kee(),Vee(),zee(),Gee(),qee(),jee(),yee(),Eee(),bee(),Aee(),Cee(),See(),_ee(),Dee(),Fee(),xee(),Bee(),Iee(),cee(),lee(),fee(),hee(),dee(),pee(),mee(),gee(),vee(),wee()];var px=B(LS());var Yee={encrypt:rA,decrypt:Cg,derivePublicKey:sI};function Xee(e){for(let t of $g)try{let r=t.test(e);if(r)return Q.info(`Pre-processor [${t.name}] activated`),t.parse(e,!1,r)}catch(r){Q.error(`Parser [${t.name}] failed
|
||
Reason: ${r}`)}return e}function Zee(e){e=Xee(e);let t=e.split(`
|
||
`),r=[],n=o=>{for(let s of Array.isArray(o)?o:[o])r.push(ote(s))},i;for(let o of t){if(o=o.trim(),o.length===0)continue;let s=!1;if(i){let[a,u]=hx(i,o);u||(n(a),s=!0)}if(!s)for(let a of cx){let[u,l]=hx(a,o);if(!l){n(u),i=a,s=!0,Q.info(`${a.name} is activated`);break}}s||Q.error(`Failed to parse line: ${o}`)}return r.filter(o=>{if(["vless","vmess"].includes(o.type))gm(o.uuid)||Q.warn(`UUID may be invalid: ${o.name} ${o.uuid}`);else if(["hysteria2"].includes(o.type)&&o.obfs&&!o["obfs-password"])return Q.error(`Proxy ${o.name} has obfs ${o.obfs} but missing obfs-password`),!1;return!0})}function mx(e,t){let r=t.process;if(!r||typeof r!="object")return!1;let{type:n,customNames:i}=r;if(!Array.isArray(i))return!1;let o=e.customName!=null&&i.includes(e.customName);return n==="disable"?o:n==="enable"?!o:!1}async function Jee(e,t=[],r,n,i,o,s={}){let a={};o!==void 0&&(a.raw=Array.isArray(o)||o!==null&&typeof o=="object"?o:[o]);for(let u of t){if($A(u.type)){Q.log(`Skipping response transformer during proxy/file processing: "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}if(mx(u,a)){Q.info(`Skipping context-controlled operator: "${u.type}" with customName "${u.customName||""}"`);continue}if(u.disabled){Q.log(`Skipping disabled operator: "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}let l,h={};if(u.type.indexOf("Script")!==-1&&({script:l,$arguments:h}=await gx(u,s)),!Ep[u.type]){Q.error(`Unknown operator: "${u.type}"`);continue}Q.log(`Applying "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m;u.type.indexOf("Script")!==-1?m=Ep[u.type](l,r,h,n,i,a):m=Ep[u.type](u.args||{},s),e=await jI(m,e)}return e}async function Qee(e,t=[],r,n,i,o={}){let s={},a=lx(e);for(let u of t){if(!$A(u.type))continue;if(mx(u,s)){Q.info(`Skipping context-controlled response transformer: "${u.type}" with customName "${u.customName||""}"`);continue}if(u.disabled){Q.log(`Skipping disabled response transformer: "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}let{script:l,$arguments:h}=await gx(u,o);Q.log(`Applying "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m=Ep[u.type](l,r,h,n,i,s);a=lx(await qI(m,a))}return a}async function gx(item,executionContext={}){if(Q.env.isNode&&!eval("process.env.SUB_STORE_FRONTEND_BACKEND_PATH")?.startsWith("/")&&!eval("process.env.SUB_STORE_BACKEND_CUSTOM_NAME")){let e="Node.js \u73AF\u5883\u4E0B\uFF0C\u811A\u672C\u64CD\u4F5C\u3001\u811A\u672C\u8FC7\u6EE4\u548C\u4FEE\u6539\u54CD\u5E94\u5FC5\u987B\u8BBE\u7F6E SUB_STORE_FRONTEND_BACKEND_PATH \u624D\u80FD\u751F\u6548\uFF1B\u82E5\u4E0D\u60F3\u6539\u53D8\u5F53\u524D path\uFF0C\u53EF\u8BBE\u7F6E SUB_STORE_FRONTEND_BACKEND_PATH=/";throw Q.error(e),new Error(e)}let script,$arguments={},{mode,content}=item.args||{};if(mode==="link"){let e=content||"",t=e.split("#");if(t.length>1)try{$arguments=JSON.parse(decodeURIComponent(t[1]))}catch{for(let i of t[1].split("&")){let o=i.split("=")[0],s=i.split("=")[1];$arguments[o]=s==null||s===""?!0:decodeURIComponent(s)}}e=`${e.split("#")[0]}${t[2]?`#${t[2]}`:$arguments?.noCache!=null||$arguments?.insecure!=null?`#${t[1]}`:""}`;let r=e.split("#")[0].match(/^\/api\/(file|module)\/(.+)/);if(r){let n="";try{n=r?.[1];let i=r?.[2];if(i==null)throw new Error(`\u672C\u5730 ${n} URL \u65E0\u6548: ${e}`);i=decodeURIComponent(i);let o=n==="module"?rm:Ic,s=ri(Q.read(o),i);if(!s)throw new Error(`\u627E\u4E0D\u5230 ${n}: ${i}`);n==="module"?script=s.content:script=await Ra({type:"file",name:i,noFlow:executionContext.noFlow})}catch(i){throw Q.error(`Error when loading ${n}: ${item.args.content}.
|
||
Reason: ${i}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${n}: ${e}`)}}else if(e?.startsWith("/"))try{script=mo().readFileSync(e.split("#")[0],"utf8")}catch(n){throw Q.error(`Error when reading local script: ${item.args.content}.
|
||
Reason: ${n}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u811A\u672C\u6587\u4EF6: ${e}`)}else try{script=await ci(e,void 0,void 0,void 0,void 0,void 0,void 0,void 0,{noFlow:executionContext.noFlow})}catch(n){throw Q.error(`Error when downloading remote script: ${item.args.content}.
|
||
Reason: ${n}`),new Error(`\u65E0\u6CD5\u4E0B\u8F7D\u811A\u672C: ${e}`)}}else script=content,$arguments=item.args?.arguments||{};return{script,$arguments}}function lx(e={}){let t=e.header||e.headers||{};(!t||typeof t!="object")&&(t={});let r={status:e.status||e.statusCode||200,body:Object.prototype.hasOwnProperty.call(e,"body")?e.body:""};return Object.defineProperty(r,"headers",{enumerable:!0,get(){return t},set(n){t=n&&typeof n=="object"?n:{}}}),Object.defineProperty(r,"header",{enumerable:!0,get(){return t},set(n){t=n&&typeof n=="object"?n:{}}}),r}function fx(e){return e.replace(/[=,]/g,"").replace(/(^|\s)(?:[#;]|\/\/)+/g,"$1").trim()}function ete(e,t,r,n={}){let i=Z9[t];if(!i)throw new Error(`Target platform: ${t} is not supported!`);let o=String(t).toLowerCase(),s=["surge","surgemac","surfboard"].includes(o);if(e=e.filter(a=>{if(!qg(a,t))return!1;let u=n["include-unsupported-proxy"];if(!u&&a.supported&&a.supported[t]===!1)return!1;if(!u&&tte(a)&&rte(a)&&!nte(a,t))return Q.error(`Target platform ${t} does not support headers for ${ste(a)} proxy ${a.name||`${a.server}:${a.port}`}. Proxy has been filtered.`),!1;if(!u&&Xf(a)&&!["qx","quantumultx","shadowrocket"].includes(o))return!1;if(["vless","vmess"].includes(a.type)){gm(a.uuid)||Q.warn(`UUID may be invalid: ${a.name} ${a.uuid}`);let h=a.type==="vless",m=h?[["reality-opts",a["reality-opts"]],["xhttp download-settings reality-opts",a["xhttp-opts"]?.["download-settings"]?.["reality-opts"]]]:[];for(let[d,v]of m)if(v&&!qe(v["public-key"])){if(d==="xhttp download-settings reality-opts"&&qe(a["reality-opts"]?.["public-key"])&&v["public-key"]==="")continue;return Q.error(`Skipping VLESS Reality proxy ${a.name}: empty ${d}.public-key`),!1}let p=a["xhttp-opts"];if(h&&a.network==="xhttp"&&p?.mode==="stream-one"&&p["download-settings"])return Q.error(`Skipping VLESS xhttp proxy ${a.name}: mode "stream-one" cannot be used with download-settings`),!1}return!0}),e=e.map(a=>(a._resolved=a.resolved,s&&typeof a.name=="string"&&(a.name=fx(a.name)),qe(a.name)||(a.name=`${a.type} ${a.server}:${a.port}`),a["disable-sni"]&&(["surge","surgemac","shadowrocket"].includes(o)||o==="surfboard"&&a.type==="vless"?a.sni="off":!["tuic"].includes(a.type)&&!["sing-box","singbox"].includes(o)&&(Q.error(`Target platform ${t} does not support sni off. As a workaround for mihomo, proxy ${a.name} sni will be set to IP instead`),a.sni=y2(a.server)?a.server:"127.0.0.1")),a.ports&&(a.ports=String(a.ports),["meta","clashmeta","clash.meta","mihomo"].includes(o)||(a.ports=a.ports.replace(/\//g,",")),a.port||(a.port=Cd(a.ports))),a.type==="wireguard"&&Ap(a),a)),Q.log(`Producing proxies for target: ${t}`),typeof i.type>"u"||i.type==="SINGLE"){let a=e.map(u=>{try{return i.produce(u,r,n)}catch(l){return Q.error(`Cannot produce proxy: ${u.name}
|
||
Reason: ${l}`),""}}).filter(u=>u.length>0);return n._merged&&n.localPort>=1&&a.push(_p().produce({name:fx(String(n._merged.name??""))||"mihomo merged",type:"external",udp:!0,exec:n._merged.exec,"local-port":n.localPort,args:["-config",bt.encode(JSON.stringify({...n._merged.config,...n._merged.configOverride||{},"mixed-port":n.localPort}))],addresses:[]},r,n)),a=r==="internal"?a:a.join(`
|
||
`),t.startsWith("Surge")&&e.length>0&&e.every(u=>u.type==="wireguard")&&(a=`#!name=${e[0]?._subName}
|
||
#!desc=${e[0]?._desc??""}
|
||
#!category=${e[0]?._category??""}
|
||
${a}`),a}else if(i.type==="ALL")return i.produce(e,r,n)}function tte(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function rte(e){return["http","h2-connect","trusttunnel"].includes(e?.type)}function nte(e,t){let r=`${t}`.toLowerCase();return r.startsWith("surge")?["http","h2-connect","trusttunnel"].includes(e.type):r==="egern"||["clashmeta","clash.meta","meta","mihomo"].includes(r)||["singbox","sing-box"].includes(r)?e.type==="http":r==="json"?["http","h2-connect","trusttunnel"].includes(e.type):!1}function ste(e){return e.type==="http"?e.tls?"HTTPS":"HTTP":e.type==="h2-connect"?"HTTP/2 CONNECT":e.type==="trusttunnel"?"TrustTunnel":e.type}var Lt={parse:Zee,process:Jee,processResponse:Qee,produce:ete,age:Yee,ipAddress:mm,getRandomPort:Cd,isIPv4:_r,isIPv6:Xt,isIP:y2,yaml:ks,getFlag:Kf,removeFlag:mp,getISO:gI,MMDB:Rg,Gist:yf,download:ci,downloadFile:mI,isValidUUID:gm,doh:DA,Buffer:w2.Buffer,Base64:bt,JSON5:px.default,hex_md5:Ur};function hx(e,t){if(!ite(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function ite(e,t){try{return e.test(t)}catch{return!1}}function dx(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function ote(e){let t=(a,u)=>Object.prototype.hasOwnProperty.call(a,u),r=a=>{if(!(!a||typeof a!="object"||Array.isArray(a)))for(let u of Object.keys(a)){let l=u.toLowerCase();u!==l&&(t(a,l)||(a[l]=a[u]),delete a[u])}};for(let a of Object.keys(e)){let u=a.toLowerCase();u.endsWith("-opts")&&(a!==u&&(t(e,u)||(e[u]=e[a]),delete e[a]),r(e[u]))}let n=a=>{let u=a?.["reality-opts"];qe(u?.["public-key"])&&!t(u,"support-x25519mlkem768")&&["safari-ios-26","chrome147"].includes(`${a._loon_tls_profile||""}`.trim())&&(u["support-x25519mlkem768"]=!0)};if(n(e),e.network==="xhttp"&&n(e["xhttp-opts"]?.["download-settings"]),e.udp=![!1,0,"0","false","off"].includes(typeof e.udp=="string"?e.udp.toLowerCase():e.udp),typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=z8(e.password)),e["hop-interval"]!=null){let a=`${e["hop-interval"]}`.trim(),u=a.match(/^(\d+)\s*-\s*(\d+)$/);if(u){let l=parseInt(u[1],10),h=parseInt(u[2],10);l>0&&l<=h?(e["hop-interval"]=l,e["hop-interval-max"]=h):(delete e["hop-interval"],delete e["hop-interval-max"])}else if(/^\d+$/.test(a)){let l=parseInt(a,10);l>0?(e["hop-interval"]=l,delete e["hop-interval-max"]):(delete e["hop-interval"],delete e["hop-interval-max"])}else delete e["hop-interval"],delete e["hop-interval-max"]}["ss"].includes(e.type)&&e.cipher==="none"&&!e.password&&(e.password=""),e.interface&&(e["interface-name"]=e.interface,delete e.interface),V8(e.port)&&(e.port=parseInt(e.port,10)),e.server&&(e.server=`${e.server}`.trim().replace(/^\[/,"").replace(/\]$/,"")),["vmess","vless","trojan","anytls"].includes(e.type)&&e["shadow-tls-opts"]&&(e.plugin="shadow-tls",e["plugin-opts"]={host:e.sni,password:e["shadow-tls-opts"].password,version:e["shadow-tls-opts"].version},delete e["shadow-tls-opts"]),e.type==="snell"&&e["obfs-opts"]?.mode==="shadow-tls"&&!e.plugin&&(e.plugin="shadow-tls",e["plugin-opts"]={...e["obfs-opts"]},delete e["plugin-opts"].mode,delete e["obfs-opts"]),e.plugin==="shadow-tls"&&e["plugin-opts"]&&(e.alpn&&!e["plugin-opts"].alpn&&(e["plugin-opts"].alpn=e.alpn),delete e.alpn);let i=e.type==="vless"&&e.network==="xhttp"?e["xhttp-opts"]?.["download-settings"]:void 0;i?.["shadow-tls-opts"]&&(i.plugin="shadow-tls",i["plugin-opts"]={host:i.servername,password:i["shadow-tls-opts"].password,version:i["shadow-tls-opts"].version},delete i["shadow-tls-opts"]),i?.plugin==="shadow-tls"&&i["plugin-opts"]&&(i.alpn&&!i["plugin-opts"].alpn&&(i["plugin-opts"].alpn=i.alpn),delete i.alpn),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 o=e[`${e.network}-opts`]?.path;if(Array.isArray(o)?e[`${e.network}-opts`].path=o.map(a=>dx(a)):o!=null&&(e[`${e.network}-opts`].path=dx(o)),e.type==="trojan"&&(e.network=e.network||"tcp"),["vmess"].includes(e.type)&&(e.network=e.network||"tcp",e.cipher=e.cipher||"none",e.alterId=e.alterId||0),["vless"].includes(e.type)&&(e.network=e.network||"tcp"),["vmess","vless"].includes(e.type)&&e["packet-encoding"]==null&&(e.xudp?e["packet-encoding"]="xudp":e["packet-addr"]&&(e["packet-encoding"]="packetaddr")),["trojan","tuic","hysteria","hysteria2","juicity","anytls","trusttunnel","h2-connect","naive","masque","shadowquic"].includes(e.type)&&(e.tls=!0),e.network){let a=e[`${e.network}-opts`]?.headers?.Host,u=e[`${e.network}-opts`]?.headers?.host;e.network!=="h2"&&u&&!a&&(e[`${e.network}-opts`].headers.Host=u,delete e[`${e.network}-opts`].headers.host)}if(e.network==="h2"){let a=e["h2-opts"],u=a?.host??a?.headers?.host??a?.headers?.Host,l=a?.path;u&&(a.host=Array.isArray(u)?u:[u]),a?.headers&&(delete a.headers.host,delete a.headers.Host,Object.keys(a.headers).length===0&&delete a.headers),Array.isArray(l)&&(a.path=l[0])}if(!e.tls&&["ws","http"].includes(e.network)&&!e[`${e.network}-opts`]?.headers?.Host&&!y2(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 a=e[`${e.network}-opts`]?.path,u=e[`${e.network}-opts`]?.headers?.Host;u&&!Array.isArray(u)&&(e[`${e.network}-opts`].headers.Host=[u]),a&&!Array.isArray(a)&&(e[`${e.network}-opts`].path=[a])}if(e.tls&&!e.sni&&e.sni!==""){if(e.network){let a=e.network==="h2"?e["h2-opts"]?.host:e[`${e.network}-opts`]?.headers?.Host;a=Array.isArray(a)?a[0]:a,a&&(e.sni=a)}!e.sni&&!y2(e.server)&&(e.sni=e.server)}if(e.ports?e.ports=String(e.ports).replace(/\//g,","):delete e.ports,["hysteria2"].includes(e.type)&&e.obfs&&!["salamander","gecko"].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||["null",null].includes(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=w2.Buffer.from(e.name.data).toString("utf8"):e.name=w2.Buffer.from(e.name).toString("utf8")}catch(a){Q.error(`proxy.name decode failed
|
||
Reason: ${a}`),e.name=`${e.type} ${e.server}:${e.port}`}["ws","http","h2"].includes(e.network)&&!["masque"].includes(e.type)&&(["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(a=>!a))&&(e[`${e.network}-opts`]=e[`${e.network}-opts`]||{},e[`${e.network}-opts`].path=["/"])),["anytls"].includes(e.type)&&e["disable-reuse"]&&(e.reuse=!1),["","off"].includes(e.sni)&&(e["disable-sni"]=!0);let s=e.ca_str;e["ca-str"]?s=e["ca-str"]:s&&(delete e.ca_str,e["ca-str"]=s);try{Q.env.isNode&&!s&&e._ca&&(s=Q.node.fs.readFileSync(e._ca,{encoding:"utf8"}))}catch(a){Q.error(`Read ca file failed
|
||
Reason: ${a}`)}return!e["tls-fingerprint"]&&s&&(e["tls-fingerprint"]=SC.generateFingerprint(s)),["tuic"].includes(e.type)&&(e.alpn=Array.isArray(e.alpn)?e.alpn:[e.alpn||"h3"],e["congestion-controller"]=e["congestion-controller"]||"cubic",e["udp-relay-mode"]=e["udp-relay-mode"]||"native"),["wireguard"].includes(e.type)&&(Array.isArray(e.peers)&&e.peers.length>0&&(e.peers.find(u=>u.ip&&u.ipv6)||e.peers.find(u=>u.ip||u.ipv6))&&(e.ip||(e.ip=e.peers[0]?.ip),e.ipv6||(e.ipv6=e.peers[0]?.ipv6)),Ap(e)),e}function y2(e){return _r(e)||Xt(e)}var{parse:Bbe,produce:Ibe}=Lt;export{Bbe as parse,Ibe as produce};
|
||
/*! 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
|
||
*)
|
||
|
||
@scure/base/index.js:
|
||
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/ciphers/utils.js:
|
||
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/hashes/utils.js:
|
||
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/curves/utils.js:
|
||
@noble/curves/abstract/modular.js:
|
||
@noble/curves/abstract/curve.js:
|
||
@noble/curves/abstract/montgomery.js:
|
||
@noble/curves/abstract/weierstrass.js:
|
||
@noble/curves/ed25519.js:
|
||
@noble/curves/nist.js:
|
||
@noble/curves/utils.js:
|
||
@noble/curves/abstract/modular.js:
|
||
@noble/curves/abstract/curve.js:
|
||
@noble/curves/abstract/weierstrass.js:
|
||
@noble/curves/nist.js:
|
||
@noble/curves/abstract/edwards.js:
|
||
@noble/curves/abstract/montgomery.js:
|
||
@noble/curves/ed25519.js:
|
||
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
||
|
||
@noble/post-quantum/utils.js:
|
||
@noble/post-quantum/_crystals.js:
|
||
@noble/post-quantum/ml-kem.js:
|
||
@noble/post-quantum/hybrid.js:
|
||
(*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) *)
|
||
*/
|