mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-30 16:38:30 +00:00
1930 lines
1.2 MiB
Plaintext
1930 lines
1.2 MiB
Plaintext
var pO=Object.create;var Zv=Object.defineProperty;var mO=Object.getOwnPropertyDescriptor;var gO=Object.getOwnPropertyNames;var vO=Object.getPrototypeOf,wO=Object.prototype.hasOwnProperty;var wu=(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),yO=(e,t)=>{for(var r in t)Zv(e,r,{get:t[r],enumerable:!0})},EO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gO(t))!wO.call(e,i)&&i!==r&&Zv(e,i,{get:()=>t[i],enumerable:!(n=mO(t,i))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?pO(vO(e)):{},EO(t||!e||!e.__esModule?Zv(r,"default",{value:e,enumerable:!0}):r,e));var xs=be((Jv,R5)=>{"use strict";var lte=B(x()),Gh=function(e){return e&&e.Math===Math&&e};R5.exports=Gh(typeof globalThis=="object"&&globalThis)||Gh(typeof window=="object"&&window)||Gh(typeof self=="object"&&self)||Gh(typeof global=="object"&&global)||Gh(typeof Jv=="object"&&Jv)||(function(){return this})()||Function("return this")()});var sa=be((fte,O5)=>{"use strict";var hte=B(x());O5.exports=function(e){try{return!!e()}catch{return!0}}});var yu=be((dte,N5)=>{"use strict";var pte=B(x()),bO=sa();N5.exports=!bO(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Qv=be((mte,L5)=>{"use strict";var gte=B(x()),AO=sa();L5.exports=!AO(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")})});var j0=be((vte,U5)=>{"use strict";var wte=B(x()),SO=Qv(),M0=Function.prototype.call;U5.exports=SO?M0.bind(M0):function(){return M0.apply(M0,arguments)}});var j5=be(M5=>{"use strict";var Ete=B(x()),H5={}.propertyIsEnumerable,q5=Object.getOwnPropertyDescriptor,_O=q5&&!H5.call({1:2},1);M5.f=_O?function(t){var r=q5(this,t);return!!r&&r.enumerable}:H5});var ew=be((bte,K5)=>{"use strict";var Ate=B(x());K5.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}});var io=be((Ste,G5)=>{"use strict";var _te=B(x()),V5=Qv(),z5=Function.prototype,tw=z5.call,CO=V5&&z5.bind.bind(tw,tw);G5.exports=V5?CO:function(e){return function(){return tw.apply(e,arguments)}}});var X5=be((Cte,Y5)=>{"use strict";var Dte=B(x()),W5=io(),DO=W5({}.toString),FO=W5("".slice);Y5.exports=function(e){return FO(DO(e),8,-1)}});var J5=be((Fte,Z5)=>{"use strict";var Bte=B(x()),BO=io(),IO=sa(),xO=X5(),rw=Object,$O=BO("".split);Z5.exports=IO(function(){return!rw("z").propertyIsEnumerable(0)})?function(e){return xO(e)==="String"?$O(e,""):rw(e)}:rw});var nw=be((Ite,Q5)=>{"use strict";var xte=B(x());Q5.exports=function(e){return e==null}});var sw=be(($te,e4)=>{"use strict";var Pte=B(x()),PO=nw(),kO=TypeError;e4.exports=function(e){if(PO(e))throw new kO("Can't call method on "+e);return e}});var K0=be((kte,t4)=>{"use strict";var Tte=B(x()),TO=J5(),RO=sw();t4.exports=function(e){return TO(RO(e))}});var Si=be((Rte,r4)=>{"use strict";var Ote=B(x()),iw=typeof document=="object"&&document.all;r4.exports=typeof iw>"u"&&iw!==void 0?function(e){return typeof e=="function"||e===iw}:function(e){return typeof e=="function"}});var jl=be((Nte,n4)=>{"use strict";var Lte=B(x()),OO=Si();n4.exports=function(e){return typeof e=="object"?e!==null:OO(e)}});var aw=be((Ute,s4)=>{"use strict";var Hte=B(x()),ow=xs(),NO=Si(),LO=function(e){return NO(e)?e:void 0};s4.exports=function(e,t){return arguments.length<2?LO(ow[e]):ow[e]&&ow[e][t]}});var o4=be((qte,i4)=>{"use strict";var Mte=B(x()),UO=io();i4.exports=UO({}.isPrototypeOf)});var l4=be((jte,c4)=>{"use strict";var Kte=B(x()),HO=xs(),a4=HO.navigator,u4=a4&&a4.userAgent;c4.exports=u4?String(u4):""});var v4=be((Vte,g4)=>{"use strict";var zte=B(x()),m4=xs(),uw=l4(),f4=m4.process,h4=m4.Deno,d4=f4&&f4.versions||h4&&h4.version,p4=d4&&d4.v8,_i,V0;p4&&(_i=p4.split("."),V0=_i[0]>0&&_i[0]<4?1:+(_i[0]+_i[1]));!V0&&uw&&(_i=uw.match(/Edge\/(\d+)/),(!_i||_i[1]>=74)&&(_i=uw.match(/Chrome\/(\d+)/),_i&&(V0=+_i[1])));g4.exports=V0});var cw=be((Gte,y4)=>{"use strict";var Wte=B(x()),w4=v4(),qO=sa(),MO=xs(),jO=MO.String;y4.exports=!!Object.getOwnPropertySymbols&&!qO(function(){var e=Symbol("symbol detection");return!jO(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&w4&&w4<41})});var lw=be((Yte,E4)=>{"use strict";var Xte=B(x()),KO=cw();E4.exports=KO&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var fw=be((Zte,b4)=>{"use strict";var Jte=B(x()),VO=aw(),zO=Si(),GO=o4(),WO=lw(),YO=Object;b4.exports=WO?function(e){return typeof e=="symbol"}:function(e){var t=VO("Symbol");return zO(t)&&GO(t.prototype,YO(e))}});var S4=be((Qte,A4)=>{"use strict";var ere=B(x()),XO=String;A4.exports=function(e){try{return XO(e)}catch{return"Object"}}});var C4=be((tre,_4)=>{"use strict";var rre=B(x()),ZO=Si(),JO=S4(),QO=TypeError;_4.exports=function(e){if(ZO(e))return e;throw new QO(JO(e)+" is not a function")}});var F4=be((nre,D4)=>{"use strict";var sre=B(x()),eN=C4(),tN=nw();D4.exports=function(e,t){var r=e[t];return tN(r)?void 0:eN(r)}});var I4=be((ire,B4)=>{"use strict";var ore=B(x()),hw=j0(),dw=Si(),pw=jl(),rN=TypeError;B4.exports=function(e,t){var r,n;if(t==="string"&&dw(r=e.toString)&&!pw(n=hw(r,e))||dw(r=e.valueOf)&&!pw(n=hw(r,e))||t!=="string"&&dw(r=e.toString)&&!pw(n=hw(r,e)))return n;throw new rN("Can't convert object to primitive value")}});var $4=be((are,x4)=>{"use strict";var ure=B(x());x4.exports=!1});var z0=be((cre,k4)=>{"use strict";var lre=B(x()),P4=xs(),nN=Object.defineProperty;k4.exports=function(e,t){try{nN(P4,e,{value:t,configurable:!0,writable:!0})}catch{P4[e]=t}return t}});var G0=be((fre,O4)=>{"use strict";var hre=B(x()),sN=$4(),iN=xs(),oN=z0(),T4="__core-js_shared__",R4=O4.exports=iN[T4]||oN(T4,{});(R4.versions||(R4.versions=[])).push({version:"3.49.0",mode:sN?"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 mw=be((dre,L4)=>{"use strict";var pre=B(x()),N4=G0();L4.exports=function(e,t){return N4[e]||(N4[e]=t||{})}});var H4=be((mre,U4)=>{"use strict";var gre=B(x()),aN=sw(),uN=Object;U4.exports=function(e){return uN(aN(e))}});var ia=be((vre,q4)=>{"use strict";var wre=B(x()),cN=io(),lN=H4(),fN=cN({}.hasOwnProperty);q4.exports=Object.hasOwn||function(t,r){return fN(lN(t),r)}});var gw=be((yre,M4)=>{"use strict";var Ere=B(x()),hN=io(),dN=0,pN=Math.random(),mN=hN(1.1.toString);M4.exports=function(e){return"Symbol("+(e===void 0?"":e)+")_"+mN(++dN+pN,36)}});var V4=be((bre,K4)=>{"use strict";var Are=B(x()),gN=xs(),vN=mw(),j4=ia(),wN=gw(),yN=cw(),EN=lw(),Kl=gN.Symbol,vw=vN("wks"),bN=EN?Kl.for||Kl:Kl&&Kl.withoutSetter||wN;K4.exports=function(e){return j4(vw,e)||(vw[e]=yN&&j4(Kl,e)?Kl[e]:bN("Symbol."+e)),vw[e]}});var Y4=be((Sre,W4)=>{"use strict";var _re=B(x()),AN=j0(),z4=jl(),G4=fw(),SN=F4(),_N=I4(),CN=V4(),DN=TypeError,FN=CN("toPrimitive");W4.exports=function(e,t){if(!z4(e)||G4(e))return e;var r=SN(e,FN),n;if(r){if(t===void 0&&(t="default"),n=AN(r,e,t),!z4(n)||G4(n))return n;throw new DN("Can't convert object to primitive value")}return t===void 0&&(t="number"),_N(e,t)}});var ww=be((Cre,X4)=>{"use strict";var Dre=B(x()),BN=Y4(),IN=fw();X4.exports=function(e){var t=BN(e,"string");return IN(t)?t:t+""}});var Q4=be((Fre,J4)=>{"use strict";var Bre=B(x()),xN=xs(),Z4=jl(),yw=xN.document,$N=Z4(yw)&&Z4(yw.createElement);J4.exports=function(e){return $N?yw.createElement(e):{}}});var Ew=be((Ire,e3)=>{"use strict";var xre=B(x()),PN=yu(),kN=sa(),TN=Q4();e3.exports=!PN&&!kN(function(){return Object.defineProperty(TN("div"),"a",{get:function(){return 7}}).a!==7})});var bw=be(r3=>{"use strict";var Pre=B(x()),RN=yu(),ON=j0(),NN=j5(),LN=ew(),UN=K0(),HN=ww(),qN=ia(),MN=Ew(),t3=Object.getOwnPropertyDescriptor;r3.f=RN?t3:function(t,r){if(t=UN(t),r=HN(r),MN)try{return t3(t,r)}catch{}if(qN(t,r))return LN(!ON(NN.f,t,r),t[r])}});var s3=be((kre,n3)=>{"use strict";var Tre=B(x()),jN=yu(),KN=sa();n3.exports=jN&&KN(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Aw=be((Rre,i3)=>{"use strict";var Ore=B(x()),VN=jl(),zN=String,GN=TypeError;i3.exports=function(e){if(VN(e))return e;throw new GN(zN(e)+" is not an object")}});var Y0=be(a3=>{"use strict";var Lre=B(x()),WN=yu(),YN=Ew(),XN=s3(),W0=Aw(),o3=ww(),ZN=TypeError,Sw=Object.defineProperty,JN=Object.getOwnPropertyDescriptor,_w="enumerable",Cw="configurable",Dw="writable";a3.f=WN?XN?function(t,r,n){if(W0(t),r=o3(r),W0(n),typeof t=="function"&&r==="prototype"&&"value"in n&&Dw in n&&!n[Dw]){var i=JN(t,r);i&&i[Dw]&&(t[r]=n.value,n={configurable:Cw in n?n[Cw]:i[Cw],enumerable:_w in n?n[_w]:i[_w],writable:!1})}return Sw(t,r,n)}:Sw:function(t,r,n){if(W0(t),r=o3(r),W0(n),YN)try{return Sw(t,r,n)}catch{}if("get"in n||"set"in n)throw new ZN("Accessors not supported");return"value"in n&&(t[r]=n.value),t}});var Fw=be((Ure,u3)=>{"use strict";var Hre=B(x()),QN=yu(),eL=Y0(),tL=ew();u3.exports=QN?function(e,t,r){return eL.f(e,t,tL(1,r))}:function(e,t,r){return e[t]=r,e}});var f3=be((qre,l3)=>{"use strict";var Mre=B(x()),Bw=yu(),rL=ia(),c3=Function.prototype,nL=Bw&&Object.getOwnPropertyDescriptor,Iw=rL(c3,"name"),sL=Iw&&function(){}.name==="something",iL=Iw&&(!Bw||Bw&&nL(c3,"name").configurable);l3.exports={EXISTS:Iw,PROPER:sL,CONFIGURABLE:iL}});var d3=be((jre,h3)=>{"use strict";var Kre=B(x()),oL=io(),aL=Si(),xw=G0(),uL=oL(Function.toString);aL(xw.inspectSource)||(xw.inspectSource=function(e){return uL(e)});h3.exports=xw.inspectSource});var g3=be((Vre,m3)=>{"use strict";var zre=B(x()),cL=xs(),lL=Si(),p3=cL.WeakMap;m3.exports=lL(p3)&&/native code/.test(String(p3))});var y3=be((Gre,w3)=>{"use strict";var Wre=B(x()),fL=mw(),hL=gw(),v3=fL("keys");w3.exports=function(e){return v3[e]||(v3[e]=hL(e))}});var $w=be((Yre,E3)=>{"use strict";var Xre=B(x());E3.exports={}});var _3=be((Zre,S3)=>{"use strict";var Jre=B(x()),dL=g3(),A3=xs(),pL=jl(),mL=Fw(),Pw=ia(),kw=G0(),gL=y3(),vL=$w(),b3="Object already initialized",Tw=A3.TypeError,wL=A3.WeakMap,X0,Wh,Z0,yL=function(e){return Z0(e)?Wh(e):X0(e,{})},EL=function(e){return function(t){var r;if(!pL(t)||(r=Wh(t)).type!==e)throw new Tw("Incompatible receiver, "+e+" required");return r}};dL||kw.state?(Ci=kw.state||(kw.state=new wL),Ci.get=Ci.get,Ci.has=Ci.has,Ci.set=Ci.set,X0=function(e,t){if(Ci.has(e))throw new Tw(b3);return t.facade=e,Ci.set(e,t),t},Wh=function(e){return Ci.get(e)||{}},Z0=function(e){return Ci.has(e)}):(Sc=gL("state"),vL[Sc]=!0,X0=function(e,t){if(Pw(e,Sc))throw new Tw(b3);return t.facade=e,mL(e,Sc,t),t},Wh=function(e){return Pw(e,Sc)?e[Sc]:{}},Z0=function(e){return Pw(e,Sc)});var Ci,Sc;S3.exports={set:X0,get:Wh,has:Z0,enforce:yL,getterFor:EL}});var B3=be((Qre,F3)=>{"use strict";var ene=B(x()),Ow=io(),bL=sa(),AL=Si(),J0=ia(),Rw=yu(),SL=f3().CONFIGURABLE,_L=d3(),D3=_3(),CL=D3.enforce,DL=D3.get,C3=String,Q0=Object.defineProperty,FL=Ow("".slice),BL=Ow("".replace),IL=Ow([].join),xL=Rw&&!bL(function(){return Q0(function(){},"length",{value:8}).length!==8}),$L=String(String).split("String"),PL=F3.exports=function(e,t,r){FL(C3(t),0,7)==="Symbol("&&(t="["+BL(C3(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!J0(e,"name")||SL&&e.name!==t)&&(Rw?Q0(e,"name",{value:t,configurable:!0}):e.name=t),xL&&r&&J0(r,"arity")&&e.length!==r.arity&&Q0(e,"length",{value:r.arity});try{r&&J0(r,"constructor")&&r.constructor?Rw&&Q0(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=CL(e);return J0(n,"source")||(n.source=IL($L,typeof t=="string"?t:"")),e};Function.prototype.toString=PL(function(){return AL(this)&&DL(this).source||_L(this)},"toString")});var x3=be((tne,I3)=>{"use strict";var rne=B(x()),kL=Si(),TL=Y0(),RL=B3(),OL=z0();I3.exports=function(e,t,r,n){n||(n={});var i=n.enumerable,o=n.name!==void 0?n.name:t;if(kL(r)&&RL(r,o,n),n.global)i?e[t]=r:OL(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch{}i?e[t]=r:TL.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e}});var P3=be((nne,$3)=>{"use strict";var sne=B(x()),NL=Math.ceil,LL=Math.floor;$3.exports=Math.trunc||function(t){var r=+t;return(r>0?LL:NL)(r)}});var Nw=be((ine,k3)=>{"use strict";var one=B(x()),UL=P3();k3.exports=function(e){var t=+e;return t!==t||t===0?0:UL(t)}});var R3=be((ane,T3)=>{"use strict";var une=B(x()),HL=Nw(),qL=Math.max,ML=Math.min;T3.exports=function(e,t){var r=HL(e);return r<0?qL(r+t,0):ML(r,t)}});var N3=be((cne,O3)=>{"use strict";var lne=B(x()),jL=Nw(),KL=Math.min;O3.exports=function(e){var t=jL(e);return t>0?KL(t,9007199254740991):0}});var U3=be((fne,L3)=>{"use strict";var hne=B(x()),VL=N3();L3.exports=function(e){return VL(e.length)}});var M3=be((dne,q3)=>{"use strict";var pne=B(x()),zL=K0(),GL=R3(),WL=U3(),H3=function(e){return function(t,r,n){var i=zL(t),o=WL(i);if(o===0)return!e&&-1;var s=GL(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}};q3.exports={includes:H3(!0),indexOf:H3(!1)}});var V3=be((mne,K3)=>{"use strict";var gne=B(x()),YL=io(),Lw=ia(),XL=K0(),ZL=M3().indexOf,JL=$w(),j3=YL([].push);K3.exports=function(e,t){var r=XL(e),n=0,i=[],o;for(o in r)!Lw(JL,o)&&Lw(r,o)&&j3(i,o);for(;t.length>n;)Lw(r,o=t[n++])&&(~ZL(i,o)||j3(i,o));return i}});var G3=be((vne,z3)=>{"use strict";var wne=B(x());z3.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Y3=be(W3=>{"use strict";var Ene=B(x()),QL=V3(),eU=G3(),tU=eU.concat("length","prototype");W3.f=Object.getOwnPropertyNames||function(t){return QL(t,tU)}});var Z3=be(X3=>{"use strict";var Ane=B(x());X3.f=Object.getOwnPropertySymbols});var Q3=be((Sne,J3)=>{"use strict";var _ne=B(x()),rU=aw(),nU=io(),sU=Y3(),iU=Z3(),oU=Aw(),aU=nU([].concat);J3.exports=rU("Reflect","ownKeys")||function(t){var r=sU.f(oU(t)),n=iU.f;return n?aU(r,n(t)):r}});var r_=be((Cne,t_)=>{"use strict";var Dne=B(x()),e_=ia(),uU=Q3(),cU=bw(),lU=Y0();t_.exports=function(e,t,r){for(var n=uU(t),i=lU.f,o=cU.f,s=0;s<n.length;s++){var a=n[s];!e_(e,a)&&!(r&&e_(r,a))&&i(e,a,o(t,a))}}});var s_=be((Fne,n_)=>{"use strict";var Bne=B(x()),fU=sa(),hU=Si(),dU=/#|\.prototype\./,Yh=function(e,t){var r=mU[pU(e)];return r===vU?!0:r===gU?!1:hU(t)?fU(t):!!t},pU=Yh.normalize=function(e){return String(e).replace(dU,".").toLowerCase()},mU=Yh.data={},gU=Yh.NATIVE="N",vU=Yh.POLYFILL="P";n_.exports=Yh});var o_=be((Ine,i_)=>{"use strict";var xne=B(x()),e1=xs(),wU=bw().f,yU=Fw(),EU=x3(),bU=z0(),AU=r_(),SU=s_();i_.exports=function(e,t){var r=e.target,n=e.global,i=e.stat,o,s,a,u,l,h;if(n?s=e1:i?s=e1[r]||bU(r,{}):s=e1[r]&&e1[r].prototype,s)for(a in t){if(l=t[a],e.dontCallGetSet?(h=wU(s,a),u=h&&h.value):u=s[a],o=SU(n?a:r+(i?".":"#")+a,e.forced),!o&&u!==void 0){if(typeof l==typeof u)continue;AU(l,u)}(e.sham||u&&u.sham)&&yU(l,"sham",!0),EU(s,a,l,e)}}});var a_=be(()=>{"use strict";var kne=B(x()),_U=o_(),CU=ia();_U({target:"Object",stat:!0},{hasOwn:CU})});var c_=be((Tne,u_)=>{"use strict";var Rne=B(x()),DU=xs();u_.exports=DU});var f_=be((One,l_)=>{"use strict";var Nne=B(x());a_();var FU=c_();l_.exports=FU.Object.hasOwn});var d_=be((Lne,h_)=>{"use strict";var Une=B(x()),BU=f_();h_.exports=BU});var x=be((Hne,p_)=>{"use strict";var IU=d_();p_.exports=IU});var R_=be(n1=>{"use strict";var Kne=B(x());n1.byteLength=qU;n1.toByteArray=jU;n1.fromByteArray=zU;var oo=[],Xs=[],HU=typeof Uint8Array<"u"?Uint8Array:Array,jw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_c=0,k_=jw.length;_c<k_;++_c)oo[_c]=jw[_c],Xs[jw.charCodeAt(_c)]=_c;var _c,k_;Xs[45]=62;Xs[95]=63;function T_(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 qU(e){var t=T_(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 jU(e){var t,r=T_(e),n=r[0],i=r[1],o=new HU(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 KU(e){return oo[e>>18&63]+oo[e>>12&63]+oo[e>>6&63]+oo[e&63]}function VU(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(KU(n));return i.join("")}function zU(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(VU(e,s,s+o>a?a:s+o));return n===1?(t=e[r-1],i.push(oo[t>>2]+oo[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(oo[t>>10]+oo[t>>4&63]+oo[t<<2&63]+"=")),i.join("")}});var O_=be(Kw=>{var zne=B(x());Kw.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)};Kw.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 aa=be(Xl=>{"use strict";var Yne=B(x());var Vw=R_(),Wl=O_(),N_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xl.Buffer=ve;Xl.SlowBuffer=JU;Xl.INSPECT_MAX_BYTES=50;var s1=2147483647;Xl.kMaxLength=s1;ve.TYPED_ARRAY_SUPPORT=GU();!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 GU(){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 oa(e){if(e>s1)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 Yw(e)}return q_(e,t,r)}ve.poolSize=8192;function q_(e,t,r){if(typeof e=="string")return YU(e,t);if(ArrayBuffer.isView(e))return XU(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(ao(e,ArrayBuffer)||e&&ao(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ao(e,SharedArrayBuffer)||e&&ao(e.buffer,SharedArrayBuffer)))return Gw(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=ZU(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 q_(e,t,r)};Object.setPrototypeOf(ve.prototype,Uint8Array.prototype);Object.setPrototypeOf(ve,Uint8Array);function M_(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 WU(e,t,r){return M_(e),e<=0?oa(e):t!==void 0?typeof r=="string"?oa(e).fill(t,r):oa(e).fill(t):oa(e)}ve.alloc=function(e,t,r){return WU(e,t,r)};function Yw(e){return M_(e),oa(e<0?0:Xw(e)|0)}ve.allocUnsafe=function(e){return Yw(e)};ve.allocUnsafeSlow=function(e){return Yw(e)};function YU(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!ve.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=j_(e,t)|0,n=oa(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function zw(e){let t=e.length<0?0:Xw(e.length)|0,r=oa(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function XU(e){if(ao(e,Uint8Array)){let t=new Uint8Array(e);return Gw(t.buffer,t.byteOffset,t.byteLength)}return zw(e)}function Gw(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 ZU(e){if(ve.isBuffer(e)){let t=Xw(e.length)|0,r=oa(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||Jw(e.length)?oa(0):zw(e);if(e.type==="Buffer"&&Array.isArray(e.data))return zw(e.data)}function Xw(e){if(e>=s1)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s1.toString(16)+" bytes");return e|0}function JU(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(ao(t,Uint8Array)&&(t=ve.from(t,t.offset,t.byteLength)),ao(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(ao(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 j_(e,t){if(ve.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ao(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 Ww(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return J_(e).length;default:if(i)return n?-1:Ww(e).length;t=(""+t).toLowerCase(),i=!0}}ve.byteLength=j_;function QU(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 cH(this,t,r);case"utf8":case"utf-8":return V_(this,t,r);case"ascii":return aH(this,t,r);case"latin1":case"binary":return uH(this,t,r);case"base64":return iH(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lH(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}ve.prototype._isBuffer=!0;function Cc(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)Cc(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)Cc(this,r,r+3),Cc(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)Cc(this,r,r+7),Cc(this,r+1,r+6),Cc(this,r+2,r+5),Cc(this,r+3,r+4);return this};ve.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?V_(this,0,t):QU.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=Xl.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};N_&&(ve.prototype[N_]=ve.prototype.inspect);ve.prototype.compare=function(t,r,n,i,o){if(ao(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 K_(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,Jw(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:L_(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):L_(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function L_(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 K_(this,t,r,n,!0)};ve.prototype.lastIndexOf=function(t,r,n){return K_(this,t,r,n,!1)};function eH(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(Jw(a))return s;e[r+s]=a}return s}function tH(e,t,r,n){return i1(Ww(t,e.length-r),e,r,n)}function rH(e,t,r,n){return i1(pH(t),e,r,n)}function nH(e,t,r,n){return i1(J_(t),e,r,n)}function sH(e,t,r,n){return i1(mH(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 eH(this,t,r,n);case"utf8":case"utf-8":return tH(this,t,r,n);case"ascii":case"latin1":case"binary":return rH(this,t,r,n);case"base64":return nH(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sH(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 iH(e,t,r){return t===0&&r===e.length?Vw.fromByteArray(e):Vw.fromByteArray(e.slice(t,r))}function V_(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 oH(n)}var U_=4096;function oH(e){let t=e.length;if(t<=U_)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=U_));return r}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]&127);return n}function uH(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 cH(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+=gH[e[o]];return i}function lH(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=Eu(function(t){t=t>>>0,Yl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Zh(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=Eu(function(t){t=t>>>0,Yl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Zh(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=Eu(function(t){t=t>>>0,Yl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Zh(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=Eu(function(t){t=t>>>0,Yl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&Zh(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),Wl.read(this,t,!0,23,4)};ve.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),Wl.read(this,t,!1,23,4)};ve.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Wr(t,8,this.length),Wl.read(this,t,!0,52,8)};ve.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Wr(t,8,this.length),Wl.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 z_(e,t,r,n,i){Z_(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 G_(e,t,r,n,i){Z_(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=Eu(function(t,r=0){return z_(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});ve.prototype.writeBigUInt64BE=Eu(function(t,r=0){return G_(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=Eu(function(t,r=0){return z_(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ve.prototype.writeBigInt64BE=Eu(function(t,r=0){return G_(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function W_(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 Y_(e,t,r,n,i){return t=+t,r=r>>>0,i||W_(e,t,r,4,34028234663852886e22,-34028234663852886e22),Wl.write(e,t,r,n,23,4),r+4}ve.prototype.writeFloatLE=function(t,r,n){return Y_(this,t,r,!0,n)};ve.prototype.writeFloatBE=function(t,r,n){return Y_(this,t,r,!1,n)};function X_(e,t,r,n,i){return t=+t,r=r>>>0,i||W_(e,t,r,8,17976931348623157e292,-17976931348623157e292),Wl.write(e,t,r,n,52,8),r+8}ve.prototype.writeDoubleLE=function(t,r,n){return X_(this,t,r,!0,n)};ve.prototype.writeDoubleBE=function(t,r,n){return X_(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 Gl={};function Zw(e,t,r){Gl[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}`}}}Zw("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Zw("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);Zw("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=H_(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H_(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function H_(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 fH(e,t,r){Yl(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&Zh(t,e.length-(r+1))}function Z_(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 Gl.ERR_OUT_OF_RANGE("value",a,e)}fH(n,i,o)}function Yl(e,t){if(typeof e!="number")throw new Gl.ERR_INVALID_ARG_TYPE(t,"number",e)}function Zh(e,t,r){throw Math.floor(e)!==e?(Yl(e,r),new Gl.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new Gl.ERR_BUFFER_OUT_OF_BOUNDS:new Gl.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var hH=/[^+/0-9A-Za-z-_]/g;function dH(e){if(e=e.split("=")[0],e=e.trim().replace(hH,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Ww(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 pH(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function mH(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 J_(e){return Vw.toByteArray(dH(e))}function i1(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 ao(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Jw(e){return e!==e}var gH=(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 Eu(e){return typeof BigInt>"u"?vH:e}function vH(){throw new Error("BigInt not supported")}});var _C=be($e=>{var Jne=B(x()),Qh={};Qh.userAgent=!1;var Zl={},wH="11.1.3",yH="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),M=this._keySchedule=[],L=0;L<I;L++)if(L<S)M[L]=K[L];else{var T=M[L-1];L%S?6<S&&L%S==4&&(T=r[T>>>24]<<24|r[T>>>16&255]<<16|r[T>>>8&255]<<8|r[T&255]):(T=T<<8|T>>>24,T=r[T>>>24]<<24|r[T>>>16&255]<<16|r[T>>>8&255]<<8|r[T&255],T^=F[L/S|0]<<24),M[L]=M[L-S]^T}for(K=this._invKeySchedule=[],S=0;S<I;S++)L=I-S,T=S%4?M[L]:M[L-4],K[S]=4>S||4>=L?T:u[r[T>>>24]]^l[r[T>>>16&255]]^h[r[T>>>8&255]]^m[r[T&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,M,L,T,O,R){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,q=1;q<N;q++)var Y=M[ae>>>24]^L[me>>>16&255]^T[he>>>8&255]^O[te&255]^I[P++],V=M[me>>>24]^L[he>>>16&255]^T[te>>>8&255]^O[ae&255]^I[P++],X=M[he>>>24]^L[te>>>16&255]^T[ae>>>8&255]^O[me&255]^I[P++],te=M[te>>>24]^L[ae>>>16&255]^T[me>>>8&255]^O[he&255]^I[P++],ae=Y,me=V,he=X;Y=(R[ae>>>24]<<24|R[me>>>16&255]<<16|R[he>>>8&255]<<8|R[te&255])^I[P++],V=(R[me>>>24]<<24|R[he>>>16&255]<<16|R[te>>>8&255]<<8|R[ae&255])^I[P++],X=(R[he>>>24]<<24|R[te>>>16&255]<<16|R[ae>>>8&255]<<8|R[me&255])^I[P++],te=(R[te>>>24]<<24|R[ae>>>16&255]<<16|R[me>>>8&255]<<8|R[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],M=m[p+12],L=m[p+13],T=m[p+14],O=m[p+15],R=d[0],q=d[1],P=d[2],N=d[3],R=t(R,q,P,N,v,7,l[0]),N=t(N,R,q,P,g,12,l[1]),P=t(P,N,R,q,y,17,l[2]),q=t(q,P,N,R,w,22,l[3]),R=t(R,q,P,N,E,7,l[4]),N=t(N,R,q,P,_,12,l[5]),P=t(P,N,R,q,C,17,l[6]),q=t(q,P,N,R,F,22,l[7]),R=t(R,q,P,N,H,7,l[8]),N=t(N,R,q,P,K,12,l[9]),P=t(P,N,R,q,S,17,l[10]),q=t(q,P,N,R,I,22,l[11]),R=t(R,q,P,N,M,7,l[12]),N=t(N,R,q,P,L,12,l[13]),P=t(P,N,R,q,T,17,l[14]),q=t(q,P,N,R,O,22,l[15]),R=r(R,q,P,N,g,5,l[16]),N=r(N,R,q,P,C,9,l[17]),P=r(P,N,R,q,I,14,l[18]),q=r(q,P,N,R,v,20,l[19]),R=r(R,q,P,N,_,5,l[20]),N=r(N,R,q,P,S,9,l[21]),P=r(P,N,R,q,O,14,l[22]),q=r(q,P,N,R,E,20,l[23]),R=r(R,q,P,N,K,5,l[24]),N=r(N,R,q,P,T,9,l[25]),P=r(P,N,R,q,w,14,l[26]),q=r(q,P,N,R,H,20,l[27]),R=r(R,q,P,N,L,5,l[28]),N=r(N,R,q,P,y,9,l[29]),P=r(P,N,R,q,F,14,l[30]),q=r(q,P,N,R,M,20,l[31]),R=n(R,q,P,N,_,4,l[32]),N=n(N,R,q,P,H,11,l[33]),P=n(P,N,R,q,I,16,l[34]),q=n(q,P,N,R,T,23,l[35]),R=n(R,q,P,N,g,4,l[36]),N=n(N,R,q,P,E,11,l[37]),P=n(P,N,R,q,F,16,l[38]),q=n(q,P,N,R,S,23,l[39]),R=n(R,q,P,N,L,4,l[40]),N=n(N,R,q,P,v,11,l[41]),P=n(P,N,R,q,w,16,l[42]),q=n(q,P,N,R,C,23,l[43]),R=n(R,q,P,N,K,4,l[44]),N=n(N,R,q,P,M,11,l[45]),P=n(P,N,R,q,O,16,l[46]),q=n(q,P,N,R,y,23,l[47]),R=i(R,q,P,N,v,6,l[48]),N=i(N,R,q,P,F,10,l[49]),P=i(P,N,R,q,T,15,l[50]),q=i(q,P,N,R,_,21,l[51]),R=i(R,q,P,N,M,6,l[52]),N=i(N,R,q,P,w,10,l[53]),P=i(P,N,R,q,S,15,l[54]),q=i(q,P,N,R,g,21,l[55]),R=i(R,q,P,N,H,6,l[56]),N=i(N,R,q,P,O,10,l[57]),P=i(P,N,R,q,C,15,l[58]),q=i(q,P,N,R,L,21,l[59]),R=i(R,q,P,N,E,6,l[60]),N=i(N,R,q,P,I,10,l[61]),P=i(P,N,R,q,y,15,l[62]),q=i(q,P,N,R,K,21,l[63]);d[0]=d[0]+R|0,d[1]=d[1]+q|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 M=p[I-15],L=p[I-2];p[I]=((M<<25|M>>>7)^(M<<14|M>>>18)^M>>>3)+p[I-7]+((L<<15|L>>>17)^(L<<13|L>>>19)^L>>>10)+p[I-16]}M=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+M|0,C=_,_=E,E=w,w=M+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,M=v.low,L=g.high,T=g.low,O=y.high,R=y.low,N=w.high,P=w.low,q=E.high,Y=E.low,V=_,X=C,te=F,ae=H,me=K,he=S,De=I,Pe=M,Ie=L,se=T,pe=O,Fe=R,Re=N,Ve=P,Oe=q,pt=Y,Qe=0;80>Qe;Qe++){var or=a[Qe];if(16>Qe)var ct=or.high=l[h+2*Qe]|0,Te=or.low=l[h+2*Qe+1]|0;else{var ct=a[Qe-15],Te=ct.high,lt=ct.low,ct=(Te>>>1|lt<<31)^(Te>>>8|lt<<24)^Te>>>7,lt=(lt>>>1|Te<<31)^(lt>>>8|Te<<24)^(lt>>>7|Te<<25),Pr=a[Qe-2],Te=Pr.high,Dt=Pr.low,Pr=(Te>>>19|Dt<<13)^(Te<<3|Dt>>>29)^Te>>>6,Dt=(Dt>>>19|Te<<13)^(Dt<<3|Te>>>29)^(Dt>>>6|Te<<26),Te=a[Qe-7],mn=Te.high,gr=a[Qe-16],Ze=gr.high,gr=gr.low,Te=lt+Te.low,ct=ct+mn+(Te>>>0<lt>>>0?1:0),Te=Te+Dt,ct=ct+Pr+(Te>>>0<Dt>>>0?1:0),Te=Te+gr,ct=ct+Ze+(Te>>>0<gr>>>0?1:0);or.high=ct,or.low=Te}var mn=Ie&pe^~Ie&Re,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+Te,Ze=Ze+ct+(Dt>>>0<Te>>>0?1:0),Te=Pr+vr,or=lt+or+(Te>>>0<Pr>>>0?1:0),Oe=Re,pt=Ve,Re=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+Te|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),M=v.low=M+Pe,v.high=I+De+(M>>>0<Pe>>>0?1:0),T=g.low=T+se,g.high=L+Ie+(T>>>0<se>>>0?1:0),R=y.low=R+Fe,y.high=O+pe+(R>>>0<Fe>>>0?1:0),P=w.low=P+Ve,w.high=N+Re+(P>>>0<Ve>>>0?1:0),Y=E.low=Y+pt,E.high=q+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,M,L,T,O;I=C=d[0],M=F=d[1],L=H=d[2],T=K=d[3],O=S=d[4];for(var R,p=0;80>p;p+=1)R=C+h[m+y[p]]|0,R=16>p?R+((F^H^K)+v[0]):32>p?R+((F&H|~F&K)+v[1]):48>p?R+(((F|~H)^K)+v[2]):64>p?R+((F&K|H&~K)+v[3]):R+((F^(H|~K))+v[4]),R|=0,R=R<<E[p]|R>>>32-E[p],R=R+S|0,C=S,S=K,K=H<<10|H>>>22,H=F,F=R,R=I+h[m+w[p]]|0,R=16>p?R+((M^(L|~T))+g[0]):32>p?R+((M&T|L&~T)+g[1]):48>p?R+(((M|~L)^T)+g[2]):64>p?R+((M&L|~M&T)+g[3]):R+((M^L^T)+g[4]),R|=0,R=R<<_[p]|R>>>32-_[p],R=R+O|0,I=O,O=T,T=L<<10|L>>>22,L=M,M=R;R=d[1]+H+T|0,d[1]=d[2]+K+O|0,d[2]=d[3]+S+I|0,d[3]=d[4]+C+M|0,d[4]=d[0]+F+L|0,d[0]=R},_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 Jl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ty="=";function fa(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=Jl.charAt(r>>6)+Jl.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Jl.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Jl.charAt(r>>2)+Jl.charAt((r&3)<<4)),ty)for(;(n.length&3)>0;)n+=ty;return n}function ef(e){var t="",r,n=0,i,o;for(r=0;r<e.length&&e.charAt(r)!=ty;++r)o=Jl.indexOf(e.charAt(r)),!(o<0)&&(n==0?(t+=ca(o>>2),i=o&3,n=1):n==1?(t+=ca(i<<2|o>>4),i=o&15,n=2):n==2?(t+=ca(i),t+=ca(o>>2),i=o&3,n=3):(t+=ca(i<<2|o>>4),t+=ca(o&15),n=0));return n==1&&(t+=ca(i<<2)),t}function rC(e){var t=ef(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 Au,EH=0xdeadbeefcafe,Q_=(EH&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 bH(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 AH(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 SH(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}Q_&&Qh.appName=="Microsoft Internet Explorer"?(ne.prototype.am=AH,Au=30):Q_&&Qh.appName!="Netscape"?(ne.prototype.am=bH,Au=26):(ne.prototype.am=SH,Au=28);ne.prototype.DB=Au;ne.prototype.DM=(1<<Au)-1;ne.prototype.DV=1<<Au;var iy=52;ne.prototype.FV=Math.pow(2,iy);ne.prototype.F1=iy-Au;ne.prototype.F2=2*Au-iy;var _H="0123456789abcdefghijklmnopqrstuvwxyz",f1=new Array,tf,Zs;tf=48;for(Zs=0;Zs<=9;++Zs)f1[tf++]=Zs;tf=97;for(Zs=10;Zs<36;++Zs)f1[tf++]=Zs;tf=65;for(Zs=10;Zs<36;++Zs)f1[tf++]=Zs;function ca(e){return _H.charAt(e)}function nC(e,t){var r=f1[e.charCodeAt(t)];return r??-1}function CH(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function DH(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 bu(e){var t=Pt();return t.fromInt(e),t}function FH(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:nC(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 BH(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function IH(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=ca(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+=ca(n));return i?o:"0"}function xH(){var e=Pt();return ne.ZERO.subTo(this,e),e}function $H(){return this.s<0?this.negate():this}function PH(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 h1(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 kH(){return this.t<=0?0:this.DB*(this.t-1)+h1(this[this.t-1]^this.s&this.DM)}function TH(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 OH(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 NH(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 LH(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 UH(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 HH(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 qH(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-h1(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 Dc(e){this.m=e}function jH(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function KH(e){return e}function VH(e){e.divRemTo(this.m,null,e)}function zH(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function GH(e,t){e.squareTo(t),this.reduce(t)}Dc.prototype.convert=jH;Dc.prototype.revert=KH;Dc.prototype.reduce=VH;Dc.prototype.mulTo=zH;Dc.prototype.sqrTo=GH;function WH(){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 Fc(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 YH(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 XH(e){var t=Pt();return e.copyTo(t),this.reduce(t),t}function ZH(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 JH(e,t){e.squareTo(t),this.reduce(t)}function QH(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Fc.prototype.convert=YH;Fc.prototype.revert=XH;Fc.prototype.reduce=ZH;Fc.prototype.mulTo=QH;Fc.prototype.sqrTo=JH;function eq(){return(this.t>0?this[0]&1:this.s)==0}function tq(e,t){if(e>4294967295||e<1)return ne.ONE;var r=Pt(),n=Pt(),i=t.convert(this),o=h1(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 rq(e,t){var r;return e<256||t.isEven()?r=new Dc(t):r=new Fc(t),this.exp(e,r)}ne.prototype.copyTo=CH;ne.prototype.fromInt=DH;ne.prototype.fromString=FH;ne.prototype.clamp=BH;ne.prototype.dlShiftTo=TH;ne.prototype.drShiftTo=RH;ne.prototype.lShiftTo=OH;ne.prototype.rShiftTo=NH;ne.prototype.subTo=LH;ne.prototype.multiplyTo=UH;ne.prototype.squareTo=HH;ne.prototype.divRemTo=qH;ne.prototype.invDigit=WH;ne.prototype.isEven=eq;ne.prototype.exp=tq;ne.prototype.toString=IH;ne.prototype.negate=xH;ne.prototype.abs=$H;ne.prototype.compareTo=PH;ne.prototype.bitLength=kH;ne.prototype.mod=MH;ne.prototype.modPowInt=rq;ne.ZERO=bu(0);ne.ONE=bu(1);function nq(){var e=Pt();return this.copyTo(e),e}function sq(){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 iq(){return this.t==0?this.s:this[0]<<24>>24}function oq(){return this.t==0?this.s:this[0]<<16>>16}function aq(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function uq(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function cq(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=bu(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 lq(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=nC(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 fq(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),oy,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 hq(){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 dq(e){return this.compareTo(e)==0}function pq(e){return this.compareTo(e)<0?this:e}function mq(e){return this.compareTo(e)>0?this:e}function gq(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 vq(e,t){return e&t}function wq(e){var t=Pt();return this.bitwiseTo(e,vq,t),t}function oy(e,t){return e|t}function yq(e){var t=Pt();return this.bitwiseTo(e,oy,t),t}function sC(e,t){return e^t}function Eq(e){var t=Pt();return this.bitwiseTo(e,sC,t),t}function iC(e,t){return e&~t}function bq(e){var t=Pt();return this.bitwiseTo(e,iC,t),t}function Aq(){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 Sq(e){var t=Pt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function _q(e){var t=Pt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Cq(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 Dq(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+Cq(this[e]);return this.s<0?this.t*this.DB:-1}function Fq(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function Bq(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Fq(this[r]^t);return e}function Iq(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function xq(e,t){var r=ne.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function $q(e){return this.changeBit(e,oy)}function Pq(e){return this.changeBit(e,iC)}function kq(e){return this.changeBit(e,sC)}function Tq(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 Rq(e){var t=Pt();return this.addTo(e,t),t}function Oq(e){var t=Pt();return this.subTo(e,t),t}function Nq(e){var t=Pt();return this.multiplyTo(e,t),t}function Lq(){var e=Pt();return this.squareTo(e),e}function Uq(e){var t=Pt();return this.divRemTo(e,t,null),t}function Hq(e){var t=Pt();return this.divRemTo(e,null,t),t}function qq(e){var t=Pt(),r=Pt();return this.divRemTo(e,t,r),new Array(t,r)}function Mq(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function jq(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 td(){}function oC(e){return e}function Kq(e,t,r){e.multiplyTo(t,r)}function Vq(e,t){e.squareTo(t)}td.prototype.convert=oC;td.prototype.revert=oC;td.prototype.mulTo=Kq;td.prototype.sqrTo=Vq;function zq(e){return this.exp(e,new td)}function Gq(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 Wq(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 rf(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 Yq(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 Xq(e){return e}function Zq(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 Jq(e,t){e.squareTo(t),this.reduce(t)}function Qq(e,t,r){e.multiplyTo(t,r),this.reduce(r)}rf.prototype.convert=Yq;rf.prototype.revert=Xq;rf.prototype.reduce=Zq;rf.prototype.mulTo=Qq;rf.prototype.sqrTo=Jq;function eM(e,t){if(e.signum()<0)return this.modInverse(t).modPow(e.negate(),t);var r=e.bitLength(),n,i=bu(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 Dc(t):t.isEven()?o=new rf(t):o=new Fc(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=h1(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 tM(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 rM(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 nM(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=bu(1),s=bu(0),a=bu(0),u=bu(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],sM=(1<<26)/Kn[Kn.length-1];function iM(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<sM;)n*=Kn[i++];for(n=r.modInt(n);t<i;)if(n%Kn[t++]==0)return!1}return r.millerRabin(e)}function oM(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=aq;ne.prototype.toRadix=cq;ne.prototype.fromRadix=lq;ne.prototype.fromNumber=fq;ne.prototype.bitwiseTo=gq;ne.prototype.changeBit=xq;ne.prototype.addTo=Tq;ne.prototype.dMultiply=Mq;ne.prototype.dAddOffset=jq;ne.prototype.multiplyLowerTo=Gq;ne.prototype.multiplyUpperTo=Wq;ne.prototype.modInt=rM;ne.prototype.millerRabin=oM;ne.prototype.clone=nq;ne.prototype.intValue=sq;ne.prototype.byteValue=iq;ne.prototype.shortValue=oq;ne.prototype.signum=uq;ne.prototype.toByteArray=hq;ne.prototype.equals=dq;ne.prototype.min=pq;ne.prototype.max=mq;ne.prototype.and=wq;ne.prototype.or=yq;ne.prototype.xor=Eq;ne.prototype.andNot=bq;ne.prototype.not=Aq;ne.prototype.shiftLeft=Sq;ne.prototype.shiftRight=_q;ne.prototype.getLowestSetBit=Dq;ne.prototype.bitCount=Bq;ne.prototype.testBit=Iq;ne.prototype.setBit=$q;ne.prototype.clearBit=Pq;ne.prototype.flipBit=kq;ne.prototype.add=Rq;ne.prototype.subtract=Oq;ne.prototype.multiply=Nq;ne.prototype.divide=Uq;ne.prototype.remainder=Hq;ne.prototype.divideAndRemainder=qq;ne.prototype.modPow=eM;ne.prototype.modInverse=nM;ne.prototype.pow=zq;ne.prototype.gcd=tM;ne.prototype.isProbablePrime=iM;ne.prototype.square=Lq;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 ay(){this.i=0,this.j=0,this.S=new Array}function aM(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 uM(){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]}ay.prototype.init=aM;ay.prototype.next=uM;function cM(){return new ay}var Jh=256;var o1,cs,Ar;function lM(e){cs[Ar++]^=e&255,cs[Ar++]^=e>>8&255,cs[Ar++]^=e>>16&255,cs[Ar++]^=e>>24&255,Ar>=Jh&&(Ar-=Jh)}function uy(){lM(new Date().getTime())}if(cs==null){if(cs=new Array,Ar=0,typeof Zl<"u"&&(Zl.crypto!==void 0||Zl.msCrypto!==void 0)){if(la=Zl.crypto||Zl.msCrypto,la.getRandomValues)for(Qw=new Uint8Array(32),la.getRandomValues(Qw),bn=0;bn<32;++bn)cs[Ar++]=Qw[bn];else if(Qh.appName=="Netscape"&&Qh.appVersion<"5")for(ey=Zl.crypto.random(32),bn=0;bn<ey.length;++bn)cs[Ar++]=ey.charCodeAt(bn)&255}if(Ar<Jh&&typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)for(a1=new Uint8Array(Jh-Ar),globalThis.crypto.getRandomValues(a1),bn=0;bn<a1.length;++bn)cs[Ar++]=a1[bn];for(;Ar<Jh;)bn=Math.floor(65536*Math.random()),cs[Ar++]=bn>>>8,cs[Ar++]=bn&255;Ar=0,uy()}var bn,la,Qw,ey,a1;function fM(){if(o1==null){for(uy(),o1=cM(),o1.init(cs),Ar=0;Ar<cs.length;++Ar)cs[Ar]=0;Ar=0}return o1.next()}function hM(e){var t;for(t=0;t<e.length;++t)e[t]=fM()}function nf(){}nf.prototype.nextBytes=hM;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 dM(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 pM(e){return e.modPowInt(this.e,this.n)}at.prototype.doPublic=pM;at.prototype.setPublic=dM;at.prototype.type="RSA";function mM(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 gM(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 vM(e,t){var r=new nf,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 wM(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=wM;at.prototype.setPrivate=mM;at.prototype.setPrivateEx=gM;at.prototype.generate=vM;function Nr(e,t){this.x=t,this.q=e}function yM(e){return e==this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function EM(){return this.x}function bM(){return new Nr(this.q,this.x.negate().mod(this.q))}function AM(e){return new Nr(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function SM(e){return new Nr(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function _M(e){return new Nr(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function CM(){return new Nr(this.q,this.x.square().mod(this.q))}function DM(e){return new Nr(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}Nr.prototype.equals=yM;Nr.prototype.toBigInteger=EM;Nr.prototype.negate=bM;Nr.prototype.add=AM;Nr.prototype.subtract=SM;Nr.prototype.multiply=_M;Nr.prototype.square=CM;Nr.prototype.divide=DM;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 FM(){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 BM(){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 IM(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 xM(){return this.x==null&&this.y==null?!0:this.z.equals(ne.ZERO)&&!this.y.toBigInteger().equals(ne.ZERO)}function $M(){return new Nt(this.curve,this.x,this.y.negate(),this.z)}function PM(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 kM(){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 TM(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 RM(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=FM;Nt.prototype.getY=BM;Nt.prototype.equals=IM;Nt.prototype.isInfinity=xM;Nt.prototype.negate=$M;Nt.prototype.add=PM;Nt.prototype.twice=kM;Nt.prototype.multiply=TM;Nt.prototype.multiplyTwo=RM;function ha(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new Nt(this,null,null)}function OM(){return this.q}function NM(){return this.a}function LM(){return this.b}function UM(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function HM(){return this.infinity}function qM(e){return new Nr(this.q,e)}function MM(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}}ha.prototype.getQ=OM;ha.prototype.getA=NM;ha.prototype.getB=LM;ha.prototype.equals=UM;ha.prototype.getInfinity=HM;ha.prototype.fromBigInteger=qM;ha.prototype.decodePointHex=MM;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 aC=(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 M=null;for(var L in I)if(h.call(I,L)&&I!==K){var T=H(I,L);T!==void 0?I[L]=T:(M||(M=[]),M.push(L))}if(M)for(var O=M.length;--O>=0;)delete I[M[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 nd(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 M=e[I],L=[],T=0;T<M.length;T++){var O=K(M[T]);L.push(O)}return new C({array:L})}if(I=="set"){for(var M=e[I],L=[],T=0;T<M.length;T++){var O=K(M[T]);L.push(O)}return new F({array:L})}if(I=="tag"){var R=e[I];if(Object.prototype.toString.call(R)==="[object Array]"&&R.length==3){var N=K(R[2]);return new H({tag:R[0],explicit:R[1],obj:N})}else return new H(R)}},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=p1(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=nd;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=gC(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=nd(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=p1(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):wC(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 y1(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 '"+hy(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=hy,p=WM,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 M=[],L=s(I,0),T=0;T<L.length;T++){var O=L[T],R=o(I,O),N=r(R);M.push(N)}return M},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&&(_=EC(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 l1(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=fy(K)}catch(M){throw new p("malformed IP address: "+d.ip+":"+M.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=uo(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"),M=A.crypto.Util.hashHex(C,S);I.hex=M}},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 q,Y=3;Y<6;Y++)if(q=g(N,0,[1,0,Y]),q!==void 0){var V=N.substr(q,2);V==="a0"&&(P.certsIdx=q),V==="a1"&&(P.revinfosIdx=q),V==="31"&&(P.signerinfosIdx=q)}},H=function(N,P){var q=P.signerinfosIdx;if(q!==void 0){var Y=y(N,q);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 q=P.idx;P.signerid_issuer1=v(N,q,[1,0],"30"),P.signerid_serial1=d(N,q,[1,1],"02"),P.hashalg=E(d(N,q,[2,0],"06"));var Y=g(N,q,[3],"a0");P.idxSignedAttrs=Y,S(N,P,Y);var V=y(N,q),X=V.length;if(X<6)throw"malformed SignerInfo";P.sigalg=E(d(N,q,[X-2,0],"06")),P.sigval=d(N,q,[X-1],"04")},S=function(N,P,q){var Y=y(N,q);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)},M=function(N,P){for(var q=P.parse.signerInfos,Y=q.length,V=!0,X=0;X<Y;X++){var te=q[X];T(N,P,te,X),te.isValid||(V=!1)}P.isValid=V},L=function(N,P,q,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();q.signerid_issuer1===De&&q.signerid_serial1===Pe&&(q.certkey_idx=ae)}},T=function(N,P,q,Y){q.verifyDetail={};var V=q.verifyDetail,X=P.parse.econtent,te=q.hashalg,ae=q.saMessageDigest;V.validMessageDigest=!1,_(X,te)===ae&&(V.validMessageDigest=!0),L(N,P,q,Y),V.validSignatureValue=!1;var me=q.sigalg,he="31"+w(N,q.idxSignedAttrs).substr(2);q.signedattrshex=he;var De=P.certs[q.certkey_idx].getPublicKey(),Pe=new A.crypto.Signature({alg:me});Pe.init(De),Pe.updateHex(he);var Ie=Pe.verify(q.sigval);V.validSignatureValue_isValid=Ie,Ie===!0&&(V.validSignatureValue=!0),q.isValid=!1,V.validMessageDigest&&V.validSignatureValue&&(q.isValid=!0)},O=function(){},R={isValid:!1,parse:{}};return I(C,R.parse),M(C,R),R};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 M=this.getAttributeList(I);d.uattrs=M}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 l1([u],a);if(typeof u=="object"&&u.length!=null)return l1(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=y1(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(y1(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 uC(e){for(var t=new Array,r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function cC(e){for(var t="",r=0;r<e.length;r++)t=t+String.fromCharCode(e[r]);return t}function d1(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 d1(uC(e))}function jM(e){return fa(hs(e))}function KM(e){return Ql(fa(hs(e)))}function VM(e){return cC(rC(rd(e)))}function Ql(e){return e=e.replace(/\=/g,""),e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}function rd(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),Ql(fa(e))}function rr(e){return ef(rd(e))}var ed,Di;typeof Buffer=="function"?(ed=function(e){return Ql(Buffer.from(e,"utf8").toString("base64"))},Di=function(e){return Buffer.from(rd(e),"base64").toString("utf8")}):(ed=function(e){return Or(g1(w1(e)))},Di=function(e){return decodeURIComponent(v1(rr(e)))});function zM(e){return fa(g1(w1(e)))}function GM(e){return decodeURIComponent(v1(ef(e)))}function p1(e){return g1(w1(e)).toLowerCase()}function Gt(e){try{return decodeURIComponent(v1(e))}catch{return null}}function WM(e){return Gt(YM(e))}function YM(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 uo(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function cy(e){return fa(e)}function XM(e){return m1(cy(e),64)}function m1(e,t){return e=e.replace(new RegExp("(.{"+t+"})","g"),`$1\r
|
||
`),e=e.replace(/\s+$/,""),e}function lC(e){var t=e.replace(/[^0-9A-Za-z\/+=]*/g,""),r=ef(t);return r}function ZM(e,t){return"-----BEGIN "+t+`-----\r
|
||
`+m1(e,64)+`\r
|
||
-----END `+t+`-----\r
|
||
`}function An(e,t){return"-----BEGIN "+t+`-----\r
|
||
`+m1(cy(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 [^-]+-----[^]*$/,"")),lC(e)}function JM(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 QM(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 ej(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 ly(e){var t,r,n,i,o,s,a,u,l,h,m,p;if(e=hC(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 tj(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 fC(e){return Math.round(ly(e)/1e3)}function rj(e){return new Date(ly(e))}function nj(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 hC(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 g1(e){return e.replace(/%/g,"")}function v1(e){return e.replace(/(..)/g,"%$1")}function ry(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 ny(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 u1(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 u1(e.substr(0,8))+"/"+eC(e.substr(8))}catch{throw t}else{if(e.length==32)return ny(e);if(e.length==64){try{return ny(e.substr(0,32))+"/"+eC(e.substr(32))}catch{throw t}return}else return e}}function eC(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 fy(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 fy(s[0])+tC(parseInt(s[1]),32)}else{if(e.match(/^[0-9a-f:]+$/)&&e.indexOf(":")!==-1)return ry(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&e.indexOf(":")!==-1){var s=e.split("/");return ry(s[0])+tC(parseInt(s[1]),128)}else throw t}}function tC(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 hy(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 w1(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 sj(e){return e=e.replace(/\r\n/mg,`
|
||
`),e}function ij(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 dC(e)};function dC(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=rd(e),A.lang.String.isBase64(e))};function dy(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 sy(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function oj(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 aj=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 pC(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 la<"u"){if(la.timingSafeEqual!==void 0)return la.timingSafeEqual(Buffer.from(e),Buffer.from(t));if(la.subtle!==void 0&&la.subtle.timingSafeEqual)return la.subtle.timingSafeEqual(Buffer.from(e),Buffer.from(t))}return mC(e,t)}function mC(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 gC(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 y1(e){if(!dC(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+c1((o[s]&127).toString(2),7):(u=u+c1((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 vC(e){var t=new ne(String(e),10);return nd(t)}function nd(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 c1=function(e,t,r){return r==null&&(r="0"),e.length>=t?e:new Array(t-e.length+1).join(r)+e};function wC(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 yC(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+c1("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function EC(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 uj(e){if(typeof e!="string"||e.match(/^[01]+$/)==null)return null;try{var t=parseInt(e,2);return yC(t)}catch{return null}}function l1(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 nf;A.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return A.crypto.Util.SECURERANDOMGEN.nextBytes(t),d1(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],d1(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=uo(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=p1(s.utf8)),s.rstr!==void 0&&(a=uo(s.rstr)),s.b64!==void 0&&(a=ef(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 nf,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 M=H.modInverse(C).multiply(F.add(_.multiply(I))).mod(C);return u.biRSSigToASN1Sig(I,M)},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 M=H.modInverse(C).multiply(F.add(_.multiply(I))).mod(C);return this.serializeSig(I,M)},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),M=H.multiply(S).add(C.multiply(I)),L=M.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 ha(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 M="";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
|
||
`),M="-----BEGIN "+g+` PRIVATE KEY-----\r
|
||
`;return M+=`Proc-Type: 4,ENCRYPTED\r
|
||
`,M+="DEK-Info: "+E+","+_+`\r
|
||
`,M+=`\r
|
||
`,M+=I,M+=`\r
|
||
-----END `+g+` PRIVATE KEY-----\r
|
||
`,M},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:vC(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 M=E(g,I[1]);try{_.pbkdf2Iter=parseInt(M,16)}catch{throw new Error("malformed format pbkdf2Iter: "+M)}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"),M=s(S,0,[2],"02"),L=s(S,0,[3],"02"),T=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new ne(I,16),new ne(M,16),new ne(L,16),new ne(T,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 R=p.getDecryptedKeyHex(e,t),N=new at;return N.readPKCS5PrvKeyHex(R),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"),q=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(q),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"),M=s(S,0,[2],"02"),L=s(S,0,[3],"02"),T=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new ne(I,16),new ne(M,16),new ne(L,16),new ne(T,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(),M="";return M+=An(K,"EC PARAMETERS"),M+=An(I,"EC PRIVATE KEY"),M}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 q=JSON.parse(JSON.stringify(P)),Y=q.passcode;return delete q.passcode,_t.getEncryptedPKCS8PEM(N,Y,q)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var T=w(e),O=T.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 R={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&R.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var T=new h(R),O=T.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 T=new l({bigint:e.x}),O=T.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=[fa(a)]),a!=null&&n!=!0&&(s.x5t=Ql(fa(u(a,"sha1")))),a!=null&&i!=!0&&(s["x5t#S256"]=Ql(fa(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 Xne=new RegExp("[^0-9a-f]","gi");function bC(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 bC(o,this.n.bitLength())};function AC(e,t,r){for(var n="",i=0;n.length<t;)n+=ds(r(uo(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(uo(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 nf().nextBytes(l),l=String.fromCharCode.apply(String,l));var h=ds(u(uo("\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=AC(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),bC(this.doPrivate(new ne(v)).toString(16),this.n.bitLength())};function SC(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=SC(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=SC(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(uo(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=AC(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(uo("\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]),M=v(I,0);if(M<0||2<M)throw new Error("malformed version field");return this.version=M+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(),M=this.getSignatureValueHex(),L=l(this.hex,0,[0],"30"),T=new A.crypto.Signature({alg:I});return T.init(S),T.updateHex(L),T.verify(M)},this.parseExt=function(S){var I,M,L;if(S===void 0){if(L=this.hex,this.version!==3)return-1;I=m(L,0,[0,7,0],"30"),M=r(L,I)}else{L=lr(S);var T=m(L,0,[0,3,0,0],"06");if(n(L,T)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}I=m(L,0,[0,3,0,1,0],"30"),M=r(L,I),this.hex=L}this.aExtInfo=new Array;for(var O=0;O<M.length;O++){var R={};R.critical=!1;var N=r(L,M[O]),P=0;N.length===3&&(R.critical=!0,P=1),R.oid=t.hextooidstr(a(L,M[O],[0],"06"));var q=m(L,M[O],[1+P]);R.vidx=d(L,q),this.aExtInfo.push(R)}},this.getExtInfo=function(S){var I=this.aExtInfo,M=S;if(S.match(/^[0-9.]+$/)||(M=A.asn1.x509.OID.name2oid(S)),M!==""){for(var L=0;L<I.length;L++)if(I[L].oid===M)return I[L]}},this.getCriticalExtV=function(S,I,M){if(I!=null)return[I,M];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 M=this.getExtInfo("basicConstraints");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.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 T=n(S,10),O=parseInt(T,16);return L.cA=!0,L.pathLen=O,L}throw new Error("hExtV parse error: "+S)},this.getExtNameConstraints=function(S,I){var M=this.getCriticalExtV("nameConstraints",S,I);if(S=M[0],I=M[1],S!=null){var L={extname:"nameConstraints"};I&&(L.critical=!0);for(var T=r(S,0),O=0;O<T.length;O++){for(var R=[],N=r(S,T[O]),P=0;P<N.length;P++){var q=s(S,N[P]),Y=this.getGeneralSubtree(q);R.push(Y)}var V=S.substr(T[O],2);V=="a0"?L.permit=R:V=="a1"&&(L.exclude=R)}return L}},this.getGeneralSubtree=function(S){var I=r(S,0),M=I.length;if(M<1||2<M)throw new Error("wrong num elements");for(var L=this.getGeneralName(s(S,I[0])),T=1;T<M;T++){var O=S.substr(I[T],2),R=n(S,I[T]),N=parseInt(R,16);O=="80"&&(L.min=N),O=="81"&&(L.max=N)}return L},this.getExtKeyUsage=function(S,I){var M=this.getCriticalExtV("keyUsage",S,I);if(S=M[0],I=M[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 M="000000000000000"+parseInt(S.substr(6),16).toString(2);return S.length==8&&(M=M.slice(-8)),S.length==10&&(M=M.slice(-16)),M=M.replace(/0+$/,""),M==""&&(M="0"),M},this.getExtKeyUsageString=function(S){for(var I=this.getExtKeyUsageBin(S),M=new Array,L=0;L<I.length;L++)I.substr(L,1)=="1"&&M.push(tt.KEYUSAGE_NAME[L]);return M.join(",")},this.getExtSubjectKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("subjectKeyIdentifier");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"subjectKeyIdentifier"};I&&(L.critical=!0);var T=n(S,0);return L.kid={hex:T},L},this.getExtAuthorityKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("authorityKeyIdentifier");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"authorityKeyIdentifier"};I&&(L.critical=!0);for(var T=r(S,0),O=0;O<T.length;O++){var R=S.substr(T[O],2);if(R==="80"&&(L.kid={hex:n(S,T[O])}),R==="a1"){var N=s(S,T[O]),P=this.getGeneralNames(N);L.issuer=P[0].dn}R==="82"&&(L.sn={hex:n(S,T[O])})}return L},this.getExtExtKeyUsage=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("extKeyUsage");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"extKeyUsage",array:[]};I&&(L.critical=!0);for(var T=r(S,0),O=0;O<T.length;O++)L.array.push(g(n(S,T[O])));return L},this.getExtExtKeyUsageName=function(){var S=this.getExtInfo("extKeyUsage");if(S===void 0)return S;var I=new Array,M=s(this.hex,S.vidx);if(M==="")return I;for(var L=r(M,0),T=0;T<L.length;T++)I.push(g(n(M,L[T])));return I},this.getExtSubjectAltName=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("subjectAltName");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.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 M=this.getExtInfo("issuerAltName");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.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),M=[],L=0;L<I.length;L++){var T=this.getGeneralName(s(S,I[L]));T!==void 0&&M.push(T)}return M},this.getGeneralName=function(S){var I=S.substr(0,2),M=n(S,0),L=ds(M);if(I=="81")return{rfc822:L};if(I=="82")return{dns:L};if(I=="86")return{uri:L};if(I=="87")return{ip:u1(M)};if(I=="a4")return{dn:this.getX500Name(M)};if(I=="a0")return{other:this.getOtherName(S)}},this.getExtSubjectAltName2=function(){var S,I,M,L=this.getExtInfo("subjectAltName");if(L===void 0)return L;for(var T=new Array,O=s(this.hex,L.vidx),R=r(O,0),N=0;N<R.length;N++)M=O.substr(R[N],2),S=n(O,R[N]),M==="81"&&(I=Gt(S),T.push(["MAIL",I])),M==="82"&&(I=Gt(S),T.push(["DNS",I])),M==="84"&&(I=tt.hex2dn(S,0),T.push(["DN",I])),M==="86"&&(I=Gt(S),T.push(["URI",I])),M==="87"&&(I=u1(S),T.push(["IP",I]));return T},this.getExtCRLDistributionPoints=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("cRLDistributionPoints");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"cRLDistributionPoints",array:[]};I&&(L.critical=!0);for(var T=r(S,0),O=0;O<T.length;O++){var R=s(S,T[O]);L.array.push(this.getDistributionPoint(R))}return L},this.getDistributionPoint=function(S){for(var I={},M=r(S,0),L=0;L<M.length;L++){var T=S.substr(M[L],2),O=s(S,M[L]);T=="a0"&&(I.dpname=this.getDistributionPointName(O))}return I},this.getDistributionPointName=function(S){for(var I={},M=r(S,0),L=0;L<M.length;L++){var T=S.substr(M[L],2),O=s(S,M[L]);T=="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,M=[],L=0;L<I.length;L++)try{I[L].dpname.full[0].uri!=null&&M.push(I[L].dpname.full[0].uri)}catch{}return M},this.getExtAIAInfo=function(){var S=this.getExtInfo("authorityInfoAccess");if(S===void 0)return S;for(var I={ocsp:[],caissuer:[]},M=r(this.hex,S.vidx),L=0;L<M.length;L++){var T=a(this.hex,M[L],[0],"06"),O=a(this.hex,M[L],[1],"86");T==="2b06010505073001"&&I.ocsp.push(Gt(O)),T==="2b06010505073002"&&I.caissuer.push(Gt(O))}return I},this.getExtAuthorityInfoAccess=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("authorityInfoAccess");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"authorityInfoAccess",array:[]};I&&(L.critical=!0);for(var T=r(S,0),O=0;O<T.length;O++){var R=u(S,T[O],[0],"06"),N=a(S,T[O],[1],"86"),P=Gt(N);if(R=="2b06010505073001")L.array.push({ocsp:P});else if(R=="2b06010505073002")L.array.push({caissuer:P});else throw new Error("unknown method: "+R)}return L},this.getExtCertificatePolicies=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("certificatePolicies");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"certificatePolicies",array:[]};I&&(L.critical=!0);for(var T=r(S,0),O=0;O<T.length;O++){var R=s(S,T[O]),N=this.getPolicyInformation(R);L.array.push(N)}return L},this.getPolicyInformation=function(S){var I={},M=a(S,0,[0],"06");I.policyoid=g(M);var L=p(S,0,[1],"30");if(L!=-1){I.array=[];for(var T=r(S,L),O=0;O<T.length;O++){var R=s(S,T[O]),N=this.getPolicyQualifierInfo(R);I.array.push(N)}}return I},this.getOtherName=function(S){var I={},M=r(S,0),L=a(S,M[0],[],"06"),T=a(S,M[1],[]);return I.oid=g(L),I.value=o(T),I},this.getPolicyQualifierInfo=function(S){var I={},M=a(S,0,[0],"06");if(M==="2b06010505070201"){var L=u(S,0,[1],"16");I.cps=ds(L)}else if(M==="2b06010505070202"){var T=l(S,0,[1],"30");I.unotice=this.getUserNotice(T)}return I},this.getUserNotice=function(S){var I=null,M={};try{I=t.parse(S);var L=this._asn1ToUnotice(I);return L}catch{return}},this._asn1ToUnotice=function(S){try{for(var I={},M=Jt(S,"seq"),L=0;L<M.length;L++){var T=this._asn1ToNoticeRef(M[L]);T!=null&&(I.noticeref=T);var O=this.asn1ToDisplayText(M[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={},M=Jt(S,"seq"),L=0;L<M.length;L++){var T=this._asn1ToNoticeNum(M[L]);T!=null&&(I.noticenum=T);var O=this.asn1ToDisplayText(M[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"),M=[],L=0;L<I.length;L++){var T=I[L];M.push(parseInt(Jt(T,"int.hex"),16))}return M}catch{return}},this.getDisplayText=function(S){var I={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},M={};return M.type=I[S.substr(0,2)],M.str=ds(n(S,0)),M},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 M=this.getCriticalExtV("policyMappings",S,I);if(S=M[0],I=M[1],S!=null){var L={extname:"policyMappings"};I&&(L.critical=!0);try{for(var T=o(S),O=T.seq,R=[],N=0;N<O.length;N++){var P=O[N].seq;R.push([P[0].oid,P[1].oid])}L.array=R}catch{throw new C("malformed policyMappings")}return L}},this.getExtPolicyConstraints=function(S,I){var M=this.getCriticalExtV("policyConstraints",S,I);if(S=M[0],I=M[1],S!=null){var L={extname:"policyConstraints"};I&&(L.critical=!0);var T=o(S);try{for(var O=T.seq,R=0;R<O.length;R++){var N=O[R].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 M=this.getCriticalExtV("inhibitAnyPolicy",S,I);if(S=M[0],I=M[1],S!=null){var L={extname:"inhibitAnyPolicy"};I&&(L.critical=!0);var T=v(S,0);return T==-1?new C("wrong value"):(L.skip=T,L)}},this.getExtCRLNumber=function(S,I){var M={extname:"cRLNumber"};if(I&&(M.critical=!0),S.substr(0,2)=="02")return M.num={hex:n(S,0)},M;throw new C("hExtV parse error: "+S)},this.getExtCRLReason=function(S,I){var M={extname:"cRLReason"};if(I&&(M.critical=!0),S.substr(0,2)=="0a")return M.code=parseInt(n(S,0),16),M;throw new Error("hExtV parse error: "+S)},this.getExtOcspNonce=function(S,I){var M={extname:"ocspNonce"};I&&(M.critical=!0);var L=n(S,0);return M.hex=L,M},this.getExtOcspNoCheck=function(S,I){var M={extname:"ocspNoCheck"};return I&&(M.critical=!0),M},this.getExtAdobeTimeStamp=function(S,I){if(S===void 0&&I===void 0){var M=this.getExtInfo("adobeTimeStamp");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"adobeTimeStamp"};I&&(L.critical=!0);var T=r(S,0);if(T.length>1){var O=s(S,T[1]),R=this.getGeneralName(O);R.uri!=null&&(L.uri=R.uri)}if(T.length>2){var N=s(S,T[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 M=this.getExtInfo("subjectDirectoryAttributes");if(M===void 0)return;S=s(this.hex,M.vidx),I=M.critical}var L={extname:"subjectDirectoryAttributes"};I&&(L.critical=!0);try{for(var T=o(S),O=[],R=0;R<T.seq.length;R++){var N=T.seq[R],P=Jt(N,"seq.0.oid"),q=Jt(N,"seq.1.set");if(P==null||q==null)throw"error";O.push({attr:P,array:q})}return L.array=O,L}catch{throw new Error("malformed subjectDirectoryAttributes extension value")}};var F=function(S){var I={};try{var M=S.seq[0].oid,L=A.asn1.x509.OID.name2oid(M);I.type=A.asn1.x509.OID.oid2atype(L);var T=S.seq[1];if(T.utf8str!=null)I.ds="utf8",I.value=T.utf8str.str;else if(T.numstr!=null)I.ds="num",I.value=T.numstr.str;else if(T.telstr!=null)I.ds="tel",I.value=T.telstr.str;else if(T.prnstr!=null)I.ds="prn",I.value=T.prnstr.str;else if(T.ia5str!=null)I.ds="ia5",I.value=T.ia5str.str;else if(T.visstr!=null)I.ds="vis",I.value=T.visstr.str;else if(T.bmpstr!=null)I.ds="bmp",I.value=T.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,M=!0,L=!1,T="",O="",R=null,N=[],P=0;P<S.length;P++)for(var q=S[P],Y=0;Y<q.length;Y++)N.push(q[Y]);for(var P=0;P<N.length;P++){var V=N[P],X=V.ds,te=V.value,ae=V.type;if(T+=":"+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,R==null)R=X;else if(R!==X)return"mixed"}return R??"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,M){var L=this.getX500NameArray(S),T=this.dnarraytostr(L),O={str:T};return O.array=L,M==!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 M=[],L=r(S,0),T=0;T<L.length;T++){var O=s(S,L[T]),R=this.getExtParam(O);R!=null&&M.push(R)}return M},this.getExtParam=function(S){var I={},M=r(S,0),L=M.length;if(L!=2&&L!=3)throw new Error("wrong number elements in Extension: "+L+" "+S);var T=y(a(S,0,[0],"06")),O=!1;L==3&&l(S,0,[1])=="0101ff"&&(O=!0);var R=l(S,0,[L-1,0]),N=void 0;if(T=="2.5.29.14"?N=this.getExtSubjectKeyIdentifier(R,O):T=="2.5.29.15"?N=this.getExtKeyUsage(R,O):T=="2.5.29.17"?N=this.getExtSubjectAltName(R,O):T=="2.5.29.18"?N=this.getExtIssuerAltName(R,O):T=="2.5.29.19"?N=this.getExtBasicConstraints(R,O):T=="2.5.29.30"?N=this.getExtNameConstraints(R,O):T=="2.5.29.31"?N=this.getExtCRLDistributionPoints(R,O):T=="2.5.29.32"?N=this.getExtCertificatePolicies(R,O):T=="2.5.29.33"?N=this.getExtPolicyMappings(R,O):T=="2.5.29.35"?N=this.getExtAuthorityKeyIdentifier(R,O):T=="2.5.29.36"?N=this.getExtPolicyConstraints(R,O):T=="2.5.29.37"?N=this.getExtExtKeyUsage(R,O):T=="2.5.29.54"?N=this.getExtInhibitAnyPolicy(R,O):T=="1.3.6.1.5.5.7.1.1"?N=this.getExtAuthorityInfoAccess(R,O):T=="2.5.29.20"?N=this.getExtCRLNumber(R,O):T=="2.5.29.21"?N=this.getExtCRLReason(R,O):T=="2.5.29.9"?N=this.getExtSubjectDirectoryAttributes(R,O):T=="1.3.6.1.5.5.7.48.1.2"?N=this.getExtOcspNonce(R,O):T=="1.3.6.1.5.5.7.48.1.5"?N=this.getExtOcspNoCheck(R,O):T=="1.2.840.113583.1.1.9.1"?N=this.getExtAdobeTimeStamp(R,O):tt.EXT_PARSER[T]!=null&&(N=tt.EXT_PARSER[T](T,O,R)),N!=null)return N;var P={extname:T,extn:R};try{P.extn=o(R)}catch{}return O&&(P.critical=!0),P},this.findExt=function(S,I){for(var M=0;M<S.length;M++)if(S[M].extname==I)return S[M];return null},this.updateExtCDPFullURI=function(S,I){var M=this.findExt(S,"cRLDistributionPoints");if(M!=null&&M.array!=null){for(var L=M.array,T=0;T<L.length;T++)if(L[T].dpname!=null&&L[T].dpname.full!=null)for(var O=L[T].dpname.full,R=0;R<O.length;R++){var N=O[T];N.uri!=null&&(N.uri=I)}}},this.updateExtAIAOCSP=function(S,I){var M=this.findExt(S,"authorityInfoAccess");if(M!=null&&M.array!=null)for(var L=M.array,T=0;T<L.length;T++)L[T].ocsp!=null&&(L[T].ocsp=I)},this.updateExtAIACAIssuer=function(S,I){var M=this.findExt(S,"authorityInfoAccess");if(M!=null&&M.array!=null)for(var L=M.array,T=0;T<L.length;T++)L[T].caissuer!=null&&(L[T].caissuer=I)},this.dnarraytostr=function(S){function I(L){return L.map(function(T){return M(T).replace(/\+/,"\\+")}).join("+")}function M(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 M=new A.asn1.x509.X500Name({str:S.str}),L=M.tohex();I=this.getX500NameArray(L)}else I=S.array;S.canon==null&&(S.canon=this.c14nRDNArray(I))},this.c14nRDNArray=function(S){for(var I=[],M=0;M<S.length;M++){for(var L=S[M],T=[],O=0;O<L.length;O++){var R=L[O],N=R.value;N=N.replace(/^\s*/,""),N=N.replace(/\s*$/,""),N=N.replace(/\s+/g," "),N=N.toLowerCase(),T.push(R.type.toLowerCase()+"="+N)}I.push(T.join("+"))}return"/"+I.join("/")},this.getInfo=function(){var S=function(pe){for(var Fe="",Re=" ",Ve=`
|
||
`,Oe=pe.array,pt=0;pt<Oe.length;pt++){var Qe=Oe[pt];if(Qe.dn!=null&&(Fe+=Re+"dn: "+Qe.dn.str+Ve),Qe.ip!=null&&(Fe+=Re+"ip: "+Qe.ip+Ve),Qe.rfc822!=null&&(Fe+=Re+"rfc822: "+Qe.rfc822+Ve),Qe.dns!=null&&(Fe+=Re+"dns: "+Qe.dns+Ve),Qe.uri!=null&&(Fe+=Re+"uri: "+Qe.uri+Ve),Qe.other!=null){var ct=Qe.other.oid,mn=JSON.stringify(Qe.other.value).replace(/\"/g,"");Fe+=Re+"other: "+ct+"="+mn+Ve}}return Fe=Fe.replace(/\n$/,""),Fe},I=function(pe){for(var Fe="",Re=pe.array,Ve=0;Ve<Re.length;Ve++){var Oe=Re[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},M=function(pe){for(var Fe="",Re=pe.array,Ve=0;Ve<Re.length;Ve++){var Oe=Re[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="",Re=pe.array,Ve=0;Ve<Re.length;Ve++){var Oe=Re[Ve];Oe.caissuer!==void 0&&(Fe+=" caissuer: "+Oe.caissuer+`
|
||
`),Oe.ocsp!==void 0&&(Fe+=" ocsp: "+Oe.ocsp+`
|
||
`)}return Fe},T=tt,O,R,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:
|
||
`,R=this.getPublicKey(),O+=" key algorithm: "+R.type+`
|
||
`,R.type==="RSA"&&(O+=" n="+sy(R.n.toString(16)).substr(0,16)+`...
|
||
`,O+=" e="+sy(R.e.toString(16))+`
|
||
`),N=this.aExtInfo,N!=null){O+=`X509v3 Extensions:
|
||
`;for(var P=0;P<N.length;P++){var q=N[P],Y=A.asn1.x509.OID.oid2name(q.oid);Y===""&&(Y=q.oid);var V="";if(q.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+=M(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 cj=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 _=ed(g),C=ed(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 M=Or(H);return F+"."+M};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),!dy(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(),pC(y,S)}else if(F.indexOf("withECDSA")!=-1){var M=null;try{M=u.concatSigToASN1Sig(y)}catch{return!1}var L=new h({alg:F});return L.init(t),L.updateString(g),L.verify(M)}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(!dy(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=aC(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=aC(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=uo(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 fC(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=nf;$e.rng_seed_time=uy;$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=cj;$e.CryptoJS=ke;$e.b64tohex=ef;$e.b64toBA=rC;$e.ECFieldElementFp=Nr;$e.ECPointFp=Nt;$e.ECCurveFp=ha;$e.stoBA=uC;$e.BAtos=cC;$e.BAtohex=d1;$e.stohex=hs;$e.stob64=jM;$e.stob64u=KM;$e.b64utos=VM;$e.b64tob64u=Ql;$e.b64utob64=rd;$e.hex2b64=fa;$e.hextob64u=Or;$e.b64utohex=rr;$e.utf8tob64u=ed;$e.b64utoutf8=Di;$e.utf8tob64=zM;$e.b64toutf8=GM;$e.utf8tohex=p1;$e.hextoutf8=Gt;$e.hextorstr=ds;$e.rstrtohex=uo;$e.hextob64=cy;$e.hextob64nl=XM;$e.b64nltohex=lC;$e.hextopem=An;$e.pemtohex=lr;$e.hextoArrayBuffer=QM;$e.ArrayBuffertohex=ej;$e.zulutomsec=ly;$e.msectozulu=tj;$e.zulutosec=fC;$e.zulutodate=rj;$e.datetozulu=nj;$e.uricmptohex=g1;$e.hextouricmp=v1;$e.ipv6tohex=ry;$e.hextoipv6=ny;$e.hextoip=u1;$e.iptohex=fy;$e.ucs2hextoutf8=hy;$e.encodeURIComponentAll=w1;$e.newline_toUnix=sj;$e.newline_toDos=ij;$e.hextoposhex=sy;$e.intarystrtohex=oj;$e.strdiffidx=aj;$e.oidtohex=gC;$e.hextooid=y1;$e.strpad=c1;$e.bitstrtoint=wC;$e.inttobitstr=yC;$e.bitstrtobinstr=EC;$e.binstrtobitstr=uj;$e.isBase64URLDot=dy;$e.namearraytobinstr=l1;$e.extendClass=Ee;$e.foldnl=m1;$e.b64topem=ZM;$e.pemtob64=JM;$e.timeogen=hC;$e.aryval=Jt;$e.inttohex=vC;$e.twoscompl=nd;$e.timingSafeEqual=pC;$e.timingSafeEqualImpl=mC;$e.KJUR=A;$e.crypto=A.crypto;$e.asn1=A.asn1;$e.jws=A.jws;$e.lang=A.lang;$e.VERSION=wH;$e.VERSION_FULL=yH});var Dd=be(cm=>{"use strict";var Afe=B(x());Object.defineProperty(cm,"__esModule",{value:!0});cm.AddressError=void 0;var Yy=class extends Error{constructor(t,r){super(t),this.name="AddressError",this.parseMessage=r}};cm.AddressError=Yy});var lm=be(ei=>{"use strict";var _fe=B(x());Object.defineProperty(ei,"__esModule",{value:!0});ei.isInSubnet=_K;ei.isHostInSubnet=Xy;ei.isGloballyReachable=CK;ei.offsetBigInt=DK;ei.isCorrect=FK;ei.prefixLengthFromMask=BK;ei.assertByteArray=IK;ei.numberToPaddedHex=N8;ei.stringToPaddedHex=xK;ei.testBit=$K;var Rc=Dd();function _K(e){return this.subnetMask<e.subnetMask?!1:Xy.call(this,e)}function Xy(e){return this.binaryZeroPad().length!==e.binaryZeroPad().length?!1:this.mask(e.subnetMask)===e.mask()}function CK(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];n.reachable!==null&&Xy.call(this,n.subnet)&&(t===null||n.subnet.subnetMask>t.subnet.subnetMask)&&(t=n)}return t===null?!0:t.reachable}function DK(e,t,r,n){if(typeof t=="number"&&!Number.isSafeInteger(t))throw new Rc.AddressError(`${n} offset must be an integer`);if(typeof t!="number"&&typeof t!="bigint")throw new Rc.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 Rc.AddressError(`${n} offset leaves the address space`);return i}function FK(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function BK(e,t){let r=e.toString(2).padStart(t,"0");if(r.length>t)throw new Rc.AddressError("Invalid subnet mask.");let n=r.indexOf("0");if(n===-1)return t;if(r.slice(n).includes("1"))throw new Rc.AddressError("Invalid subnet mask.");return n}function IK(e,t,r,n){if(e.length!==t)throw new Rc.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 Rc.AddressError(`All bytes must be integers between ${n} and 255`)}function N8(e){return e.toString(16).padStart(2,"0")}function xK(e){return N8(parseInt(e,10))}function $K(e,t){let{length:r}=e;if(t>=r)return!1;let n=r-t-1;return e.substring(n,n+1)==="1"}});var Zy=be(ti=>{"use strict";var Dfe=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 Jy=be(Eo=>{"use strict";var Bfe=B(x()),PK=Eo&&Eo.__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]})),kK=Eo&&Eo.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),L8=Eo&&Eo.__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)&&PK(t,e,r);return kK(t,e),t};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.Address4=void 0;var Ts=L8(lm()),fr=L8(Zy()),Ri=Dd(),TK=Ts.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=TK,this.isInSubnet=Ts.isInSubnet,this.isHostInSubnet=Ts.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 Ri.AddressError("Invalid subnet mask.");t=t.replace(fr.RE_SUBNET_STRING,"")}let n=fr.GROUPS*4-1;if(t.length>n)throw new Ri.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 Ri.AddressError("IPv4 addresses can't have leading zeroes.");if(!t.match(fr.RE_ADDRESS))throw new Ri.AddressError("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromAddressAndMask(t,r){let n=Ts.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=Ts.prefixLengthFromMask(o,fr.BITS);return new e(`${t}/${s}`)}static fromWildcard(t){let r=t.split(".");if(r.length!==fr.GROUPS)throw new Ri.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 Ri.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 Ri.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 Ri.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 Ri.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=>Ts.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(`${Ts.stringToPaddedHex(this.parsedAddress[r])}${Ts.stringToPaddedHex(this.parsedAddress[r+1])}`);return t.join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(t=>Ts.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(Ts.offsetBigInt(this.bigInt(),t,fr.BITS,"IPv4")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(Ts.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 Ri.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 Ts.assertByteArray(t,4,"IPv4",0),this.fromUnsignedByteArray(t)}static fromUnsignedByteArray(t){if(t.length!==4)throw new Ri.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 OK.some(t=>this.isHostInSubnet(t))}isLoopback(){return this.isHostInSubnet(NK)}isLinkLocal(){return this.isHostInSubnet(LK)}isUnspecified(){return this.isHostInSubnet(UK)}isBroadcast(){return this.isHostInSubnet(HK)}isCGNAT(){return this.isHostInSubnet(qK)}isDocumentation(){return MK.some(t=>this.isHostInSubnet(t))}isBenchmarking(){return this.isHostInSubnet(jK)}isReserved(){return this.isHostInSubnet(KK)}isGlobal(){return!this.isMulticast()&&Ts.isGloballyReachable.call(this,VK)}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>`)}};Eo.Address4=Yr;var RK=new Yr("224.0.0.0/4"),OK=[new Yr("10.0.0.0/8"),new Yr("172.16.0.0/12"),new Yr("192.168.0.0/16")],NK=new Yr("127.0.0.0/8"),LK=new Yr("169.254.0.0/16"),UK=new Yr("0.0.0.0/32"),HK=new Yr("255.255.255.255/32"),qK=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")],jK=new Yr("198.18.0.0/15"),KK=new Yr("240.0.0.0/4"),VK=fr.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new Yr(e),reachable:t}))});var Qy=be(sr=>{"use strict";var xfe=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 eE=be(Oc=>{"use strict";var Pfe=B(x());Object.defineProperty(Oc,"__esModule",{value:!0});Oc.escapeHtml=fm;Oc.spanAllZeroes=U8;Oc.spanAll=zK;Oc.spanLeadingZeroes=GK;Oc.simpleGroup=WK;function fm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function U8(e){return fm(e).replace(/(0+)/g,'<span class="zero">$1</span>')}function zK(e,t=0){return e.split("").map((n,i)=>`<span class="digit value-${fm(n)} position-${i+t}">${U8(n)}</span>`).join("")}function H8(e){return fm(e).replace(/^(0+)/,'<span class="zero">$1</span>')}function GK(e){return e.split(":").map(r=>H8(r)).join(":")}function WK(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:`<span class="hover-group group-${i+t}">${H8(n)}</span>`)}});var q8=be(vs=>{"use strict";var Tfe=B(x()),YK=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]})),XK=vs&&vs.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ZK=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)&&YK(t,e,r);return XK(t,e),t};Object.defineProperty(vs,"__esModule",{value:!0});vs.ADDRESS_BOUNDARY=void 0;vs.groupPossibilities=dm;vs.padGroup=hm;vs.simpleRegularExpression=QK;vs.possibleElisions=eV;var JK=ZK(Qy());function dm(e){return`(${e.join("|")})`}function hm(e){return e.length<4?`0{0,${4-e.length}}${e}`:e}vs.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function QK(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===JK.GROUPS-1?":":"";return dm([hm(i),s])}return hm(i)}).join(":"));return r.push(e.map(hm).join(":")),dm(r)}function eV(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 dm(o)}});var V8=be(So=>{"use strict";var Ofe=B(x()),tV=So&&So.__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]})),rV=So&&So.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),gm=So&&So.__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)&&tV(t,e,r);return rV(t,e),t};Object.defineProperty(So,"__esModule",{value:!0});So.Address6=void 0;var Ao=gm(lm()),tE=gm(Zy()),Ct=gm(Qy()),Nc=gm(eE()),bo=Jy(),Lc=q8(),Xr=Dd(),pm=lm(),nV=Ao.isCorrect(Ct.BITS);function mm(e){if(!e)throw new Error("Assertion failed.")}function sV(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function iV(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 oV(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 M8(e){return parseInt(e,16).toString(16).padStart(4,"0")}function j8(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=Ao.isInSubnet,this.isHostInSubnet=Ao.isHostInSubnet,this.isCorrect=nV,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=Ao.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=Ao.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 bo.Address4(t),n=Ct.BITS-(tE.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":sV((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(Ao.offsetBigInt(this.bigInt(),t,Ct.BITS,"IPv6")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(Ao.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<K8.length;t++){let r=K8[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=oV(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===tE.GROUPS&&i.every(s=>/^\d{1,3}$/.test(s))&&i.some(s=>/^0\d/.test(s))){let s=i.map(iV).join("."),a=r.slice(0,-1).map(Nc.escapeHtml).join(":"),u=r.length>1?":":"";throw new Xr.AddressError("IPv4 addresses can't have leading zeroes.",`${a}${u}${s}`)}let o=n.match(tE.RE_ADDRESS);if(o){this.parsedAddress4=o[0];let s=this.subnetMask>=96?`/${this.subnetMask-96}`:"";this.address4=new bo.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(M8).join(":")}decimal(){return this.parsedAddress.map(t=>parseInt(t,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(M8).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 bo.Address4(`${i.join(".")}/${n}`)}return bo.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=bo.Address4.fromHex(this.getBitsBase16(32,64)),o=this.getBits(96,128),s=bo.Address4.fromHex((o^BigInt("0xffffffff")).toString(16).padStart(8,"0")),a=this.getBitsBase2(64,80),u=(0,pm.testBit)(a,15),l=(0,pm.testBit)(a,14),h=(0,pm.testBit)(a,8),m=(0,pm.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=bo.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 bo.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 bo.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(j8)}static fromByteArray(t){return Ao.assertByteArray(t,16,"IPv6",-128),this.fromUnsignedByteArray(t.map(j8))}static fromUnsignedByteArray(t){Ao.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(lV)}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(mV)}embeddedIPv4(){return this.isMapped4()||this.isHostInSubnet(gV)?this.to4():null}isTeredo(){return this.isHostInSubnet(aV)}is6to4(){return this.isHostInSubnet(uV)}isLoopback(){let t=this.embeddedIPv4();return t?t.isLoopback():this.getType()==="Loopback"}isULA(){return this.isHostInSubnet(cV)}isPrivate(){let t=this.embeddedIPv4();return t?t.isPrivate():this.isULA()||this.isHostInSubnet(vV)}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 fV.some(t=>this.isHostInSubnet(t))}isBenchmarking(){let t=this.embeddedIPv4();return t?t.isBenchmarking():this.isHostInSubnet(hV)}isGlobal(){let t=this.embeddedIPv4();return t?t.isGlobal():this.isHostInSubnet(dV)&&Ao.isGloballyReachable.call(this,pV)}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=Nc.escapeHtml(`${t.prefix}${n}`),o=Nc.escapeHtml(n);if(t.className){let s=Nc.escapeHtml(t.className);return`<a href="${i}" class="${s}">${o}</a>`}return`<a href="${i}">${o}</a>`}group(){if(this.elidedGroups===0)return Nc.simpleGroup(this.addressMinusSuffix).join(":");mm(typeof this.elidedGroups=="number"),mm(typeof this.elisionBegin=="number");let t=[],[r,n]=this.addressMinusSuffix.split("::");r.length?t.push(...Nc.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(...Nc.simpleGroup(n,this.elisionEnd)):t.push(""),this.is4()&&(mm(this.address4 instanceof bo.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,Lc.simpleRegularExpression)(n.parsedAddress));else if(n.elidedGroups===Ct.GROUPS)r.push((0,Lc.possibleElisions)(Ct.GROUPS));else{let i=n.address.split("::");i[0].length&&r.push((0,Lc.simpleRegularExpression)(i[0].split(":"))),mm(typeof n.elidedGroups=="number"),r.push((0,Lc.possibleElisions)(n.elidedGroups,i[0].length!==0,i[1].length!==0)),i[1].length&&r.push((0,Lc.simpleRegularExpression)(i[1].split(":"))),r=[r.join(":")]}return t||(r=["(?=^|",Lc.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...r,")(?=[^\\w\\:]|",Lc.ADDRESS_BOUNDARY,"|$)"]),r.join("")}regularExpression(t=!1){return new RegExp(this.regularExpressionString(t),"i")}};So.Address6=In;var K8=Object.keys(Ct.TYPES).map(e=>[new In(e),Ct.TYPES[e]]),aV=new In("2001::/32"),uV=new In("2002::/16"),cV=new In("fc00::/7"),lV=new In("fe80::/10"),fV=[new In("2001:db8::/32"),new In("3fff::/20")],hV=new In("2001:2::/48"),dV=new In("2000::/3"),pV=Ct.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new In(e),reachable:t})),mV=new In("::ffff:0:0/96"),gV=new In("64:ff9b::/96"),vV=new In("64:ff9b:1::/48")});var z8=be(xn=>{"use strict";var Lfe=B(x()),wV=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]})),yV=xn&&xn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),EV=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)&&wV(t,e,r);return yV(t,e),t};Object.defineProperty(xn,"__esModule",{value:!0});xn.v6=xn.AddressError=xn.Address6=xn.Address4=void 0;var bV=Jy();Object.defineProperty(xn,"Address4",{enumerable:!0,get:function(){return bV.Address4}});var AV=V8();Object.defineProperty(xn,"Address6",{enumerable:!0,get:function(){return AV.Address6}});var SV=Dd();Object.defineProperty(xn,"AddressError",{enumerable:!0,get:function(){return SV.AddressError}});var _V=EV(eE());xn.v6={helpers:_V}});var X8=be(Y8=>{"use strict";var Mfe=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,M=-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&&(M=(H>>10)+55296|0,F=(H&1023)+56320|0,31>I?(d[I]=M,I=I+1|0,M=-1):(S=M,M=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]=M,I=~M>>>31,M=-1,y.length<g.length)continue}else M!==-1&&(y+=n(M));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"?Y8:self:global)});var yI=be(pA=>{"use strict";var m2e=B(x());pA.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};pA.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 EI=be(mA=>{"use strict";var v2e=B(x());mA.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};mA.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 bI=be(gA=>{"use strict";var y2e=B(x());gA.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};gA.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 AI=be(vA=>{"use strict";var b2e=B(x());vA.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};vA.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 SI=be(wA=>{"use strict";var S2e=B(x());wA.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}`};wA.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 DI=be((CI,yA)=>{var _2e=B(x()),_I=(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 _I}):typeof yA=="object"&&typeof CI=="object"&&(yA.exports=_I)});var II=be(Ye=>{"use strict";var D2e=B(x()),Xe=aa().Buffer,Va=yI(),EY=EI(),bY=bI(),Lg=AI(),EA=SI(),ll=DI(),AY=0,FI=32768,bA=32768,SY=~bA,BI=32768,_Y=~BI,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"?FI:AY;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&FI?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:bY.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:EY.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 Oa=Ye.unknown={};Oa.encode=function(e,t,r){return t||(t=Xe.alloc(Oa.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),Oa.encode.bytes=e.length+2,t};Oa.encode.bytes=0;Oa.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return Oa.decode.bytes=r+2,n};Oa.decode.bytes=0;Oa.encodingLength=function(e){return e.length+2};var Na=Ye.ns={};Na.encode=function(e,t,r){return t||(t=Xe.alloc(Na.encodingLength(e))),r||(r=0),Le.encode(e,t,r+2),t.writeUInt16BE(Le.encode.bytes,r),Na.encode.bytes=Le.encode.bytes+2,t};Na.encode.bytes=0;Na.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=Le.decode(e,t+2);return Na.decode.bytes=r+2,n};Na.decode.bytes=0;Na.encodingLength=function(e){return Le.encodingLength(e)+2};var La=Ye.soa={};La.encode=function(e,t,r){t||(t=Xe.alloc(La.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),La.encode.bytes=r-n,t};La.encode.bytes=0;La.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,La.decode.bytes=t-r,n};La.decode.bytes=0;La.encodingLength=function(e){return 22+Le.encodingLength(e.mname)+Le.encodingLength(e.rname)};var Ua=Ye.txt={};Ua.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(Ua.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),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=[];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 Ua.decode.bytes=t-r,i};Ua.decode.bytes=0;Ua.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 Ha=Ye.null={};Ha.encode=function(e,t,r){t||(t=Xe.alloc(Ha.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),Ha.encode.bytes=r-n,t};Ha.encode.bytes=0;Ha.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,Ha.decode.bytes=t-r,i};Ha.decode.bytes=0;Ha.encodingLength=function(e){return e?(Xe.isBuffer(e)?e.length:Xe.byteLength(e))+2:2};var qa=Ye.hinfo={};qa.encode=function(e,t,r){t||(t=Xe.alloc(qa.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),qa.encode.bytes=r-n,t};qa.encode.bytes=0;qa.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,qa.decode.bytes=t-r,n};qa.decode.bytes=0;qa.encodingLength=function(e){return St.encodingLength(e.cpu)+St.encodingLength(e.os)+2};var Mi=Ye.ptr={},CY=Ye.cname=Mi,DY=Ye.dname=Mi;Mi.encode=function(e,t,r){return t||(t=Xe.alloc(Mi.encodingLength(e))),r||(r=0),Le.encode(e,t,r+2),t.writeUInt16BE(Le.encode.bytes,r),Mi.encode.bytes=Le.encode.bytes+2,t};Mi.encode.bytes=0;Mi.decode=function(e,t){t||(t=0);let r=Le.decode(e,t+2);return Mi.decode.bytes=Le.decode.bytes+2,r};Mi.decode.bytes=0;Mi.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 Rs=Ye.caa={};Rs.ISSUER_CRITICAL=128;Rs.encode=function(e,t,r){let n=Rs.encodingLength(e);return t||(t=Xe.alloc(Rs.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=Rs.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),Rs.encode.bytes=n,t};Rs.encode.bytes=0;Rs.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&Rs.ISSUER_CRITICAL),Rs.decode.bytes=r+2,i};Rs.decode.bytes=0;Rs.encodingLength=function(e){return St.encodingLength(e.tag)+St.encodingLength(e.value)+2};var Qu=Ye.mx={};Qu.encode=function(e,t,r){t||(t=Xe.alloc(Qu.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),Qu.encode.bytes=r-n,t};Qu.encode.bytes=0;Qu.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,Qu.decode.bytes=t-r,n};Qu.encodingLength=function(e){return 4+Le.encodingLength(e.exchange)};var ja=Ye.a={};ja.encode=function(e,t,r){return t||(t=Xe.alloc(ja.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,ll.v4.encode(e,t,r),ja.encode.bytes=6,t};ja.encode.bytes=0;ja.decode=function(e,t){t||(t=0),t+=2;let r=ll.v4.decode(e,t);return ja.decode.bytes=6,r};ja.decode.bytes=0;ja.encodingLength=function(){return 6};var Ka=Ye.aaaa={};Ka.encode=function(e,t,r){return t||(t=Xe.alloc(Ka.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,ll.v6.encode(e,t,r),Ka.encode.bytes=18,t};Ka.encode.bytes=0;Ka.decode=function(e,t){t||(t=0),t+=2;let r=ll.v6.decode(e,t);return Ka.decode.bytes=18,r};Ka.decode.bytes=0;Ka.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=EA.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||ll.familyOf(e.ip),a=ll.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=EA.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=ll.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(EA.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=zf(e,Es);return t.writeUInt16BE(i,r),r=wp(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+zf(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 Po=Ye.rrsig={};Po.encode=function(e,t,r){t||(t=Xe.alloc(Po.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(Va.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,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;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=Va.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,Po.decode.bytes=t-r,n};Po.decode.bytes=0;Po.encodingLength=function(e){return 20+Le.encodingLength(e.signersName)+Xe.byteLength(e.signature)};var ko=Ye.rp={};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.mbox||".",t,r,{mail:!0}),r+=Le.encode.bytes,Le.encode(e.txt||".",t,r),r+=Le.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,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,ko.decode.bytes=t-r,n};ko.decode.bytes=0;ko.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=Va.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=Va.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=Va.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 To=Ye.nsec={};To.encode=function(e,t,r){t||(t=Xe.alloc(To.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,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.nextDomain=Le.decode(e,t),t+=Le.decode.bytes,n.rrtypes=Jr.decode(e,t,i-(t-r)),t+=Jr.decode.bytes,To.decode.bytes=t-r,n};To.decode.bytes=0;To.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 Oo=Ye.ds={};Oo.encode=function(e,t,r){t||(t=Xe.alloc(Oo.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,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;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,Oo.decode.bytes=t-r,n};Oo.decode.bytes=0;Oo.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 No=Ye.naptr={};No.encode=function(e,t,r){t||(t=Xe.alloc(No.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,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={};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,No.decode.bytes=t-r,n};No.decode.bytes=0;No.encodingLength=function(e){return St.encodingLength(e.flags)+St.encodingLength(e.services)+St.encodingLength(e.regexp)+Le.encodingLength(e.replacement)+6};var Lo=Ye.tlsa={};Lo.encode=function(e,t,r){t||(t=Xe.alloc(Lo.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,Lo.encode.bytes=r-n,t.writeUInt16BE(Lo.encode.bytes-2,n),t};Lo.encode.bytes=0;Lo.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,Lo.decode.bytes=t-r,n};Lo.decode.bytes=0;Lo.encodingLength=function(e){return 5+Xe.byteLength(e.certificate)};var AA=Ye.record=function(e){switch(e.toUpperCase()){case"A":return ja;case"PTR":return Mi;case"CNAME":return CY;case"DNAME":return DY;case"TXT":return Ua;case"NULL":return Ha;case"AAAA":return Ka;case"SRV":return Ma;case"HINFO":return qa;case"CAA":return Rs;case"NS":return Na;case"SOA":return La;case"MX":return Qu;case"OPT":return Ns;case"DNSKEY":return Yn;case"RRSIG":return Po;case"RP":return ko;case"NSEC":return To;case"NSEC3":return Ro;case"SSHFP":return Os;case"DS":return Oo;case"NAPTR":return No;case"TLSA":return Lo}return Oa},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(Va.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=Lg.toClass(e.class===void 0?"IN":e.class);e.flush&&(i|=bA),t.writeUInt16BE(i,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let o=AA(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=Va.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=Lg.toString(i&SY),r.flush=!!(i&bA);let o=AA(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+AA(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(Va.toType(e.type),r),r+=2,t.writeUInt16BE(Lg.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=Va.toString(e.readUInt16BE(t)),t+=2,n.class=Lg.toString(e.readUInt16BE(t)),t+=2,!!(n.class&BI)&&(n.class&=_Y),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=wp(e.questions,ji,t,r),r=wp(e.answers,ln,t,r),r=wp(e.authorities,ln,t,r),r=wp(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=Ng(n.questions,ji,e,t),t=Ng(n.answers,ln,e,t),t=Ng(n.authorities,ln,e,t),t=Ng(n.additionals,ln,e,t),Ye.decode.bytes=t-r,n};Ye.decode.bytes=0;Ye.encodingLength=function(e){return Ki.encodingLength(e)+zf(e.questions||[],ji)+zf(e.answers||[],ln)+zf(e.authorities||[],ln)+zf(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 zf(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function wp(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 Ng(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 za=be((Wf,Ep)=>{var j2e=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,M="...",L=800,T=16,O=1,R=2,N=3,P=1/0,q=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]",Re="[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]",Te="[object ArrayBuffer]",or="[object DataView]",Rn="[object Float32Array]",mt="[object Float64Array]",cc="[object Int8Array]",On="[object Int16Array]",Se="[object Int32Array]",tu="[object Uint8Array]",Ut="[object Uint8ClampedArray]",gn="[object Uint16Array]",Xi="[object Uint32Array]",Al=/\b__p \+= '';/g,ru=/\b(__p \+=) '' \+/g,ah=/(__e\(.*?\)|\b__t\)) \+\n'';/g,nu=/&(?:amp|lt|gt|quot|#39);/g,Zi=/[&<>"']/g,Kt=RegExp(nu.source),Ms=RegExp(Zi.source),Sl=/<%-([\s\S]+?)%>/g,uh=/<%([\s\S]+?)%>/g,lc=/<%=([\s\S]+?)%>/g,su=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ch=/^\w*$/,_l=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fc=/[\\^$.*+?()[\]{}|]/g,lh=RegExp(fc.source),ie=/^\s+/,we=/\s/,je=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,qe=/\{\n\/\* \[wrapped with (.+)\] \*/,et=/,? & /,gt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,wt=/[()=,{}\[\]\/\s]/,kr=/\\(\\)?/g,ar=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,js=/\w*$/,Ji=/^[-+]0x[0-9a-f]+$/i,Nn=/^0b[01]+$/i,es=/^\[object .+?Constructor\]$/,Fr=/^0o[0-7]+$/i,Ln=/^(?:0|[1-9]\d*)$/,iu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ou=/($^)/,fh=/['\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",Qi="A-Z\\xc0-\\xd6\\xd8-\\xde",Cl="\\ufe0e\\ufe0f",Hp=ts+_s+Ks+gi,hh="['\u2019]",A2="["+vn+"]",qp="["+Hp+"]",Dl="["+ur+"]",Mp="\\d+",S2="["+wn+"]",dh="["+nr+"]",ph="[^"+vn+Hp+Mp+wn+nr+Qi+"]",mh="\\ud83c[\\udffb-\\udfff]",_2="(?:"+Dl+"|"+mh+")",jp="[^"+vn+"]",gh="(?:\\ud83c[\\udde6-\\uddff]){2}",au="[\\ud800-\\udbff][\\udc00-\\udfff]",uu="["+Qi+"]",Kp="\\u200d",Vp="(?:"+dh+"|"+ph+")",C2="(?:"+uu+"|"+ph+")",zp="(?:"+hh+"(?:d|ll|m|re|s|t|ve))?",Gp="(?:"+hh+"(?:D|LL|M|RE|S|T|VE))?",Wp=_2+"?",Yp="["+Cl+"]?",D2="(?:"+Kp+"(?:"+[jp,gh,au].join("|")+")"+Yp+Wp+")*",F2="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",B2="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Xp=Yp+Wp+D2,I2="(?:"+[S2,gh,au].join("|")+")"+Xp,x2="(?:"+[jp+Dl+"?",Dl,gh,au,A2].join("|")+")",$2=RegExp(hh,"g"),P2=RegExp(Dl,"g"),vh=RegExp(mh+"(?="+mh+")|"+x2+Xp,"g"),k2=RegExp([uu+"?"+dh+"+"+zp+"(?="+[qp,uu,"$"].join("|")+")",C2+"+"+Gp+"(?="+[qp,uu+Vp,"$"].join("|")+")",uu+"?"+Vp+"+"+zp,uu+"+"+Gp,B2,F2,Mp,I2].join("|"),"g"),T2=RegExp("["+Kp+vn+ur+Cl+"]"),R2=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,O2=["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"],N2=-1,er={};er[Rn]=er[mt]=er[cc]=er[On]=er[Se]=er[tu]=er[Ut]=er[gn]=er[Xi]=!0,er[he]=er[De]=er[Te]=er[Ie]=er[or]=er[se]=er[Fe]=er[Re]=er[Oe]=er[pt]=er[ct]=er[vr]=er[lt]=er[Pr]=er[Dt]=!1;var Zt={};Zt[he]=Zt[De]=Zt[Te]=Zt[or]=Zt[Ie]=Zt[se]=Zt[Rn]=Zt[mt]=Zt[cc]=Zt[On]=Zt[Se]=Zt[Oe]=Zt[pt]=Zt[ct]=Zt[vr]=Zt[lt]=Zt[Pr]=Zt[Qn]=Zt[tu]=Zt[Ut]=Zt[gn]=Zt[Xi]=!0,Zt[Fe]=Zt[Re]=Zt[Dt]=!1;var L2={\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"},U2={"&":"&","<":"<",">":">",'"':""","'":"'"},H2={"&":"&","<":"<",">":">",""":'"',"'":"'"},q2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},M2=parseFloat,j2=parseInt,Zp=typeof global=="object"&&global&&global.Object===Object&&global,K2=typeof self=="object"&&self&&self.Object===Object&&self,Ir=Zp||K2||Function("return this")(),wh=typeof Wf=="object"&&Wf&&!Wf.nodeType&&Wf,Ko=wh&&typeof Ep=="object"&&Ep&&!Ep.nodeType&&Ep,Jp=Ko&&Ko.exports===wh,yh=Jp&&Zp.process,rs=(function(){try{var oe=Ko&&Ko.require&&Ko.require("util").types;return oe||yh&&yh.binding&&yh.binding("util")}catch{}})(),Qp=rs&&rs.isArrayBuffer,e0=rs&&rs.isDate,t0=rs&&rs.isMap,r0=rs&&rs.isRegExp,n0=rs&&rs.isSet,s0=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 V2(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 hc(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 Tr(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 cu(oe,ye){var de=oe==null?0:oe.length;return!!de&&lu(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 eo(oe,ye){for(var de=-1,He=ye.length,ot=oe.length;++de<He;)oe[ot+de]=ye[de];return oe}function i0(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 WS(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 YS=Ae("length");function Eh(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 Fl(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 lu(oe,ye,de){return ye===ye?X2(oe,ye,de):Fl(oe,bh,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 bh(oe){return oe!==oe}function fu(oe,ye){var de=oe==null?0:oe.length;return de?_h(oe,ye)/de:V}function Ae(oe){return function(ye){return ye==null?e:ye[oe]}}function Ah(oe){return function(ye){return oe==null?e:oe[ye]}}function Sh(oe,ye,de,He,ot){return ot(oe,function(xt,wr,Vt){de=He?(He=!1,xt):ye(de,xt,wr,Vt)}),de}function o0(oe,ye){var de=oe.length;for(oe.sort(ye);de--;)oe[de]=oe[de].value;return oe}function _h(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 Ch(oe,ye){for(var de=-1,He=Array(oe);++de<oe;)He[de]=ye(de);return He}function a0(oe,ye){return Wt(ye,function(de){return[de,oe[de]]})}function Dh(oe){return oe&&oe.slice(0,xh(oe)+1).replace(ie,"")}function Qr(oe){return function(ye){return oe(ye)}}function Fh(oe,ye){return Wt(ye,function(de){return oe[de]})}function Vo(oe,ye){return oe.has(ye)}function u0(oe,ye){for(var de=-1,He=oe.length;++de<He&&lu(ye,oe[de],0)>-1;);return de}function Bh(oe,ye){for(var de=oe.length;de--&&lu(ye,oe[de],0)>-1;);return de}function Ih(oe,ye){for(var de=oe.length,He=0;de--;)oe[de]===ye&&++He;return He}var z2=Ah(L2),c0=Ah(U2);function G2(oe){return"\\"+q2[oe]}function l0(oe,ye){return oe==null?e:oe[ye]}function hu(oe){return T2.test(oe)}function W2(oe){return R2.test(oe)}function Y2(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 dc(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 zo(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=He}),de}function f0(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=[He,He]}),de}function X2(oe,ye,de){for(var He=de-1,ot=oe.length;++He<ot;)if(oe[He]===ye)return He;return-1}function h0(oe,ye,de){for(var He=de+1;He--;)if(oe[He]===ye)return He;return He}function Go(oe){return hu(oe)?Z2(oe):YS(oe)}function Hn(oe){return hu(oe)?J2(oe):Eh(oe)}function xh(oe){for(var ye=oe.length;ye--&&we.test(oe.charAt(ye)););return ye}var d0=Ah(H2);function Z2(oe){for(var ye=vh.lastIndex=0;vh.test(oe);)++ye;return ye}function J2(oe){return oe.match(vh)||[]}function Q2(oe){return oe.match(k2)||[]}var $h=(function oe(ye){ye=ye==null?Ir:wi.defaults(Ir.Object(),ye,wi.pick(Ir,O2));var de=ye.Array,He=ye.Date,ot=ye.Error,xt=ye.Function,wr=ye.Math,Vt=ye.Object,Ph=ye.RegExp,ev=ye.String,ns=ye.TypeError,pc=de.prototype,p0=xt.prototype,Cs=Vt.prototype,Bl=ye["__core-js_shared__"],Wo=p0.toString,Ot=Cs.hasOwnProperty,kh=0,m0=(function(){var c=/[^.]+$/.exec(Bl&&Bl.keys&&Bl.keys.IE_PROTO||"");return c?"Symbol(src)_1."+c:""})(),Il=Cs.toString,tv=Wo.call(Vt),rv=Ir._,nv=Ph("^"+Wo.call(Ot).replace(fc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xl=Jp?ye.Buffer:e,to=ye.Symbol,$l=ye.Uint8Array,g0=xl?xl.allocUnsafe:e,Pl=dc(Vt.getPrototypeOf,Vt),v0=Vt.create,Yt=Cs.propertyIsEnumerable,kl=pc.splice,Tl=to?to.isConcatSpreadable:e,mc=to?to.iterator:e,Yo=to?to.toStringTag:e,D=(function(){try{var c=Ec(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,qt=Vt.getOwnPropertySymbols,yr=xl?xl.isBuffer:e,XS=ye.isFinite,wx=pc.join,yx=dc(Vt.keys,Vt),Rr=wr.max,yn=wr.min,Ex=He.now,bx=ye.parseInt,ZS=wr.random,Ax=pc.reverse,sv=Ec(ye,"DataView"),Th=Ec(ye,"Map"),iv=Ec(ye,"Promise"),Rl=Ec(ye,"Set"),Rh=Ec(ye,"WeakMap"),Oh=Ec(Vt,"create"),w0=Rh&&new Rh,Ol={},Sx=bc(sv),_x=bc(Th),Cx=bc(iv),Dx=bc(Rl),Fx=bc(Rh),y0=to?to.prototype:e,Nh=y0?y0.valueOf:e,JS=y0?y0.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 Q6(c)}return new Vs(c)}var Nl=(function(){function c(){}return function(f){if(!cr(f))return{};if(v0)return v0(f);c.prototype=f;var b=new c;return c.prototype=e,b}})();function E0(){}function Vs(c,f){this.__wrapped__=c,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=e}G.templateSettings={escape:Sl,evaluate:uh,interpolate:lc,variable:"",imports:{_:G}},G.prototype=E0.prototype,G.prototype.constructor=G,Vs.prototype=Nl(E0.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 Bx(){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 Ix(){if(this.__filtered__){var c=new Bt(this);c.__dir__=-1,c.__filtered__=!0}else c=this.clone(),c.__dir__*=-1;return c}function xx(){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 A6(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==R)nt=jn;else if(!jn){if(Bs==O)continue e;break e}}it[Ne++]=nt}return it}Bt.prototype=Nl(E0.prototype),Bt.prototype.constructor=Bt;function gc(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 $x(){this.__data__=Oh?Oh(null):{},this.size=0}function Px(c){var f=this.has(c)&&delete this.__data__[c];return this.size-=f?1:0,f}function kx(c){var f=this.__data__;if(Oh){var b=f[c];return b===a?e:b}return Ot.call(f,c)?f[c]:e}function Tx(c){var f=this.__data__;return Oh?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]=Oh&&f===e?a:f,this}gc.prototype.clear=$x,gc.prototype.delete=Px,gc.prototype.get=kx,gc.prototype.has=Tx,gc.prototype.set=Rx;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 Ox(){this.__data__=[],this.size=0}function Nx(c){var f=this.__data__,b=b0(f,c);if(b<0)return!1;var k=f.length-1;return b==k?f.pop():kl.call(f,b,1),--this.size,!0}function Lx(c){var f=this.__data__,b=b0(f,c);return b<0?e:f[b][1]}function Ux(c){return b0(this.__data__,c)>-1}function Hx(c,f){var b=this.__data__,k=b0(b,c);return k<0?(++this.size,b.push([c,f])):b[k][1]=f,this}Xo.prototype.clear=Ox,Xo.prototype.delete=Nx,Xo.prototype.get=Lx,Xo.prototype.has=Ux,Xo.prototype.set=Hx;function Zo(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 qx(){this.size=0,this.__data__={hash:new gc,map:new(Th||Xo),string:new gc}}function Mx(c){var f=k0(this,c).delete(c);return this.size-=f?1:0,f}function jx(c){return k0(this,c).get(c)}function Kx(c){return k0(this,c).has(c)}function Vx(c,f){var b=k0(this,c),k=b.size;return b.set(c,f),this.size+=b.size==k?0:1,this}Zo.prototype.clear=qx,Zo.prototype.delete=Mx,Zo.prototype.get=jx,Zo.prototype.has=Kx,Zo.prototype.set=Vx;function vc(c){var f=-1,b=c==null?0:c.length;for(this.__data__=new Zo;++f<b;)this.add(c[f])}function zx(c){return this.__data__.set(c,a),this}function Gx(c){return this.__data__.has(c)}vc.prototype.add=vc.prototype.push=zx,vc.prototype.has=Gx;function yi(c){var f=this.__data__=new Xo(c);this.size=f.size}function Wx(){this.__data__=new Xo,this.size=0}function Yx(c){var f=this.__data__,b=f.delete(c);return this.size=f.size,b}function Xx(c){return this.__data__.get(c)}function Zx(c){return this.__data__.has(c)}function Jx(c,f){var b=this.__data__;if(b instanceof Xo){var k=b.__data__;if(!Th||k.length<r-1)return k.push([c,f]),this.size=++b.size,this;b=this.__data__=new Zo(k)}return b.set(c,f),this.size=b.size,this}yi.prototype.clear=Wx,yi.prototype.delete=Yx,yi.prototype.get=Xx,yi.prototype.has=Zx,yi.prototype.set=Jx;function QS(c,f){var b=ht(c),k=!b&&Ac(c),j=!b&&!k&&vu(c),W=!b&&!k&&!j&&ql(c),J=b||k||j||W,re=J?Ch(c.length,ev):[],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")||ea(_e,ue)))&&re.push(_e);return re}function e6(c){var f=c.length;return f?c[gv(0,f-1)]:e}function Qx(c,f){return T0(ss(c),wc(f,0,c.length))}function e$(c){return T0(ss(c))}function ov(c,f,b){(b!==e&&!bi(c[f],b)||b===e&&!(f in c))&&ro(c,f,b)}function Lh(c,f,b){var k=c[f];(!(Ot.call(c,f)&&bi(k,b))||b===e&&!(f in c))&&ro(c,f,b)}function b0(c,f){for(var b=c.length;b--;)if(bi(c[b][0],f))return b;return-1}function t$(c,f,b,k){return du(c,function(j,W,J){f(k,j,b(j),J)}),k}function t6(c,f){return c&&so(f,Gr(f),c)}function r$(c,f){return c&&so(f,os(f),c)}function ro(c,f,b){f=="__proto__"&&D?D(c,f,{configurable:!0,enumerable:!0,value:b,writable:!0}):c[f]=b}function av(c,f){for(var b=-1,k=f.length,j=de(k),W=c==null;++b<k;)j[b]=W?e:Mv(c,f[b]);return j}function wc(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=K$(c),!re)return ss(c,J)}else{var Be=En(c),Ne=Be==Re||Be==Ve;if(vu(c))return C6(c,re);if(Be==ct||Be==he||Ne&&!j){if(J=ue||Ne?{}:K6(c),!re)return ue?k$(c,r$(J,c)):P$(c,t6(J,c))}else{if(!Zt[Be])return j?c:{};J=V$(c,Be,re)}}W||(W=new yi);var ze=W.get(c);if(ze)return ze;W.set(c,J),y5(c)?c.forEach(function(nt){J.add(zs(nt,f,b,nt,c,W))}):v5(c)&&c.forEach(function(nt,Ft){J.set(Ft,zs(nt,f,b,Ft,c,W))});var it=_e?ue?Fv:Dv:ue?os:Gr,Et=Ce?e:it(c);return U(Et||c,function(nt,Ft){Et&&(Ft=nt,nt=c[Ft]),Lh(J,Ft,zs(nt,f,b,Ft,c,W))}),J}function n$(c){var f=Gr(c);return function(b){return r6(b,c,f)}}function r6(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 n6(c,f,b){if(typeof c!="function")throw new ns(i);return Vh(function(){c.apply(e,b)},f)}function Uh(c,f,b,k){var j=-1,W=cu,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=Vo,J=!1,f=new vc(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 du=x6(no),s6=x6(cv,!0);function s$(c,f){var b=!0;return du(c,function(k,j,W){return b=!!f(k,j,W),b}),b}function A0(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 i$(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:b5(k);b<k;)c[b++]=f;return c}function i6(c,f){var b=[];return du(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=G$),j||(j=[]);++W<J;){var re=c[W];f>0&&b(re)?f>1?tn(re,f-1,b,k,j):eo(j,re):k||(j[j.length]=re)}return j}var uv=$6(),o6=$6(!0);function no(c,f){return c&&uv(c,f,Gr)}function cv(c,f){return c&&o6(c,f,Gr)}function S0(c,f){return Tr(f,function(b){return ta(c[b])})}function yc(c,f){f=mu(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 a6(c,f,b){var k=f(c);return ht(c)?k:eo(k,b(c))}function qn(c){return c==null?c===e?mi:Qe:Yo&&Yo in Vt(c)?q$(c):eP(c)}function lv(c,f){return c>f}function o$(c,f){return c!=null&&Ot.call(c,f)}function a$(c,f){return c!=null&&f in Vt(c)}function u$(c,f,b){return c>=yn(f,b)&&c<Rr(f,b)}function fv(c,f,b){for(var k=b?ce:cu,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 vc(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?Vo(Ne,it):k(_e,it,b))){for(J=W;--J;){var Et=re[J];if(!(Et?Vo(Et,it):k(c[J],it,b)))continue e}Ne&&Ne.push(it),_e.push(ze)}}return _e}function c$(c,f,b,k){return no(c,function(j,W,J){f(k,b(j),W,J)}),k}function Hh(c,f,b){f=mu(f,c),c=W6(c,f);var k=c==null?c:c[Ei(Ws(f))];return k==null?e:Un(k,c,b)}function u6(c){return hr(c)&&qn(c)==he}function l$(c){return hr(c)&&qn(c)==Te}function f$(c){return hr(c)&&qn(c)==se}function qh(c,f,b,k,j){return c===f?!0:c==null||f==null||!hr(c)&&!hr(f)?c!==c&&f!==f:h$(c,f,b,k,qh,j)}function h$(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&&vu(c)){if(!vu(f))return!1;J=!0,Ce=!1}if(Ne&&!Ce)return W||(W=new yi),J||ql(c)?q6(c,f,b,k,j,W):U$(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),H$(c,f,b,k,j,W)):!1}function d$(c){return hr(c)&&En(c)==Oe}function hv(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?qh(Ce,_e,d|v,k,Be):Ne))return!1}}return!0}function c6(c){if(!cr(c)||Y$(c))return!1;var f=ta(c)?nv:es;return f.test(bc(c))}function p$(c){return hr(c)&&qn(c)==vr}function m$(c){return hr(c)&&En(c)==lt}function g$(c){return hr(c)&&H0(c.length)&&!!er[qn(c)]}function l6(c){return typeof c=="function"?c:c==null?as:typeof c=="object"?ht(c)?d6(c[0],c[1]):h6(c):k5(c)}function dv(c){if(!Kh(c))return yx(c);var f=[];for(var b in Vt(c))Ot.call(c,b)&&b!="constructor"&&f.push(b);return f}function v$(c){if(!cr(c))return Q$(c);var f=Kh(c),b=[];for(var k in c)k=="constructor"&&(f||!Ot.call(c,k))||b.push(k);return b}function pv(c,f){return c<f}function f6(c,f){var b=-1,k=is(c)?de(c.length):[];return du(c,function(j,W,J){k[++b]=f(j,W,J)}),k}function h6(c){var f=Iv(c);return f.length==1&&f[0][2]?z6(f[0][0],f[0][1]):function(b){return b===c||hv(b,c,f)}}function d6(c,f){return $v(c)&&V6(f)?z6(Ei(c),f):function(b){var k=Mv(b,c);return k===e&&k===f?jv(b,c):qh(f,k,d|v)}}function _0(c,f,b,k,j){c!==f&&uv(f,function(W,J){if(j||(j=new yi),cr(W))w$(c,f,J,b,_0,k,j);else{var re=k?k(kv(c,J),W,J+"",c,f,j):e;re===e&&(re=W),ov(c,J,re)}},os)}function w$(c,f,b,k,j,W,J){var re=kv(c,b),ue=kv(f,b),_e=J.get(ue);if(_e){ov(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&&vu(ue),it=!Ne&&!ze&&ql(ue);Ce=ue,Ne||ze||it?ht(re)?Ce=re:Er(re)?Ce=ss(re):ze?(Be=!1,Ce=C6(ue,!0)):it?(Be=!1,Ce=D6(ue,!0)):Ce=[]:zh(ue)||Ac(ue)?(Ce=re,Ac(re)?Ce=A5(re):(!cr(re)||ta(re))&&(Ce=K6(ue))):Be=!1}Be&&(J.set(ue,Ce),j(Ce,ue,k,W,J),J.delete(ue)),ov(c,b,Ce)}function p6(c,f){var b=c.length;if(b)return f+=f<0?b:0,ea(f,b)?c[f]:e}function m6(c,f,b){f.length?f=Wt(f,function(W){return ht(W)?function(J){return yc(J,W.length===1?W[0]:W)}:W}):f=[as];var k=-1;f=Wt(f,Qr(st()));var j=f6(c,function(W,J,re){var ue=Wt(f,function(_e){return _e(W)});return{criteria:ue,index:++k,value:W}});return o0(j,function(W,J){return $$(W,J,b)})}function y$(c,f){return g6(c,f,function(b,k){return jv(c,k)})}function g6(c,f,b){for(var k=-1,j=f.length,W={};++k<j;){var J=f[k],re=yc(c,J);b(re,J)&&Mh(W,mu(J,c),re)}return W}function E$(c){return function(f){return yc(f,c)}}function mv(c,f,b,k){var j=k?vi:lu,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&&kl.call(re,ue,1),kl.call(c,ue,1);return c}function v6(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;ea(j)?kl.call(c,j,1):yv(c,j)}}return c}function gv(c,f){return c+ge(ZS()*(f-c+1))}function b$(c,f,b,k){for(var j=-1,W=Rr(fe((f-c)/(b||1)),0),J=de(W);W--;)J[k?W:++j]=c,c+=b;return J}function vv(c,f){var b="";if(!c||f<1||f>q)return b;do f%2&&(b+=c),f=ge(f/2),f&&(c+=c);while(f);return b}function At(c,f){return Tv(G6(c,f,as),c+"")}function A$(c){return e6(Ml(c))}function S$(c,f){var b=Ml(c);return T0(b,wc(f,0,b.length))}function Mh(c,f,b,k){if(!cr(c))return c;f=mu(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:ea(f[j+1])?[]:{})}Lh(re,ue,_e),re=re[ue]}return c}var w6=w0?function(c,f){return w0.set(c,f),c}:as,_$=D?function(c,f){return D(c,"toString",{configurable:!0,enumerable:!1,value:Vv(f),writable:!0})}:as;function C$(c){return T0(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 D$(c,f){var b;return du(c,function(k,j,W){return b=f(k,j,W),!b}),!!b}function C0(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 wv(c,f,as,b)}function wv(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 y6(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 E6(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 JS?JS.call(c):"";var f=c+"";return f=="0"&&1/c==-P?"-0":f}function pu(c,f,b){var k=-1,j=cu,W=c.length,J=!0,re=[],ue=re;if(b)J=!1,j=ce;else if(W>=r){var _e=f?null:N$(c);if(_e)return zo(_e);J=!1,j=Vo,ue=new vc}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 yv(c,f){f=mu(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=W6(c,f);return W==null||delete W[Ei(Ws(f))]}function b6(c,f,b,k){return Mh(c,f,b(yc(c,f)),k)}function D0(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 A6(c,f){var b=c;return b instanceof Bt&&(b=b.value()),i0(f,function(k,j){return j.func.apply(j.thisArg,eo([k],j.args))},b)}function Ev(c,f,b){var k=c.length;if(k<2)return k?pu(c[0]):[];for(var j=-1,W=de(k);++j<k;)for(var J=c[j],re=-1;++re<k;)re!=j&&(W[j]=Uh(W[j]||J,c[re],f,b));return pu(tn(W,1),f,b)}function S6(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 bv(c){return Er(c)?c:[]}function Av(c){return typeof c=="function"?c:as}function mu(c,f){return ht(c)?c:$v(c,f)?[c]:J6(zt(c))}var F$=At;function gu(c,f,b){var k=c.length;return b=b===e?k:b,!f&&b>=k?c:Gs(c,f,b)}var _6=z||function(c){return Ir.clearTimeout(c)};function C6(c,f){if(f)return c.slice();var b=c.length,k=g0?g0(b):new c.constructor(b);return c.copy(k),k}function Sv(c){var f=new c.constructor(c.byteLength);return new $l(f).set(new $l(c)),f}function B$(c,f){var b=f?Sv(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.byteLength)}function I$(c){var f=new c.constructor(c.source,js.exec(c));return f.lastIndex=c.lastIndex,f}function x$(c){return Nh?Vt(Nh.call(c)):{}}function D6(c,f){var b=f?Sv(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.length)}function F6(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 $$(c,f,b){for(var k=-1,j=c.criteria,W=f.criteria,J=j.length,re=b.length;++k<J;){var ue=F6(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 B6(c,f,b,k){for(var j=-1,W=c.length,J=b.length,re=-1,ue=f.length,_e=Rr(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 I6(c,f,b,k){for(var j=-1,W=c.length,J=-1,re=b.length,ue=-1,_e=f.length,Ce=Rr(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 so(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?ro(b,re,ue):Lh(b,re,ue)}return b}function P$(c,f){return so(c,xv(c),f)}function k$(c,f){return so(c,M6(c),f)}function F0(c,f){return function(b,k){var j=ht(b)?V2:t$,W=f?f():{};return j(b,c,st(k,2),W)}}function Ll(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&&Mn(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 x6(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 $6(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 T$(c,f,b){var k=f&g,j=jh(c);function W(){var J=this&&this!==Ir&&this instanceof W?j:c;return J.apply(k?b:this,arguments)}return W}function P6(c){return function(f){f=zt(f);var b=hu(f)?Hn(f):e,k=b?b[0]:f.charAt(0),j=b?gu(b,1).join(""):f.slice(1);return k[c]()+j}}function Ul(c){return function(f){return i0($5(x5(f).replace($2,"")),c,"")}}function jh(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=Nl(c.prototype),k=c.apply(b,f);return cr(k)?k:b}}function R$(c,f,b){var k=jh(c);function j(){for(var W=arguments.length,J=de(W),re=W,ue=Hl(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 N6(c,f,B0,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 k6(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 T6(c){return Qo(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&&P0(W)=="wrapper")var J=new Vs([],!0)}for(k=J?k:b;++k<b;){W=f[k];var re=P0(W),ue=re=="wrapper"?Bv(W):e;ue&&Pv(ue[0])&&ue[1]==(H|E|C|K)&&!ue[4].length&&ue[9]==1?J=J[P0(ue[0])].apply(J,ue[3]):J=W.length==1&&Pv(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 B0(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:jh(c);function nt(){for(var Ft=arguments.length,$t=de(Ft),Bs=Ft;Bs--;)$t[Bs]=arguments[Bs];if(ze)var jn=Hl(nt),Is=Ih($t,jn);if(k&&($t=B6($t,k,j,ze)),W&&($t=I6($t,W,J,ze)),Ft-=Is,ze&&Ft<_e){var br=en($t,jn);return N6(c,f,B0,nt.placeholder,b,$t,br,re,ue,_e-Ft)}var Ai=Be?b:this,na=Ne?Ai[c]:c;return Ft=$t.length,re?$t=tP($t,re):it&&Ft>1&&$t.reverse(),Ce&&ue<Ft&&($t.length=ue),this&&this!==Ir&&this instanceof nt&&(na=Et||jh(na)),na.apply(Ai,$t)}return nt}function R6(c,f){return function(b,k){return c$(b,c,f(k),{})}}function I0(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=E6(b),k=E6(k)),j=c(b,k)}return j}}function _v(c){return Qo(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 x0(c,f){f=f===e?" ":Ds(f);var b=f.length;if(b<2)return b?vv(f,c):f;var k=vv(f,fe(c/Go(f)));return hu(f)?gu(Hn(k),0,c).join(""):k.slice(0,c)}function O$(c,f,b,k){var j=f&g,W=jh(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 O6(c){return function(f,b,k){return k&&typeof k!="number"&&Mn(f,b,k)&&(b=k=e),f=ra(f),b===e?(b=f,f=0):b=ra(b),k=k===e?f<b?1:-1:ra(k),b$(f,b,k,c)}}function $0(c){return function(f,b){return typeof f=="string"&&typeof b=="string"||(f=Ys(f),b=Ys(b)),c(f,b)}}function N6(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 Pv(c)&&Y6(nt,Et),nt.placeholder=k,X6(nt,c,f)}function Cv(c){var f=wr[c];return function(b,k){if(b=Ys(b),k=k==null?0:yn(yt(k),292),k&&XS(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 N$=Rl&&1/zo(new Rl([,-0]))[1]==P?function(c){return new Rl(c)}:Wv;function L6(c){return function(f){var b=En(f);return b==Oe?zr(f):b==lt?f0(f):a0(f,c(f))}}function Jo(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:Rr(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:Bv(c),ze=[c,f,b,k,j,Ce,Be,W,J,re];if(Ne&&J$(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:Rr(ze[9]-_e,0),!re&&f&(E|_)&&(f&=~(E|_)),!f||f==g)var it=T$(c,f,b);else f==E||f==_?it=R$(c,f,re):(f==C||f==(g|C))&&!j.length?it=O$(c,f,b,k):it=B0.apply(e,ze);var Et=Ne?w6:Y6;return X6(Et(it,ze),c,f)}function U6(c,f,b,k){return c===e||bi(c,Cs[b])&&!Ot.call(k,b)?f:c}function H6(c,f,b,k,j,W){return cr(c)&&cr(f)&&(W.set(f,c),_0(c,f,e,H6,W),W.delete(f)),c}function L$(c){return zh(c)?e:c}function q6(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 vc: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(!Vo(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 U$(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 Te:return!(c.byteLength!=f.byteLength||!W(new $l(c),new $l(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=zo),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=q6(re(c),re(f),k,j,W,J);return J.delete(c),Ce;case Qn:if(Nh)return Nh.call(c)==Nh.call(f)}return!1}function H$(c,f,b,k,j,W){var J=b&d,re=Dv(c),ue=re.length,_e=Dv(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 Qo(c){return Tv(G6(c,e,r5),c+"")}function Dv(c){return a6(c,Gr,xv)}function Fv(c){return a6(c,os,M6)}var Bv=w0?function(c){return w0.get(c)}:Wv;function P0(c){for(var f=c.name+"",b=Ol[f],k=Ot.call(Ol,f)?b.length:0;k--;){var j=b[k],W=j.func;if(W==null||W==c)return j.name}return f}function Hl(c){var f=Ot.call(G,"placeholder")?G:c;return f.placeholder}function st(){var c=G.iteratee||zv;return c=c===zv?l6:c,arguments.length?c(arguments[0],arguments[1]):c}function k0(c,f){var b=c.__data__;return W$(f)?b[typeof f=="string"?"string":"hash"]:b.map}function Iv(c){for(var f=Gr(c),b=f.length;b--;){var k=f[b],j=c[k];f[b]=[k,j,V6(j)]}return f}function Ec(c,f){var b=l0(c,f);return c6(b)?b:e}function q$(c){var f=Ot.call(c,Yo),b=c[Yo];try{c[Yo]=e;var k=!0}catch{}var j=Il.call(c);return k&&(f?c[Yo]=b:delete c[Yo]),j}var xv=qt?function(c){return c==null?[]:(c=Vt(c),Tr(qt(c),function(f){return Yt.call(c,f)}))}:Yv,M6=qt?function(c){for(var f=[];c;)eo(f,xv(c)),c=Pl(c);return f}:Yv,En=qn;(sv&&En(new sv(new ArrayBuffer(1)))!=or||Th&&En(new Th)!=Oe||iv&&En(iv.resolve())!=mn||Rl&&En(new Rl)!=lt||Rh&&En(new Rh)!=Dt)&&(En=function(c){var f=qn(c),b=f==ct?c.constructor:e,k=b?bc(b):"";if(k)switch(k){case Sx:return or;case _x:return Oe;case Cx:return mn;case Dx:return lt;case Fx: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=Rr(c,f-J);break}}return{start:c,end:f}}function j$(c){var f=c.match(qe);return f?f[1].split(et):[]}function j6(c,f,b){f=mu(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&&H0(j)&&ea(J,j)&&(ht(c)||Ac(c)))}function K$(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 K6(c){return typeof c.constructor=="function"&&!Kh(c)?Nl(Pl(c)):{}}function V$(c,f,b){var k=c.constructor;switch(f){case Te:return Sv(c);case Ie:case se:return new k(+c);case or:return B$(c,b);case Rn:case mt:case cc:case On:case Se:case tu:case Ut:case gn:case Xi:return D6(c,b);case Oe:return new k;case pt:case Pr:return new k(c);case vr:return I$(c);case lt:return new k;case Qn:return x$(c)}}function z$(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 G$(c){return ht(c)||Ac(c)||!!(Tl&&c&&c[Tl])}function ea(c,f){var b=typeof c;return f=f??q,!!f&&(b=="number"||b!="symbol"&&Ln.test(c))&&c>-1&&c%1==0&&c<f}function Mn(c,f,b){if(!cr(b))return!1;var k=typeof f;return(k=="number"?is(b)&&ea(f,b.length):k=="string"&&f in b)?bi(b[f],c):!1}function $v(c,f){if(ht(c))return!1;var b=typeof c;return b=="number"||b=="symbol"||b=="boolean"||c==null||Fs(c)?!0:ch.test(c)||!su.test(c)||f!=null&&c in Vt(f)}function W$(c){var f=typeof c;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?c!=="__proto__":c===null}function Pv(c){var f=P0(c),b=G[f];if(typeof b!="function"||!(f in Bt.prototype))return!1;if(c===b)return!0;var k=Bv(b);return!!k&&c===k[0]}function Y$(c){return!!m0&&m0 in c}var X$=Bl?ta:Xv;function Kh(c){var f=c&&c.constructor,b=typeof f=="function"&&f.prototype||Cs;return c===b}function V6(c){return c===c&&!cr(c)}function z6(c,f){return function(b){return b==null?!1:b[c]===f&&(f!==e||c in Vt(b))}}function Z$(c){var f=L0(c,function(k){return b.size===u&&b.clear(),k}),b=f.cache;return f}function J$(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?B6(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?I6(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 Q$(c){var f=[];if(c!=null)for(var b in Vt(c))f.push(b);return f}function eP(c){return Il.call(c)}function G6(c,f,b){return f=Rr(f===e?c.length-1:f,0),function(){for(var k=arguments,j=-1,W=Rr(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 W6(c,f){return f.length<2?c:yc(c,Gs(f,0,-1))}function tP(c,f){for(var b=c.length,k=yn(f.length,b),j=ss(c);k--;){var W=f[k];c[k]=ea(W,b)?j[W]:e}return c}function kv(c,f){if(!(f==="constructor"&&typeof c[f]=="function")&&f!="__proto__")return c[f]}var Y6=Z6(w6),Vh=Z||function(c,f){return Ir.setTimeout(c,f)},Tv=Z6(_$);function X6(c,f,b){var k=f+"";return Tv(c,z$(k,rP(j$(k),b)))}function Z6(c){var f=0,b=0;return function(){var k=Ex(),j=T-(k-b);if(b=k,j>0){if(++f>=L)return arguments[0]}else f=0;return c.apply(e,arguments)}}function T0(c,f){var b=-1,k=c.length,j=k-1;for(f=f===e?k:f;++b<f;){var W=gv(b,j),J=c[W];c[W]=c[b],c[b]=J}return c.length=f,c}var J6=Z$(function(c){var f=[];return c.charCodeAt(0)===46&&f.push(""),c.replace(_l,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 bc(c){if(c!=null){try{return Wo.call(c)}catch{}try{return c+""}catch{}}return""}function rP(c,f){return U(me,function(b){var k="_."+b[0];f&b[1]&&!cu(c,k)&&c.push(k)}),c.sort()}function Q6(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 nP(c,f,b){(b?Mn(c,f,b):f===e)?f=1:f=Rr(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 sP(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 iP(){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 eo(ht(b)?ss(b):[b],tn(f,1))}var oP=At(function(c,f){return Er(c)?Uh(c,tn(f,1,Er,!0)):[]}),aP=At(function(c,f){var b=Ws(f);return Er(b)&&(b=e),Er(c)?Uh(c,tn(f,1,Er,!0),st(b,2)):[]}),uP=At(function(c,f){var b=Ws(f);return Er(b)&&(b=e),Er(c)?Uh(c,tn(f,1,Er,!0),e,b):[]});function cP(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 lP(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 fP(c,f){return c&&c.length?D0(c,st(f,3),!0,!0):[]}function hP(c,f){return c&&c.length?D0(c,st(f,3),!0):[]}function dP(c,f,b,k){var j=c==null?0:c.length;return j?(b&&typeof b!="number"&&Mn(c,f,b)&&(b=0,k=j),i$(c,f,b,k)):[]}function e5(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=Rr(k+j,0)),Fl(c,st(f,3),j)}function t5(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?Rr(k+j,0):yn(j,k-1)),Fl(c,st(f,3),j,!0)}function r5(c){var f=c==null?0:c.length;return f?tn(c,1):[]}function pP(c){var f=c==null?0:c.length;return f?tn(c,P):[]}function mP(c,f){var b=c==null?0:c.length;return b?(f=f===e?1:yt(f),tn(c,f)):[]}function gP(c){for(var f=-1,b=c==null?0:c.length,k={};++f<b;){var j=c[f];ro(k,j[0],j[1])}return k}function n5(c){return c&&c.length?c[0]:e}function vP(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=Rr(k+j,0)),lu(c,f,j)}function wP(c){var f=c==null?0:c.length;return f?Gs(c,0,-1):[]}var yP=At(function(c){var f=Wt(c,bv);return f.length&&f[0]===c[0]?fv(f):[]}),EP=At(function(c){var f=Ws(c),b=Wt(c,bv);return f===Ws(b)?f=e:b.pop(),b.length&&b[0]===c[0]?fv(b,st(f,2)):[]}),bP=At(function(c){var f=Ws(c),b=Wt(c,bv);return f=typeof f=="function"?f:e,f&&b.pop(),b.length&&b[0]===c[0]?fv(b,e,f):[]});function AP(c,f){return c==null?"":wx.call(c,f)}function Ws(c){var f=c==null?0:c.length;return f?c[f-1]:e}function SP(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?Rr(k+j,0):yn(j,k-1)),f===f?h0(c,f,j):Fl(c,bh,j,!0)}function _P(c,f){return c&&c.length?p6(c,yt(f)):e}var CP=At(s5);function s5(c,f){return c&&c.length&&f&&f.length?mv(c,f):c}function DP(c,f,b){return c&&c.length&&f&&f.length?mv(c,f,st(b,2)):c}function FP(c,f,b){return c&&c.length&&f&&f.length?mv(c,f,e,b):c}var BP=Qo(function(c,f){var b=c==null?0:c.length,k=av(c,f);return v6(c,Wt(f,function(j){return ea(j,b)?+j:j}).sort(F6)),k});function IP(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 v6(c,j),b}function Rv(c){return c==null?c:Ax.call(c)}function xP(c,f,b){var k=c==null?0:c.length;return k?(b&&typeof b!="number"&&Mn(c,f,b)?(f=0,b=k):(f=f==null?0:yt(f),b=b===e?k:yt(b)),Gs(c,f,b)):[]}function $P(c,f){return C0(c,f)}function PP(c,f,b){return wv(c,f,st(b,2))}function kP(c,f){var b=c==null?0:c.length;if(b){var k=C0(c,f);if(k<b&&bi(c[k],f))return k}return-1}function TP(c,f){return C0(c,f,!0)}function RP(c,f,b){return wv(c,f,st(b,2),!0)}function OP(c,f){var b=c==null?0:c.length;if(b){var k=C0(c,f,!0)-1;if(bi(c[k],f))return k}return-1}function NP(c){return c&&c.length?y6(c):[]}function LP(c,f){return c&&c.length?y6(c,st(f,2)):[]}function UP(c){var f=c==null?0:c.length;return f?Gs(c,1,f):[]}function HP(c,f,b){return c&&c.length?(f=b||f===e?1:yt(f),Gs(c,0,f<0?0:f)):[]}function qP(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?D0(c,st(f,3),!1,!0):[]}function jP(c,f){return c&&c.length?D0(c,st(f,3)):[]}var KP=At(function(c){return pu(tn(c,1,Er,!0))}),VP=At(function(c){var f=Ws(c);return Er(f)&&(f=e),pu(tn(c,1,Er,!0),st(f,2))}),zP=At(function(c){var f=Ws(c);return f=typeof f=="function"?f:e,pu(tn(c,1,Er,!0),e,f)});function GP(c){return c&&c.length?pu(c):[]}function WP(c,f){return c&&c.length?pu(c,st(f,2)):[]}function YP(c,f){return f=typeof f=="function"?f:e,c&&c.length?pu(c,e,f):[]}function Ov(c){if(!(c&&c.length))return[];var f=0;return c=Tr(c,function(b){if(Er(b))return f=Rr(b.length,f),!0}),Ch(f,function(b){return Wt(c,Ae(b))})}function i5(c,f){if(!(c&&c.length))return[];var b=Ov(c);return f==null?b:Wt(b,function(k){return Un(f,e,k)})}var XP=At(function(c,f){return Er(c)?Uh(c,f):[]}),ZP=At(function(c){return Ev(Tr(c,Er))}),JP=At(function(c){var f=Ws(c);return Er(f)&&(f=e),Ev(Tr(c,Er),st(f,2))}),QP=At(function(c){var f=Ws(c);return f=typeof f=="function"?f:e,Ev(Tr(c,Er),e,f)}),ek=At(Ov);function tk(c,f){return S6(c||[],f||[],Lh)}function rk(c,f){return S6(c||[],f||[],Mh)}var nk=At(function(c){var f=c.length,b=f>1?c[f-1]:e;return b=typeof b=="function"?(c.pop(),b):e,i5(c,b)});function o5(c){var f=G(c);return f.__chain__=!0,f}function sk(c,f){return f(c),c}function R0(c,f){return f(c)}var ik=Qo(function(c){var f=c.length,b=f?c[0]:0,k=this.__wrapped__,j=function(W){return av(W,c)};return f>1||this.__actions__.length||!(k instanceof Bt)||!ea(b)?this.thru(j):(k=k.slice(b,+b+(f?1:0)),k.__actions__.push({func:R0,args:[j],thisArg:e}),new Vs(k,this.__chain__).thru(function(W){return f&&!W.length&&W.push(e),W}))});function ok(){return o5(this)}function ak(){return new Vs(this.value(),this.__chain__)}function uk(){this.__values__===e&&(this.__values__=E5(this.value()));var c=this.__index__>=this.__values__.length,f=c?e:this.__values__[this.__index__++];return{done:c,value:f}}function ck(){return this}function lk(c){for(var f,b=this;b instanceof E0;){var k=Q6(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 fk(){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:R0,args:[Rv],thisArg:e}),new Vs(f,this.__chain__)}return this.thru(Rv)}function hk(){return A6(this.__wrapped__,this.__actions__)}var dk=F0(function(c,f,b){Ot.call(c,b)?++c[b]:ro(c,b,1)});function pk(c,f,b){var k=ht(c)?hc:s$;return b&&Mn(c,f,b)&&(f=e),k(c,st(f,3))}function mk(c,f){var b=ht(c)?Tr:i6;return b(c,st(f,3))}var gk=k6(e5),vk=k6(t5);function wk(c,f){return tn(O0(c,f),1)}function yk(c,f){return tn(O0(c,f),P)}function Ek(c,f,b){return b=b===e?1:yt(b),tn(O0(c,f),b)}function a5(c,f){var b=ht(c)?U:du;return b(c,st(f,3))}function u5(c,f){var b=ht(c)?ft:s6;return b(c,st(f,3))}var bk=F0(function(c,f,b){Ot.call(c,b)?c[b].push(f):ro(c,b,[f])});function Ak(c,f,b,k){c=is(c)?c:Ml(c),b=b&&!k?yt(b):0;var j=c.length;return b<0&&(b=Rr(j+b,0)),q0(c)?b<=j&&c.indexOf(f,b)>-1:!!j&&lu(c,f,b)>-1}var Sk=At(function(c,f,b){var k=-1,j=typeof f=="function",W=is(c)?de(c.length):[];return du(c,function(J){W[++k]=j?Un(f,J,b):Hh(J,f,b)}),W}),_k=F0(function(c,f,b){ro(c,b,f)});function O0(c,f){var b=ht(c)?Wt:f6;return b(c,st(f,3))}function Ck(c,f,b,k){return c==null?[]:(ht(f)||(f=f==null?[]:[f]),b=k?e:b,ht(b)||(b=b==null?[]:[b]),m6(c,f,b))}var Dk=F0(function(c,f,b){c[b?0:1].push(f)},function(){return[[],[]]});function Fk(c,f,b){var k=ht(c)?i0:Sh,j=arguments.length<3;return k(c,st(f,4),b,j,du)}function Bk(c,f,b){var k=ht(c)?WS:Sh,j=arguments.length<3;return k(c,st(f,4),b,j,s6)}function Ik(c,f){var b=ht(c)?Tr:i6;return b(c,U0(st(f,3)))}function xk(c){var f=ht(c)?e6:A$;return f(c)}function $k(c,f,b){(b?Mn(c,f,b):f===e)?f=1:f=yt(f);var k=ht(c)?Qx:S$;return k(c,f)}function Pk(c){var f=ht(c)?e$:C$;return f(c)}function kk(c){if(c==null)return 0;if(is(c))return q0(c)?Go(c):c.length;var f=En(c);return f==Oe||f==lt?c.size:dv(c).length}function Tk(c,f,b){var k=ht(c)?tr:D$;return b&&Mn(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&&Mn(c,f[0],f[1])?f=[]:b>2&&Mn(f[0],f[1],f[2])&&(f=[f[0]]),m6(c,tn(f,1),[])}),N0=ee||function(){return Ir.Date.now()};function Ok(c,f){if(typeof f!="function")throw new ns(i);return c=yt(c),function(){if(--c<1)return f.apply(this,arguments)}}function c5(c,f,b){return f=b?e:f,f=c&&f==null?c.length:f,Jo(c,H,e,e,e,e,f)}function l5(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 Nv=At(function(c,f,b){var k=g;if(b.length){var j=en(b,Hl(Nv));k|=C}return Jo(c,k,f,b,j)}),f5=At(function(c,f,b){var k=g|y;if(b.length){var j=en(b,Hl(f5));k|=C}return Jo(f,k,c,b,j)});function h5(c,f,b){f=b?e:f;var k=Jo(c,E,e,e,e,e,e,f);return k.placeholder=h5.placeholder,k}function d5(c,f,b){f=b?e:f;var k=Jo(c,_,e,e,e,e,e,f);return k.placeholder=d5.placeholder,k}function p5(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?Rr(Ys(b.maxWait)||0,f):W,Ne="trailing"in b?!!b.trailing:Ne);function ze(br){var Ai=k,na=j;return k=j=e,_e=br,J=c.apply(na,Ai),J}function it(br){return _e=br,re=Vh(Ft,f),Ce?ze(br):J}function Et(br){var Ai=br-ue,na=br-_e,T5=f-Ai;return Be?yn(T5,W-na):T5}function nt(br){var Ai=br-ue,na=br-_e;return ue===e||Ai>=f||Ai<0||Be&&na>=W}function Ft(){var br=N0();if(nt(br))return $t(br);re=Vh(Ft,Et(br))}function $t(br){return re=e,Ne&&k?ze(br):(k=j=e,J)}function Bs(){re!==e&&_6(re),_e=0,k=ue=j=re=e}function jn(){return re===e?J:$t(N0())}function Is(){var br=N0(),Ai=nt(br);if(k=arguments,j=this,ue=br,Ai){if(re===e)return it(ue);if(Be)return _6(re),re=Vh(Ft,f),ze(ue)}return re===e&&(re=Vh(Ft,f)),J}return Is.cancel=Bs,Is.flush=jn,Is}var Nk=At(function(c,f){return n6(c,1,f)}),Lk=At(function(c,f,b){return n6(c,Ys(f)||0,b)});function Uk(c){return Jo(c,S)}function L0(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(L0.Cache||Zo),b}L0.Cache=Zo;function U0(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 Hk(c){return l5(2,c)}var qk=F$(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)})}),Lv=At(function(c,f){var b=en(f,Hl(Lv));return Jo(c,C,e,f,b)}),m5=At(function(c,f){var b=en(f,Hl(m5));return Jo(c,F,e,f,b)}),Mk=Qo(function(c,f){return Jo(c,K,e,e,e,f)});function jk(c,f){if(typeof c!="function")throw new ns(i);return f=f===e?f:yt(f),At(c,f)}function Kk(c,f){if(typeof c!="function")throw new ns(i);return f=f==null?0:Rr(yt(f),0),At(function(b){var k=b[f],j=gu(b,0,f);return k&&eo(j,k),Un(c,this,j)})}function Vk(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),p5(c,f,{leading:k,maxWait:f,trailing:j})}function zk(c){return c5(c,1)}function Gk(c,f){return Lv(Av(f),c)}function Wk(){if(!arguments.length)return[];var c=arguments[0];return ht(c)?c:[c]}function Yk(c){return zs(c,p)}function Xk(c,f){return f=typeof f=="function"?f:e,zs(c,p,f)}function Zk(c){return zs(c,h|p)}function Jk(c,f){return f=typeof f=="function"?f:e,zs(c,h|p,f)}function Qk(c,f){return f==null||r6(c,f,Gr(f))}function bi(c,f){return c===f||c!==c&&f!==f}var eT=$0(lv),tT=$0(function(c,f){return c>=f}),Ac=u6((function(){return arguments})())?u6:function(c){return hr(c)&&Ot.call(c,"callee")&&!Yt.call(c,"callee")},ht=de.isArray,rT=Qp?Qr(Qp):l$;function is(c){return c!=null&&H0(c.length)&&!ta(c)}function Er(c){return hr(c)&&is(c)}function nT(c){return c===!0||c===!1||hr(c)&&qn(c)==Ie}var vu=yr||Xv,sT=e0?Qr(e0):f$;function iT(c){return hr(c)&&c.nodeType===1&&!zh(c)}function oT(c){if(c==null)return!0;if(is(c)&&(ht(c)||typeof c=="string"||typeof c.splice=="function"||vu(c)||ql(c)||Ac(c)))return!c.length;var f=En(c);if(f==Oe||f==lt)return!c.size;if(Kh(c))return!dv(c).length;for(var b in c)if(Ot.call(c,b))return!1;return!0}function aT(c,f){return qh(c,f)}function uT(c,f,b){b=typeof b=="function"?b:e;var k=b?b(c,f):e;return k===e?qh(c,f,e,b):!!k}function Uv(c){if(!hr(c))return!1;var f=qn(c);return f==Fe||f==pe||typeof c.message=="string"&&typeof c.name=="string"&&!zh(c)}function cT(c){return typeof c=="number"&&XS(c)}function ta(c){if(!cr(c))return!1;var f=qn(c);return f==Re||f==Ve||f==Pe||f==gr}function g5(c){return typeof c=="number"&&c==yt(c)}function H0(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=q}function cr(c){var f=typeof c;return c!=null&&(f=="object"||f=="function")}function hr(c){return c!=null&&typeof c=="object"}var v5=t0?Qr(t0):d$;function lT(c,f){return c===f||hv(c,f,Iv(f))}function fT(c,f,b){return b=typeof b=="function"?b:e,hv(c,f,Iv(f),b)}function hT(c){return w5(c)&&c!=+c}function dT(c){if(X$(c))throw new ot(n);return c6(c)}function pT(c){return c===null}function mT(c){return c==null}function w5(c){return typeof c=="number"||hr(c)&&qn(c)==pt}function zh(c){if(!hr(c)||qn(c)!=ct)return!1;var f=Pl(c);if(f===null)return!0;var b=Ot.call(f,"constructor")&&f.constructor;return typeof b=="function"&&b instanceof b&&Wo.call(b)==tv}var Hv=r0?Qr(r0):p$;function gT(c){return g5(c)&&c>=-q&&c<=q}var y5=n0?Qr(n0):m$;function q0(c){return typeof c=="string"||!ht(c)&&hr(c)&&qn(c)==Pr}function Fs(c){return typeof c=="symbol"||hr(c)&&qn(c)==Qn}var ql=s0?Qr(s0):g$;function vT(c){return c===e}function wT(c){return hr(c)&&En(c)==Dt}function yT(c){return hr(c)&&qn(c)==Ze}var ET=$0(pv),bT=$0(function(c,f){return c<=f});function E5(c){if(!c)return[];if(is(c))return q0(c)?Hn(c):ss(c);if(mc&&c[mc])return Y2(c[mc]());var f=En(c),b=f==Oe?zr:f==lt?zo:Ml;return b(c)}function ra(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=ra(c),b=f%1;return f===f?b?f-b:f:0}function b5(c){return c?wc(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=Dh(c);var b=Nn.test(c);return b||Fr.test(c)?j2(c.slice(2),b?2:8):Ji.test(c)?V:+c}function A5(c){return so(c,os(c))}function AT(c){return c?wc(yt(c),-q,q):c===0?c:0}function zt(c){return c==null?"":Ds(c)}var ST=Ll(function(c,f){if(Kh(f)||is(f)){so(f,Gr(f),c);return}for(var b in f)Ot.call(f,b)&&Lh(c,b,f[b])}),S5=Ll(function(c,f){so(f,os(f),c)}),_5=Ll(function(c,f,b,k){so(f,os(f),c,k)}),qv=Ll(function(c,f,b,k){so(f,Gr(f),c,k)}),_T=Qo(av);function CT(c,f){var b=Nl(c);return f==null?b:t6(b,f)}var DT=At(function(c,f){c=Vt(c);var b=-1,k=f.length,j=k>2?f[2]:e;for(j&&Mn(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}),FT=At(function(c){return c.push(e,H6),Un(C5,e,c)});function BT(c,f){return Vr(c,st(f,3),no)}function IT(c,f){return Vr(c,st(f,3),cv)}function xT(c,f){return c==null?c:uv(c,st(f,3),os)}function $T(c,f){return c==null?c:o6(c,st(f,3),os)}function PT(c,f){return c&&no(c,st(f,3))}function kT(c,f){return c&&cv(c,st(f,3))}function TT(c){return c==null?[]:S0(c,Gr(c))}function RT(c){return c==null?[]:S0(c,os(c))}function Mv(c,f,b){var k=c==null?e:yc(c,f);return k===e?b:k}function OT(c,f){return c!=null&&j6(c,f,o$)}function jv(c,f){return c!=null&&j6(c,f,a$)}var NT=R6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=Il.call(f)),c[f]=b},Vv(as)),LT=R6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=Il.call(f)),Ot.call(c,f)?c[f].push(b):c[f]=[b]},st),UT=At(Hh);function Gr(c){return is(c)?QS(c):dv(c)}function os(c){return is(c)?QS(c,!0):v$(c)}function HT(c,f){var b={};return f=st(f,3),no(c,function(k,j,W){ro(b,f(k,j,W),k)}),b}function qT(c,f){var b={};return f=st(f,3),no(c,function(k,j,W){ro(b,j,f(k,j,W))}),b}var MT=Ll(function(c,f,b){_0(c,f,b)}),C5=Ll(function(c,f,b,k){_0(c,f,b,k)}),jT=Qo(function(c,f){var b={};if(c==null)return b;var k=!1;f=Wt(f,function(W){return W=mu(W,c),k||(k=W.length>1),W}),so(c,Fv(c),b),k&&(b=zs(b,h|m|p,L$));for(var j=f.length;j--;)yv(b,f[j]);return b});function KT(c,f){return D5(c,U0(st(f)))}var VT=Qo(function(c,f){return c==null?{}:y$(c,f)});function D5(c,f){if(c==null)return{};var b=Wt(Fv(c),function(k){return[k]});return f=st(f),g6(c,b,function(k,j){return f(k,j[0])})}function zT(c,f,b){f=mu(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=ta(W)?W.call(c):W}return c}function GT(c,f,b){return c==null?c:Mh(c,f,b)}function WT(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:Mh(c,f,b,k)}var F5=L6(Gr),B5=L6(os);function YT(c,f,b){var k=ht(c),j=k||vu(c)||ql(c);if(f=st(f,4),b==null){var W=c&&c.constructor;j?b=k?new W:[]:cr(c)?b=ta(W)?Nl(Pl(c)):{}:b={}}return(j?U:no)(c,function(J,re,ue){return f(b,J,re,ue)}),b}function XT(c,f){return c==null?!0:yv(c,f)}function ZT(c,f,b){return c==null?c:b6(c,f,Av(b))}function JT(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:b6(c,f,Av(b),k)}function Ml(c){return c==null?[]:Fh(c,Gr(c))}function QT(c){return c==null?[]:Fh(c,os(c))}function eR(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),wc(Ys(c),f,b)}function tR(c,f,b){return f=ra(f),b===e?(b=f,f=0):b=ra(b),c=Ys(c),u$(c,f,b)}function rR(c,f,b){if(b&&typeof b!="boolean"&&Mn(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=ra(c),f===e?(f=c,c=0):f=ra(f)),c>f){var k=c;c=f,f=k}if(b||c%1||f%1){var j=ZS();return yn(c+j*(f-c+M2("1e-"+((j+"").length-1))),f)}return gv(c,f)}var nR=Ul(function(c,f,b){return f=f.toLowerCase(),c+(b?I5(f):f)});function I5(c){return Kv(zt(c).toLowerCase())}function x5(c){return c=zt(c),c&&c.replace(iu,z2).replace(P2,"")}function sR(c,f,b){c=zt(c),f=Ds(f);var k=c.length;b=b===e?k:wc(yt(b),0,k);var j=b;return b-=f.length,b>=0&&c.slice(b,j)==f}function iR(c){return c=zt(c),c&&Ms.test(c)?c.replace(Zi,c0):c}function oR(c){return c=zt(c),c&&lh.test(c)?c.replace(fc,"\\$&"):c}var aR=Ul(function(c,f,b){return c+(b?"-":"")+f.toLowerCase()}),uR=Ul(function(c,f,b){return c+(b?" ":"")+f.toLowerCase()}),cR=P6("toLowerCase");function lR(c,f,b){c=zt(c),f=yt(f);var k=f?Go(c):0;if(!f||k>=f)return c;var j=(f-k)/2;return x0(ge(j),b)+c+x0(fe(j),b)}function fR(c,f,b){c=zt(c),f=yt(f);var k=f?Go(c):0;return f&&k<f?c+x0(f-k,b):c}function hR(c,f,b){c=zt(c),f=yt(f);var k=f?Go(c):0;return f&&k<f?x0(f-k,b)+c:c}function dR(c,f,b){return b||f==null?f=0:f&&(f=+f),bx(zt(c).replace(ie,""),f||0)}function pR(c,f,b){return(b?Mn(c,f,b):f===e)?f=1:f=yt(f),vv(zt(c),f)}function mR(){var c=arguments,f=zt(c[0]);return c.length<3?f:f.replace(c[1],c[2])}var gR=Ul(function(c,f,b){return c+(b?"_":"")+f.toLowerCase()});function vR(c,f,b){return b&&typeof b!="number"&&Mn(c,f,b)&&(f=b=e),b=b===e?X:b>>>0,b?(c=zt(c),c&&(typeof f=="string"||f!=null&&!Hv(f))&&(f=Ds(f),!f&&hu(c))?gu(Hn(c),0,b):c.split(f,b)):[]}var wR=Ul(function(c,f,b){return c+(b?" ":"")+Kv(f)});function yR(c,f,b){return c=zt(c),b=b==null?0:wc(yt(b),0,c.length),f=Ds(f),c.slice(b,b+f.length)==f}function ER(c,f,b){var k=G.templateSettings;b&&Mn(c,f,b)&&(f=e),c=zt(c),f=qv({},f,k,U6);var j=qv({},f.imports,k.imports,U6),W=Gr(j),J=Fh(j,W);U(W,function(nt){if(wt.test(nt))throw new ot(s)});var re,ue,_e=0,Ce=f.interpolate||ou,Be="__p += '",Ne=Ph((f.escape||ou).source+"|"+Ce.source+"|"+(Ce===lc?ar:ou).source+"|"+(f.evaluate||ou).source+"|$","g"),ze="//# sourceURL="+(Ot.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++N2+"]")+`
|
||
`;c.replace(Ne,function(nt,Ft,$t,Bs,jn,Is){return $t||($t=Bs),Be+=c.slice(_e,Is).replace(fh,G2),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(Al,""):Be).replace(ru,"$1").replace(ah,"$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=P5(function(){return xt(W,ze+"return "+Be).apply(e,J)});if(Et.source=Be,Uv(Et))throw Et;return Et}function bR(c){return zt(c).toLowerCase()}function AR(c){return zt(c).toUpperCase()}function SR(c,f,b){if(c=zt(c),c&&(b||f===e))return Dh(c);if(!c||!(f=Ds(f)))return c;var k=Hn(c),j=Hn(f),W=u0(k,j),J=Bh(k,j)+1;return gu(k,W,J).join("")}function _R(c,f,b){if(c=zt(c),c&&(b||f===e))return c.slice(0,xh(c)+1);if(!c||!(f=Ds(f)))return c;var k=Hn(c),j=Bh(k,Hn(f))+1;return gu(k,0,j).join("")}function CR(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=u0(k,Hn(f));return gu(k,j).join("")}function DR(c,f){var b=I,k=M;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(hu(c)){var J=Hn(c);W=J.length}if(b>=W)return c;var re=b-Go(k);if(re<1)return k;var ue=J?gu(J,0,re).join(""):c.slice(0,re);if(j===e)return ue+k;if(J&&(re+=ue.length-re),Hv(j)){if(c.slice(re).search(j)){var _e,Ce=ue;for(j.global||(j=Ph(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 FR(c){return c=zt(c),c&&Kt.test(c)?c.replace(nu,d0):c}var BR=Ul(function(c,f,b){return c+(b?" ":"")+f.toUpperCase()}),Kv=P6("toUpperCase");function $5(c,f,b){return c=zt(c),f=b?e:f,f===e?W2(c)?Q2(c):rt(c):c.match(f)||[]}var P5=At(function(c,f){try{return Un(c,e,f)}catch(b){return Uv(b)?b:new ot(b)}}),IR=Qo(function(c,f){return U(f,function(b){b=Ei(b),ro(c,b,Nv(c[b],c))}),c});function xR(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 $R(c){return n$(zs(c,h))}function Vv(c){return function(){return c}}function PR(c,f){return c==null||c!==c?f:c}var kR=T6(),TR=T6(!0);function as(c){return c}function zv(c){return l6(typeof c=="function"?c:zs(c,h))}function RR(c){return h6(zs(c,h))}function OR(c,f){return d6(c,zs(f,h))}var NR=At(function(c,f){return function(b){return Hh(b,c,f)}}),LR=At(function(c,f){return function(b){return Hh(c,b,f)}});function Gv(c,f,b){var k=Gr(f),j=S0(f,k);b==null&&!(cr(f)&&(j.length||!k.length))&&(b=f,f=c,c=this,j=S0(f,Gr(f)));var W=!(cr(b)&&"chain"in b)||!!b.chain,J=ta(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,eo([this.value()],arguments))})}),c}function UR(){return Ir._===this&&(Ir._=rv),this}function Wv(){}function HR(c){return c=yt(c),At(function(f){return p6(f,c)})}var qR=_v(Wt),MR=_v(hc),jR=_v(tr);function k5(c){return $v(c)?Ae(Ei(c)):E$(c)}function KR(c){return function(f){return c==null?e:yc(c,f)}}var VR=O6(),zR=O6(!0);function Yv(){return[]}function Xv(){return!1}function GR(){return{}}function WR(){return""}function YR(){return!0}function XR(c,f){if(c=yt(c),c<1||c>q)return[];var b=X,k=yn(c,X);f=st(f),c-=X;for(var j=Ch(k,f);++b<c;)f(b);return j}function ZR(c){return ht(c)?Wt(c,Ei):Fs(c)?[c]:ss(J6(zt(c)))}function JR(c){var f=++kh;return zt(c)+f}var QR=I0(function(c,f){return c+f},0),eO=Cv("ceil"),tO=I0(function(c,f){return c/f},1),rO=Cv("floor");function nO(c){return c&&c.length?A0(c,as,lv):e}function sO(c,f){return c&&c.length?A0(c,st(f,2),lv):e}function iO(c){return fu(c,as)}function oO(c,f){return fu(c,st(f,2))}function aO(c){return c&&c.length?A0(c,as,pv):e}function uO(c,f){return c&&c.length?A0(c,st(f,2),pv):e}var cO=I0(function(c,f){return c*f},1),lO=Cv("round"),fO=I0(function(c,f){return c-f},0);function hO(c){return c&&c.length?_h(c,as):0}function dO(c,f){return c&&c.length?_h(c,st(f,2)):0}return G.after=Ok,G.ary=c5,G.assign=ST,G.assignIn=S5,G.assignInWith=_5,G.assignWith=qv,G.at=_T,G.before=l5,G.bind=Nv,G.bindAll=IR,G.bindKey=f5,G.castArray=Wk,G.chain=o5,G.chunk=nP,G.compact=sP,G.concat=iP,G.cond=xR,G.conforms=$R,G.constant=Vv,G.countBy=dk,G.create=CT,G.curry=h5,G.curryRight=d5,G.debounce=p5,G.defaults=DT,G.defaultsDeep=FT,G.defer=Nk,G.delay=Lk,G.difference=oP,G.differenceBy=aP,G.differenceWith=uP,G.drop=cP,G.dropRight=lP,G.dropRightWhile=fP,G.dropWhile=hP,G.fill=dP,G.filter=mk,G.flatMap=wk,G.flatMapDeep=yk,G.flatMapDepth=Ek,G.flatten=r5,G.flattenDeep=pP,G.flattenDepth=mP,G.flip=Uk,G.flow=kR,G.flowRight=TR,G.fromPairs=gP,G.functions=TT,G.functionsIn=RT,G.groupBy=bk,G.initial=wP,G.intersection=yP,G.intersectionBy=EP,G.intersectionWith=bP,G.invert=NT,G.invertBy=LT,G.invokeMap=Sk,G.iteratee=zv,G.keyBy=_k,G.keys=Gr,G.keysIn=os,G.map=O0,G.mapKeys=HT,G.mapValues=qT,G.matches=RR,G.matchesProperty=OR,G.memoize=L0,G.merge=MT,G.mergeWith=C5,G.method=NR,G.methodOf=LR,G.mixin=Gv,G.negate=U0,G.nthArg=HR,G.omit=jT,G.omitBy=KT,G.once=Hk,G.orderBy=Ck,G.over=qR,G.overArgs=qk,G.overEvery=MR,G.overSome=jR,G.partial=Lv,G.partialRight=m5,G.partition=Dk,G.pick=VT,G.pickBy=D5,G.property=k5,G.propertyOf=KR,G.pull=CP,G.pullAll=s5,G.pullAllBy=DP,G.pullAllWith=FP,G.pullAt=BP,G.range=VR,G.rangeRight=zR,G.rearg=Mk,G.reject=Ik,G.remove=IP,G.rest=jk,G.reverse=Rv,G.sampleSize=$k,G.set=GT,G.setWith=WT,G.shuffle=Pk,G.slice=xP,G.sortBy=Rk,G.sortedUniq=NP,G.sortedUniqBy=LP,G.split=vR,G.spread=Kk,G.tail=UP,G.take=HP,G.takeRight=qP,G.takeRightWhile=MP,G.takeWhile=jP,G.tap=sk,G.throttle=Vk,G.thru=R0,G.toArray=E5,G.toPairs=F5,G.toPairsIn=B5,G.toPath=ZR,G.toPlainObject=A5,G.transform=YT,G.unary=zk,G.union=KP,G.unionBy=VP,G.unionWith=zP,G.uniq=GP,G.uniqBy=WP,G.uniqWith=YP,G.unset=XT,G.unzip=Ov,G.unzipWith=i5,G.update=ZT,G.updateWith=JT,G.values=Ml,G.valuesIn=QT,G.without=XP,G.words=$5,G.wrap=Gk,G.xor=ZP,G.xorBy=JP,G.xorWith=QP,G.zip=ek,G.zipObject=tk,G.zipObjectDeep=rk,G.zipWith=nk,G.entries=F5,G.entriesIn=B5,G.extend=S5,G.extendWith=_5,Gv(G,G),G.add=QR,G.attempt=P5,G.camelCase=nR,G.capitalize=I5,G.ceil=eO,G.clamp=eR,G.clone=Yk,G.cloneDeep=Zk,G.cloneDeepWith=Jk,G.cloneWith=Xk,G.conformsTo=Qk,G.deburr=x5,G.defaultTo=PR,G.divide=tO,G.endsWith=sR,G.eq=bi,G.escape=iR,G.escapeRegExp=oR,G.every=pk,G.find=gk,G.findIndex=e5,G.findKey=BT,G.findLast=vk,G.findLastIndex=t5,G.findLastKey=IT,G.floor=rO,G.forEach=a5,G.forEachRight=u5,G.forIn=xT,G.forInRight=$T,G.forOwn=PT,G.forOwnRight=kT,G.get=Mv,G.gt=eT,G.gte=tT,G.has=OT,G.hasIn=jv,G.head=n5,G.identity=as,G.includes=Ak,G.indexOf=vP,G.inRange=tR,G.invoke=UT,G.isArguments=Ac,G.isArray=ht,G.isArrayBuffer=rT,G.isArrayLike=is,G.isArrayLikeObject=Er,G.isBoolean=nT,G.isBuffer=vu,G.isDate=sT,G.isElement=iT,G.isEmpty=oT,G.isEqual=aT,G.isEqualWith=uT,G.isError=Uv,G.isFinite=cT,G.isFunction=ta,G.isInteger=g5,G.isLength=H0,G.isMap=v5,G.isMatch=lT,G.isMatchWith=fT,G.isNaN=hT,G.isNative=dT,G.isNil=mT,G.isNull=pT,G.isNumber=w5,G.isObject=cr,G.isObjectLike=hr,G.isPlainObject=zh,G.isRegExp=Hv,G.isSafeInteger=gT,G.isSet=y5,G.isString=q0,G.isSymbol=Fs,G.isTypedArray=ql,G.isUndefined=vT,G.isWeakMap=wT,G.isWeakSet=yT,G.join=AP,G.kebabCase=aR,G.last=Ws,G.lastIndexOf=SP,G.lowerCase=uR,G.lowerFirst=cR,G.lt=ET,G.lte=bT,G.max=nO,G.maxBy=sO,G.mean=iO,G.meanBy=oO,G.min=aO,G.minBy=uO,G.stubArray=Yv,G.stubFalse=Xv,G.stubObject=GR,G.stubString=WR,G.stubTrue=YR,G.multiply=cO,G.nth=_P,G.noConflict=UR,G.noop=Wv,G.now=N0,G.pad=lR,G.padEnd=fR,G.padStart=hR,G.parseInt=dR,G.random=rR,G.reduce=Fk,G.reduceRight=Bk,G.repeat=pR,G.replace=mR,G.result=zT,G.round=lO,G.runInContext=oe,G.sample=xk,G.size=kk,G.snakeCase=gR,G.some=Tk,G.sortedIndex=$P,G.sortedIndexBy=PP,G.sortedIndexOf=kP,G.sortedLastIndex=TP,G.sortedLastIndexBy=RP,G.sortedLastIndexOf=OP,G.startCase=wR,G.startsWith=yR,G.subtract=fO,G.sum=hO,G.sumBy=dO,G.template=ER,G.times=XR,G.toFinite=ra,G.toInteger=yt,G.toLength=b5,G.toLower=bR,G.toNumber=Ys,G.toSafeInteger=AT,G.toString=zt,G.toUpper=AR,G.trim=SR,G.trimEnd=_R,G.trimStart=CR,G.truncate=DR,G.unescape=FR,G.uniqueId=JR,G.upperCase=BR,G.upperFirst=Kv,G.each=a5,G.eachRight=u5,G.first=n5,Gv(G,(function(){var c={};return no(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:Rr(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 Hh(b,c,f)})}),Bt.prototype.reject=function(c){return this.filter(U0(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)},no(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,eo([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:R0,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=pc[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)})}}),no(Bt.prototype,function(c,f){var b=G[f];if(b){var k=b.name+"";Ot.call(Ol,k)||(Ol[k]=[]),Ol[k].push({name:f,func:b})}}),Ol[B0(e,y).name]=[{name:"wrapper",func:e}],Bt.prototype.clone=Bx,Bt.prototype.reverse=Ix,Bt.prototype.value=xx,G.prototype.at=ik,G.prototype.chain=ok,G.prototype.commit=ak,G.prototype.next=uk,G.prototype.plant=lk,G.prototype.reverse=fk,G.prototype.toJSON=G.prototype.valueOf=G.prototype.value=hk,G.prototype.first=G.prototype.head,mc&&(G.prototype[mc]=ck),G}),wi=$h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ir._=wi,define(function(){return wi})):Ko?((Ko.exports=wi)._=wi,wh._=wi):Ir._=wi}).call(Wf)});var l2=be((xye,Q9)=>{"use strict";var $ye=B(x()),OJ=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])},hS=class e extends Error{constructor(t,r,n){super(t),OJ(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(`
|
||
|
||
`)}};Q9.exports=hS});var hi=be((Pye,e7)=>{"use strict";var kye=B(x()),NJ={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}};e7.exports=NJ});var ic=be((Tye,r7)=>{"use strict";var Rye=B(x()),LJ=hi(),t7={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=LJ.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=t7.findRule(e,o.name);return s?i(s):void 0},literal(o){return o.value!==""},class:r,any:r});return i(t)}};r7.exports=t7});var dS=be((Oye,n7)=>{"use strict";var Nye=B(x()),UJ={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};n7.exports=UJ});var pS=be((Lye,s7)=>{"use strict";var Uye=B(x()),HJ=hi(),qJ=ic(),MJ=l2(),Tp=1,bl=0,Rp=-1;function f2(e){function t(s){return s.match=bl}function r(s){return o(s.expression),s.match=Tp}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===Tp&&++l,p===Rp&&++h}return l===u?Tp:a?h===u?Rp:bl:h>0?Rp:bl}let o=HJ.build({rule(s){let a,u=0;if(typeof s.match>"u"){s.match=bl;do if(a=s.match,s.match=o(s.expression),++u>6)throw new MJ("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=qJ.findRule(e,s.name);return s.match=o(a)},literal(s){let a=s.value.length===0?Tp:bl;return s.match=a},class(s){let a=s.parts.length===0?Rp:bl;return s.match=a},any:t});o(e)}f2.ALWAYS_MATCH=Tp;f2.SOMETIMES_MATCH=bl;f2.NEVER_MATCH=Rp;s7.exports=f2});var o7=be((Hye,i7)=>{"use strict";var qye=B(x()),jJ=ic(),Ue=dS(),KJ=hi(),{ALWAYS_MATCH:ih,SOMETIMES_MATCH:mS,NEVER_MATCH:gS}=pS();function VJ(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===ih?C:E===gS?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=KJ.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===gS?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===ih?S:h(S,F.length>1?m(mS,[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!==gS?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,jJ.indexOfRule(e,E.name)]},literal(E){if(E.value.length>0){let _=E.match|0,F=_===mS||_===ih&&!E.ignoreCase?o(E.ignoreCase?E.value.toLowerCase():E.value):null,H=_!==ih?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=_===mS?s(E):null,F=_!==ih?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=_!==ih?a({type:"any"}):null;return m(_,[Ue.MATCH_ANY],[Ue.ACCEPT_N,1],[Ue.FAIL,C])}});w(e)}i7.exports=VJ});var u7=be((Mye,a7)=>{"use strict";var jye=B(x()),vS=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+").")}};a7.exports=vS});var wS=be((Kye,c7)=>{"use strict";var Vye=B(x());c7.exports="2.0.1"});var l7=be(h2=>{"use strict";var Gye=B(x());function Qa(e){return e.charCodeAt(0).toString(16).toUpperCase()}h2.hex=Qa;function zJ(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"+Qa(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Qa(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Qa(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Qa(t))}h2.stringEscape=zJ;function GJ(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"+Qa(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+Qa(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+Qa(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+Qa(t))}h2.regexpClassEscape=GJ});var d7=be(h7=>{var Yye=B(x()),f7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");h7.encode=function(e){if(0<=e&&e<f7.length)return f7[e];throw new TypeError("Must be between 0 and 63: "+e)}});var v7=be(g7=>{var Zye=B(x()),WJ=d7(),p7=5,m7=1<<p7,YJ=m7-1,XJ=m7;function ZJ(e){return e<0?(-e<<1)+1:(e<<1)+0}g7.encode=function(t){let r="",n,i=ZJ(t);do n=i&YJ,i>>>=p7,i>0&&(n|=XJ),r+=WJ.encode(n);while(i>0);return r}});var p2=be(ac=>{var Qye=B(x());function JJ(e,t,r){if(t in e)return e[t];if(arguments.length===3)return r;throw new Error('"'+t+'" is a required argument.')}ac.getArg=JJ;var y7=(function(){return!("__proto__"in Object.create(null))})();function E7(e){return e}function QJ(e){return b7(e)?"$"+e:e}ac.toSetString=y7?E7:QJ;function eQ(e){return b7(e)?e.slice(1):e}ac.fromSetString=y7?E7:eQ;function b7(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 w7(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function tQ(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=w7(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:w7(e.name,t.name)}ac.compareByGeneratedPositionsInflated=tQ;var yS="http:",Op=`${yS}//host`;function A7(e){return t=>{let r=Np(t),n=ES(t),i=new URL(t,n);e(i);let o=i.toString();return r==="absolute"?o:r==="scheme-relative"?o.slice(yS.length):r==="path-absolute"?o.slice(Op.length):bS(n,o)}}function oc(e,t){return new URL(e,t).toString()}function rQ(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function ES(e){let t=e.split("..").length-1,r=rQ("p",e),n=`${Op}/`;for(let i=0;i<t;i++)n+=`${r}/`;return n}var nQ=/^[A-Za-z0-9\+\-\.]+:/;function Np(e){return e[0]==="/"?e[1]==="/"?"scheme-relative":"path-absolute":nQ.test(e)?"absolute":"path-relative"}function bS(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 sQ=A7(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),d2=A7(e=>{});ac.normalize=d2;function iQ(e,t){let r=Np(t),n=Np(e);if(e=sQ(e),r==="absolute")return oc(t,void 0);if(n==="absolute")return oc(t,e);if(r==="scheme-relative")return d2(t);if(n==="scheme-relative")return oc(t,oc(e,Op)).slice(yS.length);if(r==="path-absolute")return d2(t);if(n==="path-absolute")return oc(t,oc(e,Op)).slice(Op.length);let i=ES(t+e),o=oc(t,oc(e,i));return bS(i,o)}ac.join=iQ;function oQ(e,t){let r=aQ(e,t);return typeof r=="string"?r:d2(t)}ac.relative=oQ;function aQ(e,t){if(Np(e)!==Np(t))return null;let n=ES(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:bS(i,o)}});var _7=be(S7=>{var tEe=B(x()),AS=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()}};S7.ArraySet=AS});var F7=be(D7=>{var nEe=B(x()),C7=p2();function uQ(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||C7.compareByGeneratedPositionsInflated(e,t)<=0}var SS=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){uQ(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(C7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};D7.MappingList=SS});var _S=be(B7=>{var iEe=B(x()),Lp=v7(),$r=p2(),m2=_7().ArraySet,cQ=F7().MappingList,g2=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 m2,this._names=new m2,this._mappings=new cQ,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 m2:this._sources,a=new m2;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+=Lp.encode(l.generatedColumn-t),t=l.generatedColumn,l.source!=null&&(m=this._sources.indexOf(l.source),u+=Lp.encode(m-s),s=m,u+=Lp.encode(l.originalLine-1-i),i=l.originalLine-1,u+=Lp.encode(l.originalColumn-n),n=l.originalColumn,l.name!=null&&(h=this._names.indexOf(l.name),u+=Lp.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())}};g2.prototype._version=3;B7.SourceMapGenerator=g2});var x7=be(I7=>{var aEe=B(x()),lQ=_S().SourceMapGenerator,v2=p2(),fQ=/(\r?\n)/,hQ=10,oh="$$$isSourceNode$$$",CS=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[oh]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,o=t.split(fQ),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=v2.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?v2.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[oh]||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[oh]||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[oh]?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[oh]?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[v2.toSetString(t)]=r}walkSourceContents(t){for(let n=0,i=this.children.length;n<i;n++)this.children[n][oh]&&this.children[n].walkSourceContents(t);let r=Object.keys(this.sourceContents);for(let n=0,i=r.length;n<i;n++)t(v2.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 lQ(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)===hQ?(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}}};I7.SourceNode=CS});var $7=be(DS=>{var cEe=B(x());DS.SourceMapGenerator=_S().SourceMapGenerator;DS.SourceNode=x7().SourceNode});var R7=be((lEe,T7)=>{"use strict";var fEe=B(x()),dQ=ic(),jt=dS(),pQ=u7(),mQ=wS(),{stringEscape:qs,regexpClassEscape:FS}=l7(),{SourceNode:di}=$7();function k7(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 P7(e,t,r,n,i){return r?new di(null,null,r.source,[e,k7(t,r,i),new di(r.end.line,r.end.column-1,r.source,n)]):new di(null,null,null,[e,t,n])}function gQ(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'"'+qs(_)+'"'}function y(_){return"/^["+(_.inverted?"^":"")+_.value.map(C=>Array.isArray(C)?FS(C[0])+"-"+FS(C[1]):FS(C)).join("")+"]/"+(_.ignoreCase?"i":"")}function w(_){switch(_.type){case"rule":return'peg$otherExpectation("'+qs(_.value)+'")';case"literal":return'peg$literalExpectation("'+qs(_.value)+'", '+_.ignoreCase+")";case"class":return"peg$classExpectation(["+_.value.map(F=>Array.isArray(F)?'["'+qs(F[0])+'", "'+qs(F[1])+'"]':'"'+qs(F)+'"').join(", ")+"], "+_.inverted+", "+_.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(_)+")")}}function E(_,C){return P7(`
|
||
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 pQ(g.name,"s","var");function E(C){let F=0,H=C.length,K=[],S;function I(T,O){let R=O+3,N=C[F+R-2],P=C[F+R-1],q,Y;w.checkedIf(F,()=>{F+=R,q=E(C.slice(F,F+N)),F+=N},P>0?()=>{Y=E(C.slice(F,F+P)),F+=P}:null),K.push("if ("+T+") {"),K.push(...q.map(r)),P>0&&(K.push("} else {"),K.push(...Y.map(r))),K.push("}")}function M(T){let R=C[F+2-1],N;w.checkedLoop(F,()=>{F+=2,N=E(C.slice(F,F+R)),F+=R}),K.push("while ("+T+") {"),K.push(...N.map(r)),K.push("}")}function L(){let O=C[F+4-1],R=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(R)),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],R=3+O;S=C.slice(F+3,F+R),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+=R;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:M(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(P7(" function ",a(g.name),g.nameLocation,`() {
|
||
`,g.name)),t.trace&&y.push(" var startPos = peg$currPos;"),y.push(r(w.defines())),y.push(...l('"'+qs(g.name)+'"',dQ.indexOfRule(e,g.name)).map(r)),y.push(..._.map(r)),y.push(...h('"'+qs(g.name)+'"',w.result()).map(r)),y.push("}"),y}function p(g){return g.codeLocation?k7(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 ${mQ}.`,"//","// 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("'+qs(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 "'+qs(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=>'"'+qs(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(M=>t.dependencies[M]),H="["+F.map(M=>'"'+qs(M)+'"').join(", ")+"]",K=F.map(M=>'require("'+qs(M)+'")').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())}T7.exports=gQ});var N7=be((hEe,O7)=>{"use strict";var dEe=B(x()),vQ=ic(),wQ=hi();function yQ(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,a,u){wQ.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:vQ.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)})}O7.exports=yQ});var U7=be((pEe,L7)=>{"use strict";var mEe=B(x()),EQ=hi();function bQ(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=EQ.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)}L7.exports=bQ});var q7=be((gEe,H7)=>{"use strict";var vEe=B(x()),AQ=hi();function SQ(e,t,r){let n={};AQ.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)}H7.exports=SQ});var K7=be((wEe,j7)=>{"use strict";var yEe=B(x()),M7=ic(),_Q=hi();function CQ(e,t,r){let n=[],i=[],o=_Q.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)}j7.exports=CQ});var G7=be((EEe,z7)=>{"use strict";var bEe=B(x()),V7=ic(),DQ=hi();function FQ(e,t,r){DQ.build({zero_or_more(i){V7.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){V7.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)}z7.exports=FQ});var Y7=be((AEe,W7)=>{"use strict";var SEe=B(x()),BQ=ic(),IQ=hi();function xQ(e,t,r){IQ.build({rule_ref(i){BQ.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}W7.exports=xQ});var Z7=be((_Ee,X7)=>{"use strict";var CEe=B(x()),$Q=hi();function PQ(e,t,r){let n=$Q.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)}X7.exports=PQ});var Q7=be((DEe,J7)=>{"use strict";var FEe=B(x()),kQ=l2(),BS=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(){}},IS=class{constructor(t){this._callbacks=new BS(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new kQ(...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}};J7.exports=IS});var ex=be((exports,module)=>{"use strict";var BEe=B(x()),generateBytecode=o7(),generateJS=R7(),inferenceMatchResult=pS(),removeProxyRules=N7(),reportDuplicateLabels=U7(),reportDuplicateRules=q7(),reportInfiniteRecursion=K7(),reportInfiniteRepetition=G7(),reportUndefinedRules=Y7(),reportIncorrectPlucking=Z7(),Session=Q7(),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 rx=be((IEe,tx)=>{"use strict";var xEe=B(x()),TQ={$:"text","&":"simple_and","!":"simple_not"},RQ={"?":"optional","*":"zero_or_more","+":"one_or_more"},OQ={"&":"semantic_and","!":"semantic_not"};function NQ(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function uc(e,t,r,n){var i=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(i,uc.prototype),i.expected=t,i.found=r,i.location=n,i.name="SyntaxError",i}NQ(uc,Error);function xS(e,t,r){return r=r||" ",e.length>t?e:(t-=e.length,r+=r.repeat(t),e+r.slice(0,t))}uc.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=xS("",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+" | "+xS("",i.column-1," ")+xS("",h,"^")}else t+=`
|
||
at `+o}return t};uc.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 LQ(e,t){t=t!==void 0?t:{};var r={},n=t.grammarSource,i={Grammar:o0},o=o0,s="{",a="}",u="=",l="/",h="@",m=":",p="$",d="&",v="!",g="?",y="*",w="+",E="(",_=")",C=" ",F="\v",H="\f",K=" ",S="\xA0",I="\uFEFF",M=`
|
||
`,L=`\r
|
||
`,T="\r",O="\u2028",R="\u2029",N="/*",P="*/",q="//",Y="_",V="\\",X="\u200C",te="\u200D",ae="i",me='"',he="'",De="[",Pe="^",Ie="]",se="-",pe="0",Fe="b",Re="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]/,Te=/^[\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]/,Rn=/^[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]/,cc=/^[\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]/,tu=/^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/,Ut=/^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,gn=rt("{",!1),Xi=rt("}",!1),Al=rt("=",!1),ru=rt("/",!1),ah=rt("@",!1),nu=rt(":",!1),Zi=rt("$",!1),Kt=rt("&",!1),Ms=rt("!",!1),Sl=rt("?",!1),uh=rt("*",!1),lc=rt("+",!1),su=rt("(",!1),ch=rt(")",!1),_l=Fl(),fc=vi("whitespace"),lh=rt(" ",!1),ie=rt("\v",!1),we=rt("\f",!1),je=rt(" ",!1),qe=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),Ji=rt("\u2028",!1),Nn=rt("\u2029",!1),es=vi("comment"),Fr=rt("/*",!1),Ln=rt("*/",!1),iu=rt("//",!1),ou=vi("identifier"),fh=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),Qi=rt("]",!1),Cl=rt("-",!1),Hp=rt("0",!1),hh=rt("b",!1),A2=rt("f",!1),qp=rt("n",!1),Dl=rt("r",!1),Mp=rt("t",!1),S2=rt("v",!1),dh=rt("x",!1),ph=rt("u",!1),mh=Vr([["0","9"]],!1,!1),_2=Vr([["0","9"],["a","f"]],!1,!0),jp=rt(".",!1),gh=vi("code block"),au=Vr(["{","}"],!1,!1),uu=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),Kp=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),Vp=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),C2=Vr(["\u01C5","\u01C8","\u01CB","\u01F2",["\u1F88","\u1F8F"],["\u1F98","\u1F9F"],["\u1FA8","\u1FAF"],"\u1FBC","\u1FCC","\u1FFC"],!1,!1),zp=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),Gp=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),Wp=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),Yp=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),D2=Vr([["\u16EE","\u16F0"],["\u2160","\u2182"],["\u2185","\u2188"],"\u3007",["\u3021","\u3029"],["\u3038","\u303A"],["\uA6E6","\uA6EF"]],!1,!1),F2=Vr(["_",["\u203F","\u2040"],"\u2054",["\uFE33","\uFE34"],["\uFE4D","\uFE4F"],"\uFF3F"],!1,!1),B2=Vr([" ","\xA0","\u1680",["\u2000","\u200A"],"\u202F","\u205F","\u3000"],!1,!1),Xp=rt(";",!1),I2=function(D,z,ee){return{type:"grammar",topLevelInitializer:D,initializer:z,rules:ee,location:tr()}},x2=function(D){return{type:"top_level_initializer",code:D[0],codeLocation:D[1],location:tr()}},$2=function(D){return{type:"initializer",code:D[0],codeLocation:D[1],location:tr()}},P2=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()}},vh=function(D,z){return z.length>0?{type:"choice",alternatives:[D].concat(z),location:tr()}:D},k2=function(D,z){return z!==null?{type:"action",expression:D,code:z[0],codeLocation:z[1],location:tr()}:D},T2=function(D,z){return z.length>0||D.type==="labeled"&&D.pick?{type:"sequence",elements:[D].concat(z),location:tr()}:D},R2=function(D,z,ee){return ee.type.startsWith("semantic_")&&Eh('"@" 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()}},O2=function(D,z){return{type:"labeled",label:D[0],labelLocation:D[1],expression:z,location:tr()}},N2=function(){return tr()},er=function(D){return Yo.indexOf(D[0])>=0&&Eh(`Label can't be a reserved word "${D[0]}"`,D[1]),D},Zt=function(D,z){return{type:TQ[D],expression:z,location:tr()}},L2=function(D,z){return{type:RQ[z],expression:D,location:tr()}},U2=function(D){return D.type==="labeled"||D.type==="sequence"?{type:"group",expression:D,location:tr()}:D},H2=function(D){return{type:"rule_ref",name:D[0],location:tr()}},q2=function(D,z){return{type:OQ[D],code:z[0],codeLocation:z[1],location:tr()}},M2=function(D,z){return[D+z.join(""),tr()]},j2=function(D,z){return{type:"literal",value:D,ignoreCase:z!==null,location:tr()}},Zp=function(D){return D.join("")},K2=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()}},wh=function(D,z){return D.charCodeAt(0)>z.charCodeAt(0)&&Eh("Invalid character range: "+eo()+"."),[D,z]},Ko=function(){return""},Jp=function(){return"\0"},yh=function(){return"\b"},rs=function(){return"\f"},Qp=function(){return`
|
||
`},e0=function(){return"\r"},t0=function(){return" "},r0=function(){return"\v"},n0=function(D){return String.fromCharCode(parseInt(D,16))},s0=function(D){return String.fromCharCode(parseInt(D,16))},Un=function(){return{type:"any",location:tr()}},V2=function(D){return[D,tr()]},U=0,ft=0,hc=[{line:1,column:1}],Tr=0,cu=[],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 eo(){return e.substring(ft,U)}function i0(){return ft}function WS(){return{source:n,start:ft,end:U}}function tr(){return fu(ft,U)}function YS(D,z){throw z=z!==void 0?z:fu(ft,U),Sh([vi(D)],e.substring(ft,U),z)}function Eh(D,z){throw z=z!==void 0?z:fu(ft,U),Ah(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 Fl(){return{type:"any"}}function lu(){return{type:"end"}}function vi(D){return{type:"other",description:D}}function bh(D){var z=hc[D],ee;if(z)return z;for(ee=D-1;!hc[ee];)ee--;for(z=hc[ee],z={line:z.line,column:z.column};ee<D;)e.charCodeAt(ee)===10?(z.line++,z.column=1):z.column++,ee++;return hc[D]=z,z}function fu(D,z){var ee=bh(D),Z=bh(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<Tr||(U>Tr&&(Tr=U,cu=[]),cu.push(D))}function Ah(D,z){return new uc(D,null,null,z)}function Sh(D,z,ee){return new uc(uc.buildMessage(D,z),D,z,ee)}function o0(){var D,z,ee,Z,fe,ge,qt,yr;if(D=U,z=Yt(),ee=U,Z=_h(),Z!==r?(fe=Yt(),ee=Z):(U=ee,ee=r),ee===r&&(ee=null),Z=U,fe=Ch(),fe!==r?(ge=Yt(),Z=fe):(U=Z,Z=r),Z===r&&(Z=null),fe=[],ge=U,qt=a0(),qt!==r?(yr=Yt(),ge=qt):(U=ge,ge=r),ge!==r)for(;ge!==r;)fe.push(ge),ge=U,qt=a0(),qt!==r?(yr=Yt(),ge=qt):(U=ge,ge=r);else fe=r;return fe!==r?(ft=D,D=I2(ee,Z,fe)):(U=D,D=r),D}function _h(){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=Wo(),ee!==r?(e.charCodeAt(U)===125?(Z=a,U++):(Z=r,ce===0&&Ae(Xi)),Z!==r?(fe=Tl(),fe!==r?(ft=D,D=x2(ee)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function Ch(){var D,z,ee;return D=U,z=Wo(),z!==r?(ee=Tl(),ee!==r?(ft=D,D=$2(z)):(U=D,D=r)):(U=D,D=r),D}function a0(){var D,z,ee,Z,fe,ge,qt,yr;return D=U,z=Hn(),z!==r?(ee=Yt(),Z=U,fe=$h(),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(Al)),fe!==r?(ge=Yt(),qt=Dh(),qt!==r?(yr=Tl(),yr!==r?(ft=D,D=P2(z,Z,qt)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function Dh(){var D,z,ee,Z,fe,ge,qt,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(ru)),ge!==r?(qt=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(ru)),ge!==r?(qt=Yt(),yr=Qr(),yr!==r?Z=yr:(U=Z,Z=r)):(U=Z,Z=r);ft=D,D=vh(z,ee)}else U=D,D=r;return D}function Qr(){var D,z,ee,Z,fe;return D=U,z=Fh(),z!==r?(ee=U,Z=Yt(),fe=Wo(),fe!==r?ee=fe:(U=ee,ee=r),ee===r&&(ee=null),ft=D,D=k2(z,ee)):(U=D,D=r),D}function Fh(){var D,z,ee,Z,fe,ge;if(D=U,z=Vo(),z!==r){for(ee=[],Z=U,fe=Yt(),ge=Vo(),ge!==r?Z=ge:(U=Z,Z=r);Z!==r;)ee.push(Z),Z=U,fe=Yt(),ge=Vo(),ge!==r?Z=ge:(U=Z,Z=r);ft=D,D=T2(z,ee)}else U=D,D=r;return D}function Vo(){var D,z,ee,Z;return D=U,z=u0(),z!==r?(ee=Bh(),ee===r&&(ee=null),Z=Ih(),Z!==r?(ft=D,D=R2(z,ee,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=U,z=Bh(),z!==r?(ee=Yt(),Z=Ih(),Z!==r?(ft=D,D=O2(z,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=Ih())),D}function u0(){var D,z;return D=U,e.charCodeAt(U)===64?(z=h,U++):(z=r,ce===0&&Ae(ah)),z!==r&&(ft=D,z=N2()),D=z,D}function Bh(){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(nu)),Z!==r?(ft=D,D=er(z)):(U=D,D=r)):(U=D,D=r),D}function Ih(){var D,z,ee,Z;return D=U,z=z2(),z!==r?(ee=Yt(),Z=c0(),Z!==r?(ft=D,D=Zt(z,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=c0()),D}function z2(){var D;return e.charCodeAt(U)===36?(D=p,U++):(D=r,ce===0&&Ae(Zi)),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(Ms)))),D}function c0(){var D,z,ee,Z;return D=U,z=l0(),z!==r?(ee=Yt(),Z=G2(),Z!==r?(ft=D,D=L2(z,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=l0()),D}function G2(){var D;return e.charCodeAt(U)===63?(D=g,U++):(D=r,ce===0&&Ae(Sl)),D===r&&(e.charCodeAt(U)===42?(D=y,U++):(D=r,ce===0&&Ae(uh)),D===r&&(e.charCodeAt(U)===43?(D=w,U++):(D=r,ce===0&&Ae(lc)))),D}function l0(){var D,z,ee,Z,fe,ge;return D=Q2(),D===r&&(D=ye(),D===r&&(D=Bl(),D===r&&(D=hu(),D===r&&(D=W2(),D===r&&(D=U,e.charCodeAt(U)===40?(z=E,U++):(z=r,ce===0&&Ae(su)),z!==r?(ee=Yt(),Z=Dh(),Z!==r?(fe=Yt(),e.charCodeAt(U)===41?(ge=_,U++):(ge=r,ce===0&&Ae(ch)),ge!==r?(ft=D,D=U2(Z)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)))))),D}function hu(){var D,z,ee,Z,fe,ge,qt,yr;return D=U,z=Hn(),z!==r?(ee=U,ce++,Z=U,fe=Yt(),ge=U,qt=$h(),qt!==r?(yr=Yt(),qt=[qt,yr],ge=qt):(U=ge,ge=r),ge===r&&(ge=null),e.charCodeAt(U)===61?(qt=u,U++):(qt=r,ce===0&&Ae(Al)),qt!==r?(fe=[fe,ge,qt],Z=fe):(U=Z,Z=r),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(ft=D,D=H2(z)):(U=D,D=r)):(U=D,D=r),D}function W2(){var D,z,ee,Z;return D=U,z=Y2(),z!==r?(ee=Yt(),Z=Wo(),Z!==r?(ft=D,D=q2(z,Z)):(U=D,D=r)):(U=D,D=r),D}function Y2(){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(Ms))),D}function zr(){var D;return e.length>U?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(_l)),D}function dc(){var D,z;return ce++,e.charCodeAt(U)===9?(D=C,U++):(D=r,ce===0&&Ae(lh)),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(qe)),D===r&&(e.charCodeAt(U)===65279?(D=I,U++):(D=r,ce===0&&Ae(et)),D===r&&(D=v0())))))),ce--,D===r&&(z=r,ce===0&&Ae(fc)),D}function en(){var D;return lt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(gt)),D}function zo(){var D,z;return ce++,e.charCodeAt(U)===10?(D=M,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=T,U++):(D=r,ce===0&&Ae(js)),D===r&&(e.charCodeAt(U)===8232?(D=O,U++):(D=r,ce===0&&Ae(Ji)),D===r&&(e.charCodeAt(U)===8233?(D=R,U++):(D=r,ce===0&&Ae(Nn)))))),ce--,D===r&&(z=r,ce===0&&Ae(wt)),D}function f0(){var D,z;return ce++,D=X2(),D===r&&(D=Go()),ce--,D===r&&(z=r,ce===0&&Ae(es)),D}function X2(){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 h0(){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 Go(){var D,z,ee,Z,fe,ge;if(D=U,e.substr(U,2)===q?(z=q,U+=2):(z=r,ce===0&&Ae(iu)),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=xh(),z!==r){for(ee=[],Z=d0();Z!==r;)ee.push(Z),Z=d0();ft=D,D=M2(z,ee)}else U=D,D=r;return ce--,D===r&&(z=r,ce===0&&Ae(ou)),D}function xh(){var D,z,ee;return D=Z2(),D===r&&(e.charCodeAt(U)===36?(D=p,U++):(D=r,ce===0&&Ae(Zi)),D===r&&(e.charCodeAt(U)===95?(D=Y,U++):(D=r,ce===0&&Ae(fh)),D===r&&(D=U,e.charCodeAt(U)===92?(z=V,U++):(z=r,ce===0&&Ae(vn)),z!==r?(ee=pc(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r)))),D}function d0(){var D;return D=xh(),D===r&&(D=J2(),D===r&&(D=$l(),D===r&&(D=Pl(),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 Z2(){var D;return D=nv(),D===r&&(D=m0(),D===r&&(D=rv(),D===r&&(D=Il(),D===r&&(D=tv(),D===r&&(D=g0()))))),D}function J2(){var D;return D=to(),D===r&&(D=xl()),D}function Q2(){var D,z,ee;return ce++,D=U,z=$h(),z!==r?(e.charCodeAt(U)===105?(ee=ae,U++):(ee=r,ce===0&&Ae(ur)),ee===r&&(ee=null),ft=D,D=j2(z,ee)):(U=D,D=r),ce--,D===r&&(z=r,ce===0&&Ae(ut)),D}function $h(){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=Zp(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=K2(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(Qi)),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(Cl)),ee!==r?(Z=He(),Z!==r?(ft=D,D=wh(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(Qi)),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=zo(),ee!==r?(ft=D,D=Ko()):(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(Hp)),z!==r?(ee=U,ce++,Z=p0(),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(ft=D,D=Jp()):(U=D,D=r)):(U=D,D=r),D===r&&(D=ns(),D===r&&(D=pc()))),D}function wr(){var D;return D=Vt(),D===r&&(D=Ph()),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(hh)),z!==r&&(ft=D,z=yh()),D=z,D===r&&(D=U,e.charCodeAt(U)===102?(z=Re,U++):(z=r,ce===0&&Ae(A2)),z!==r&&(ft=D,z=rs()),D=z,D===r&&(D=U,e.charCodeAt(U)===110?(z=Ve,U++):(z=r,ce===0&&Ae(qp)),z!==r&&(ft=D,z=Qp()),D=z,D===r&&(D=U,e.charCodeAt(U)===114?(z=Oe,U++):(z=r,ce===0&&Ae(Dl)),z!==r&&(ft=D,z=e0()),D=z,D===r&&(D=U,e.charCodeAt(U)===116?(z=pt,U++):(z=r,ce===0&&Ae(Mp)),z!==r&&(ft=D,z=t0()),D=z,D===r&&(D=U,e.charCodeAt(U)===118?(z=Qe,U++):(z=r,ce===0&&Ae(S2)),z!==r&&(ft=D,z=r0()),D=z)))))))),D}function Ph(){var D,z,ee,Z;return D=U,z=U,ee=U,ce++,Z=ev(),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 ev(){var D;return D=Vt(),D===r&&(D=p0(),D===r&&(e.charCodeAt(U)===120?(D=ct,U++):(D=r,ce===0&&Ae(dh)),D===r&&(e.charCodeAt(U)===117?(D=mn,U++):(D=r,ce===0&&Ae(ph))))),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(dh)),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=n0(ee)):(U=D,D=r)):(U=D,D=r),D}function pc(){var D,z,ee,Z,fe,ge,qt,yr;return D=U,e.charCodeAt(U)===117?(z=mn,U++):(z=r,ce===0&&Ae(ph)),z!==r?(ee=U,Z=U,fe=Cs(),fe!==r?(ge=Cs(),ge!==r?(qt=Cs(),qt!==r?(yr=Cs(),yr!==r?(fe=[fe,ge,qt,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=s0(ee)):(U=D,D=r)):(U=D,D=r),D}function p0(){var D;return Pr.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(mh)),D}function Cs(){var D;return Qn.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(_2)),D}function Bl(){var D,z;return D=U,e.charCodeAt(U)===46?(z=gr,U++):(z=r,ce===0&&Ae(jp)),z!==r&&(ft=D,z=Un()),D=z,D}function Wo(){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(Xi)),Z!==r?D=ee:(U=D,D=r)):(U=D,D=r),ce--,D===r&&(z=r,ce===0&&Ae(gh)),D}function Ot(){var D,z;return D=U,z=kh(),ft=D,z=V2(z),D=z,D}function kh(){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(au)),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(au)),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=kh(),e.charCodeAt(U)===125?(ge=a,U++):(ge=r,ce===0&&Ae(Xi)),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(au)),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(au)),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=kh(),e.charCodeAt(U)===125?(ge=a,U++):(ge=r,ce===0&&Ae(Xi)),ge!==r?(Z=[Z,fe,ge],ee=Z):(U=ee,ee=r)):(U=ee,ee=r))}return D=e.substring(D,U),D}function m0(){var D;return Dt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(uu)),D}function Il(){var D;return Ze.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Kp)),D}function tv(){var D;return Te.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Vp)),D}function rv(){var D;return or.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(C2)),D}function nv(){var D;return Rn.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(zp)),D}function xl(){var D;return mt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Gp)),D}function to(){var D;return cc.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Wp)),D}function $l(){var D;return On.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Yp)),D}function g0(){var D;return Se.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(D2)),D}function Pl(){var D;return tu.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(F2)),D}function v0(){var D;return Ut.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(B2)),D}function Yt(){var D,z;for(D=[],z=dc(),z===r&&(z=zo(),z===r&&(z=f0()));z!==r;)D.push(z),z=dc(),z===r&&(z=zo(),z===r&&(z=f0()));return D}function kl(){var D,z;for(D=[],z=dc(),z===r&&(z=h0());z!==r;)D.push(z),z=dc(),z===r&&(z=h0());return D}function Tl(){var D,z,ee,Z;return D=U,z=Yt(),e.charCodeAt(U)===59?(ee=vr,U++):(ee=r,ce===0&&Ae(Xp)),ee!==r?(z=[z,ee],D=z):(U=D,D=r),D===r&&(D=U,z=kl(),ee=Go(),ee===r&&(ee=null),Z=zo(),Z!==r?(z=[z,ee,Z],D=z):(U=D,D=r),D===r&&(D=U,z=Yt(),ee=mc(),ee!==r?(z=[z,ee],D=z):(U=D,D=r))),D}function mc(){var D,z;return D=U,ce++,e.length>U?(z=e.charAt(U),U++):(z=r,ce===0&&Ae(_l)),ce--,z===r?D=void 0:(U=D,D=r),D}let Yo=t.reservedWords||[];if(Wt=o(),Wt!==r&&U===e.length)return Wt;throw Wt!==r&&U<e.length&&Ae(lu()),Sh(cu,Tr<e.length?e.charAt(Tr):null,Tr<e.length?fu(Tr,Tr+1):fu(Tr,Tr))}tx.exports={SyntaxError:uc,parse:LQ}});var w2=be(($Ee,nx)=>{"use strict";var PEe=B(x()),UQ=l2(),HQ=ex(),qQ=rx(),MQ=wS(),jQ=["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"],Up={VERSION:MQ,RESERVED_WORDS:jQ,GrammarError:UQ,parser:qQ,compiler:HQ,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:Up.parser,passes:r(Up.compiler.passes),reservedWords:Up.RESERVED_WORDS.slice()};return n.forEach(o=>{o.use(i,t)}),Up.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};nx.exports=Up});var HS=be((LS,US)=>{var zEe=B(x());(function(e,t){typeof LS=="object"&&typeof US<"u"?US.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(LS,(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,qe;if(we&&typeof(je=ie.toString)=="function"&&!i(qe=je.call(ie))||typeof(je=ie.valueOf)=="function"&&!i(qe=je.call(ie))||!we&&typeof(je=ie.toString)=="function"&&!i(qe=je.call(ie)))return qe;throw TypeError("Can't convert object to primitive value")},d=Object.defineProperty,v=a?Object.defineProperty:function(we,je,qe){if(o(we),je=p(je,!0),o(qe),m)try{return d(we,je,qe)}catch{}if("get"in qe||"set"in qe)throw TypeError("Accessors not supported!");return"value"in qe&&(we[je]=qe.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(qe,et){return je[qe]||(je[qe]=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),M=e(function(ie){var we=H("src"),je="toString",qe=(""+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]:qe.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},T=function(ie,we,je){if(L(ie),we===void 0)return ie;switch(je){case 1:return function(qe){return ie.call(we,qe)};case 2:return function(qe,et){return ie.call(we,qe,et)};case 3:return function(qe,et,gt){return ie.call(we,qe,et,gt)}}return function(){return ie.apply(we,arguments)}},O="prototype",R=function(ie,we,je){var qe=ie&R.F,et=ie&R.G,gt=ie&R.S,wt=ie&R.P,kr=ie&R.B,ar=et?t:gt?t[we]||(t[we]={}):(t[we]||{})[O],js=et?r:r[we]||(r[we]={}),Ji=js[O]||(js[O]={}),Nn,es,Fr,Ln;et&&(je=we);for(Nn in je)es=!qe&&ar&&ar[Nn]!==void 0,Fr=(es?ar:je)[Nn],Ln=kr&&es?T(Fr,t):wt&&typeof Fr=="function"?T(Function.call,Fr):Fr,ar&&M(ar,Nn,Fr,ie&R.U),js[Nn]!=Fr&&w(js,Nn,Ln),wt&&Ji[Nn]!=Fr&&(Ji[Nn]=Fr)};t.core=r,R.F=1,R.G=2,R.S=4,R.P=8,R.B=16,R.W=32,R.U=64,R.R=128;var N=R,P=Math.ceil,q=Math.floor,Y=function(ie){return isNaN(ie=+ie)?0:(ie>0?q: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 qe=String(V(we)),et=Y(je),gt=qe.length,wt,kr;return et<0||et>=gt?ie?"":void 0:(wt=qe.charCodeAt(et),wt<55296||wt>56319||et+1===gt||(kr=qe.charCodeAt(et+1))<56320||kr>57343?ie?qe.charAt(et):wt:ie?qe.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,qe=[],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");qe.push(wt<65536?Pe(wt):Pe(((wt-=65536)>>10)+55296,wt%1024+56320))}return qe.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]/,Re=/[\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:Re},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=cc(),ah[Qe]();while(lt.type!=="eof");return typeof je=="function"?Dt({"":Qn},"",je):Qn};function Dt(ie,we,je){var qe=ie[we];if(qe!=null&&typeof qe=="object")if(Array.isArray(qe))for(var et=0;et<qe.length;et++){var gt=String(et),wt=Dt(qe,gt,je);wt===void 0?delete qe[gt]:Object.defineProperty(qe,gt,{value:wt,writable:!0,enumerable:!0,configurable:!0})}else for(var kr in qe){var ar=Dt(qe,kr,je);ar===void 0?delete qe[kr]:Object.defineProperty(qe,kr,{value:ar,writable:!0,enumerable:!0,configurable:!0})}return je.call(ie,we,qe)}var Ze,Te,or,Rn,mt;function cc(){for(Ze="default",Te="",or=!1,Rn=1;;){mt=On();var ie=tu[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 tu={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 tu[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()==="-"&&(Rn=-1),Ze="sign";return;case".":Te=Se(),Ze="decimalPointLeading";return;case"0":Te=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Te=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()==='"',Te="",Ze="string";return}throw Kt(Se())},identifierNameStartEscape:function(){if(mt!=="u")throw Kt(Se());Se();var we=ru();switch(we){case"$":case"_":break;default:if(!Oe.isIdStartChar(we))throw Sl();break}Te+=we,Ze="identifierName"},identifierName:function(){switch(mt){case"$":case"_":case"\u200C":case"\u200D":Te+=Se();return;case"\\":Se(),Ze="identifierNameEscape";return}if(Oe.isIdContinueChar(mt)){Te+=Se();return}return Ut("identifier",Te)},identifierNameEscape:function(){if(mt!=="u")throw Kt(Se());Se();var we=ru();switch(we){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Oe.isIdContinueChar(we))throw Sl();break}Te+=we,Ze="identifierName"},sign:function(){switch(mt){case".":Te=Se(),Ze="decimalPointLeading";return;case"0":Te=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Te=Se(),Ze="decimalInteger";return;case"I":return Se(),gn("nfinity"),Ut("numeric",Rn*(1/0));case"N":return Se(),gn("aN"),Ut("numeric",NaN)}throw Kt(Se())},zero:function(){switch(mt){case".":Te+=Se(),Ze="decimalPoint";return;case"e":case"E":Te+=Se(),Ze="decimalExponent";return;case"x":case"X":Te+=Se(),Ze="hexadecimal";return}return Ut("numeric",Rn*0)},decimalInteger:function(){switch(mt){case".":Te+=Se(),Ze="decimalPoint";return;case"e":case"E":Te+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Te+=Se();return}return Ut("numeric",Rn*Number(Te))},decimalPointLeading:function(){if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalFraction";return}throw Kt(Se())},decimalPoint:function(){switch(mt){case"e":case"E":Te+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalFraction";return}return Ut("numeric",Rn*Number(Te))},decimalFraction:function(){switch(mt){case"e":case"E":Te+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Te+=Se();return}return Ut("numeric",Rn*Number(Te))},decimalExponent:function(){switch(mt){case"+":case"-":Te+=Se(),Ze="decimalExponentSign";return}if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalExponentInteger";return}throw Kt(Se())},decimalExponentSign:function(){if(Oe.isDigit(mt)){Te+=Se(),Ze="decimalExponentInteger";return}throw Kt(Se())},decimalExponentInteger:function(){if(Oe.isDigit(mt)){Te+=Se();return}return Ut("numeric",Rn*Number(Te))},hexadecimal:function(){if(Oe.isHexDigit(mt)){Te+=Se(),Ze="hexadecimalInteger";return}throw Kt(Se())},hexadecimalInteger:function(){if(Oe.isHexDigit(mt)){Te+=Se();return}return Ut("numeric",Rn*Number(Te))},string:function(){switch(mt){case"\\":Se(),Te+=Xi();return;case'"':if(or)return Se(),Ut("string",Te);Te+=Se();return;case"'":if(!or)return Se(),Ut("string",Te);Te+=Se();return;case`
|
||
`:case"\r":throw Kt(Se());case"\u2028":case"\u2029":uh(mt);break;case void 0:throw Kt(Se())}Te+=Se()},start:function(){switch(mt){case"{":case"[":return Ut("punctuator",Se())}Ze="value"},beforePropertyName:function(){switch(mt){case"$":case"_":Te=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)){Te+=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 qe=je[we],et=On();if(et!==qe)throw Kt(Se());Se()}}function Xi(){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(),Al();case"u":return Se(),ru();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 Al(){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 ru(){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 ah={start:function(){if(lt.type==="eof")throw Ms();nu()},beforePropertyName:function(){switch(lt.type){case"identifier":case"string":Pr=lt.value,Qe="afterPropertyName";return;case"punctuator":Zi();return;case"eof":throw Ms()}},afterPropertyName:function(){if(lt.type==="eof")throw Ms();Qe="beforePropertyValue"},beforePropertyValue:function(){if(lt.type==="eof")throw Ms();nu()},beforeArrayValue:function(){if(lt.type==="eof")throw Ms();if(lt.type==="punctuator"&<.value==="]"){Zi();return}nu()},afterPropertyValue:function(){if(lt.type==="eof")throw Ms();switch(lt.value){case",":Qe="beforePropertyName";return;case"}":Zi()}},afterArrayValue:function(){if(lt.type==="eof")throw Ms();switch(lt.value){case",":Qe="beforeArrayValue";return;case"]":Zi()}},end:function(){}};function nu(){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 Zi(){ct.pop();var ie=ct[ct.length-1];ie==null?Qe="end":Array.isArray(ie)?Qe="afterArrayValue":Qe="afterPropertyValue"}function Kt(ie){return su(ie===void 0?"JSON5: invalid end of input at "+gr+":"+vr:"JSON5: invalid character '"+lc(ie)+"' at "+gr+":"+vr)}function Ms(){return su("JSON5: invalid end of input at "+gr+":"+vr)}function Sl(){return vr-=5,su("JSON5: invalid identifier character at "+gr+":"+vr)}function uh(ie){console.warn("JSON5: '"+lc(ie)+"' in strings is not valid ECMAScript; consider escaping")}function lc(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 su(ie){var we=new SyntaxError(ie);return we.lineNumber=gr,we.columnNumber=vr,we}var ch=function(we,je,qe){var et=[],gt="",wt,kr,ar="",js;if(je!=null&&typeof je=="object"&&!Array.isArray(je)&&(qe=je.space,js=je.quote,je=je.replacer),typeof je=="function")kr=je;else if(Array.isArray(je)){wt=[];for(var Ji=0,Nn=je;Ji<Nn.length;Ji+=1){var es=Nn[Ji],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 qe instanceof Number?qe=Number(qe):qe instanceof String&&(qe=String(qe)),typeof qe=="number"?qe>0&&(qe=Math.min(10,Math.floor(qe)),ar=" ".substr(0,qe)):typeof qe=="string"&&(ar=qe.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 iu(ut,!1);if(typeof ut=="number")return String(ut);if(typeof ut=="object")return Array.isArray(ut)?vn(ut):ou(ut)}function iu(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 ou(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=fh(ts)+":";ar!==""&&(Ks+=" "),Ks+=_s,ur.push(Ks)}}var gi;if(ur.length===0)gi="{}";else{var Qi;if(ar==="")Qi=ur.join(","),gi="{"+Qi+"}";else{var Cl=`,
|
||
`+gt;Qi=ur.join(Cl),gi=`{
|
||
`+gt+Qi+`,
|
||
`+Br+"}"}}return et.pop(),gt=Br,gi}function fh(Ht){if(Ht.length===0)return iu(Ht,!0);var Br=String.fromCodePoint(Ht.codePointAt(0));if(!Oe.isIdStartChar(Br))return iu(Ht,!0);for(var ut=Br.length;ut<Ht.length;ut++)if(!Oe.isIdContinueChar(String.fromCodePoint(Ht.codePointAt(ut))))return iu(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}},_l={parse:mi,stringify:ch},fc=_l,lh=fc;return lh}))});var Tbe=B(x());var Ibe=B(x());var Mne=B(x(),1),E_="3.7.8",xU=E_,zl=typeof Buffer=="function",m_=typeof TextDecoder=="function"?new TextDecoder:void 0,g_=typeof TextEncoder=="function"?new TextEncoder:void 0,$U="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Xh=Array.prototype.slice.call($U),t1=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(Xh),PU=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,rn=String.fromCharCode.bind(String),v_=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),b_=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),A_=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),S_=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+=Xh[t>>18&63]+Xh[t>>12&63]+Xh[t>>6&63]+Xh[t&63]}return s?o.slice(0,s-3)+"===".substring(s):o},qw=typeof btoa=="function"?e=>btoa(e):zl?e=>Buffer.from(e,"binary").toString("base64"):S_,Uw=zl?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 qw(r.join(""))},r1=(e,t=!1)=>t?b_(Uw(e)):Uw(e),kU=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)}},TU=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,__=e=>e.replace(TU,kU),w_=zl?e=>Buffer.from(e,"utf8").toString("base64"):g_?e=>Uw(g_.encode(e)):e=>qw(__(e)),Vl=(e,t=!1)=>t?b_(w_(e)):w_(e),y_=e=>Vl(e,!0),RU=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,OU=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))}},C_=e=>e.replace(RU,OU),D_=e=>{if(e=e.replace(/\s+/g,""),!PU.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=t1[e.charAt(o++)]<<18|t1[e.charAt(o++)]<<12|(r=t1[e.charAt(o++)])<<6|(n=t1[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("")},Mw=typeof atob=="function"?e=>atob(A_(e)):zl?e=>Buffer.from(e,"base64").toString("binary"):D_,F_=zl?e=>v_(Buffer.from(e,"base64")):e=>v_(Mw(e).split("").map(t=>t.charCodeAt(0))),B_=e=>F_(I_(e)),NU=zl?e=>Buffer.from(e,"base64").toString("utf8"):m_?e=>m_.decode(F_(e)):e=>C_(Mw(e)),I_=e=>A_(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Hw=e=>NU(I_(e)),LU=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)},x_=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),$_=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,x_(r));e("fromBase64",function(){return Hw(this)}),e("toBase64",function(t){return Vl(this,t)}),e("toBase64URI",function(){return Vl(this,!0)}),e("toBase64URL",function(){return Vl(this,!0)}),e("toUint8Array",function(){return B_(this)})},P_=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,x_(r));e("toBase64",function(t){return r1(this,t)}),e("toBase64URI",function(){return r1(this,!0)}),e("toBase64URL",function(){return r1(this,!0)})},UU=()=>{$_(),P_()},bt={version:E_,VERSION:xU,atob:Mw,atobPolyfill:D_,btoa:qw,btoaPolyfill:S_,fromBase64:Hw,toBase64:Vl,encode:Vl,encodeURI:y_,encodeURL:y_,utob:__,btou:C_,decode:Hw,isValid:LU,fromUint8Array:r1,toUint8Array:B_,extendString:$_,extendUint8Array:P_,extendBuiltins:UU};var E2=B(aa());var ese=B(x()),py=B(_C());function lj(e){let t=py.default.pemtohex(e);return py.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var CC={generateFingerprint:lj};var rfe=B(x());var Jle=B(x(),1);var Rle=B(x(),1);var Zce=B(x(),1);var cse=B(x(),1);var rse=B(x(),1),E1=Symbol.for("yaml.alias"),b1=Symbol.for("yaml.document"),Fi=Symbol.for("yaml.map"),my=Symbol.for("yaml.pair"),$s=Symbol.for("yaml.scalar"),da=Symbol.for("yaml.seq"),Vn=Symbol.for("yaml.node.type"),ps=e=>!!e&&typeof e=="object"&&e[Vn]===E1,Bi=e=>!!e&&typeof e=="object"&&e[Vn]===b1,Ii=e=>!!e&&typeof e=="object"&&e[Vn]===Fi,It=e=>!!e&&typeof e=="object"&&e[Vn]===my,dt=e=>!!e&&typeof e=="object"&&e[Vn]===$s,Ps=e=>!!e&&typeof e=="object"&&e[Vn]===da;function Mt(e){if(e&&typeof e=="object")switch(e[Vn]){case Fi:case da:return!0}return!1}function kt(e){if(e&&typeof e=="object")switch(e[Vn]){case E1:case Fi:case $s:case da:return!0}return!1}var A1=e=>(dt(e)||Mt(e))&&!!e.anchor;var ise=B(x(),1);var ms=Symbol("break visit"),DC=Symbol("skip children"),co=Symbol("remove node");function gs(e,t){let r=FC(t);Bi(e)?sf(null,e.contents,r,Object.freeze([e]))===co&&(e.contents=null):sf(null,e,r,Object.freeze([]))}gs.BREAK=ms;gs.SKIP=DC;gs.REMOVE=co;function sf(e,t,r,n){let i=BC(e,t,r,n);if(kt(i)||It(i))return IC(e,n,i),sf(e,i,r,n);if(typeof i!="symbol"){if(Mt(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=sf(o,t.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===ms)return ms;s===co&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){n=Object.freeze(n.concat(t));let o=sf("key",t.key,r,n);if(o===ms)return ms;o===co&&(t.key=null);let s=sf("value",t.value,r,n);if(s===ms)return ms;s===co&&(t.value=null)}}return i}async function S1(e,t){let r=FC(t);Bi(e)?await of(null,e.contents,r,Object.freeze([e]))===co&&(e.contents=null):await of(null,e,r,Object.freeze([]))}S1.BREAK=ms;S1.SKIP=DC;S1.REMOVE=co;async function of(e,t,r,n){let i=await BC(e,t,r,n);if(kt(i)||It(i))return IC(e,n,i),of(e,i,r,n);if(typeof i!="symbol"){if(Mt(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=await of(o,t.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===ms)return ms;s===co&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){n=Object.freeze(n.concat(t));let o=await of("key",t.key,r,n);if(o===ms)return ms;o===co&&(t.key=null);let s=await of("value",t.value,r,n);if(s===ms)return ms;s===co&&(t.value=null)}}return i}function FC(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 BC(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 IC(e,t,r){let n=t[t.length-1];if(Mt(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 fj={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},hj=e=>e.replace(/[!,[\]{}]/g,t=>fj[t]),lo=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+hj(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(`
|
||
`)}};lo.defaultYaml={explicit:!1,version:"1.2"};lo.defaultTags={"!!":"tag:yaml.org,2002:"};var Aue=B(x(),1);var xse=B(x(),1);var dse=B(x(),1);function _1(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 gy(e){let t=new Set;return gs(e,{Value(r,n){n.anchor&&t.add(n.anchor)}}),t}function vy(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function xC(e,t){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=gy(e));let s=vy(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)||Mt(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 Sse=B(x(),1);var mse=B(x(),1);function Su(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=Su(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=Su(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=Su(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=Su(e,n,i,o);s===void 0?delete n[i]:s!==o&&(n[i]=s)}return e.call(t,r,n)}var wse=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||!A1(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 _u=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"?Su(o,{"":a},"",a):a}};var pa=class extends _u{constructor(t){super(E1),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)||A1(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=C1(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(_1(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 C1(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(Mt(t)){let n=0;for(let i of t.items){let o=C1(e,i,r);o>n&&(n=o)}return n}else if(It(t)){let n=C1(e,t.key,r),i=C1(e,t.value,r);return Math.max(n,i)}return 1}var Vse=B(x(),1);var Hse=B(x(),1);var Rse=B(x(),1);var D1=e=>!e||typeof e!="function"&&typeof e!="object",Ke=class extends _u{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 dj="tag:yaml.org,2002:";function pj(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 ma(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 pa(u.anchor);u={anchor:null,node:null},a.set(e,u)}t?.startsWith("!!")&&(t=dj+t.slice(2));let l=pj(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[da]: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 sd(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 ma(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 uf=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,af=class extends _u{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(uf(t))this.add(r);else{let[n,...i]=t,o=this.get(n,!0);if(Mt(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,sd(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(Mt(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:Mt(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 Mt(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(Mt(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,sd(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};var xie=B(x(),1);var fie=B(x(),1);var iie=B(x(),1);var Gse=B(x(),1),$C=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Js(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var fo=(e,t,r)=>e.endsWith(`
|
||
`)?Js(r,t):r.includes(`
|
||
`)?`
|
||
`+Js(r,t):(e.endsWith(" ")?"":" ")+r;var Qse=B(x(),1);var Yse=B(x(),1),wy="flow",F1="block",od="quoted";function ad(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===F1&&(g=PC(e,g,t.length),g!==-1&&(m=g+u));for(let _;_=e[g+=1];){if(r===od&&_==="\\"){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===F1&&(g=PC(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===od){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===od&&h[C]&&(E+=`${e[C]}\\`),E+=`
|
||
${t}${e.slice(C+1,F)}`)}return E}function PC(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 I1=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),x1=e=>/^(%|---|\.\.\.)/m.test(e);function mj(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 ud(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(x1(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:ad(s,o,od,I1(t,!1))}function yy(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
||
`)||/[ \t]\n|\n[ \t]/.test(e))return ud(e,t);let r=t.indent||(x1(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
||
${r}`)+"'";return t.implicitKey?n:ad(n,r,wy,I1(t,!1))}function cf(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=ud;else{let i=e.includes('"'),o=e.includes("'");i&&!o?n=yy:o&&!i?n=ud:n=r?yy:ud}return n(e,t)}var Ey;try{Ey=new RegExp(`(^|(?<!
|
||
))
|
||
+(?!
|
||
|$)`,"g")}catch{Ey=/\n+(?!\n|$)/g}function B1({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 cf(r,n);let l=n.indent||(n.forceBlockIndent||x1(r)?" ":""),h=s==="literal"?!0:s==="folded"||t===Ke.BLOCK_FOLDED?!1:t===Ke.BLOCK_LITERAL?!0:!mj(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(Ey,`$&${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=I1(n,!0);s!=="folded"&&t!==Ke.BLOCK_FOLDED&&(K.onOverflow=()=>{H=!0});let S=ad(`${E}${F}${d}`,l,F1,K);if(!H)return`>${C}
|
||
${l}${S}`}return r=r.replace(/\n+/g,`$&${l}`),`|${C}
|
||
${l}${E}${r}${d}`}function gj(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 cf(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||h||!o.includes(`
|
||
`)?cf(o,t):B1(e,t,r,n);if(!a&&!h&&i!==Ke.PLAIN&&o.includes(`
|
||
`))return B1(e,t,r,n);if(x1(o)){if(u==="")return t.forceBlockIndent=!0,B1(e,t,r,n);if(a&&u===l)return cf(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 cf(o,t)}return a?m:ad(m,u,wy,I1(t,!1))}function Bc(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?cf(s.value,t):B1(s,t,r,n);case Ke.QUOTE_DOUBLE:return ud(s.value,t);case Ke.QUOTE_SINGLE:return yy(s.value,t);case Ke.PLAIN:return gj(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 $1(e,t){let r=Object.assign({blockQuote:!0,commentString:$C,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 vj(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 wj(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(dt(e)||Mt(e))&&e.anchor;o&&_1(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 ga(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=vj(t.doc.schema.tags,o));let s=wj(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)?Bc(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 kC({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(Mt(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||Mt(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=ga(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+=fo(y,r.indent,l(p)):g&&i&&i(),y;v&&(p=null),d?(p&&(y+=fo(y,r.indent,l(p))),y=`? ${y}
|
||
${a}:`):(y=`${y}:`,p&&(y+=fo(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=ga(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&&Mt(t)){let K=F[0],S=F.indexOf(`
|
||
`),I=S!==-1,M=r.inFlow??t.flow??t.items.length===0;if(I||!M){let L=!1;if(I&&(K==="&"||K==="!")){let T=F.indexOf(" ");K==="&"&&T!==-1&&T<S&&F[T+1]==="!"&&(T=F.indexOf(" ",T+1)),(T===-1||S<T)&&(L=!0)}L||(H=`
|
||
${r.indent}`)}}else(F===""||F[0]===`
|
||
`)&&(H="");return y+=H+F,r.inFlow?C&&n&&n():_&&!C?y+=fo(y,r.indent,l(_)):g&&i&&i(),y}var _ie=B(x(),1);var die=B(x(),1);function P1(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var vie=B(x(),1);var k1="<<",xi={identify:e=>e===k1||typeof e=="symbol"&&e.description===k1,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ke(Symbol(k1)),{addToJSMap:Ay}),stringify:()=>k1},TC=(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 Ay(e,t,r){let n=RC(e,r);if(Ps(n))for(let i of n.items)by(e,t,i);else if(Array.isArray(n))for(let i of n)by(e,t,i);else by(e,t,n)}function by(e,t,r){let n=RC(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 RC(e,t){return e&&ps(t)?t.resolve(e.doc,e):t}function T1(e,t,{key:r,value:n}){if(kt(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(TC(e,r))Ay(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=yj(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 yj(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(kt(e)&&r?.doc){let n=$1(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)+'..."'),P1(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 lf(e,t,r){let n=ma(e,void 0,r),i=ma(t,void 0,r);return new dr(n,i)}var dr=class e{constructor(t,r=null){Object.defineProperty(this,Vn,{value:my}),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 T1(r,n,this)}toString(t,r,n){return t?.doc?kC(this,t,r,n):JSON.stringify(this)}};var sue=B(x(),1);var Gie=B(x(),1);var jie=B(x(),1);var Rie=B(x(),1);function O1(e,t,r){return(t.inFlow??e.flow?bj:Ej)(e,t,r)}function Ej({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(""),R1(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(""),R1(r,p,E.commentBefore,m))}m=!1;let w=ga(g,h,()=>y=null,()=>m=!0);y&&(w+=fo(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 bj({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(""),R1(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(""),R1(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=ga(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+=fo(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 R1({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 Cu(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 af{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(lf(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=Cu(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);dt(i.value)&&D1(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=Cu(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let i=Cu(this.items,t)?.value;return(!r&&dt(i)?i.value:i)??void 0}has(t){return!!Cu(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)T1(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})),O1(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 ioe=B(x(),1);var toe=B(x(),1);var Sn=class extends af{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(da,t),this.items=[]}add(t){this.items.push(t)}delete(t){let r=N1(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let n=N1(t);if(typeof n!="number")return;let i=this.items[n];return!r&&dt(i)?i.value:i}has(t){let r=N1(t);return typeof r=="number"&&r<this.items.length}set(t,r){let n=N1(t);if(typeof n!="number")throw new Error(`Expected a valid index, not ${t}.`);let i=this.items[n];dt(i)&&D1(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?O1(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(ma(a,void 0,n))}}return o}};function N1(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 uoe=B(x(),1);var Du={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),Bc(e,t,r,n)}};var Zae=B(x(),1);var foe=B(x(),1);var Ic={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"&&Ic.test.test(e)?e:t.options.nullStr};var poe=B(x(),1);var cd={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&&cd.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 Eoe=B(x(),1);var goe=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 L1={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},U1={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)}},H1={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 Soe=B(x(),1);var q1=e=>typeof e=="bigint"||Number.isInteger(e),Sy=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);function OC(e,t,r){let{value:n}=e;return q1(n)&&n>=0?r+n.toString(t):_n(e)}var M1={identify:e=>q1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>Sy(e,2,8,r),stringify:e=>OC(e,8,"0o")},j1={identify:q1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>Sy(e,0,10,r),stringify:_n},K1={identify:e=>q1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>Sy(e,2,16,r),stringify:e=>OC(e,16,"0x")};var Poe=B(x(),1);var NC=[$i,Pi,Du,Ic,cd,M1,j1,K1,L1,U1,H1];var Noe=B(x(),1);function LC(e){return typeof e=="bigint"||Number.isInteger(e)}var V1=({value:e})=>JSON.stringify(e),Aj=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:V1},{identify:e=>e==null,createNode:()=>new Ke(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:V1},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:V1},{identify:LC,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})=>LC(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:V1}],Sj={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},UC=[$i,Pi].concat(Aj,Sj);var qoe=B(x(),1);var ld={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 Bc({comment:e,type:t,value:a},n,i,o)}};var eae=B(x(),1);var Goe=B(x(),1);function _y(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 Cy(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(lf(a,u,r))}return i}var fd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_y,createNode:Cy};var ff=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=Cy(t,r,n),o=new this;return o.items=i.items,o}};ff.tag="tag:yaml.org,2002:omap";var hd={collection:"seq",identify:e=>e instanceof Map,nodeClass:ff,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=_y(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 ff,r)},createNode:(e,t,r)=>ff.from(e,t,r)};var kae=B(x(),1);var nae=B(x(),1);function HC({value:e,source:t},r){return t&&(e?Dy:Fy).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var Dy={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:HC},Fy={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:HC};var aae=B(x(),1);var qC={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},MC={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)}},jC={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 lae=B(x(),1);var dd=e=>typeof e=="bigint"||Number.isInteger(e);function z1(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 By(e,t,r){let{value:n}=e;if(dd(n)){let i=n.toString(t);return n<0?"-"+r+i.substr(1):r+i}return _n(e)}var KC={identify:dd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>z1(e,2,2,r),stringify:e=>By(e,2,"0b")},VC={identify:dd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>z1(e,1,8,r),stringify:e=>By(e,8,"0")},zC={identify:dd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>z1(e,0,10,r),stringify:_n},GC={identify:dd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>z1(e,2,16,r),stringify:e=>By(e,16,"0x")};var mae=B(x(),1);var hf=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),Cu(this.items,r.key)||this.items.push(r)}get(t,r){let n=Cu(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=Cu(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(lf(s,null,n));return o}};hf.tag="tag:yaml.org,2002:set";var pd={collection:"map",identify:e=>e instanceof Set,nodeClass:hf,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>hf.from(e,t,r),resolve(e,t){if(Ii(e)){if(e.hasAllNullValues(!0))return Object.assign(new hf,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};var wae=B(x(),1);function Iy(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 WC(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 G1={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})=>Iy(e,r),stringify:WC},W1={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=>Iy(e,!1),stringify:WC},df={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(df.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=Iy(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 xy=[$i,Pi,Du,Ic,Dy,Fy,KC,VC,zC,GC,qC,MC,jC,ld,xi,hd,fd,pd,G1,W1,df];var YC=new Map([["core",NC],["failsafe",[$i,Pi,Du]],["json",UC],["yaml11",xy],["yaml-1.1",xy]]),XC={binary:ld,bool:cd,float:H1,floatExp:U1,floatNaN:L1,floatTime:W1,int:j1,intHex:K1,intOct:M1,intTime:G1,map:$i,merge:xi,null:Ic,omap:hd,pairs:fd,seq:Pi,set:pd,timestamp:df},ZC={"tag:yaml.org,2002:binary":ld,"tag:yaml.org,2002:merge":xi,"tag:yaml.org,2002:omap":hd,"tag:yaml.org,2002:pairs":fd,"tag:yaml.org,2002:set":pd,"tag:yaml.org,2002:timestamp":df};function Y1(e,t,r){let n=YC.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(YC.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"?XC[s]:s;if(!a){let u=JSON.stringify(s),l=Object.keys(XC).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 _j=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,md=class e{constructor({compat:t,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?Y1(t,"compat"):t?Y1(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?ZC:{},this.tags=Y1(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Fi,{value:$i}),Object.defineProperty(this,$s,{value:Du}),Object.defineProperty(this,da,{value:Pi}),this.sortMapEntries=typeof s=="function"?s:s===!0?_j:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};var cue=B(x(),1);function JC(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=$1(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=ga(e.contents,i,()=>a=null,u);a&&(l+=fo(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ga(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 va=class e{constructor(t,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Vn,{value:b1});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 lo({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:b1}});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){pf(this.contents)&&this.contents.add(t)}addIn(t,r){pf(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let n=gy(this);t.anchor=!r||n.has(r)?vy(r||"a",n):r}return new pa(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}=xC(this,s||"a"),v={aliasDuplicateObjects:o??!0,keepUndefined:u??!1,onAnchor:m,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:d},g=ma(t,h,v);return a&&Mt(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 pf(this.contents)?this.contents.delete(t):!1}deleteIn(t){return uf(t)?this.contents==null?!1:(this.contents=null,!0):pf(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return Mt(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return uf(t)?!r&&dt(this.contents)?this.contents.value:this.contents:Mt(this.contents)?this.contents.getIn(t,r):void 0}has(t){return Mt(this.contents)?this.contents.has(t):!1}hasIn(t){return uf(t)?this.contents!==void 0:Mt(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=sd(this.schema,[t],r):pf(this.contents)&&this.contents.set(t,r)}setIn(t,r){uf(t)?this.contents=r:this.contents==null?this.contents=sd(this.schema,Array.from(t),r):pf(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 lo({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 lo({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 md(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"?Su(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 JC(this,t)}};function pf(e){if(Mt(e))return!0;throw new Error("Expected a YAML collection as document contents")}var _ue=B(x(),1),gd=class extends Error{constructor(t,r,n,i){super(),this.name=t,this.code=n,this.message=i,this.pos=r}},ki=class extends gd{constructor(t,r,n){super("YAMLParseError",t,r,n)}},vd=class extends gd{constructor(t,r,n){super("YAMLWarning",t,r,n)}},$y=(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 jce=B(x(),1);var Nce=B(x(),1);var pce=B(x(),1);var Mue=B(x(),1);var Due=B(x(),1);function ho(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 Bue=B(x(),1);function Fu(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(Fu(t.key)||Fu(t.value))return!0}return!1;default:return!0}}var $ue=B(x(),1);function wd(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];n.indent===e&&(n.source==="]"||n.source==="}")&&Fu(t)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var Tue=B(x(),1);function X1(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 QC="All mapping items must start at the same column";function e8({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=ho(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",QC)),!g.anchor&&!g.tag&&!d){l=g.end,g.comment&&(a.comment?a.comment+=`
|
||
`+g.comment:a.comment=g.comment);continue}(g.newlineAfterProp||Fu(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",QC);r.atKey=!0;let w=g.end,E=p?e(r,p,g,i):t(r,w,m,null,g,i);r.schema.compat&&wd(n.indent,p,i),r.atKey=!1,X1(r,a.items,E)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let _=ho(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&&wd(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 Gue=B(x(),1);function t8({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=ho(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&&wd(n.indent,m,i),u=d.range[2],a.items.push(d)}return a.range=[n.offset,u,l??u],a}var ice=B(x(),1);var Yue=B(x(),1);function po(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 Py="Block collections are not allowed within flow collections",ky=e=>e&&(e.type==="block-map"||e.type==="block-seq");function r8({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=ho(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&&Fu(_)&&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],ky(F)&&i(K.range,"BLOCK_IN_FLOW",Py)}else{r.atKey=!0;let K=H.end,S=_?e(r,_,H,i):t(r,K,E,null,H,i);ky(_)&&i(S.range,"BLOCK_IN_FLOW",Py),r.atKey=!1;let I=ho(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 T of C){if(T===I.found)break;if(T.type==="newline"){i(T,"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 M=F?e(r,F,I,i):I.found?t(r,I.end,C,null,I,i):null;M?ky(F)&&i(M.range,"BLOCK_IN_FLOW",Py):I.comment&&(S.comment?S.comment+=`
|
||
`+I.comment:S.comment=I.comment);let L=new dr(S,M);if(r.options.keepSourceTokens&&(L.srcToken=w),s){let T=l;X1(r,T.items,S)&&i(K,"DUPLICATE_KEY","Map keys must be unique"),T.items.push(L)}else{let T=new Sr(r.schema);T.flow=!0,T.items.push(L);let O=(M??S).range;T.range=[S.range[0],O[1],O[2]],l.items.push(T)}m=M?M.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=po(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 Ty(e,t,r,n,i,o){let s=r.type==="block-map"?e8(e,t,r,n,o):r.type==="block-seq"?t8(e,t,r,n,o):r8(e,t,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function n8(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 Ty(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),Ty(e,t,r,i,s)}let l=Ty(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 Fce=B(x(),1);var vce=B(x(),1);function Ry(e,t,r){let n=t.offset,i=Cj(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?Dj(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 Cj({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 Dj(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 bce=B(x(),1);function Oy(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=Fj(o,l);break;case"single-quoted-scalar":a=Ke.QUOTE_SINGLE,u=Bj(o,l);break;case"double-quoted-scalar":a=Ke.QUOTE_DOUBLE,u=Ij(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=po(s,h,t,r);return{value:u,type:a,comment:m.comment,range:[n,h,m.offset]}}function Fj(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}`),s8(e)}function Bj(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),s8(e.slice(1,-1)).replace(/''/g,"'")}function s8(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 Ij(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}=xj(e,n);r+=o,n=s}else if(i==="\\"){let o=e[++n],s=$j[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+=Pj(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 xj(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 $j={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
||
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Pj(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 Ny(e,t,r,n){let{value:i,type:o,comment:s,range:a}=t.type==="block-scalar"?Ry(e,t,n):Oy(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=kj(e.schema,i,u,r,n):t.type==="scalar"?l=Tj(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 kj(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 Tj({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 Ice=B(x(),1);function i8(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:Ly,composeEmptyNode:Z1};function Ly(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=Oj(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=Ny(e,t,u,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=n8(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=Z1(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 Z1(e,t,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:u},l){let h={type:"scalar",offset:i8(t,r,n),indent:-1,source:""},m=Ny(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 Oj({options:e},{offset:t,source:r,end:n},i){let o=new pa(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=po(n,s,e.strict,i);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}function o8(e,t,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:t},e),u=new va(void 0,a),l={atKey:!1,atRoot:!0,directives:u.directives,options:u.options,schema:u.schema},h=ho(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?Ly(l,i,h,s):Z1(l,h.end,n,null,h,s);let m=u.contents.range[2],p=po(o,m,!1,s);return p.comment&&(u.comment=p.comment),u.range=[r,m,p.offset],u}function yd(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 a8(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 Ed=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=yd(r);o?this.warnings.push(new vd(s,n,i)):this.errors.push(new ki(s,n,i))},this.directives=new lo({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:n,afterEmptyLine:i}=a8(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(Mt(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:a8(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=yd(t);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=o8(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(yd(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(yd(t),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=po(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(yd(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 va(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 hle=B(x(),1);var nle=B(x(),1);var ile=B(x(),1);var ale=B(x(),1),Uy=Symbol("break visit"),Nj=Symbol("skip children"),u8=Symbol("remove item");function xc(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),c8(Object.freeze([]),e,t)}xc.BREAK=Uy;xc.SKIP=Nj;xc.REMOVE=u8;xc.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};xc.parentCollection=(e,t)=>{let r=xc.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 c8(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=c8(Object.freeze(e.concat([[i,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===Uy)return Uy;a===u8&&(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 Hy="\uFEFF",qy="",My="",J1="";function l8(e){switch(e){case Hy:return"byte-order-mark";case qy:return"doc-mode";case My:return"flow-error-end";case J1: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 wle=B(x(),1);function Ti(e){switch(e){case void 0:case" ":case`
|
||
`:case"\r":case" ":return!0;default:return!1}}var f8=new Set("0123456789ABCDEFabcdef"),Uj=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Q1=new Set(",[]{}"),Hj=new Set(` ,[]{}
|
||
\r `),jy=e=>!e||Hj.has(e),bd=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==="...")&&Ti(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]===Hy&&(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 qy,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==="...")&&Ti(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&&!Ti(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===":")&&Ti(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(jy),"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("..."))&&Ti(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield My,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(jy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||Ti(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=>Ti(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 J1,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(Ti(o)||t&&Q1.has(o))break;r=n}else if(Ti(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===`
|
||
`?(n+=1,i=`
|
||
`,o=this.buffer[n+1]):r=n),o==="#"||t&&Q1.has(o))break;if(i===`
|
||
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(t&&Q1.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield J1,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(jy),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Ti(n)||r&&Q1.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(;!Ti(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(Uj.has(r))r=this.buffer[++t];else if(r==="%"&&f8.has(this.buffer[t+1])&&f8.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 Ele=B(x(),1),Ad=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 _le=B(x(),1);function Bu(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function h8(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 p8(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 em(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 mf(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 tm(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 d8(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Bu(t.start,"explicit-key-ind")&&!Bu(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,p8(t.value)?t.value.end?tm(t.value.end,t.sep):t.value.end=t.sep:tm(t.start,t.sep),delete t.sep)}var Sd=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 bd,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=l8(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"&&d8(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&&h8(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":{h8(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=em(this.peek(2)),n=mf(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)){tm(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(Bu(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(p8(r.key)&&!Bu(r.sep,"newline")){let s=mf(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(Bu(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=mf(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]}):Bu(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&&!Bu(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)){tm(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||Bu(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=em(n),o=mf(i);d8(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=em(t),n=mf(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=em(t),n=mf(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 kle=B(x(),1);function qj(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Ad||null,prettyErrors:t}}function _d(e,t={}){let{lineCounter:r,prettyErrors:n}=qj(t),i=new Sd(r?.addNewLine),o=new Ed(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($y(e,r)),s.warnings.forEach($y(e,r))),s}function Ky(e,t,r){let n;typeof t=="function"?n=t:r===void 0&&t&&typeof t=="object"&&(r=t);let i=_d(e,r);if(!i)return null;if(i.warnings.forEach(o=>P1(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 Vy(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 va(e,n,r).toString(r)}var jj={logLevel:"error",merge:!0};function g8(e,t,...r){try{return e(t,...r)}catch{return e(y8(e(t.replace(/!<str>\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function rm(e){return JSON.parse(JSON.stringify(e))}function Kj(e){return{...jj,...e||{}}}function Vj(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 v8(e,t){return Ky(e,Kj(t))}function w8(e,t){return Vy(e,Vj(t))}function gf(e,...t){return g8(v8,rm(e),...t)}function zj(e,...t){return g8(v8,rm(e),...t)}function m8(e,...t){return w8(rm(e),...t)}function y8(e,...t){return w8(rm(e),...t)}var ks={safeLoad:gf,load:zj,safeDump:m8,dump:y8,parse:gf,stringify:m8};var n2e=B(x());var sfe=B(x());var pr="settings",nm="subs",zy="collections",$c="files",sm="modules",Cd="artifacts",E8="rules";var Pc="#sub-store-cached-resource",kc="#sub-store-cached-headers-resource",Tc="#sub-store-cached-script-resource",Gy="#sub-store-logs";var wfe=B(x());var afe=B(x());var A8=1e4,Gj=1e3,I8=["log","info","warn","error","debug"],S8="unknown",x8=/^Sub-Store\s+--\s+v\d+(?:\.\d+){0,3}$/,_8=/^\u2505{8,}$/,Wj=/^\[sub-store\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/,$8=/^\[[^\]\r\n]+\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/i,Yj=/^\[([^\]\r\n]+)\]\s*/,Xj=[/^(?:.+\sParser|Rule parser \[.+\]) is activated!?$/,/^Pre-processor \[.+\] activated!?$/,/^Fallback Base64 Pre-processor error: decoded line does not start with protocol$/,/^\[CORS\] allowed origins: .+$/],C8=!1,Wy=!1,im=null,D8=0;function Zj(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?F8(n):n} ${o}`,...s]}return[r.length?F8(n):n,...r]}function F8(e){return`${e}`.replace(/%/g,"%%")}function Jj(e,t=0){let r=B8(t,0,A8);return B8(e,r,A8)}function Qj(e){return Array.from(e||[]).map(cK).join(" ")}function eK(e){try{let t=e.read(Gy);if(!t)return[];let r=typeof t=="string"?JSON.parse(t):t;return Array.isArray(r)?r.filter(lK):[]}catch{return[]}}function tK(e,t){e.write(JSON.stringify(Array.isArray(t)?t:[]),Gy)}function rK(e,t,r){try{let n=nK(e);if(n===0)return;let i=Qj(r);if(iK(i))return;let o=eK(e),s=k8(t);o.push({id:fK(),time:Date.now(),level:s,message:sK(i,s)}),tK(e,o.slice(-n))}catch{}}function P8(e){C8||typeof console>"u"||(C8=!0,I8.forEach(t=>{let r=console[t];typeof r=="function"&&(console[t]=function(...n){if(r.apply(console,Zj(n,{isNode:e.env.isNode})),!Wy)try{Wy=!0,rK(e,t,n)}finally{Wy=!1}})}))}function nK(e){let t=Date.now();if(im!==null&&t<D8)return im;let r=e.read(pr)||{};return im=Jj(r.logsMaxCount),D8=t+Gj,im}function B8(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 k8(e){return I8.includes(e)?e:"log"}function sK(e,t){let r=`${e||""}`;if($8.test(r))return r;let n=k8(t).toUpperCase(),i=r.match(Yj);if(i){let o=i[1].trim()||S8,s=r.slice(i[0].length).trimStart();return`[${o}] ${n}: ${s}`}return`[${S8}] ${n}: ${r}`}function iK(e){let t=oK(e);return t.length===1?x8.test(t[0])||uK(t[0]):aK(t)}function oK(e){let t=`${e||""}`.split(/\r?\n/).map(n=>n.trim()).filter(Boolean);if(t.length===0)return t;let r=t[0].replace($8,"").trim();return r!==t[0]&&(r?t[0]=r:t.shift()),t}function aK(e){return e.length<3||!_8.test(e[0])||!_8.test(e[e.length-1])?!1:e.slice(1,-1).some(t=>x8.test(t))}function uK(e){let t=e.replace(Wj,"");return Xj.some(r=>r.test(t))}function cK(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 lK(e){return e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.time=="number"&&typeof e.level=="string"&&typeof e.message=="string"}function fK(){return`${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var dfe=B(x());var lfe=B(x());function mo(e){if(Qs().isNode)try{return e()}catch{return}}function go(){return mo(()=>wu("fs"))}var Iu=typeof $task<"u",wo=typeof $loon<"u",wa=typeof Egern<"u",xu=typeof $httpClient<"u"&&!wo&&!wa,vo=eval('typeof process !== "undefined"'),T8=typeof $environment<"u"&&$environment["stash-version"],R8=typeof $rocket<"u",hK=typeof $native<"u",$u=typeof $Plugins<"u",dK=wo&&typeof $loon=="object"&&$loon!==null&&$loon.isSubsCheckPro===!0;function om(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function pK(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 mK(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 am=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=yo(),this.env=Qs(),vo){let dotenv=eval('require("dotenv")');dotenv.config()}this.node=vo?{fs:go()}:null,this.initCache(),P8(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(Iu&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(wo||xu||wa)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),$u&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),vo){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".",rootPath=`${basePath}/root.json`,backupRootPath=`${basePath}/root_${Date.now()}.json`;if(this.log(`Root path: ${rootPath}`),this.node.fs.existsSync(rootPath))try{this.root=JSON.parse(this.node.fs.readFileSync(`${rootPath}`))}catch(e){this.node.fs.copyFileSync(rootPath,backupRootPath),this.error(`Failed to parse ${rootPath}: ${e.message}. Backup created at ${backupRootPath}`)}om(this.root)||(this.node.fs.writeFileSync(rootPath,JSON.stringify({}),{flag:"w"}),this.root={});let fpath=`${basePath}/${this.name}.json`,backupPath=`${basePath}/${this.name}_${Date.now()}.json`;if(this.log(`Data path: ${fpath}`),this.node.fs.existsSync(fpath))try{if(this.cache=JSON.parse(this.node.fs.readFileSync(`${fpath}`,"utf-8")),!om(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"}),!om(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}`)}}om(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(Iu&&$prefs.setValueForKey(data,this.name),(wo||xu||wa)&&$persistentStore.write(data,this.name),$u&&$Plugins.SubStoreCache.set(this.name,data),vo){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),xu||wo||wa)return $persistentStore.write(e,t);if(Iu)return $prefs.setValueForKey(e,t);if(vo&&(this.root[t]=e),$u)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),xu||wo||wa)return $persistentStore.read(e);if(Iu)return $prefs.valueForKey(e);if(vo)return this.root[e];if($u)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),xu||wo||wa)return $persistentStore.write(null,e);if(Iu)return $prefs.removeValueForKey(e);if(vo&&delete this.root[e],$u)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(Iu&&$notify(title,subtitle,content,options),(xu||wa)&&$notification.post(title,subtitle,content+`${mediaURL?`
|
||
\u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),wo){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(vo){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(`
|
||
`)));yo().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:gK(yo())}).then(()=>console.log("[Push Service] RES: sent"),t=>console.log(`[Push Service] ERROR: ${t.message}`))).catch(()=>console.log("[Push Service] ERROR: notification delivery failed"))}$u&&$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={}){Iu||wo||xu||$u||wa?$done(e):vo&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function Qs(){return{isQX:Iu,isLoon:wo,isSurge:xu,isNode:vo,isStash:T8,isShadowRocket:R8,isEgern:wa,isLanceX:hK,isGUIforCores:$u,isSubsCheckPro:dK}}function gK(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 yo(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=mK(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(pK(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||T8||R8)&&(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 Efe=B(x()),O8=0;function Ur(e){return wK(vK(yK(e)))}function vK(e){return bK(AK(EK(e),e.length*8))}function wK(e){for(var t=O8?"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 yK(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 EK(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 bK(e){for(var t="",r=0;r<e.length*32;r+=8)t+=String.fromCharCode(e[r>>5]>>>r%32&255);return t}function AK(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=Pu(r,a),n=Pu(n,u),i=Pu(i,l),o=Pu(o,h)}return Array(r,n,i,o)}function um(e,t,r,n,i,o){return Pu(SK(Pu(Pu(t,e),Pu(n,o)),i),r)}function Cn(e,t,r,n,i,o,s){return um(t&r|~t&n,e,t,i,o,s)}function Dn(e,t,r,n,i,o,s){return um(t&n|r&~n,e,t,i,o,s)}function Fn(e,t,r,n,i,o,s){return um(t^r^n,e,t,i,o,s)}function Bn(e,t,r,n,i,o,s){return um(r^(t|~n),e,t,i,o,s)}function Pu(e,t){var r=(e&65535)+(t&65535),n=(e>>16)+(t>>16)+(r>>16);return n<<16|r&65535}function SK(e,t){return e<<t|e>>>32-t}var Hfe=B(x()),vm=B(z8()),CV=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,DV=/^(([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 CV.test(e)}function Xt(e){return DV.test(e)}function G8(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 Me(e){return typeof e=="string"&&e.trim().length>0}function vt(e,t){return Me(e)?e:t}function vf(e){return typeof e<"u"&&e!==null}function ya(e,t){return vf(e)?e:t}function Ea(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function FV(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function Fd(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return FV(n,i)}else return Number(r)}function W8(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function wm(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 We(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}var Xfe=B(x());var zfe=B(x()),jfe=B(X8());var BV=new am("sub-store"),Q=BV;var nE=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=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),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=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)??xV();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 xV(){let t=(Q.read(pr)||{})?.resourceCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:36e5}var Hr=new nE;var ehe=B(x());var iE=class{constructor(){Q.read(kc)||Q.write("{}",kc);try{this.resourceCache=JSON.parse(Q.read(kc))}catch(t){Q.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${kc} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},Q.write("{}",kc)}this._cleanup()}_cleanup(t,r){let n=sE(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),kc)}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=sE(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=sE(n)??PV();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function sE(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function PV(){let t=(Q.read(pr)||{})?.headersCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:6e4}var Bd=new iE;var dhe=B(x());var she=B(x());var Z8=10,kV="backendRequestConcurrency",J8=0,TV="backendRequestConcurrencyWaitTime",Id=0,uE=[];function RV(e){return new Promise(t=>setTimeout(t,e))}function OV(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return Z8;let t=Number(e);return!Number.isInteger(t)||t<1?Z8:t}function NV(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return J8;let t=Number(e);return!Number.isInteger(t)||t<0?J8:t}function oE(){let e=Q.read(pr)||{};return OV(e[kV])}function aE(){let e=Q.read(pr)||{};return NV(e[TV])}function LV(e,t){return`active=${Id}, pending=${uE.length}, limit=${e}, waitTime=${t}ms`}function ym(e,t,r,n){Q.log(`[Backend Request Concurrency] ${e}: ${t} (${LV(r,n)})`)}function UV(){let e=uE.shift();e&&e()}async function HV(e){let t=oE(),r=aE();for(;Id>=t;)ym("queued",e,t,r),await new Promise(n=>{uE.push(n)}),t=oE(),r=aE();Id+=1,ym("acquired",e,t,r),r>0&&(ym("waiting before request",e,t,r),await RV(r))}function qV(e){Id=Math.max(0,Id-1),ym("released",e,oE(),aE()),UV()}async function wf(e,t="request"){await HV(t);try{return await e()}finally{qV(t)}}function Uc(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 Em(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=Bd.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=yo();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 wf(()=>e.get({url,headers:customHeaders||{"User-Agent":userAgent},timeout:requestTimeout,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ea(proxy):{},...insecure||{}}),"flow body GET");if(i<200||i>=400)throw new Error(`statusCode: ${i}`);t=r;let o=yf(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=Uc(t),i=yf(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 wf(()=>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?Ea(proxy):{},...insecure||{}}),"flow headers HEAD");flowInfo=Uc(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 wf(()=>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?Ea(proxy):{},...insecure||{}}),"flow headers GET");flowInfo=Uc(t)}}flowInfo&&(flowInfo=flowInfo.trim()),flowInfo&&Bd.set(id,flowInfo,$arguments?.headersCacheTtl?$arguments?.headersCacheTtl*1e3:void 0)}return flowInfo}function yf(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 xd(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}:xd(e/1024,r[++n])}function bm(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=xd(Math.abs(n));i.value=n<0?"-"+i.value:i.value;let o=xd(e.total);throw new Error(`\u6D41\u91CF\u5DF2\u7528\u5B8C: ${i.value} ${i.unit} / ${o.value} ${o.unit}`)}}}function Q8(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 eD(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 mhe=B(x());function ri(e,t,r="name"){return e.find(n=>n[r]===t)}var Oge=B(x());var vhe=B(x());var yhe=B(x()),cE=class{constructor(t,r,n){this.code=t,this.message=r,this.details=n}};var ba=class extends cE{constructor(t,r,n){super(t,r,n),this.type="RequestInvalidError"}};var Che=B(x());var fE=new Map,lE=new Set,hE;function dE(e){return e?.cron==null?"":`${e.cron}`.trim()}function tD(e){return dE(e).length>0}function MV(e){let t=e?.displayName??e?.["display-name"];return t==null?"":`${t}`.trim()}function rD(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 jV(e){return!tD(e)}function KV(cron){if(!(!cron||!Q.env.isNode))try{let{CronTime}=eval('require("cron")');new CronTime(cron)}catch(e){throw new ba("INVALID_ARTIFACT_CRON",`Artifact cron ${cron} is invalid.`,`Reason: ${e.message??e}`)}}function VV(e){if(!e||typeof e!="object")return e;let t=dE(e);return t?(KV(t),e.cron=t,e):(delete e.cron,e)}function zV(){fE.forEach(e=>e.stop()),fE.clear()}async function GV(e,t,r){if(lE.has(e)){Q.info(`[ARTIFACT CRON] ${t} ${r} skipped: previous run is still running`);return}lE.add(e);try{Q.info(`[ARTIFACT CRON] ${t} ${r} started`),await hE(e),Q.info(`[ARTIFACT CRON] ${t} ${r} finished`)}catch(n){Q.error(`[ARTIFACT CRON] ${t} ${r} error: ${n.message??n}`)}finally{lE.delete(e)}}function WV(artifact){let cron=dE(artifact),name=artifact.name,logName=rD(artifact),{CronJob}=eval('require("cron")');try{let e=new CronJob(cron,async function(){await GV(name,logName,cron)},null,!0);fE.set(name,e),Q.info(`[ARTIFACT CRON] ${logName} ${cron} scheduled`)}catch(e){Q.error(`[ARTIFACT CRON] ${logName} ${cron} schedule error: ${e.message??e}`)}}function nD(){if(!Q.env.isNode||!hE)return;zV();let e=Q.read(Cd);(Array.isArray(e)?e:[]).filter(r=>r.sync&&r.source).filter(tD).forEach(WV)}function She(e){Q.env.isNode&&(hE=e,nD())}var Lhe=B(x());var Fhe=B(x());function YV(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function XV(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var sD=[YV(),XV()];var xhe=B(x());function ZV(){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 iD(){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 JV(){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))),iD().func(r))}}function QV(){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 oD={QX:ZV(),Surge:iD(),Loon:JV(),Clash:QV()};var Phe=B(x()),ez=[[/^(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 tz(){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 ez)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 aD=[tz()];var Am=(function(){function e(n){for(let i of sD)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 aD){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=oD[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 tge=B(x());var Mhe=B(x());var Yhe=B(x());var pE="https://api.github.com";function uD(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 rz(e,t=pE){return(String(e??"").trim()||t).replace(/\/+$/,"")}function nz({githubApiUrl:e,githubProxy:t}={}){let r=rz(e),n=r!==pE,i=String(t||"").trim().replace(/\/+$/,"");return n?r:`${i?`${i}/`:""}${pE}`}function Ghe(e={}){return!!e?.gistToken}var Ef=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=Qs(),{defaultProxy,githubApiTimeout,githubProxy,githubApiUrl}=Q.read(pr)||{},githubApiRequestTimeout=githubApiTimeout||1e4,githubGistBaseURL=nz({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=yo({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?Ea(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(uD(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=yo({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?Ea(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(uD(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 nde=B(x());var Ome=B(x());var $me=B(x(),1);var ude=B(x(),1);var ide=B(x(),1);function mE(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=mE(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 Sa(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 bf(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 Sm(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 _m(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 Af(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Oi(e,t){return e<<32-t|e>>>t}function Tt(e,t){return e<<t|e>>>32-t>>>0}var sz=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function iz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function oz(e){for(let t=0;t<e.length;t++)e[t]=iz(e[t]);return e}var gE=sz?e=>e:oz,fD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",az=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Cm(e){if(nn(e),fD)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=az[e[r]];return t}var Aa={_0:48,_9:57,A:65,F:70,a:97,f:102};function lD(e){if(e>=Aa._0&&e<=Aa._9)return e-Aa._0;if(e>=Aa.A&&e<=Aa.F)return e-(Aa.A-10);if(e>=Aa.a&&e<=Aa.f)return e-(Aa.a-10)}function $d(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(fD)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=lD(e.charCodeAt(o)),a=lD(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 uz(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function vE(e,t=""){return typeof e=="string"?uz(e):nn(e,void 0,t)}function wE(...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 Dm(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 yE(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 ku(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 EE=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Fm=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if(Sa(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 bf(this),this.iHash.update(t),this}digestInto(t){bf(this),Sm(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()}},_o=(()=>{let e=((t,r,n)=>new Fm(t,r).update(n).digest());return e.create=(t,r)=>new Fm(t,r),e})();var hde=B(x(),1);function Pd(e,t,r){return Sa(e),r===void 0&&(r=new Uint8Array(e.outputLen)),_o(e,r,t)}var bE=Uint8Array.of(0),hD=Uint8Array.of();function AE(e,t,r,n=32){Sa(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=hD:nn(r,void 0,"info");let s=new Uint8Array(o*i),a=_o.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)bE[0]=h+1,u.update(h===0?hD:l).update(r).update(bE).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),zn(l,bE),s.slice(0,n)}var Tu=(e,t,r,n,i)=>AE(e,Pd(e,t,r),n,i);var Ade=B(x(),1);var mde=B(x(),1);function dD(e,t,r){return e&t^~e&r}function pD(e,t,r){return e&t^e&r^t&r}var kd=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=Af(this.buffer)}update(t){bf(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=Af(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){bf(this),Sm(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=Af(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()}},_a=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 gde=B(x(),1),Bm=BigInt(4294967295),mD=BigInt(32);function cz(e,t=!1){return t?{h:Number(e&Bm),l:Number(e>>mD&Bm)}:{h:Number(e>>mD&Bm)|0,l:Number(e&Bm)|0}}function gD(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}=cz(e[o],t);[n[o],i[o]]=[s,a]}return[n,i]}var SE=(e,t,r)=>e>>>r,_E=(e,t,r)=>e<<32-r|t>>>r,Hc=(e,t,r)=>e>>>r|t<<32-r,qc=(e,t,r)=>e<<32-r|t>>>r,Td=(e,t,r)=>e<<64-r|t>>>r-32,Rd=(e,t,r)=>e>>>r-32|t<<64-r;function Co(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var vD=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),wD=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,yD=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),ED=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,bD=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),AD=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;var fz=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),CE=class extends kd{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+dD(a,u,l)+fz[m]+Ru[m]|0,g=(Oi(n,2)^Oi(n,13)^Oi(n,22))+pD(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)}},DE=class extends CE{A=_a[0]|0;B=_a[1]|0;C=_a[2]|0;D=_a[3]|0;E=_a[4]|0;F=_a[5]|0;G=_a[6]|0;H=_a[7]|0;constructor(){super(32)}};var SD=gD(["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))),hz=SD[0],dz=SD[1],Ou=new Uint32Array(80),Nu=new Uint32Array(80),FE=class extends kd{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)Ou[_]=t.getUint32(r),Nu[_]=t.getUint32(r+=4);for(let _=16;_<80;_++){let C=Ou[_-15]|0,F=Nu[_-15]|0,H=Hc(C,F,1)^Hc(C,F,8)^SE(C,F,7),K=qc(C,F,1)^qc(C,F,8)^_E(C,F,7),S=Ou[_-2]|0,I=Nu[_-2]|0,M=Hc(S,I,19)^Td(S,I,61)^SE(S,I,6),L=qc(S,I,19)^Rd(S,I,61)^_E(S,I,6),T=yD(K,L,Nu[_-7],Nu[_-16]),O=ED(T,H,M,Ou[_-7],Ou[_-16]);Ou[_]=O|0,Nu[_]=T|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=Hc(m,p,14)^Hc(m,p,18)^Td(m,p,41),F=qc(m,p,14)^qc(m,p,18)^Rd(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=bD(E,F,K,dz[_],Nu[_]),I=AD(S,w,C,H,hz[_],Ou[_]),M=S|0,L=Hc(n,i,28)^Td(n,i,34)^Td(n,i,39),T=qc(n,i,28)^Rd(n,i,34)^Rd(n,i,39),O=n&o^n&a^o&a,R=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}=Co(l|0,h|0,I|0,M|0),l=a|0,h=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let N=vD(M,T,R);n=wD(N,I,L,O),i=N|0}({h:n,l:i}=Co(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Co(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=Co(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=Co(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=Co(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=Co(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=Co(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=Co(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(Ou,Nu)}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)}},BE=class extends FE{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=yE(()=>new DE,EE(1));var Im=yE(()=>new BE,EE(3));var J1e=B(x(),1);var _de=B(x(),1);function PE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function pz(e){if(!PE(e))throw new TypeError("Uint8Array expected")}function FD(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 mz(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function Mc(e,t){if(typeof t!="string")throw new TypeError(`${e}: string expected`);return!0}function kE(e){if(typeof e!="number")throw new TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function IE(e){if(!Array.isArray(e))throw new TypeError("array expected")}function $m(e,t){if(!FD(!0,t))throw new TypeError(`${e}: array of strings expected`)}function BD(e,t){if(!FD(!1,t))throw new TypeError(`${e}: array of numbers expected`)}function TE(...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 RE(e){let t=typeof e=="string"?e.split(""):e,r=t.length;$m("alphabet",t);let n=new Map(t.map((i,o)=>[i,o]));return{encode:i=>(IE(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=>(IE(i),i.map(o=>{Mc("alphabet.decode",o);let s=n.get(o);if(s===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return s}))}}function OE(e=""){return Mc("join",e),{encode:t=>($m("join.decode",t),t.join(e)),decode:t=>(Mc("join.decode",t),t.split(e))}}function gz(e,t="="){return kE(e),Mc("padding",t),{encode(r){for($m("padding.encode",r);r.length*e%8;)r.push(t);return r},decode(r){$m("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 ID=(e,t)=>t===0?e:ID(t,e%t),Pm=(e,t)=>e+(t-ID(e,t)),xm=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function xE(e,t,r,n){if(IE(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(Pm(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${Pm(t,r)}`);let i=0,o=0,s=xm[t],a=xm[r]-1,u=[];for(let l of e){if(kE(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=xm[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 NE(e,t=!1){if(kE(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(Pm(8,e)>32||Pm(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:r=>{if(!PE(r))throw new TypeError("radix2.encode input should be Uint8Array");return xE(Array.from(r),8,e,!t)},decode:r=>(BD("radix2.decode",r),Uint8Array.from(xE(r,e,8,t)))}}function _D(e){return mz(e),function(...t){try{return e.apply(null,t)}catch{}}}var vz=typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function",wz=/[\t\n\f\r ]/,yz=(e,t)=>{Mc("base64",e);let r=t?"base64url":"base64";if(e.length>0&&wz.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},LE=Object.freeze(vz?{encode(e){return pz(e),e.toBase64()},decode(e){return yz(e,!1)}}:TE(NE(6),RE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),gz(6),OE(""))),$n=Object.freeze(TE(NE(6),RE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),OE("")));var $E=TE(RE("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),OE("")),CD=[996825010,642813549,513874426,1027748829,705979059];function Od(e){let t=e>>25,r=(e&33554431)<<5;for(let n=0;n<CD.length;n++)(t>>n&1)===1&&(r^=CD[n]);return r}function DD(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=Od(i)^s>>5}i=Od(i);for(let o=0;o<n;o++)i=Od(i)^e.charCodeAt(o)&31;for(let o of t)i=Od(i)^o;for(let o=0;o<6;o++)i=Od(i);return i^=r,$E.encode(xE([i%xm[30]],30,5,!1))}function Ez(e){let t=e==="bech32"?1:734539939,r=NE(5),n=r.decode,i=r.encode,o=_D(n);function s(m,p,d=90){Mc("bech32.encode prefix",m),PE(p)&&(p=Array.from(p)),BD("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=DD(y,p,t);return`${y}1${$E.encode(p)}${w}`}function a(m,p=90){Mc("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=$E.decode(w).slice(0,-6),_=DD(y,E,t);if(!w.endsWith(_))throw new Error(`Invalid checksum in ${m}: expected "${_}"`);return{prefix:y,words:E}}let u=_D(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(Ez("bech32"));var kde=B(x(),1);var Bde=B(x(),1);function Az(e,t,r,n){Sa(e);let i=Dm({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=vE(t,"password"),l=vE(r,"salt"),h=new Uint8Array(s),m=_o.create(e,u),p=m._cloneInto().update(l);return{c:o,dkLen:s,asyncTick:a,DK:h,PRF:m,PRFSalt:p}}function Sz(e,t,r,n,i){return e.destroy(),t.destroy(),n&&n.destroy(),zn(i),r}function UE(e,t,r,n){let{c:i,dkLen:o,DK:s,PRF:a,PRFSalt:u}=Az(e,t,r,n),l,h=new Uint8Array(4),m=Af(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 Sz(a,u,s,l,p)}function xD(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,M=h,L=m,T=p,O=d,R=v,N=g,P=y,q=w,Y=E,V=_,X=C,te=F;for(let ae=0;ae<8;ae+=2)M^=Tt(H+Y|0,7),R^=Tt(M+H|0,9),Y^=Tt(R+M|0,13),H^=Tt(Y+R|0,18),N^=Tt(L+K|0,7),V^=Tt(N+L|0,9),K^=Tt(V+N|0,13),L^=Tt(K+V|0,18),X^=Tt(P+T|0,7),S^=Tt(X+P|0,9),T^=Tt(S+X|0,13),P^=Tt(T+S|0,18),I^=Tt(te+q|0,7),O^=Tt(I+te|0,9),q^=Tt(O+I|0,13),te^=Tt(q+O|0,18),K^=Tt(H+I|0,7),S^=Tt(K+H|0,9),I^=Tt(S+K|0,13),H^=Tt(I+S|0,18),T^=Tt(L+M|0,7),O^=Tt(T+L|0,9),M^=Tt(O+T|0,13),L^=Tt(M+O|0,18),q^=Tt(P+N|0,7),R^=Tt(q+P|0,9),N^=Tt(R+q|0,13),P^=Tt(N+R|0,18),Y^=Tt(te+X|0,7),V^=Tt(Y+te|0,9),X^=Tt(V+Y|0,13),te^=Tt(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+M|0,i[o++]=m+L|0,i[o++]=p+T|0,i[o++]=d+O|0,i[o++]=v+R|0,i[o++]=g+N|0,i[o++]=y+P|0,i[o++]=w+q|0,i[o++]=E+Y|0,i[o++]=_+V|0,i[o++]=C+X|0,i[o++]=F+te|0}function HE(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)xD(r,s,e,t,r,o),a>0&&(s+=16),xD(r,o,e,t+=16,r,s)}function _z(e,t,r){let n=Dm({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=UE(Dr,e,t,{c:1,dkLen:m*s}),y=_m(g),w=_m(new Uint8Array(m*i)),E=_m(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 Cz(e,t,r,n,i){let o=UE(Dr,e,r,{c:1,dkLen:t});return zn(r,n,i),o}function qE(e,t,r){let{N:n,r:i,p:o,dkLen:s,blockSize32:a,V:u,B32:l,B:h,tmp:m,blockMixCb:p}=_z(e,t,r);gE(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++)HE(u,y,u,y+=a,i),p();HE(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];HE(m,0,l,v,i),p()}}return gE(l),Cz(e,s,h,u,m)}var Qde=B(x(),1);var Ude=B(x(),1);var Rde=B(x(),1);function Dz(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function km(e){if(typeof e!="boolean")throw new TypeError(`boolean expected, not ${e}`)}function Sf(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 qr(e,t,r=""){let n=Dz(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 ME(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 $D(e,t,r=!1){qr(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&&!_f(e))throw new Error("invalid output, must be aligned")}function Do(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 Fz(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var jc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,Bz=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;var Iz=e=>{for(let t=0;t<e.length;t++)e[t]=Bz(e[t]);return e},Ca=jc?e=>e:Iz;function PD(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function kD(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 TD(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 RD=(e,t)=>{function r(n,...i){if(qr(n,void 0,"key"),e.nonceLength!==void 0){let h=i[0];qr(h,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let o=e.tagLength;o&&i[1]!==void 0&&qr(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");qr(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,qr(h),a(s.encrypt.length,m),s.encrypt(h,m)},decrypt(h,m){if(qr(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 Nd(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(qr(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(r&&!_f(t))throw new Error("invalid output, must be aligned");return t}function OD(e,t,r){Sf(e),Sf(t),km(r);let n=new Uint8Array(16),i=Fz(n);return i.setBigUint64(0,BigInt(t),r),i.setBigUint64(8,BigInt(e),r),n}function _f(e){return e.byteOffset%4===0}function Cf(e){return Uint8Array.from(qr(e))}var LD=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),xz=Ca(Do(LD("expand 16-byte k"))),$z=Ca(Do(LD("expand 32-byte k")));function Rt(e,t){return e<<t|e>>>32-t}var Ld=64,Pz=16,jE=2**32-1,ND=Uint32Array.of();function kz(e,t,r,n,i,o,s,a){let u=i.length,l=new Uint8Array(Ld),h=Do(l),m=jc&&_f(i)&&_f(o),p=m?Do(i):ND,d=m?Do(o):ND;if(!jc){for(let v=0;v<u;s++){if(e(t,r,n,h,s,a),Ca(h),s>=jE)throw new Error("arx: counter overflow");let g=Math.min(Ld,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>=jE)throw new Error("arx: counter overflow");let g=Math.min(Ld,u-v);if(m&&g===Ld){let y=v/4;if(v%4!==0)throw new Error("arx: invalid block position");for(let w=0,E;w<Pz;w++)E=y+w,d[E]=p[E]^h[w];v+=Ld;continue}for(let y=0,w;y<g;y++)w=v+y,o[w]=i[w]^l[y];v+=g}}function UD(e,t){let{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:o,rounds:s}=PD({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return Sf(i),Sf(s),km(o),km(r),(a,u,l,h,m=0)=>{qr(a,void 0,"key"),qr(u,void 0,"nonce"),qr(l,void 0,"data");let p=l.length;if(h=Nd(p,h,!1),Sf(m),m<0||m>=jE)throw new Error("arx: counter overflow");let d=[],v=a.length,g,y;if(v===32)d.push(g=Cf(a)),y=$z;else if(v===16&&r)g=new Uint8Array(32),g.set(a),g.set(a,16),y=xz,d.push(g);else throw qr(a,32,"arx key"),new Error("invalid key size");(!jc||!_f(u))&&d.push(u=Cf(u));let w=Do(g);if(n){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let C=u.subarray(0,16);if(jc)n(y,w,Do(C),w);else{let F=Ca(Uint32Array.from(y));n(F,w,Do(C),w),Ni(F),Ca(w)}u=u.subarray(16)}else jc||Ca(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 _=Ca(Do(u));try{return kz(e,y,w,_,l,h,m,s),h}finally{Ni(...d)}}}var zde=B(x(),1);function on(e,t){return e[t++]&255|(e[t++]&255)<<8}var KE=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=Cf(qr(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),M=o[1]+((w>>>13|E<<3)&8191),L=o[2]+((E>>>10|_<<6)&8191),T=o[3]+((_>>>7|C<<9)&8191),O=o[4]+((C>>>4|F<<12)&8191),R=o[5]+(F>>>1&8191),N=o[6]+((F>>>14|H<<2)&8191),P=o[7]+((H>>>11|K<<5)&8191),q=o[8]+((K>>>8|S<<8)&8191),Y=o[9]+(S>>>5|i),V=0,X=V+I*a+M*(5*y)+L*(5*g)+T*(5*v)+O*(5*d);V=X>>>13,X&=8191,X+=R*(5*p)+N*(5*m)+P*(5*h)+q*(5*l)+Y*(5*u),V+=X>>>13,X&=8191;let te=V+I*u+M*a+L*(5*y)+T*(5*g)+O*(5*v);V=te>>>13,te&=8191,te+=R*(5*d)+N*(5*p)+P*(5*m)+q*(5*h)+Y*(5*l),V+=te>>>13,te&=8191;let ae=V+I*l+M*u+L*a+T*(5*y)+O*(5*g);V=ae>>>13,ae&=8191,ae+=R*(5*v)+N*(5*d)+P*(5*p)+q*(5*m)+Y*(5*h),V+=ae>>>13,ae&=8191;let me=V+I*h+M*l+L*u+T*a+O*(5*y);V=me>>>13,me&=8191,me+=R*(5*g)+N*(5*v)+P*(5*d)+q*(5*p)+Y*(5*m),V+=me>>>13,me&=8191;let he=V+I*m+M*h+L*l+T*u+O*a;V=he>>>13,he&=8191,he+=R*(5*y)+N*(5*g)+P*(5*v)+q*(5*d)+Y*(5*p),V+=he>>>13,he&=8191;let De=V+I*p+M*m+L*h+T*l+O*u;V=De>>>13,De&=8191,De+=R*a+N*(5*y)+P*(5*g)+q*(5*v)+Y*(5*d),V+=De>>>13,De&=8191;let Pe=V+I*d+M*p+L*m+T*h+O*l;V=Pe>>>13,Pe&=8191,Pe+=R*u+N*a+P*(5*y)+q*(5*g)+Y*(5*v),V+=Pe>>>13,Pe&=8191;let Ie=V+I*v+M*d+L*p+T*m+O*h;V=Ie>>>13,Ie&=8191,Ie+=R*l+N*u+P*a+q*(5*y)+Y*(5*g),V+=Ie>>>13,Ie&=8191;let se=V+I*g+M*v+L*d+T*p+O*m;V=se>>>13,se&=8191,se+=R*h+N*l+P*u+q*a+Y*(5*y),V+=se>>>13,se&=8191;let pe=V+I*y+M*g+L*v+T*d+O*p;V=pe>>>13,pe&=8191,pe+=R*m+N*h+P*l+q*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){ME(this),qr(t),t=Cf(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){ME(this),$D(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}},HD=TD(32,e=>new KE(e));function Tz(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,M=h,L=m,T=p,O=d,R=v,N=g,P=y,q=w,Y=E,V=_,X=C,te=F;for(let me=0;me<o;me+=2)H=H+M|0,Y=Rt(Y^H,16),R=R+Y|0,M=Rt(M^R,12),H=H+M|0,Y=Rt(Y^H,8),R=R+Y|0,M=Rt(M^R,7),K=K+L|0,V=Rt(V^K,16),N=N+V|0,L=Rt(L^N,12),K=K+L|0,V=Rt(V^K,8),N=N+V|0,L=Rt(L^N,7),S=S+T|0,X=Rt(X^S,16),P=P+X|0,T=Rt(T^P,12),S=S+T|0,X=Rt(X^S,8),P=P+X|0,T=Rt(T^P,7),I=I+O|0,te=Rt(te^I,16),q=q+te|0,O=Rt(O^q,12),I=I+O|0,te=Rt(te^I,8),q=q+te|0,O=Rt(O^q,7),H=H+L|0,te=Rt(te^H,16),P=P+te|0,L=Rt(L^P,12),H=H+L|0,te=Rt(te^H,8),P=P+te|0,L=Rt(L^P,7),K=K+T|0,Y=Rt(Y^K,16),q=q+Y|0,T=Rt(T^q,12),K=K+T|0,Y=Rt(Y^K,8),q=q+Y|0,T=Rt(T^q,7),S=S+O|0,V=Rt(V^S,16),R=R+V|0,O=Rt(O^R,12),S=S+O|0,V=Rt(V^S,8),R=R+V|0,O=Rt(O^R,7),I=I+M|0,X=Rt(X^I,16),N=N+X|0,M=Rt(M^N,12),I=I+M|0,X=Rt(X^I,8),N=N+X|0,M=Rt(M^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+M|0,n[ae++]=m+L|0,n[ae++]=p+T|0,n[ae++]=d+O|0,n[ae++]=v+R|0,n[ae++]=g+N|0,n[ae++]=y+P|0,n[ae++]=w+q|0,n[ae++]=E+Y|0,n[ae++]=_+V|0,n[ae++]=C+X|0,n[ae++]=F+te|0}var Rz=UD(Tz,{counterRight:!1,counterLength:4,allowShortKeys:!1});var Oz=new Uint8Array(16),qD=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(Oz.subarray(r))},Nz=new Uint8Array(32);function MD(e,t,r,n,i){i!==void 0&&qr(i,void 0,"AAD");let o=e(t,r,Nz),s=OD(n.length,i?i.length:0,!0),a=HD.create(o);i&&qD(a,i),qD(a,n),a.update(s);let u=a.digest();return Ni(o,s),u}var Lz=e=>(t,r,n)=>({encrypt(o,s){let a=o.length;s=Nd(a+16,s,!1),s.set(o);let u=s.subarray(0,-16);e(t,r,u,u,1);let l=MD(e,t,r,u,n);return s.set(l,a),Ni(l),s},decrypt(o,s){s=Nd(o.length-16,s,!1);let a=o.subarray(0,-16),u=o.subarray(-16),l=MD(e,t,r,a,n);if(!kD(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=RD({blockSize:64,nonceLength:12,tagLength:16},Lz(Rz));var N0e=B(x(),1);var spe=B(x(),1);var tpe=B(x(),1);function Df(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=Df(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 Fa(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 Tm(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 Rm(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 Om(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Li(e,t){return e<<32-t|e>>>t}var Uz=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Hz(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function qz(e){for(let t=0;t<e.length;t++)e[t]=Hz(e[t]);return e}var VE=Uz?e=>e:qz,KD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Mz=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kc(e){if(Je(e),KD)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=Mz[e[r]];return t}var Da={_0:48,_9:57,A:65,F:70,a:97,f:102};function jD(e){if(e>=Da._0&&e<=Da._9)return e-Da._0;if(e>=Da.A&&e<=Da.F)return e-(Da.A-10);if(e>=Da.a&&e<=Da.f)return e-(Da.a-10)}function Vc(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(KD)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=jD(e.charCodeAt(o)),a=jD(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 Ff(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 Lu(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 Uu=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var GE=BigInt(0),zE=BigInt(1);function Ud(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new Error(r+"expected boolean, got type="+typeof e)}return e}function VD(e){if(typeof e=="bigint"){if(!Nm(e))throw new Error("positive bigint expected, got "+e)}else Zr(e);return e}function Hd(e){let t=VD(e).toString(16);return t.length&1?"0"+t:t}function zD(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?GE:BigInt("0x"+e)}function Hu(e){return zD(Kc(e))}function qu(e){return zD(Kc(Lm(Je(e)).reverse()))}function Bf(e,t){Zr(t),e=VD(e);let r=Vc(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw new Error("number too large");return r}function qd(e,t){return Bf(e,t).reverse()}function Lm(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 Nm=e=>typeof e=="bigint"&&GE<=e;function jz(e,t,r){return Nm(e)&&Nm(t)&&Nm(r)&&t<=e&&e<r}function Md(e,t,r,n){if(!jz(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function WE(e){let t;for(t=0;e>GE;e>>=zE,t+=1);return t}var jd=e=>(zE<<BigInt(e))-zE;function GD(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 zc(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 YE(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 hpe=B(x(),1);var upe=B(x(),1);var Wn=BigInt(0),Pn=BigInt(1),Gc=BigInt(2),XD=BigInt(3),ZD=BigInt(4),JD=BigInt(5),Kz=BigInt(7),QD=BigInt(8),Vz=BigInt(9),eF=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 WD(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 ZE(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function tF(e,t){let r=(e.ORDER+Pn)/ZD,n=e.pow(t,r);return ZE(e,n,t),n}function zz(e,t){let r=(e.ORDER-JD)/QD,n=e.mul(t,Gc),i=e.pow(n,r),o=e.mul(t,i),s=e.mul(e.mul(o,Gc),i),a=e.mul(o,e.sub(s,e.ONE));return ZE(e,a,t),a}function Gz(e){let t=Um(e),r=rF(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+Kz)/eF;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 ZE(a,y,u),y}}function rF(e){if(e<XD)throw new Error("sqrt is not defined for small field");let t=e-Pn,r=0;for(;t%Gc===Wn;)t/=Gc,r++;let n=Gc,i=Um(e);for(;YD(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return tF;let o=i.pow(n,t),s=(t+Pn)/Gc;return function(u,l){if(u.is0(l))return l;if(YD(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 Wz(e){return e%ZD===XD?tF:e%QD===JD?zz:e%eF===Vz?Gz(e):rF(e)}var Yz=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function JE(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=Yz.reduce((n,i)=>(n[i]="function",n),t);return zc(e,r),e}function Xz(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 Kd(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 YD(e,t){let r=(e.ORDER-Pn)/Gc,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 Zz(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 XE=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}=Zz(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 Xz(this,t,r)}div(t,r){return Gn(t*WD(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 WD(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=Wz(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?qd(t,this.BYTES):Bf(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?qu(t):Hu(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 Kd(this,t)}cmov(t,r,n){return n?r:t}};function Um(e,t={}){return new XE(e,t)}function nF(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 QE(e){let t=nF(e);return t+Math.ceil(t/2)}function sF(e,t,r=!1){Je(e);let n=e.length,i=nF(t),o=QE(t);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?qu(e):Hu(e),a=Gn(s,t-Pn)+Pn;return r?qd(a,i):Bf(a,i)}var If=BigInt(0),Wc=BigInt(1);function Vd(e,t){let r=t.negate();return e?r:t}function nb(e,t){let r=Kd(e.Fp,t.map(n=>n.Z));return t.map((n,i)=>e.fromAffine(n.toAffine(r[i])))}function uF(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function eb(e,t){uF(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e,o=jd(e),s=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function iF(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+=Wc);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 tb=new WeakMap,cF=new WeakMap;function rb(e){return cF.get(e)||1}function oF(e){if(e!==If)throw new Error("invalid wNAF")}var Hm=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>If;)r&Wc&&(n=n.add(i)),i=i.double(),r>>=Wc;return n}precomputeWindow(t,r){let{windows:n,windowSize:i}=eb(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=eb(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=iF(n,a,s);n=u,h?o=o.add(Vd(p,r[d])):i=i.add(Vd(m,r[l]))}return oF(n),{p:i,f:o}}wNAFUnsafe(t,r,n,i=this.ZERO){let o=eb(t,this.bits);for(let s=0;s<o.windows&&n!==If;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=iF(n,s,o);if(n=a,!l){let m=r[u];i=i.add(h?m.negate():m)}}return oF(n),i}getPrecomputes(t,r,n){let i=tb.get(r);return i||(i=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(i=n(i)),tb.set(r,i))),i}cached(t,r,n){let i=rb(t);return this.wNAF(i,this.getPrecomputes(i,t,n),r)}unsafe(t,r,n,i){let o=rb(t);return o===1?this._unsafeLadder(t,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,i)}createCache(t,r){uF(r,this.bits),cF.set(t,r),tb.delete(t)}hasCache(t){return rb(t)!==1}};function lF(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>If||n>If;)r&Wc&&(o=o.add(i)),n&Wc&&(s=s.add(i)),i=i.double(),r>>=Wc,n>>=Wc;return{p1:o,p2:s}}function aF(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return JE(t),t}else return Um(e,{isLE:r})}function fF(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>If))throw new Error(`CURVE.${u} must be positive bigint`)}let i=aF(t.p,r.Fp,n),o=aF(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 qm(e,t){return function(n){let i=e(n);return{secretKey:i,publicKey:t(i)}}}var vpe=B(x(),1);var zd=BigInt(0),xf=BigInt(1),Mm=BigInt(2);function Jz(e){return zc(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function hF(e){let t=Jz(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||Lu,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?Mm**BigInt(254):Mm**BigInt(447),v=a?BigInt(8)*Mm**BigInt(251)-xf:BigInt(4)*Mm**BigInt(445)-xf,g=d+v+xf,y=R=>Gn(R,r),w=E(m);function E(R){return qd(y(R),h)}function _(R){let N=Lm(Je(R,h,"uCoordinate"));return a&&(N[31]&=127),y(qu(N))}function C(R){return qu(i(Lm(Je(R,h,"scalar"))))}function F(R,N){let P=M(_(N),C(R));if(P===zd)throw new Error("invalid private or public key received");return E(P)}function H(R){return F(R,w)}let K=H,S=F;function I(R,N,P){let q=y(R*(N-P));return N=y(N-q),P=y(P+q),{x_2:N,x_3:P}}function M(R,N){Md("u",R,zd,r),Md("scalar",N,d,g);let P=N,q=R,Y=xf,V=zd,X=R,te=xf,ae=zd;for(let he=BigInt(l-1);he>=zd;he--){let De=P>>he&xf;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,Re=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Re*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(q*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},T=(R=u(h))=>(Je(R,L.seed,"seed"),R),O={randomSecretKey:T};return Object.freeze({keygen:qm(T,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var Fpe=B(x(),1);var Epe=B(x(),1);var jm=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 Fa(this),this.iHash.update(t),this}digestInto(t){Fa(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()}},$f=(e,t,r)=>new jm(e,t).update(r).digest();$f.create=(e,t)=>new jm(e,t);var dF=(e,t)=>(e+(e>=0?t:-t)/pF)/t;function Qz(e,t,r){let[[n,i],[o,s]]=t,a=dF(s*e,r),u=dF(-i*e,r),l=e-a*n-u*o,h=-a*i-u*s,m=l<Ba,p=h<Ba;m&&(l=-l),p&&(h=-h);let d=jd(Math.ceil(WE(r)/2))+Pf;if(l<Ba||l>=d||h<Ba||h>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:m,k1:l,k2neg:p,k2:h}}function ib(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function sb(e,t){let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return Ud(r.lowS,"lowS"),Ud(r.prehash,"prehash"),r.format!==void 0&&ib(r.format),r}var ob=class extends Error{constructor(t=""){super(t)}},ju={Err:ob,_tlv:{encode:(e,t)=>{let{Err:r}=ju;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=Hd(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?Hd(i.length/2|128):"";return Hd(e)+o+i+t},decode(e,t){let{Err:r}=ju,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}=ju;if(e<Ba)throw new t("integer: negative integers are not allowed");let r=Hd(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}=ju;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 Hu(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=ju,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}=ju,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s)),o=n+i;return t.encode(48,o)}},Ba=BigInt(0),Pf=BigInt(1),pF=BigInt(2),Km=BigInt(3),eG=BigInt(4);function ab(e,t={}){let r=fF("weierstrass",e,t),{Fp:n,Fn:i}=r,o=r.CURVE,{h:s,n:a}=o;zc(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=gF(n,i);function h(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(T,O,R){let{x:N,y:P}=O.toAffine(),q=n.toBytes(N);if(Ud(R,"isCompressed"),R){h();let Y=!n.isOdd(P);return xr(mF(Y),q)}else return xr(Uint8Array.of(4),q,n.toBytes(P))}function p(T){Je(T,void 0,"Point");let{publicKey:O,publicKeyUncompressed:R}=l,N=T.length,P=T[0],q=T.subarray(1);if(N===O&&(P===2||P===3)){let Y=n.fromBytes(q);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===R&&P===4){let Y=n.BYTES,V=n.fromBytes(q.subarray(0,Y)),X=n.fromBytes(q.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=${R}`)}let d=t.toBytes||m,v=t.fromBytes||p;function g(T){let O=n.sqr(T),R=n.mul(O,T);return n.add(n.add(R,n.mul(T,o.a)),o.b)}function y(T,O){let R=n.sqr(O),N=g(T);return n.eql(R,N)}if(!y(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let w=n.mul(n.pow(o.a,Km),eG),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 _(T,O,R=!1){if(!n.isValid(O)||R&&n.is0(O))throw new Error(`bad point coordinate ${T}`);return O}function C(T){if(!(T instanceof I))throw new Error("Weierstrass Point expected")}function F(T){if(!u||!u.basises)throw new Error("no endo");return Qz(T,u.basises,i.ORDER)}let H=YE((T,O)=>{let{X:R,Y:N,Z:P}=T;if(n.eql(P,n.ONE))return{x:R,y:N};let q=T.is0();O==null&&(O=q?n.ONE:n.inv(P));let Y=n.mul(R,O),V=n.mul(N,O),X=n.mul(P,O);if(q)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=YE(T=>{if(T.is0()){if(t.allowInfinityPoint&&!n.is0(T.Y))return;throw new Error("bad point: ZERO")}let{x:O,y:R}=T.toAffine();if(!n.isValid(O)||!n.isValid(R))throw new Error("bad point: x or y not field elements");if(!y(O,R))throw new Error("bad point: equation left != right");if(!T.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function S(T,O,R,N,P){return R=new I(n.mul(R.X,T),R.Y,R.Z),O=Vd(N,O),R=Vd(P,R),O.add(R)}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,R,N){this.X=_("x",O),this.Y=_("y",R,!0),this.Z=_("z",N),Object.freeze(this)}static CURVE(){return o}static fromAffine(O){let{x:R,y:N}=O||{};if(!O||!n.isValid(R)||!n.isValid(N))throw new Error("invalid affine point");if(O instanceof I)throw new Error("projective point not allowed");return n.is0(R)&&n.is0(N)?I.ZERO:new I(R,N,n.ONE)}static fromBytes(O){let R=I.fromAffine(v(Je(O,void 0,"point")));return R.assertValidity(),R}static fromHex(O){return I.fromBytes(Vc(O))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(O=8,R=!0){return L.createCache(this,O),R||this.multiply(Km),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:R,Y:N,Z:P}=this,{X:q,Y,Z:V}=O,X=n.eql(n.mul(R,V),n.mul(q,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:R}=o,N=n.mul(R,Km),{X:P,Y:q,Z:Y}=this,V=n.ZERO,X=n.ZERO,te=n.ZERO,ae=n.mul(P,P),me=n.mul(q,q),he=n.mul(Y,Y),De=n.mul(P,q);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(q,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:R,Y:N,Z:P}=this,{X:q,Y,Z:V}=O,X=n.ZERO,te=n.ZERO,ae=n.ZERO,me=o.a,he=n.mul(o.b,Km),De=n.mul(R,q),Pe=n.mul(N,Y),Ie=n.mul(P,V),se=n.add(R,N),pe=n.add(q,Y);se=n.mul(se,pe),pe=n.add(De,Pe),se=n.sub(se,pe),pe=n.add(R,P);let Fe=n.add(q,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:R}=t;if(!i.isValidNot0(O))throw new Error("invalid scalar: out of range");let N,P,q=Y=>L.cached(this,Y,V=>nb(I,V));if(R){let{k1neg:Y,k1:V,k2neg:X,k2:te}=F(O),{p:ae,f:me}=q(V),{p:he,f:De}=q(te);P=me.add(De),N=S(R.beta,ae,he,Y,X)}else{let{p:Y,f:V}=q(O);N=Y,P=V}return nb(I,[N,P])[0]}multiplyUnsafe(O){let{endo:R}=t,N=this;if(!i.isValid(O))throw new Error("invalid scalar: out of range");if(O===Ba||N.is0())return I.ZERO;if(O===Pf)return N;if(L.hasCache(this))return this.multiply(O);if(R){let{k1neg:P,k1:q,k2neg:Y,k2:V}=F(O),{p1:X,p2:te}=lF(I,N,q,V);return S(R.beta,X,te,P,Y)}else return L.unsafe(N,O)}toAffine(O){return H(this,O)}isTorsionFree(){let{isTorsionFree:O}=t;return s===Pf?!0:O?O(I,this):L.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:O}=t;return s===Pf?this:O?O(I,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(O=!0){return Ud(O,"isCompressed"),this.assertValidity(),d(I,this,O)}toHex(O=!0){return Kc(this.toBytes(O))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let M=i.BITS,L=new Hm(I,t.endo?Math.ceil(M/2):M);return I.BASE.precompute(8),I}function mF(e){return Uint8Array.of(e?2:3)}function gF(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function tG(e,t={}){let{Fn:r}=e,n=t.randomBytes||Lu,i=Object.assign(gF(e.Fp,r),{seed:QE(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 sF(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(!Df(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=qm(a,u);return Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function ub(e,t,r={}){ii(t),zc(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes||Lu,i=r.hmac||((R,N)=>$f(t,R,N)),{Fp:o,Fn:s}=e,{ORDER:a,BITS:u}=s,{keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d}=tG(e,r),v={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},g=a*pF<o.ORDER;function y(R){let N=a>>Pf;return R>N}function w(R,N){if(!s.isValidNot0(N))throw new Error(`invalid signature ${R}: 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 _(R,N){ib(N);let P=d.signature,q=N==="compact"?P:N==="recovered"?P+1:void 0;return Je(R,q)}class C{r;s;recovery;constructor(N,P,q){if(this.r=w("r",N),this.s=w("s",P),q!=null){if(E(),![0,1,2,3].includes(q))throw new Error("invalid recovery id");this.recovery=q}Object.freeze(this)}static fromBytes(N,P=v.format){_(N,P);let q;if(P==="der"){let{r:te,s:ae}=ju.toSig(Je(N));return new C(te,ae)}P==="recovered"&&(q=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),q)}static fromHex(N,P){return this.fromBytes(Vc(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:q}=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(mF((Y&1)===0),X)),ae=s.inv(V),me=H(Je(N,void 0,"msgHash")),he=s.create(-me*ae),De=s.create(q*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(ib(N),N==="der")return Vc(ju.hexFromSig(this));let{r:P,s:q}=this,Y=s.toBytes(P),V=s.toBytes(q);return N==="recovered"?(E(),xr(Uint8Array.of(this.assertRecovery()),Y,V)):xr(Y,V)}toHex(N){return Kc(this.toBytes(N))}}let F=r.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");let P=Hu(N),q=N.length*8-u;return q>0?P>>BigInt(q):P},H=r.bits2int_modN||function(N){return s.create(F(N))},K=jd(u);function S(R){return Md("num < 2^"+u,R,Ba,K),s.toBytes(R)}function I(R,N){return Je(R,void 0,"message"),N?Je(t(R),void 0,"prehashed message"):R}function M(R,N,P){let{lowS:q,prehash:Y,extraEntropy:V}=sb(P,v);R=I(R,Y);let X=H(R),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===Ba)return;let Re=s.create(se*s.create(he+Fe*te));if(Re===Ba)return;let Ve=(pe.x===Fe?0:2)|Number(pe.y&Pf),Oe=Re;return q&&y(Re)&&(Oe=s.neg(Re),Ve^=1),new C(Fe,Oe,g?void 0:Ve)}return{seed:me,k2sig:De}}function L(R,N,P={}){let{seed:q,k2sig:Y}=M(R,N,P);return GD(t.outputLen,s.BYTES,i)(q,Y).toBytes(P.format)}function T(R,N,P,q={}){let{lowS:Y,prehash:V,format:X}=sb(q,v);if(P=Je(P,void 0,"publicKey"),N=I(N,V),!Df(R)){let te=R instanceof C?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}_(R,X);try{let te=C.fromBytes(R,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(R,N,P={}){let{prehash:q}=sb(P,v);return N=I(N,q),C.fromBytes(R,"recovered").recoverPublicKey(N).toBytes()}return Object.freeze({keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d,Point:e,sign:L,verify:T,recoverPublicKey:O,Signature:C,hash:t})}var Kpe=B(x(),1);var Npe=B(x(),1);var xpe=B(x(),1);function vF(e,t,r){return e&t^~e&r}function wF(e,t,r){return e&t^e&r^t&r}var Gd=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=Om(this.buffer)}update(t){Fa(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=Om(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){Fa(this),Tm(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=Om(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()}},Ia=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 $pe=B(x(),1),Vm=BigInt(4294967295),yF=BigInt(32);function rG(e,t=!1){return t?{h:Number(e&Vm),l:Number(e>>yF&Vm)}:{h:Number(e>>yF&Vm)|0,l:Number(e&Vm)|0}}function zm(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}=rG(e[o],t);[n[o],i[o]]=[s,a]}return[n,i]}var cb=(e,t,r)=>e>>>r,lb=(e,t,r)=>e<<32-r|t>>>r,Yc=(e,t,r)=>e>>>r|t<<32-r,Xc=(e,t,r)=>e<<32-r|t>>>r,Wd=(e,t,r)=>e<<64-r|t>>>r-32,Yd=(e,t,r)=>e>>>r-32|t<<64-r;var EF=(e,t,r)=>e<<r|t>>>32-r,bF=(e,t,r)=>t<<r|e>>>32-r,AF=(e,t,r)=>t<<r-32|e>>>64-r,SF=(e,t,r)=>e<<r-32|t>>>64-r;function Fo(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var _F=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),CF=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,DF=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),FF=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,BF=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),IF=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;var sG=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]),Ku=new Uint32Array(64),fb=class extends Gd{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)Ku[m]=t.getUint32(r,!1);for(let m=16;m<64;m++){let p=Ku[m-15],d=Ku[m-2],v=Li(p,7)^Li(p,18)^p>>>3,g=Li(d,17)^Li(d,19)^d>>>10;Ku[m]=g+Ku[m-7]+v+Ku[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+vF(a,u,l)+sG[m]+Ku[m]|0,g=(Li(n,2)^Li(n,13)^Li(n,22))+wF(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(Ku)}destroy(){this.set(0,0,0,0,0,0,0,0),ws(this.buffer)}},hb=class extends fb{A=Ia[0]|0;B=Ia[1]|0;C=Ia[2]|0;D=Ia[3]|0;E=Ia[4]|0;F=Ia[5]|0;G=Ia[6]|0;H=Ia[7]|0;constructor(){super(32)}};var xF=zm(["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))),iG=xF[0],oG=xF[1],Vu=new Uint32Array(80),zu=new Uint32Array(80),db=class extends Gd{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)Vu[_]=t.getUint32(r),zu[_]=t.getUint32(r+=4);for(let _=16;_<80;_++){let C=Vu[_-15]|0,F=zu[_-15]|0,H=Yc(C,F,1)^Yc(C,F,8)^cb(C,F,7),K=Xc(C,F,1)^Xc(C,F,8)^lb(C,F,7),S=Vu[_-2]|0,I=zu[_-2]|0,M=Yc(S,I,19)^Wd(S,I,61)^cb(S,I,6),L=Xc(S,I,19)^Yd(S,I,61)^lb(S,I,6),T=DF(K,L,zu[_-7],zu[_-16]),O=FF(T,H,M,Vu[_-7],Vu[_-16]);Vu[_]=O|0,zu[_]=T|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=Yc(m,p,14)^Yc(m,p,18)^Wd(m,p,41),F=Xc(m,p,14)^Xc(m,p,18)^Yd(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=BF(E,F,K,oG[_],zu[_]),I=IF(S,w,C,H,iG[_],Vu[_]),M=S|0,L=Yc(n,i,28)^Wd(n,i,34)^Wd(n,i,39),T=Xc(n,i,28)^Yd(n,i,34)^Yd(n,i,39),O=n&o^n&a^o&a,R=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}=Fo(l|0,h|0,I|0,M|0),l=a|0,h=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let N=_F(M,T,R);n=CF(N,I,L,O),i=N|0}({h:n,l:i}=Fo(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Fo(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=Fo(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=Fo(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=Fo(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=Fo(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=Fo(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=Fo(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(Vu,zu)}destroy(){ws(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var pb=class extends db{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 Gm=Ff(()=>new hb,Uu(1));var $F=Ff(()=>new pb,Uu(2));var aG=BigInt(1),PF=BigInt(2),uG=BigInt(3),cG=BigInt(5),Mpe=BigInt(8),kF=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");function lG(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=kF,a=e*e%o*e%o,u=oi(a,PF,o)*a%o,l=oi(u,aG,o)*e%o,h=oi(l,cG,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,PF,o)*e%o,b2:a}}function fG(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var TF=(()=>{let e=kF;return hF({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=lG(t);return Gn(oi(r,uG,e)*n,e)},adjustScalarBytes:fG})})();var Xpe=B(x(),1);var hG={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},dG={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")};var pG=ab(hG),mb=ub(pG,Gm);var mG=ab(dG),RF=ub(mG,$F);var e0e=B(x(),1);function NF(e,t,r){return ii(e),r===void 0&&(r=new Uint8Array(e.outputLen)),$f(e,r,t)}var gb=Uint8Array.of(0),OF=Uint8Array.of();function LF(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=OF:Je(r,void 0,"info");let s=new Uint8Array(o*i),a=$f.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)gb[0]=h+1,u.update(h===0?OF:l).update(r).update(gb).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),ws(l,gb),s.slice(0,n)}var s0e=B(x(),1);var gG=BigInt(0),Xd=BigInt(1),vG=BigInt(2),wG=BigInt(7),yG=BigInt(256),EG=BigInt(113),qF=[],MF=[],jF=[];for(let e=0,t=Xd,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],qF.push(2*(5*n+r)),MF.push((e+1)*(e+2)/2%64);let i=gG;for(let o=0;o<7;o++)t=(t<<Xd^(t>>wG)*EG)%yG,t&vG&&(i^=Xd<<(Xd<<BigInt(o))-Xd);jF.push(i)}var KF=zm(jF,!0),bG=KF[0],AG=KF[1],UF=(e,t,r)=>r>32?AF(e,t,r):EF(e,t,r),HF=(e,t,r)=>r>32?SF(e,t,r):bF(e,t,r);function SG(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=UF(l,h,1)^r[a],p=HF(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=MF[s],u=UF(i,o,a),l=HF(i,o,a),h=qF[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]^=bG[n],e[1]^=AG[n]}ws(r)}var Wm=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=Rm(this.state)}clone(){return this._cloneInto()}keccak(){VE(this.state32),SG(this.state32,this.rounds),VE(this.state32),this.posOut=0,this.pos=0}update(t){Fa(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){Fa(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(Tm(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}},VF=(e,t,r,n={})=>Ff(()=>new Wm(t,e,r),n);var Zc=VF(6,136,32,Uu(8));var zF=VF(6,72,64,Uu(10));var GF=(e,t,r,n={})=>Ff((i={})=>new Wm(t,e,i.dkLen===void 0?r:i.dkLen,!0),n),WF=GF(31,168,16,Uu(11)),Bo=GF(31,136,32,Uu(12));var S0e=B(x(),1);var g0e=B(x(),1);var o0e=B(x(),1);function vb(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function XF(e){return vb(e),(e&e-1)===0&&e!==0}function wb(e,t){vb(e);let r=0;for(let n=0;n<t;n++,e>>>=1)r=r<<1|e&1;return r}function ZF(e){return vb(e),31-Math.clz32(e)}function YF(e){let t=e.length;if(t<2||!XF(t))throw new Error("n must be a power of 2 and greater than 1. Got "+t);let r=ZF(t);for(let n=0;n<t;n++){let i=wb(n,r);if(n<i){let o=e[n];e[n]=e[i],e[i]=o}}return e}var yb=(e,t)=>{let{N:r,roots:n,dit:i,invertButterflies:o=!1,skipStages:s=0,brp:a=!0}=t,u=ZF(r);if(!XF(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&&YF(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 M=e.mul(S,K);h[F]=e.add(I,M),h[H]=e.sub(I,M)}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&&YF(h),h}};var l0e=B(x(),1);var Io=Lu;function Ym(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 JF(e){return Uint8Array.from(e)}function Jc(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 Xm(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 Mr(...e){for(let t of e)if(Array.isArray(t))for(let r of t)r.fill(0);else t.fill(0)}function Eb(e){return(1<<e)-1}var u0e=Uint8Array.of();var QF=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=wb(_,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=yb(p,{dit:!1,...d}),g=yb(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=Eb(E),F=E*(r/8);return{bytesLen:F,encode:H=>{let K=new Uint8Array(F);for(let S=0,I=0,M=0,L=0;S<H.length;S++)for(I|=(_.encode(H[S])&C)<<M,M+=E;M>=8;M-=8,I>>=8)K[L++]=I&Eb(M);return K},decode:H=>{let K=t(r);for(let S=0,I=0,M=0,L=0;S<H.length;S++)for(I|=H[S]<<M,M+=8;M>=E;M-=E,I>>=E)K[L++]=_.decode(I&C);return K}}}}},_G=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(),Mr(o,n)}}},eB=_G(WF);var kn=256,xa=3329,CG=3303,DG=17,{mod:Qd,nttZetas:FG,NTT:Qc,bitsCoder:BG}=QF({N:kn,Q:xa,F:CG,ROOT_OF_UNITY:DG,newPoly:e=>new Uint16Array(e),brvBits:7,isKyber:!0}),bb={512:{N:kn,Q:xa,K:2,ETA1:3,ETA2:2,du:10,dv:4,RBGstrength:128},768:{N:kn,Q:xa,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:kn,Q:xa,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}},IG=e=>{if(e>=12)return{encode:r=>r,decode:r=>r};let t=2**(e-1);return{encode:r=>((r<<e)+xa/2)/xa,decode:r=>r*xa+t>>>e}},Zd=e=>BG(e,IG(e));function el(e,t){for(let r=0;r<kn;r++)e[r]=Qd(e[r]+t[r])}function xG(e,t){for(let r=0;r<kn;r++)e[r]=Qd(e[r]-t[r])}function $G(e,t,r,n,i){let o=Qd(t*n*i+e*r),s=Qd(e*n+t*r);return{c0:o,c1:s}}function Zm(e,t){for(let r=0;r<kn/2;r++){let n=FG[64+(r>>1)];r&1&&(n=-n);let{c0:i,c1:o}=$G(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 tB(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<xa&&(t[r++]=o),r<kn&&s<xa&&(t[r++]=s)}}return t}function Jd(e,t,r,n){let i=e(n*kn/4,t,r),o=new Uint16Array(kn),s=Rm(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++]=Qd(m-h),h=0,a=0)}if(a)throw new Error(`sampleCBD: leftover bits: ${a}`);return o}var PG=e=>{let{K:t,PRF:r,XOF:n,HASH512:i,ETA1:o,ETA2:s,du:a,dv:u}=e,l=Zd(1),h=Zd(u),m=Zd(a),p=Jc("publicKey",Xm(Zd(12),t),32),d=Xm(Zd(12),t),v=Jc("ciphertext",Xm(m,t),h),g=Jc("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(Qc.encode(Jd(r,C,I,o)));let K=n(_);for(let I=0;I<t;I++){let M=Qc.encode(Jd(r,C,t+I,o));for(let L=0;L<t;L++){let T=tB(K.get(L,I));el(M,Zm(T,F[L]))}H.push(M)}K.clean();let S={publicKey:p.encode([H,_]),secretKey:d.encode(F)};return Mr(_,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(Qc.encode(Jd(r,E,L,o)));let H=n(C),K=new Uint16Array(kn),S=[];for(let L=0;L<t;L++){let T=Jd(r,E,t+L,s),O=new Uint16Array(kn);for(let R=0;R<t;R++){let N=tB(H.get(L,R));el(O,Zm(N,F[R]))}el(T,Qc.decode(O)),S.push(T),el(K,Zm(_[L],F[L])),Mr(O)}H.clean();let I=Jd(r,E,2*t,s);el(I,Qc.decode(K));let M=l.decode(w);return el(M,I),Mr(_,F,K,I),v.encode([S,M])},decrypt:(y,w)=>{let[E,_]=v.decode(y),C=d.decode(w),F=new Uint16Array(kn);for(let H=0;H<t;H++)el(F,Zm(C[H],Qc.encode(E[H])));return xG(_,Qc.decode(F)),Mr(F,C,E),l.encode(_)}}};function Ab(e){let t=PG(e),{HASH256:r,HASH512:n,KDF:i}=e,{secretCoder:o,lengths:s}=t,a=Jc("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=Io(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 Mr(p,d),{publicKey:m,secretKey:v}},getPublicKey:h=>{let[m,p,d,v]=a.decode(h);return Uint8Array.from(p)},encapsulate:(h,m=Io(u))=>{Je(h,s.publicKey,"publicKey"),Je(m,u,"message");let p=h.subarray(0,384*e.K),d=o.encode(o.decode(JF(p)));if(!Ym(d,p))throw Mr(d),new Error("ML-KEM.encapsulate: wrong publicKey modulus");Mr(d);let v=n.create().update(m).update(r(h)).digest(),g=t.encrypt(h,m,v.subarray(32,64));return Mr(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(!Ym(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=Ym(h,H),S=i.create({dkLen:32}).update(E).update(h).digest();return Mr(_,H,K?S:F),K?F:S}}}function kG(e,t,r){return Bo.create({dkLen:e}).update(t).update(new Uint8Array([r])).digest()}var Sb={HASH256:Zc,HASH512:zF,KDF:Bo,XOF:eB,PRF:kG},b0e=Ab({...Sb,...bb[512]}),ep=Ab({...Sb,...bb[768]}),rB=Ab({...Sb,...bb[1024]});function TG(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=Io(r.seed))=>{Je(s,r.seed,"seed");let a=o.isLE?qu(s):Hu(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 _b(e,t=!1){let r=TG(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=Io(e.lengths.seed)){let o=this.keygen(i).secretKey,s=this.decapsulate(n,o),a=e.getPublicKey(o);return Mr(o),{sharedSecret:s,cipherText:a}},decapsulate(n,i){let o=e.getSharedSecret(i,n);return e.lengths.publicKeyHasPrefix?o.subarray(1):o}}}function tp(e,t){return Jc(t,...e.map(r=>{if(typeof r.lengths[t]!="number")throw new Error("wrong length: "+t);return r.lengths[t]}))}function Cb(e){return(t,r)=>e(t,{dkLen:r})}function RG(e,t,...r){let n=tp(r,"seed"),i=tp(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=Io(e)){let{publicKey:a,secretKey:u}=o(s),l=i.encode(a);return Mr(a),Mr(u),{secretKey:s,publicKey:l}},expandDecapsulationKey:o,realSeedLen:e}}function Jm(e,t,r,n,...i){let o=RG(e,r,...i),s=tp(i,"cipherText"),a=tp(i,"publicKey"),u=tp(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=Io(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 Mr(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 nB(e,t,r,n,i){return ii(n),ii(i),Jm(32,32,Cb(n),(o,s,a)=>i(xr(a[0],a[1],s[1],o[1],Mu(e))),t,r)}var k0e=nB("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",ep,_b(mb,!0),Bo,Zc),T0e=nB("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",rB,_b(RF,!0),Bo,Zc);function OG(e,t,r,n,i){return ii(n),ii(i),Jm(32,32,Cb(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=NF(i,h),p=xr(Bf(l,2),Mu("shared_secret"),Mu("")),d=LF(i,m,p,l);return Mr(m,p,h,u),d},t,r)}var sB=_b(TF),R0e=OG("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",ep,sB,Bo,Gm),NG=Jm(32,32,Cb(Bo),(e,t,r)=>Zc(xr(r[0],r[1],t[1],e[1],Mu("\\.//^\\"))),ep,sB);function LG(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=Io(n)){return Je(s,n,"seed"),o(s)},getPublicKey(s){return e.getPublicKey(s,!1)},encapsulate(s,a=Io(n)){Je(a,n,"rand");let{secretKey:u}=o(a),l=this.decapsulate(s,u),h=e.getPublicKey(u,!1);return Mr(u),{sharedSecret:l,cipherText:h}},decapsulate(s,a){return e.getSharedSecret(a,s).subarray(1)}}}function UG(e,t,r,n){let{secretKey:i,publicKeyUncompressed:o}=r.lengths;if(!i||!o)throw new Error("wrong curve");let s=LG(r,i,o,n),a=64,u=a+n;return Jm(32,32,l=>{Je(l,32);let h=Bo(l,{dkLen:u}),m=h.subarray(0,a),p=h.subarray(a,u);return xr(m,p)},(l,h,m)=>Zc(xr(m[0],m[1],h[1],l[1],Mu(e))),t,s)}var HG=UG("MLKEM768-P256",ep,mb,128);var Qm=NG,iB=HG;var l1e=B(x(),1);var H0e=B(x(),1);var Qt=(e,t,r)=>nn(e,t,r),Fb=Cr,kf=Cm,un=(...e)=>wE(...e),Tf=e=>$d(e),Rf=mE,Of=e=>ku(e),tg=BigInt(0),Db=BigInt(1);function $a(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new TypeError(r+"expected boolean, got type="+typeof e)}return e}function rg(e){if(typeof e=="bigint"){if(!eg(e))throw new RangeError("positive bigint expected, got "+e)}else Fb(e);return e}function xo(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 rp(e){let t=rg(e).toString(16);return t.length&1?"0"+t:t}function oB(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?tg:BigInt("0x"+e)}function tl(e){return oB(Cm(e))}function Ui(e){return oB(Cm(Gu(nn(e)).reverse()))}function ng(e,t){if(Cr(t),t===0)throw new RangeError("zero length");e=rg(e);let r=e.toString(16);if(r.length>t*2)throw new RangeError("number too large");return $d(r.padStart(t*2,"0"))}function np(e,t){return ng(e,t).reverse()}function aB(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 Gu(e){return Uint8Array.from(Qt(e))}function sg(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 eg=e=>typeof e=="bigint"&&tg<=e;function qG(e,t,r){return eg(e)&&eg(t)&&eg(r)&&t<=e&&e<r}function Pa(e,t,r,n){if(!qG(t,r,n))throw new RangeError("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function Nf(e){if(e<tg)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>tg;e>>=Db,t+=1);return t}var sp=e=>(Db<<BigInt(e))-Db;function uB(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 Bb=()=>{throw new Error("not implemented")};var G0e=B(x(),1);var j0e=B(x(),1);var cn=BigInt(0),mr=BigInt(1),rl=BigInt(2),hB=BigInt(3),dB=BigInt(4),pB=BigInt(5),MG=BigInt(7),mB=BigInt(8),jG=BigInt(9),gB=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 cB(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 Ib(e,t,r){let n=e;if(!n.eql(n.sqr(t),r))throw new Error("Cannot find square root")}function vB(e,t){let r=e,n=(r.ORDER+mr)/dB,i=r.pow(t,n);return Ib(r,i,t),i}function KG(e,t){let r=e,n=(r.ORDER-pB)/mB,i=r.mul(t,rl),o=r.pow(i,n),s=r.mul(t,o),a=r.mul(r.mul(s,rl),o),u=r.mul(s,r.sub(a,r.ONE));return Ib(r,u,t),u}function VG(e){let t=og(e),r=wB(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+MG)/gB;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 Ib(l,w,u),w})}function wB(e){if(e<hB)throw new Error("sqrt is not defined for small field");let t=e-mr,r=0;for(;t%rl===cn;)t/=rl,r++;let n=rl,i=og(e);for(;lB(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return vB;let o=i.pow(n,t),s=(t+mr)/rl;return function(u,l){let h=u;if(h.is0(l))return l;if(lB(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 zG(e){return e%dB===hB?vB:e%mB===pB?KG:e%gB===jG?VG(e):wB(e)}var ka=(e,t)=>(ir(e,t)&mr)===mr,GG=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function xb(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=GG.reduce((n,i)=>(n[i]="function",n),t);if(ai(e,r),xo(e.BYTES,"BYTES"),xo(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 WG(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 ip(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 lB(e,t){let r=e,n=(r.ORDER-mr)/rl,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 YG(e,t){if(t!==void 0&&Fb(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=Nf(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 fB=new WeakMap,ig=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}=YG(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 WG(this,t,r)}div(t,r){return ir(t*cB(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 cB(t,this.ORDER)}sqrt(t){let r=fB.get(this);return r||fB.set(this,r=zG(this.ORDER)),r(this,t)}toBytes(t){return this.isLE?np(t,this.BYTES):ng(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):tl(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 ip(this,t)}cmov(t,r,n){return $a(n,"condition"),n?r:t}};Object.freeze(ig.prototype);function og(e,t={}){return new ig(e,t)}function yB(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=Nf(e-mr);return Math.ceil(t/8)}function $b(e){let t=yB(e);return t+Math.ceil(t/2)}function EB(e,t,r=!1){Qt(e);let n=e.length,i=yB(t),o=Math.max($b(t),16);if(n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?Ui(e):tl(e),a=ir(s,t-mr)+mr;return r?np(a,i):ng(a,i)}var Lf=BigInt(0),nl=BigInt(1);function op(e,t){let r=t.negate();return e?r:t}function sl(e,t){let r=ip(e.Fp,t.map(n=>n.Z));return t.map((n,i)=>e.fromAffine(n.toAffine(r[i])))}function _B(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Pb(e,t){_B(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e,o=sp(e),s=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function bB(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+=nl);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 kb=new WeakMap,CB=new WeakMap;function Tb(e){return CB.get(e)||1}function AB(e){if(e!==Lf)throw new Error("invalid wNAF")}var Uf=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>Lf;)r&nl&&(n=n.add(i)),i=i.double(),r>>=nl;return n}precomputeWindow(t,r){let{windows:n,windowSize:i}=Pb(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=Pb(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=bB(n,a,s);n=u,h?o=o.add(op(p,r[d])):i=i.add(op(m,r[l]))}return AB(n),{p:i,f:o}}wNAFUnsafe(t,r,n,i=this.ZERO){let o=Pb(t,this.bits);for(let s=0;s<o.windows&&n!==Lf;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=bB(n,s,o);if(n=a,!l){let m=r[u];i=i.add(h?m.negate():m)}}return AB(n),i}getPrecomputes(t,r,n){let i=kb.get(r);return i||(i=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(i=n(i)),kb.set(r,i))),i}cached(t,r,n){let i=Tb(t);return this.wNAF(i,this.getPrecomputes(i,t,n),r)}unsafe(t,r,n,i){let o=Tb(t);return o===1?this._unsafeLadder(t,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,i)}createCache(t,r){_B(r,this.bits),CB.set(t,r),kb.delete(t)}hasCache(t){return Tb(t)!==1}};function DB(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>Lf||n>Lf;)r&nl&&(o=o.add(i)),n&nl&&(s=s.add(i)),i=i.double(),r>>=nl,n>>=nl;return{p1:o,p2:s}}function SB(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return xb(t),t}else return og(e,{isLE:r})}function ag(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>Lf))throw new Error(`CURVE.${u} must be positive bigint`)}let i=SB(t.p,r.Fp,n),o=SB(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 ap(e,t){return function(n){let i=e(n);return{secretKey:i,publicKey:t(i)}}}var X0e=B(x(),1);function up(e,t){if(xo(e),xo(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 XG(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 ZG(e){if(!Rf(e)&&typeof e!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof e=="string"?sg(e):e;if(t.length===0)throw new Error("DST must be non-empty");return t}function Rb(e,t,r,n){Qt(e),xo(r),t=ZG(t),t.length>255&&(t=n(un(sg("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,up(t.length,1)),u=new Uint8Array(o),l=up(r,2),h=new Array(s),m=n(un(u,e,l,up(0,1),a));h[0]=n(un(m,up(1,1),a));for(let d=1;d<s;d++){let v=[XG(m,h[d-1]),up(d+1,1),a];h[d]=n(un(...v))}return un(...h).slice(0,r)}var FB="HashToScalar-";var s1e=B(x(),1);var BB=(e,t)=>(e+(e>=0?t:-t)/IB)/t;function JG(e,t,r){Pa("scalar",e,$o,r);let[[n,i],[o,s]]=t,a=BB(s*e,r),u=BB(-i*e,r),l=e-a*n-u*o,h=-a*i-u*s,m=l<$o,p=h<$o;m&&(l=-l),p&&(h=-h);let d=sp(Math.ceil(Nf(r)/2))+Wu;if(l<$o||l>=d||h<$o||h>=d)throw new Error("splitScalar (endomorphism): failed for k");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 Ob(e,t){ai(e);let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return $a(r.lowS,"lowS"),$a(r.prehash,"prehash"),r.format!==void 0&&Nb(r.format),r}var Lb=class extends Error{constructor(t=""){super(t)}},Hi={Err:Lb,_tlv:{encode:(e,t)=>{let{Err:r}=Hi;if(xo(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=rp(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?rp(i.length/2|128):"";return rp(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(rg(e),e<$o)throw new t("integer: negative integers are not allowed");let r=rp(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 tl(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 $o=BigInt(0),Wu=BigInt(1),IB=BigInt(2),ug=BigInt(3),QG=BigInt(4);function xB(e,t={}){let r=ag("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=PB(n,i);function m(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function p(L,T,O){if(l&&T.is0())return Uint8Array.of(0);let{x:R,y:N}=T.toAffine(),P=n.toBytes(R);if($a(O,"isCompressed"),O){m();let q=!n.isOdd(N);return un($B(q),P)}else return un(Uint8Array.of(4),P,n.toBytes(N))}function d(L){Qt(L,void 0,"Point");let{publicKey:T,publicKeyUncompressed:O}=h,R=L.length,N=L[0],P=L.subarray(1);if(l&&R===1&&N===0)return{x:n.ZERO,y:n.ZERO};if(R===T&&(N===2||N===3)){let q=n.fromBytes(P);if(!n.isValid(q))throw new Error("bad point: is not on curve, wrong x");let Y=y(q),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:q,y:V}}else if(R===O&&N===4){let q=n.BYTES,Y=n.fromBytes(P.subarray(0,q)),V=n.fromBytes(P.subarray(q,q*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 ${R}, expected compressed=${T} or uncompressed=${O}`)}let v=t.toBytes===void 0?p:t.toBytes,g=t.fromBytes===void 0?d:t.fromBytes;function y(L){let T=n.sqr(L),O=n.mul(T,L);return n.add(n.add(O,n.mul(L,o.a)),o.b)}function w(L,T){let O=n.sqr(T),R=y(L);return n.eql(O,R)}if(!w(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let E=n.mul(n.pow(o.a,ug),QG),_=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,T,O=!1){if(!n.isValid(T)||O&&n.is0(T))throw new Error(`bad point coordinate ${L}`);return T}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 JG(L,u.basises,i.ORDER)}function K(L,T,O,R,N){return O=new S(n.mul(O.X,L),O.Y,O.Z),T=op(R,T),O=op(N,O),T.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(T,O,R){this.X=C("x",T),this.Y=C("y",O,!0),this.Z=C("z",R),Object.freeze(this)}static CURVE(){return o}static fromAffine(T){let{x:O,y:R}=T||{};if(!T||!n.isValid(O)||!n.isValid(R))throw new Error("invalid affine point");if(T instanceof S)throw new Error("projective point not allowed");return n.is0(O)&&n.is0(R)?S.ZERO:new S(O,R,n.ONE)}static fromBytes(T){let O=S.fromAffine(g(Qt(T,void 0,"point")));return O.assertValidity(),O}static fromHex(T){return S.fromBytes(Tf(T))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(T=8,O=!0){return M.createCache(this,T),O||this.multiply(ug),this}assertValidity(){let T=this;if(T.is0()){if(t.allowInfinityPoint&&n.is0(T.X)&&n.eql(T.Y,n.ONE)&&n.is0(T.Z))return;throw new Error("bad point: ZERO")}let{x:O,y:R}=T.toAffine();if(!n.isValid(O)||!n.isValid(R))throw new Error("bad point: x or y not field elements");if(!w(O,R))throw new Error("bad point: equation left != right");if(!T.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:T}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(T)}equals(T){F(T);let{X:O,Y:R,Z:N}=this,{X:P,Y:q,Z:Y}=T,V=n.eql(n.mul(O,Y),n.mul(P,N)),X=n.eql(n.mul(R,Y),n.mul(q,N));return V&&X}negate(){return new S(this.X,n.neg(this.Y),this.Z)}double(){let{a:T,b:O}=o,R=n.mul(O,ug),{X:N,Y:P,Z:q}=this,Y=n.ZERO,V=n.ZERO,X=n.ZERO,te=n.mul(N,N),ae=n.mul(P,P),me=n.mul(q,q),he=n.mul(N,P);return he=n.add(he,he),X=n.mul(N,q),X=n.add(X,X),Y=n.mul(T,X),V=n.mul(R,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(R,X),me=n.mul(T,me),he=n.sub(te,me),he=n.mul(T,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,q),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(T){F(T);let{X:O,Y:R,Z:N}=this,{X:P,Y:q,Z:Y}=T,V=n.ZERO,X=n.ZERO,te=n.ZERO,ae=o.a,me=n.mul(o.b,ug),he=n.mul(O,P),De=n.mul(R,q),Pe=n.mul(N,Y),Ie=n.add(O,R),se=n.add(P,q);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(R,N),V=n.add(q,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(T){return F(T),this.add(T.negate())}is0(){return this.equals(S.ZERO)}multiply(T){let{endo:O}=t;if(!i.isValidNot0(T))throw new RangeError("invalid scalar: out of range");let R,N,P=q=>M.cached(this,q,Y=>sl(S,Y));if(O){let{k1neg:q,k1:Y,k2neg:V,k2:X}=H(T),{p:te,f:ae}=P(Y),{p:me,f:he}=P(X);N=ae.add(he),R=K(O.beta,te,me,q,V)}else{let{p:q,f:Y}=P(T);R=q,N=Y}return sl(S,[R,N])[0]}multiplyUnsafe(T){let{endo:O}=t,R=this,N=T;if(!i.isValid(N))throw new RangeError("invalid scalar: out of range");if(N===$o||R.is0())return S.ZERO;if(N===Wu)return R;if(M.hasCache(this))return this.multiply(N);if(O){let{k1neg:P,k1:q,k2neg:Y,k2:V}=H(N),{p1:X,p2:te}=DB(S,R,q,V);return K(O.beta,X,te,P,Y)}else return M.unsafe(R,N)}toAffine(T){let O=this,R=T,{X:N,Y:P,Z:q}=O;if(n.eql(q,n.ONE))return{x:N,y:P};let Y=O.is0();R==null&&(R=Y?n.ONE:n.inv(q));let V=n.mul(N,R),X=n.mul(P,R),te=n.mul(q,R);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:T}=t;return s===Wu?!0:T?T(S,this):M.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:T}=t;return s===Wu?this:T?T(S,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===Wu?this.is0():this.clearCofactor().is0()}toBytes(T=!0){return $a(T,"isCompressed"),this.assertValidity(),v(S,this,T)}toHex(T=!0){return kf(this.toBytes(T))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let I=i.BITS,M=new Uf(S,t.endo?Math.ceil(I/2):I);return I>=8&&S.BASE.precompute(8),Object.freeze(S.prototype),Object.freeze(S),S}function $B(e){return Uint8Array.of(e?2:3)}function PB(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function eW(e,t={}){let{Fn:r}=e,n=t.randomBytes===void 0?Of:t.randomBytes,i=Object.assign(PB(e.Fp,r),{seed:Math.max($b(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,EB(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=ap(a,u);return Object.freeze(m),Object.freeze(i),Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function kB(e,t,r={}){let n=t;Sa(n),ai(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let i=r.randomBytes===void 0?Of:r.randomBytes,o=r.hmac===void 0?(N,P)=>_o(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}=eW(e,r),g={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},y=u*IB+Wu<s.ORDER;function w(N){let P=u>>Wu;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){Nb(P);let q=v.signature,Y=P==="compact"?q:P==="recovered"?q+1:void 0;return Qt(N,Y)}class F{r;s;recovery;constructor(P,q,Y){if(this.r=E("r",P),this.s=E("s",q),Y!=null){if(_(),![0,1,2,3].includes(Y))throw new Error("invalid recovery id");this.recovery=Y}Object.freeze(this)}static fromBytes(P,q=g.format){C(P,q);let Y;if(q==="der"){let{r:ae,s:me}=Hi.toSig(Qt(P));return new F(ae,me)}q==="recovered"&&(Y=P[0],q="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,q){return this.fromBytes(Tf(P),q)}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:q,s:Y}=this,V=this.assertRecovery(),X=V===2||V===3?q+u:q;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($B((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(Nb(P),P==="der")return Tf(Hi.hexFromSig(this));let{r:q,s:Y}=this,V=a.toBytes(q),X=a.toBytes(Y);return P==="recovered"?(_(),un(Uint8Array.of(this.assertRecovery()),V,X)):un(V,X)}toHex(P){return kf(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 q=tl(P),Y=P.length*8-l;return Y>0?q>>BigInt(Y):q}:r.bits2int,K=r.bits2int_modN===void 0?function(P){return a.create(H(P))}:r.bits2int_modN,S=sp(l);function I(N){return Pa("num < 2^"+l,N,$o,S),a.toBytes(N)}function M(N,P){return Qt(N,void 0,"message"),P?Qt(n(N),void 0,"prehashed message"):N}function L(N,P,q){let{lowS:Y,prehash:V,extraEntropy:X}=Ob(q,g);N=M(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(),Re=a.create(Fe.x);if(Re===$o)return;let Ve=a.create(pe*a.create(De+Re*ae));if(Ve===$o)return;let Oe=(Fe.x===Re?0:2)|Number(Fe.y&Wu),pt=Ve;return Y&&w(Ve)&&(pt=a.neg(Ve),Oe^=1),new F(Re,pt,y?void 0:Oe)}return{seed:he,k2sig:Pe}}function T(N,P,q={}){let{seed:Y,k2sig:V}=L(N,P,q);return uB(n.outputLen,a.BYTES,o)(Y,V).toBytes(q.format)}function O(N,P,q,Y={}){let{lowS:V,prehash:X,format:te}=Ob(Y,g);if(q=Qt(q,void 0,"publicKey"),P=M(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(q);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 R(N,P,q={}){let{prehash:Y}=Ob(q,g);return P=M(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:T,verify:O,recoverPublicKey:R,Signature:F,hash:n})}var tW={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")};var rW=xB(tW),Hf=kB(rW,Dr);var k1e=B(x(),1);var $1e=B(x(),1);var p1e=B(x(),1);var Yu=BigInt(0),ys=BigInt(1),Ub=BigInt(2),nW=BigInt(8);function sW(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 TB(e,t={}){let r=t,n=ag("edwards",e,r,r.FpFnLE),{Fp:i,Fn:o}=n,s=n.CURVE,{h:a}=s;ai(r,{},{uvRatio:"function"});let u=Ub<<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:Yu}}}:r.uvRatio;if(!sW(i,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function m(g,y,w=!1){let E=w?ys:Yu;return Pa("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(Yu,ys,ys,Yu);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=Gu(Qt(y,E,"point")),$a(w,"zip215");let F=Gu(y),H=y[E-1];F[E-1]=H&-129;let K=Ui(F),S=w?u:i.ORDER;Pa("point.y",K,Yu,S);let I=l(K*K),M=l(I-ys),L=l(C*I-_),{isValid:T,value:O}=h(M,L);if(!T)throw new Error("bad point: invalid y coordinate");let R=(O&ys)===ys,N=(H&128)!==0;if(!w&&O===Yu&&N)throw new Error("bad point: x=0 and x_0=1");return N!==R&&(O=l(-O)),d.fromAffine({x:O,y:K})}static fromHex(y,w=!1){return d.fromBytes(Tf(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(Ub),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),M=l(I*I),L=l(K*w),T=l(I*l(L+S)),O=l(M+l(E*l(K*S)));if(T!==O)throw new Error("bad point: equation left != right (1)");let R=l(_*C),N=l(F*H);if(R!==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),M=l(F*_);return K===S&&I===M}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(Ub*l(_*_)),K=l(y*C),S=w+E,I=l(l(S*S)-C-F),M=K+F,L=M-H,T=K-F,O=l(I*L),R=l(M*T),N=l(I*T),P=l(L*M);return new d(O,R,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:M}=y,L=l(_*K),T=l(C*S),O=l(H*E*M),R=l(F*I),N=l((_+C)*(K+S)-L-T),P=R-O,q=R+O,Y=l(T-w*L),V=l(N*P),X=l(q*Y),te=l(N*Y),ae=l(P*q);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,_=>sl(d,_));return sl(d,[w,E])[0]}multiplyUnsafe(y){if(!o.isValid(y))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return y===Yu?d.ZERO:this.is0()||y===ys?this:v.unsafe(this,y,w=>sl(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?nW:i.inv(F));let K=l(_*E),S=l(C*E),I=i.mul(F,E);if(H)return{x:Yu,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 kf(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let v=new Uf(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var cg=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){Bb()}static fromHex(t){Bb()}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 kf(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 y1e=B(x(),1);var cp=BigInt(0),qf=BigInt(1),lg=BigInt(2);function iW(e){return ai(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function RB(e){let t=iW(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?Of:s,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?lg**BigInt(254):lg**BigInt(447),v=a?BigInt(8)*lg**BigInt(251)-qf:BigInt(4)*lg**BigInt(445)-qf,g=d+v+qf,y=R=>ir(R,r),w=E(m);function E(R){return np(y(R),h)}function _(R){let N=Gu(Qt(R,h,"uCoordinate"));return a&&(N[31]&=127),y(Ui(N))}function C(R){return Ui(i(Gu(Qt(R,h,"scalar"))))}function F(R,N){let P=M(_(N),C(R));if(P===cp)throw new Error("invalid private or public key received");return E(P)}function H(R){return F(R,w)}let K=H,S=F;function I(R,N,P){let q=y(R*(N-P));return N=y(N-q),P=y(P+q),{x_2:N,x_3:P}}function M(R,N){Pa("u",R,cp,r),Pa("scalar",N,d,g);let P=N,q=R,Y=qf,V=cp,X=R,te=qf,ae=cp;for(let he=BigInt(l-1);he>=cp;he--){let De=P>>he&qf;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,Re=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Re*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(q*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},T=R=>(R=R===void 0?u(h):R,Qt(R,L.seed,"seed"),R),O={randomSecretKey:T};return Object.freeze(L),Object.freeze(O),Object.freeze({keygen:ap(T,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var oW=BigInt(0),Ta=BigInt(1),OB=BigInt(2),aW=BigInt(3),uW=BigInt(5),cW=BigInt(8),ol=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),jb={p:ol,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:cW,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function UB(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=ol,a=e*e%o*e%o,u=ui(a,OB,o)*a%o,l=ui(u,Ta,o)*e%o,h=ui(l,uW,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,OB,o)*e%o,b2:a}}function lW(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var Hb=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Kb(e,t){let r=ol,n=ir(t*t*t,r),i=ir(n*n*t,r),o=UB(e*i).pow_p_5_8,s=ir(e*n*o,r),a=ir(t*s*s,r),u=s,l=ir(s*Hb,r),h=a===e,m=a===ir(-e,r),p=a===ir(-e*Hb,r);return h&&(s=u),(m||p)&&(s=l),ka(s,r)&&(s=ir(-s,r)),{isValid:h||m,value:s}}var il=TB(jb,{uvRatio:Kb}),Xu=il.Fp,HB=il.Fn;var fg=(()=>{let e=ol;return RB({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=UB(t);return ir(ui(r,aW,e)*n,e)},adjustScalarBytes:lW})})();var qb=Hb,fW=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),hW=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),dW=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),pW=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),NB=e=>Kb(Ta,e),mW=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Mb=e=>Xu.create(Ui(e)&mW);function LB(e){let{d:t}=jb,r=ol,n=w=>Xu.create(w),i=n(qb*e*e),o=n((i+Ta)*dW),s=BigInt(-1),a=n((s-t*i)*n(i+t)),{isValid:u,value:l}=Kb(o,a),h=n(l*e);ka(h,r)||(h=n(-h)),u||(l=h),u||(s=i);let m=n(s*(i-Ta)*pW-a),p=l*l,d=n((l+l)*a),v=n(m*fW),g=n(Ta-p),y=n(Ta+p);return new il(n(d*y),n(g*v),n(v*y),n(d*g))}var Zu=class e extends cg{static BASE=new e(il.BASE);static ZERO=new e(il.ZERO);static Fp=Xu;static Fn=HB;constructor(t){super(t)}static fromAffine(t){return new e(il.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}=jb,i=ol,o=C=>Xu.create(C),s=Mb(t);if(!aB(Xu.toBytes(s),t)||ka(s,i))throw new Error("invalid ristretto255 encoding 1");let a=o(s*s),u=o(Ta+r*a),l=o(Ta-r*a),h=o(u*u),m=o(l*l),p=o(r*n*h-m),{isValid:d,value:v}=NB(o(p*m)),g=o(v*l),y=o(v*g*p),w=o((s+s)*g);ka(w,i)&&(w=o(-w));let E=o(u*y),_=o(w*E);if(!d||ka(_,i)||E===oW)throw new Error("invalid ristretto255 encoding 2");return new e(new il(w,E,Ta,_))}static fromHex(t){return e.fromBytes($d(t))}toBytes(){let{X:t,Y:r,Z:n,T:i}=this.ep,o=ol,s=y=>Xu.create(y),a=s(s(n+r)*s(n-r)),u=s(t*r),l=s(u*u),{value:h}=NB(s(a*l)),m=s(h*a),p=s(h*u),d=s(m*p*i),v;if(ka(i*d,o)){let y=s(r*qb),w=s(t*qb);t=y,r=w,v=s(m*hW)}else v=p;ka(t*d,o)&&(r=s(-r));let g=s((n-r)*v);return ka(g,o)&&(g=s(-g)),Xu.toBytes(g)}equals(t){this.assertSame(t);let{X:r,Y:n}=this.ep,{X:i,Y:o}=t.ep,s=l=>Xu.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(Zu.BASE);Object.freeze(Zu.ZERO);Object.freeze(Zu.prototype);Object.freeze(Zu);var gW=Object.freeze({Point:Zu,hashToCurve(e,t){let r=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,n=Rb(e,r,64,Im);return gW.deriveToCurve(n)},hashToScalar(e,t={DST:FB}){let r=Rb(e,t.DST,64,Im);return HB.create(Ui(r))},deriveToCurve(e){nn(e,64);let t=Mb(e.subarray(0,32)),r=LB(t),n=Mb(e.subarray(32,64)),i=LB(n);return new Zu(r.add(i))}});var qB=!1,vW=!1;async function MB(e,t){if(vW)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 hg(e,t){return await MB(async()=>{let r=Vb(e)?e:await yW(e),n=await crypto.subtle.importKey("raw",t,{name:"X25519"},qB,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:n},r,256))},()=>{if(Vb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return fg.scalarMult(e,t)})}async function lp(e){return await MB(async()=>hg(e,fg.GuBytes),()=>{if(Vb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return fg.scalarMultBase(e)})}var wW=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);async function yW(e){if(e.length!==32)throw new Error("X25519 private key must be 32 bytes");let t=new Uint8Array([...wW,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},qB,["deriveBits"])}function Vb(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var U1e=B(x(),1);var R1e=B(x(),1);var dg=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),bW(al(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=al(t),null;this.buf=n.value}}close(){return this.s.releaseLock(),{rest:this.buf,transcript:al(this.transcript)}}};function bW(e){return e.forEach(t=>{if(t<32||t>126)throw Error("invalid non-ASCII byte in header")}),new TextDecoder().decode(e)}function al(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 pg(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function zb(e){if(!(e instanceof ReadableStream))throw new Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function jB(e){if(!(e instanceof ReadableStream))throw new Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function KB(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=al(n),s=o.subarray(0,t),a=Mf(e,o.subarray(t));return{data:s,rest:a}}var qi=class{args;body;constructor(t,r){this.args=t,this.body=r}};async function AW(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=al(n);return{s:new qi(r,i)}}async function VB(e){let t=new dg(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 AW(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 Gb(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 zB(e,t){return al([Gb(e),new TextEncoder().encode(" "+$n.encode(t)+`
|
||
`)])}async function Sg(e){let t;if(WB(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=Qm.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 lp(t);return ni.encodeFromBytes("age",r)}var gg=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}=Qm.encapsulate(this.recipient),i=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:o,nonce:s}=_g(GB,n,i),a=si(o,s).encrypt(t);return[new qi(["mlkem768x25519",$n.encode(r)],a)]}},vg=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=Qm.decapsulate(n,this.identity),o=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:s,nonce:a}=_g(GB,i,o);try{return si(s,a).decrypt(r.body)}catch{continue}}return null}},GB=25722,SW=80,Wb=16;function _g(e,t,r){let n=_W(e),i=mg(n,void 0,"psk_id_hash",new Uint8Array(0)),o=mg(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=mg(n,t,"secret",new Uint8Array(0)),u=Yb(n,a,"key",s,32),l=Yb(n,a,"base_nonce",s,12);return{key:u,nonce:l}}function _W(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 mg(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),Pd(Dr,i,t)}function Yb(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),AE(Dr,t,o,i)}function CW(e){e.length!==Hf.lengths.publicKeyUncompressed&&(e=Hf.Point.fromBytes(e).toBytes(!1));let t=Hf.utils.randomSecretKey(),r=Hf.getPublicKey(t,!1),n=Hf.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]=Wb>>8,o[4]=Wb&255;let s=mg(o,void 0,"eae_prk",n),a=Yb(o,s,"shared_secret",i,32);return{encapsulatedKey:r,sharedSecret:a}}var wg=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}=CW(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),Pd(Dr,h,i).subarray(0,4)})(),{key:s,nonce:a}=_g(Wb,n,i),u=si(s,a).encrypt(t);return[new qi(["p256tag",$n.encode(o),$n.encode(r)],u)]}},yg=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}=iB.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),Pd(Dr,h,i).subarray(0,4)})(),{key:s,nonce:a}=_g(SW,n,i),u=si(s,a).encrypt(t);return[new qi(["mlkem768p256tag",$n.encode(o),$n.encode(r)],u)]}},Eg=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=ku(32),n=await lp(r),i=await hg(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=Tu(Dr,i,o,s,32);return[new qi(["X25519",$n.encode(n)],Xb(t,a))]}},fp=class{identity;recipient;constructor(t){if(WB(t)){this.identity=t,this.recipient=lp(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=lp(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 hg(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=Tu(Dr,i,s,a,32),l=Zb(r.body,u);if(l!==null)return l}return null}},bg=class{passphrase;logN;constructor(t,r){this.passphrase=t,this.logN=r}wrapFileKey(t){let r=ku(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=qE(this.passphrase,i,{N:2**this.logN,r:8,p:1,dkLen:32});return[new qi(["scrypt",$n.encode(r),this.logN.toString()],Xb(t,o))]}},Ag=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=qE(this.passphrase,s,{N:2**i,r:8,p:1,dkLen:32}),u=Zb(r.body,a);if(u!==null)return u}return null}};function Xb(e,t){let r=new Uint8Array(12);return si(t,r).encrypt(e)}function Zb(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 WB(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var tme=B(x(),1);var ul=16,Qb=64*1024,Jb=Qb+ul;function YB(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(Jb),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 XB(e){if(e<ul)throw Error("ciphertext is too small");if(e===ul)return 0;let t=Math.floor(e/Jb),r=e%Jb;if(0<r&&r<=ul)throw Error("ciphertext size is invalid");let n=e;return n-=t*ul,n-=r>0?ul:0,n}function ZB(e){let t=new Uint8Array(12),r=()=>{for(let o=t.length-2;o>=0&&(t[o]++,t[o]===0);o--);},n=new Uint8Array(Qb),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 JB(e){let t=Math.max(1,Math.ceil(e/Qb));return e+ul*t}var hp={};yO(hp,{decode:()=>FW,encode:()=>DW});var sme=B(x(),1);function DW(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(LE.encode(e.subarray(r,n))+`
|
||
`)}return t.push(`-----END AGE ENCRYPTED FILE-----
|
||
`),t.join("")}function FW(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 LE.decode(t.join(""))}var wme=B(x(),1);var ime=B(x(),1);var dp=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 gg(t));else if(t.startsWith("age1tag1"))this.recipients.push(new wg(t));else if(t.startsWith("age1tagpq1"))this.recipients.push(new yg(t));else if(t.startsWith("age1"))this.recipients.push(new Eg(t));else throw new Error("unrecognized recipient type");else this.recipients.push(t)}async encrypt(t){let r=ku(16),n=[],i=this.recipients;this.passphrase!==null&&(i=[new bg(this.passphrase,this.scryptWorkFactor)]);for(let d of i)n.push(...await d.wrapFileKey(r));let o=new TextEncoder().encode("header"),s=Tu(Dr,r,void 0,o,32),a=_o(Dr,s,Gb(n)),u=zB(n,a),l=ku(16),h=new TextEncoder().encode("payload"),m=Tu(Dr,r,l,h,32),p=ZB(m);return t instanceof ReadableStream?Object.assign(Mf(t.pipeThrough(p),u,l),{size:d=>JB(d)+u.length+l.length}):(typeof t=="string"&&(t=new TextEncoder().encode(t)),await zb(Mf(pg(t).pipeThrough(p),u,l)))}},Cg=class{identities=[];addPassphrase(t){this.identities.push(new Ag(t))}addIdentity(t){if(kW(t))this.identities.push(new fp(t));else if(typeof t=="string")if(t.startsWith("AGE-SECRET-KEY-1"))this.identities.push(new fp(t));else if(t.startsWith("AGE-SECRET-KEY-PQ-1"))this.identities.push(new vg(t));else throw new Error("unrecognized identity type");else this.identities.push(t)}async decrypt(t,r){let n=t instanceof ReadableStream?t:pg(t),{fileKey:i,headerSize:o,rest:s}=await this.decryptHeaderInternal(n),{data:a,rest:u}=await KB(s,16),l=new TextEncoder().encode("payload"),h=Tu(Dr,i,a,l,32),m=YB(h),p=u.pipeThrough(m),d=Object.assign(p,{size:v=>XB(v-o-a.length)});return t instanceof ReadableStream?d:r==="text"?await jB(p):await zb(p)}async decryptHeader(t){return(await this.decryptHeaderInternal(pg(t))).fileKey}async decryptHeaderInternal(t){let r=await VB(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=Tu(Dr,n,void 0,i,32),s=_o(Dr,o,r.headerNoMAC);if(!PW(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 PW(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 kW(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var RW="-----BEGIN AGE ENCRYPTED FILE-----";var eA="age-secret-key",Tme=Object.freeze({X25519:"x25519",HYBRID:"mlkem768-x25519"}),OW=["TextEncoder","TextDecoder","ReadableStream","TransformStream","Response","Uint8Array"],NW=/\bAGE-SECRET-KEY(?:-PQ)?-1[023456789ACDEFGHJKLMNPQRSTUVWXYZ]+\b/g,tA="__subStoreAgeX25519Fallback";function rA(e){return String(e??"").trim()}function LW(e){return e.startsWith("age1")&&!e.startsWith("age1pq1")&&!e.startsWith("age1tag1")&&!e.startsWith("age1tagpq1")}function UW(e){return e.startsWith("age1pq1")}function HW(e){return e.startsWith("AGE-SECRET-KEY-1")}function qW(e){return e.startsWith("AGE-SECRET-KEY-PQ-1")}function QB(){return new ba("INVALID_AGE_PUBLIC_KEY","age-public-key \u4EC5\u652F\u6301 X25519(age1...) \u6216 MLKEM768-X25519(age1pq1...) \u516C\u94A5")}function eI(){return new ba("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 nA(e=globalThis){let t=OW.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(", ")}`);zW(e)}function Dg(){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 Dg()},deriveBits(){throw Dg()}};return e[tA]=!0,e}function jW(e){return typeof e=="string"?e:e?.name}function tI(e){return String(jW(e)||"").toUpperCase()==="X25519"}function KW(e){let t=String(e?.message||e||"");return/x25519|algorithm|not\s+supported|unsupported|unrecognized|unknown/i.test(t)}function rI(e){return e instanceof TypeError||e instanceof ReferenceError||e?.name==="TypeError"||e?.name==="ReferenceError"||e?.name==="NotSupportedError"||e?.name==="Error"&&KW(e)||typeof DOMException<"u"&&e instanceof DOMException&&e.name==="NotSupportedError"}function VW(e){let t=Object.create(e);return Object.defineProperty(t,tA,{configurable:!0,value:!0}),Object.defineProperty(t,"importKey",{configurable:!0,value:async(...r)=>{try{return await e.importKey.apply(e,r)}catch(n){throw tI(r[2])&&rI(n)?Dg():n}}}),Object.defineProperty(t,"deriveBits",{configurable:!0,value:async(...r)=>{try{return await e.deriveBits.apply(e,r)}catch(n){throw tI(r[0])&&rI(n)?Dg():n}}}),t}function nI(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 zW(e=globalThis){let t=e?.crypto,r=t?.subtle;if(!(!t||r?.[tA])){if(!r||typeof r.importKey!="function"||typeof r.deriveBits!="function"){nI(e,t,MW());return}typeof process>"u"&&nI(e,t,VW(r))}}function sI(e){let t=rA(e);if(!t||!LW(t)&&!UW(t))throw QB();try{new dp().addRecipient(t)}catch{throw QB()}return t}async function iI(e){let t=rA(e);if(!t||!HW(t)&&!qW(t))throw eI();try{await Sg(t)}catch{throw eI()}return t}async function oI(e){nA();let t=await iI(e),r=await Sg(t);return sI(r)}async function sA(e,t){nA();let r=sI(t),n=new dp;n.addRecipient(r);let i=await n.encrypt(e??"");return hp.encode(i)}function GW(e){return rA(e).startsWith(RW)}async function Fg(e,t){let r=e??"",n=typeof r=="string"?r:new TextDecoder().decode(r);if(!GW(n))return r;nA();let i=await iI(t),o=new Cg;o.addIdentity(i);try{let s=hp.decode(n);return await o.decrypt(s,"text")}catch(s){throw new Error(`age \u89E3\u5BC6\u5931\u8D25: ${s?.message??s}`)}}function WW(e){return String(e??"").replace(NW,t=>`${t.startsWith("AGE-SECRET-KEY-PQ-1")?"AGE-SECRET-KEY-PQ-1":"AGE-SECRET-KEY-1"}...${t.slice(-6)}`)}function Ju(e){return WW(String(e??"").replace(/([?#&]age-secret-key=)[^&#\s]+/gi,"$1***"))}var Qme=["Sub-Store placeholder","This file keeps the Gist alive when all sync configuration files are deleted."].join(`
|
||
`);var sge=B(x());var QW=new Set(["enabled","fallbackNotify"]),eY=new Set(["fallbackNotify","fallbackQuiet"]);function Bg(e){return e===!0?"quiet":e===!1||e==null||e===""?"disabled":e}function Ig(...e){for(let t of e)if(t!=null&&t!=="")return Bg(t);return"disabled"}function xg(e){return QW.has(Bg(e))}function jf(e){return eY.has(Bg(e))}function pp({mode:e,message:t,notify:r}){let n=Bg(e);if(n==="disabled"||jf(n))throw new Error(t);xg(n)&&r?.(t)}function $g({mode:e,notify:t,error:r}){xg(e)&&t?.(r)}function iA({platform:e="JSON",produceType:t,produceOpts:r={}}){return t==="raw"?JSON.stringify([]):Lt.produce([],e,t,r)}var lge=B(x());var aI={merge:!0,logLevel:"error"};function uI(e){return typeof e=="string"&&e.includes("short-id")}function Pg(e){if(!uI(e))return e;try{let t=_d(e,aI);return cI(e,t)}catch{return e}}function cI(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?gf(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 tY(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function rY(){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 nY(){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 sY(){let e="Clash Pre-processor",t=function(i,o){if(o&&!/proxies/.test(i))return!1;let s,a;if(uI(i))try{s=_d(i,aI),s.errors.length===0&&(a=s.toJS())}catch{s=void 0}if(a===void 0&&(a=gf(i)),o&&!Array.isArray(a.proxies)&&!Array.isArray(a["proxy-groups"]))return!1;if(s){let u=cI(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:gf(s.normalized);return(o?`proxies:
|
||
`:"")+(Array.isArray(a)?a:[]).map(u=>`${o?" - ":""}${JSON.stringify(u)}
|
||
`).join("")}}}function iY(){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 oY(){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 kg=[tY(),sY(),rY(),iY(),oY(),nY()];var pge=B(x());var gge=B(x()),oA="mihomoConfig",aY="mihomoProfile",uY=[oA,aY];function cl(e){let t=typeof e=="string"?e:e?.type;return uY.includes(t)}function lI(e){return!e||!cl(e)||e.type===oA?e:{...e,type:oA}}var cY=["localFirst","remoteFirst"],lY=["local","remote"],fY=["collection","local","none","remote","subscription"];function mp(e){return Object.keys(e).map(Ju).join(", ")}function fI(e){return cY.includes(e)}function hY(e){return cl(e)?dI(e):e?.source}function dI(e){return fY.includes(e?.sourceType)?e.sourceType:"collection"}function Tg(e){return(Array.isArray(e)?e:[e]).flat()}function pI(e){return Tg(e).filter(t=>t!=null&&t!=="").join(`
|
||
`)}function dY(e,t){return t!=null&&t!==""?t:e.ignoreFailedRemoteFile}async function hI({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 ${Ju(p)} \u53D1\u751F\u9519\u8BEF: ${d}`),""}})),m=dY(e,s);if(Object.keys(u).length>0)if(m)m==="enabled"&&Q.notify(a,`\u274C ${e.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${mp(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${mp(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);return h}async function mI(e,{url:t,ua:r,content:n,mergeSources:i,ignoreFailedRemoteFile:o,proxy:s,noCache:a,noFlow:u,notifyTitle:l}={}){if(n&&!fI(i))return n;if(t){let m=await hI({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(hY(e)==="local"&&!fI(e.mergeSources))return e.content;let h=await hI({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 pY(e,t={}){let r={},n=dI(e);if(n==="none")return Lt.yaml.safeDump(r);if(lY.includes(n)){let i=await mI(e,t);if(e?.mode!=="proxy")return pI(i);let o=Tg(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(nm);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=Ig(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 T={},O=await Promise.all(n.split(/[\r\n]+/).map(R=>R.trim()).filter(R=>R.length).map(async R=>{try{return await ci(R,i||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return T[R]=N,Q.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Ju(R)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(R=>R.result??R),K=O.map(R=>R.raw??R),Object.keys(T).length>0){let R=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${mp(T)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;pp({mode:F,message:R,notify:()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,R)}})}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 T={},O=await Promise.all(C.url.split(/[\r\n]+/).map(R=>R.trim()).filter(R=>R.length).map(async R=>{try{return await ci(R,i||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return T[R]=N,Q.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Ju(R)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(R=>R.result??R),K=O.map(R=>R.raw??R),Object.keys(T).length>0){let R=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${mp(T)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;pp({mode:F,message:R,notify:()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,R)}})}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 T=JSON.stringify((Array.isArray(S)?S:[S]).flat());return _?{result:T,raw:Array.isArray(K)?K:[K]}:T}let I=(Array.isArray(S)?S:[S]).map(T=>Lt.parse(T)).flat();if(I.forEach(T=>{T._subName=C.name,T._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 M={};for(let T of I){if(M[T.name]){Q.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${T.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}M[T.name]=!0}let L=Lt.produce(I,r,l,h);return _?{result:L,raw:Array.isArray(K)?K:[K]}:L}catch(S){if(!jf(F))throw S;$g({mode:F,error:S,notify:M=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,`\u{1F914} \u539F\u56E0\uFF1A${M.message??M}`)}}),Q.error(`\u8BA2\u9605 ${C.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${S.message??S}`);let I=iA({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(nm),F=Q.read(zy),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(T=>{Array.isArray(T.tag)&&T.tag.length>0&&!K.includes(T.name)&&T.tag.some(O=>S.includes(O))&&K.push(T.name)});let I=Ig(a,H.ignoreFailedRemoteSub),M=w||H.noFlow,L={};try{let T={},O={},R=0;if(await Promise.all(K.map(async Y=>{let V=ri(C,Y),X=Ig(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:M||V.noFlow})}catch(Fe){return Ie[pe]=Fe,Q.error(`\u8BA2\u9605 ${V.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Ju(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 ${mp(Ie)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;pp({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:M||V.noFlow}),T[Y]=De,L[Y]=Pe,R++,Q.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${V.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(R/K.length).toFixed(1)}% `)}catch(me){if(R++,jf(X)){$g({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}`),T[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*(R/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(T).length>0&&jf(I)?(Object.keys(O).forEach(te=>{L[te]=[]}),xg(I)&&V()):pp({mode:I,message:Y,notify:V})}let N=Array.prototype.concat.apply([],K.map(Y=>T[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:M}),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 q=Lt.produce(N,r,l,h);return _?{result:q,raw:L}:q}catch(T){if(!jf(I))throw T;$g({mode:I,error:T,notify:R=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,`\u{1F914} \u539F\u56E0\uFF1A${R.message??R}`)}}),Q.error(`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${T.message??T}`);let O=iA({platform:r,produceType:l,produceOpts:h});return _?{result:O,raw:L}:O}}else if(e==="rule"){let C=Q.read(E8),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),M=Am.parse(I);H=H.concat(M)}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 Am.process(H,[{type:"Remove Duplicate Filter"}]),Am.produce(H,r)}else if(e==="file"){let C=Q.read($c),F=lI(p||ri(C,t));if(!F)throw new Error(`\u627E\u4E0D\u5230\u6587\u4EF6 ${t}`);let H="";if(cl(F)?H=await pY(F,{url:n,ua:i,content:o,mergeSources:s,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}):H=await mI(F,{url:n,ua:i,content:o,mergeSources:s,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}),l==="raw")return JSON.stringify(Tg(H));let K=Tg(H),S=pI(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=Pg(I?.$content??""),(E?I:I?.$content)??""}}var Uge=B(x());function aA(){return mo(()=>wu("stream/promises"))}var gI=kg.find(e=>e.name==="Clash Pre-processor"),uA=new Map;function mY(e=""){let t=`${e}`.trim();return t?new RegExp(t,"i"):null}function gY(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=mY(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 vY(e){return Ju(e)}async function Kf(e,{ageSecretKey:t,preprocess:r,url:n}){let i=t?await Fg(e,t):e,o=i;if(r)try{let s=gI.test(i);s&&(i=gI.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 gp(e,t){return t?{result:e.result,raw:e.raw}:e.result}function cA(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?.[eA]||options?.ageSecretKey:void 0,returnRaw=options&&typeof options=="object"&&options.returnRaw,ageSecretKey=explicitAgeSecretKey||$arguments?.[eA],{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=gY(url,githubProxy,githubProxyRegex);let safeUrl=vY(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`),gp(await Kf(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 gp(await Kf(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"?sm:$c,n=ri(Q.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return cA(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=go();return cA(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&&uA.has(id))return gp(await Kf(await uA.get(id),{ageSecretKey,preprocess,url:safeUrl}),returnRaw);let http=yo({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 Kf(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 wf(()=>http.get({url,...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ea(proxy):{},...e||{}}),"download");if(Q.info(`statusCode: ${n}`),n<200||n>=400)throw new Error(`statusCode: ${n}`);if(r){let o=Uc(r);o&&Bd.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 Kf(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}`),gp(await Kf(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 bm(yf(await Em(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl,$arguments.flowHeaders))),isNode||uA.set(id,rawResult),gp(result,returnRaw)}async function vI(url,file){let undici=eval("require('undici')"),fs=go(),{pipeline}=aA(),{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 fve=B(x());var a2e=B(x());var fA=class{constructor(){Q.read(Tc)||Q.write("{}",Tc);try{this.resourceCache=JSON.parse(Q.read(Tc))}catch(t){Q.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Tc} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},Q.write("{}",Tc)}this._cleanup()}_cleanup(t,r){let n=lA(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),Tc)}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=lA(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=lA(n)??yY();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function lA(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function yY(){let t=(Q.read(pr)||{})?.scriptCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:1728e5}var hA=new fA;var c2e=B(x());function Rg(e,t){return[...Array(e).keys()].map(()=>t)}var d2e=B(x());var dA={"\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 Vf(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(dA))if(dA[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 wI(e){return dA[Vf(e)]?.[0]}function vp(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴☠️|🏳️🌈/g,"").trim()}var Og=class{constructor({country,asn}={}){if(Q.env.isNode){let Reader=eval('require("@maxmind/geoip2-node")').Reader,fs=go(),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 M2e=B(x());var Gf=B(II());var I2e=B(x());function SA(){return mo(()=>wu("dgram"))}var P2e=B(x());function _A(){return mo(()=>wu("net"))}var R2e=B(x());function CA(){return mo(()=>wu("tls"))}var fl=B(aa());var xI=53,FY=853,yp=2;function DA({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}]}),Gf.default.encode({type:"query",id:0,flags:Gf.default.RECURSION_DESIRED,questions:[{type:t,name:e}],additionals:n})}function FA(e){return e||8e3}function BY(e){return e?.replace(/^\[(.*)\]$/,"$1")}function IY(e){return _r(e)||Xt(e)}function xY(e,t=xI){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 $Y(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 PY(e,t){try{let r=t?e:`udp://${Xt(e)?`[${e}]`:e}`,n=new URL(r);$Y(n,e);let i=BY(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:xY(n.port,t==="tls"?FY:xI)}}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 kY(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 PY(t,n)}async function BA({url:e,domain:t,type:r="A",timeout:n,edns:i,skipCertVerify:o}){let s=DA({domain:t,type:r,edns:i}),u=fl.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 Gf.default.decode(fl.Buffer.from(Q.env.isQX?l.bodyBytes:l.body))}async function TY({server:e,domain:t,type:r="A",timeout:n,edns:i}){let o=SA(),s=DA({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"))},FA(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,Gf.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"?CA():_A(),a=e.protocol==="tls"?"TLS":"TCP",u=DA({domain:t,type:r,edns:i}),l=fl.Buffer.alloc(yp);l.writeUInt16BE(u.length,0);let h=fl.Buffer.concat([l,u]);return new Promise((m,p)=>{let d=!1,v=fl.Buffer.alloc(0),g,y=e.protocol==="tls"?s.connect({host:e.host,port:e.port,servername:IY(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(FA(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=fl.Buffer.concat([v,_]),g==null&&v.length>=yp&&(g=v.readUInt16BE(0)),g!=null&&v.length>=g+yp){let C=v.slice(yp,g+yp);E(null,Gf.default.decode(C))}}catch(C){E(C)}})})}async function Ug({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:FA(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=kY(e);if(l.protocol==="doh")return BA({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}):TY({server:l,domain:t,type:r,timeout:n,edns:i})}var Yf=B(za());var W2e=B(x());var $I="2.44.32";var{isNode:PI,isQX:NY,isLoon:LY,isSurge:UY,isStash:HY,isShadowRocket:qY,isLanceX:MY,isEgern:jY,isGUIforCores:KY}=Qs(),Uo="Node";PI?Uo="Node":NY?Uo="QX":LY?Uo="Loon":HY?Uo="Stash":qY?Uo="Shadowrocket":jY?Uo="Egern":UY?Uo="Surge":MY?Uo="LanceX":KY&&(Uo="GUI.for.Cores");var hl={},VY={};try{if(typeof $environment<"u"&&(hl.env=$environment),typeof $loon<"u"&&(hl.loon=$loon),typeof $script<"u"&&(hl.script=$script),typeof $Plugin<"u"&&(hl.plugin=$Plugin),PI){hl.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)&&(hl.node.env[e]=env[e])}}catch(e){}var Hg={backend:Uo,version:$I,feature:VY,meta:hl};var PA="Response Transformer";function kA(e){return e===PA}function bp(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function OI(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(We(r[n]))if(n.endsWith("!")){let i=bp(n.slice(0,-1));e[i]=r[n]}else{let i=bp(n);e[i]||Object.assign(e,{[i]:{}}),OI(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=bp(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=bp(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=bp(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function zY({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>qg(e,r))}}function qg(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=>qg(r,t));case"OR":return e.child.some(r=>qg(r,t));case"NOT":return!qg(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function GY(e){return{name:"Quick Setting Operator",func:i=>{if(t(e.useless)){let a=jI().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 WY({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=vp(n.name);else{let i=Vf(n.name);n.name=vp(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 YY(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=>Yf.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=>Yf.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=>Yf.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 XY(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 AX(t);default:throw new Error("Unknown sort option: "+e)}}}}function ZY(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=>RA(s)),o=new Map;return n.sort((s,a)=>{let u=kI(i,s.name,o),l=kI(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 kI(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 NI(e){return{name:"Regex Rename Operator",func:t=>t.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(RA(n,"g"),i).trim();return r})}}function JY(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:NI(t).func}}function QY(e,t,r,n,i,o){return o.source=n,o.env=Hg,{name:"Script Operator",func:async s=>{let a=s;if(cl(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(OI(l||{},u)),a}catch{}return await(async function(){a=Xf("operator",e,r,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=s;return await(async function(){a=Xf("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 LI="Add Proxies From Subscription Operator";function eX(e){if(!e)return{};let t=ks.safeLoad(e);return We(t)?t:{}}function tX(e){return Array.isArray(e?.proxies)?e.proxies:[]}function rX({sourceType:e="subscription",sourceName:t,includeUnsupportedProxy:r,position:n="replace"}={},i={}){let o=async s=>{if(!cl(s?.$file))return s;let a=eX(s.$content),u=tX(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:LI,func:o,nodeFunc:o}}function nX(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 sX=10,iX=2,TI=20;function oX(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("\u57DF\u540D\u89E3\u6790\u5E76\u53D1\u6570\u5E94\u4E3A\u5927\u4E8E 0 \u7684\u6574\u6570");return t}function UI(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return iX;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 aX(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 uX(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 TA(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 cX(e){return TA(e).join(`
|
||
`)}async function lX(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 fX(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 $A(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 hX(e,t,r,n,i,o){if(n==="disabled")return null;let s=$A(e,t,r,i,o),a=s?Hr.get(s):null;return e==="Custom"?qI(a):a}function IA(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 dX(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 HI(e,t){return e&&typeof e=="object"&&Object.defineProperty(e,"_resolverUrl",{value:t,enumerable:!1,configurable:!0}),e}function pX(e,t){return{result:e,resolverUrl:t}}function qI(e){return e&&typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.result)?HI(e.result,e.resolverUrl):e}function RI(e){return e&&typeof e=="object"?e._resolverUrl:null}var Mg={Custom:async function(e,t,r,n,i,o,s,a,u){let l=TA(o),h=l.join(`
|
||
`),m=UI(a),p=Ur(`CUSTOM:${s?"INSECURE:":""}${h}:${e}:${t}`),d=qI(Hr.get(p));if(!r&&d)return d;let v=t==="IPv6"?"AAAA":"A",g=async E=>{let _=await Ug({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 fX(l,m,g);return Hr.set(p,pX(y,w),u),HI(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 Ug({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 Ug({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 MI({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=aX(s,m),d=uX(a),v=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",g=Mg[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(!dl(y))throw new Error("\u57DF\u540D\u89E3\u6790 EDNS \u5E94\u4E3A IP");let w=oX(l),E=e==="Custom"?cX(i):i,_=e==="Custom"?TA(E).length:1,C=e==="Custom"?UI(h):1,F=w*Math.min(C,_),H=e==="Custom"&&(o===!0||o==="enabled");return F>TI&&Q.warn(`\u57DF\u540D\u89E3\u6790\u603B\u5E76\u53D1\u6570\u4E0A\u9650 ${F} \u8D85\u8FC7\u5EFA\u8BAE\u503C ${TI}, \u53EF\u80FD\u5BFC\u81F4\u4EE3\u7406 App TCP \u8FDE\u63A5\u6570\u6FC0\u589E`),Q.info(`Domain Resolver: [${t}] ${e} ${y||""} ${dX(e,E)}${H?" tlsSkipCertVerify=enabled":""} concurrency=${w}${e==="Custom"?` dnsConcurrency=${C}`:""}`),{name:"Resolve Domain Operator",func:async K=>{K.forEach((L,T)=>{!L["_no-resolve"]&&L["no-resolve"]&&(K[T]["_no-resolve"]=L["no-resolve"])});let S={},I=[...new Map(K.filter(L=>!dl(L.server)&&!L["_no-resolve"]).map(L=>{let T=$A(e,L.server,v,E,H);return[T,{id:T,domain:L.server}]})).values()],M=[];return I.forEach(({id:L,domain:T})=>{let O=hX(e,T,v,n,E,H);if(O){S[L]=O;let R=e==="Custom"&&RI(O)||E;Q.info(`Using cached resolved domain: ${T}${IA(e,R)} \u279F ${O}`)}else M.push({id:L,domain:T})}),await lX(M,w,async({id:L,domain:T})=>{try{let O=await g(T,v,n==="disabled",p,y,E,H,C,d);S[L]=O;let R=e==="Custom"&&RI(O)||E;Q.info(`Successfully resolved domain: ${T}${IA(e,R)} \u279F ${O}`)}catch(O){Q.error(`Failed to resolve domain: ${T}${IA(e,E)} with resolver [${e}]: ${O}`)}}),K.forEach(L=>{if(!L["_no-resolve"]){let T=$A(e,L.server,v,E,H);if(T&&S[T]){L._resolved_ips=S[T];let O=Array.isArray(S[T])?S[T][Math.floor(Math.random()*S[T].length)]:S[T];if(v==="IPv6"&&Xt(O)){try{O=new vm.Address6(O).correctForm()}catch(R){Q.error(`Failed to parse IPv6 address: ${O}: ${R}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(O)){L._IP4P=O;let{server:R,port:N}=nX(O);R&&N?(L._domain=L.server,L.server=R,L.port=N,L.resolved=!0,L._IPv4=L.server,dl(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,dl(L._IP)||(L._IP=L.server)}else L._domain=L.server,L.server=O,L.resolved=!0,L[`_${v}`]=L.server,dl(L._IP)||(L._IP=L.server)}else L.resolved||(L.resolved=!1)}}),K.filter(L=>r==="removeFailed"?dl(L.server)||L["_no-resolve"]||L.resolved:r==="IPOnly"?dl(L.server):r==="IPv4Only"?_r(L.server):r==="IPv6Only"?Xt(L.server):!0)}}}function dl(e){return _r(e)||Xt(e)}MI.resolver=Mg;function xA(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function jI(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!xA(t.cipher))return!1;if(t.password&&!xA(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&&!xA(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function mX(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=Vf(o.name),a=t.some(u=>n[u]===s);return r?a:!a})}}function gX({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(o=>RA(o).test(n.name));return t?i:!i})}}function RA(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function vX(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 wX(e,t,r,n,i,o){return o.source=n,o.env=Hg,{name:"Script Filter",func:async s=>{let a=Rg(s.length,!0);return await(async function(){a=Xf("filter",e,r,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=Rg(s.length,!0);return await(async function(){a=Xf("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 yX(e,t,r,n,i,o){return o.source=n,o.env=Hg,{name:PA,func:async s=>{let a=s;return await(async function(){a=Xf("transformFunction",e,r,i)(s,o)})(),a},shortcutFunc:async s=>{let a=s;return await(async function(){a=Xf("transformFunction",`async function transformFunction(res = {}, context) {
|
||
let $res = res
|
||
${e}
|
||
return $res
|
||
}`,r,i)(s,o)})(),a}}}var Ap={"Useless Filter":jI,"Region Filter":mX,"Regex Filter":gX,"Type Filter":vX,"Script Filter":wX,"Conditional Filter":zY,"Quick Setting Operator":GY,"Flag Operator":WY,"Sort Operator":XY,"Regex Sort Operator":ZY,"Regex Rename Operator":NI,"Regex Delete Operator":JY,"Script Operator":QY,[LI]:rX,[PA]:yX,"Handle Duplicate Operator":YY,"Resolve Domain Operator":MI};async function KI(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 EX(e,t){let r=Rg(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 bX(e,t){let r=SX(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 VI(e,t){if(e.name.indexOf("Filter")!==-1)return EX(e,t);if(e.name.indexOf("Operator")!==-1)return bX(e,t)}function AX(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 SX(e){return JSON.parse(JSON.stringify(e))}function Xf(name,script,$arguments,$options){let flowUtils={getFlowField:Uc,getFlowHeaders:Em,parseFlowHeaders:yf,flowTransfer:xd,validCheck:bm,getRmainingDays:Q8,normalizeFlowHeader:eD};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,Yf.default,$persistentStore,$httpClient,$notification,Lt,Lt.yaml,Lt.Buffer,Lt.Base64.decode,Lt.Base64.encode,Mg,hA,flowUtils,Ra,eval('typeof require !== "undefined"')?wu: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,Yf.default,Lt,Lt.yaml,Lt.Buffer,Lt.Base64.decode,Lt.Base64.encode,Mg,hA,flowUtils,Ra,eval('typeof require !== "undefined"')?wu:void 0)}var Iye=B(x());var Ove=B(x()),i9=B(za());var wve=B(x()),WI=B(za());var Ge=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=WI.default.get(e,t);return typeof r<"u"&&r!==null}function Vi(e){return`"${String(e).replace(/["\\]/g,"\\$&")}"`}function jg(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?Me(n)&&n.trim()!=="none"||o&&!["ws","xhttp"].includes(t):!0}function Kg(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 Zf(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 Sp(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 YI(e){return!!Sp(e)}function Jf(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 zI(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 Vg(e){if(["vmess","vless","trojan","anytls"].includes(e.type)&&zI(e,"sni")&&["vmess","vless"].includes(e.type)&&(e.tls=!0),e.type==="vless"&&e.network==="xhttp"){let t=e["xhttp-opts"]?.["download-settings"];zI(t,"servername")&&(t.tls=!0)}}function OA(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 XI(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:OA(i,s?32:128)}:null}function GI(e,t){let{addressKey:r,cidrKey:n,family:i,defaultCIDR:o}=t,s=XI(e[r],i);if(!s){(e[r]==null||`${e[r]}`.trim().length===0)&&delete e[n];return}e[r]=s.address;let a=OA(e[n],o);e[n]=a??s.cidr??o}function _p(e={}){return GI(e,{addressKey:"ip",cidrKey:"ip-cidr",family:"ipv4",defaultCIDR:32}),GI(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=XI(e[r.addressKey],t);if(!n)return;let i=OA(e[r.cidrKey],r.defaultCIDR);return`${n.address}/${i??n.cidr??r.defaultCIDR}`}function Ho(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"]?Pg(ks.safeDump({proxies:e},{lineWidth:-1})):`proxies:
|
||
`+e.map(n=>" - "+JSON.stringify(n)+`
|
||
`).join("")}var bve=B(x());var pl="_dns",NA="_force-query",LA="_sockopt",ZI="https://dns.alidns.com/dns-query";function zg(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 JI(e){if(!Me(e))return;if(!e.includes("://"))return{type:"config",config:e};let t=e.split("+");if(t.length===1&&Me(t[0]))return{type:"dns",dns:t[0]};if(t.length===2&&Me(t[0])&&Me(t[1]))return{type:"dns",queryServerName:t[0],dns:t[1]}}function UA(e){return JI(e)!=null}function Gg(e){return["none","half","full"].includes(e)}function HA(e){return typeof e=="boolean"?e:typeof e=="number"&&Number.isInteger(e)&&e!==0}function Wg({echConfigList:e,echForceQuery:t,echSockopt:r}={}){let n=JI(e);if(!n)return;let i={enable:!0};return n.type==="config"?i.config=n.config:(i[pl]=n.dns,n.queryServerName&&(i["query-server-name"]=n.queryServerName)),Gg(t)&&(i[NA]=t),We(r)&&(i[LA]=r),i}function qA(e,t,{dnsFieldPath:r="ech-opts._dns",warnDefaultDns:n}={}){let i={};if(We(e)){if(!HA(e.enable))return i;let o=e["query-server-name"];return Me(e.config)?i.echConfigList=e.config:Me(e[pl])?i.echConfigList=Me(o)?`${o}+${e[pl]}`:e[pl]:Me(o)&&(i.echConfigList=`${o}+${ZI}`,n?.({defaultDns:ZI,dnsFieldPath:r,queryServerName:o})),i.echConfigList&&Gg(e[NA])&&(i.echForceQuery=e[NA]),i.echConfigList&&We(e[LA])&&(i.echSockopt=e[LA]),i}return Me(t)&&(i.echConfigList=t),i}function MA(e,t,r){return qA(e,t,r).echConfigList}var Dve=B(x()),e9=B(za());var Sve=B(x());function jA(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 _X(e){return jA(e,{allowZeroUpperBound:!1})}function QI(e){return jA(e,{allowZeroLowerBound:!1,allowZeroUpperBound:!1})}function qo(e){let t=_X(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Qf(e){let t=QI(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?`${n}`:`${r}-${n}`}function ml(e){let t=QI(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Ls(e){let t=jA(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 eh={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 t9(e,t,r){if(!Object.prototype.hasOwnProperty.call(eh,t))return;let n=eh[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=ml(r)??r;break;case"min-posts-interval":i=qo(r)??r;break;case"xmux-keep-alive":i=Xn(r)??r;break}e9.default.set(e,n,i)}var Bve=B(x()),th="auto",CX=[th,"none","zero","aes-128-gcm","chacha20-poly1305"],DX=[th,"aes-128-gcm","chacha20-poly1305","none"],FX=["none","chacha20-poly1305"],BX={"chacha20-ietf-poly1305":"chacha20-poly1305"};function r9(e){return e==null?"":`${e}`.trim().toLowerCase()}function KA(e){return BX[e]||e}function jr(e,t=CX,{acceptAliases:r=!0,fallback:n=th}={}){let i=r9(e);if(!i)return n;let o=t.map(r9);if(o.includes(i))return KA(i);let s=KA(i),a=o.map(KA);return r&&a.includes(s)?s:n}function Cp(e){return jr(e,DX)}function n9(e){return jr(e,FX,{fallback:"chacha20-poly1305"})}function s9(e){let t=Cp(e);return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}function Yg(e){let t=jr(e,["aes-128-gcm","chacha20-poly1305"]);if(t!==th)return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}var Xg="Surge",rh=class extends Error{constructor(t){super(t),this.name="SurgeUnsupportedProxyError"}};function Tn(e){return new rh(e)}var IX={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 zi(e){return`"${String(Mo(e))}"`}function gl(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":IX[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(",")?zi(u):u;e.append(`,${a}=${l}`)}}function VA(e,t){if(gl(t.ports)){if(gl(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,";")}"`)}gl(t["hop-interval"])&&e.append(`,port-hopping-interval=${t["hop-interval"]}`)}function o9(e){return(Array.isArray(e)?e:Mo(`${e||""}`).split(",")).filter(r=>r!=null).map(r=>String(Mo(r)).trim()).filter(r=>r!=="").join(",")}function a9(e,t){let r=o9(t.alpn);r&&e.append(`,alpn="${r}"`)}function u9(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 xX(e){return o9(e?.["plugin-opts"]?.alpn??e?.alpn)}function Ga(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 Tn(`shadow-tls version ${o} is not supported`);e.append(`,shadow-tls-version=${o}`)}let s=xX(t);s&&e.append(`,alpn="${s}"`),r&&e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function Gi(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=${zi(t["name-cert-verify"])}`,"name-cert-verify"),t.plugin!=="shadow-tls"&&a9(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=${zi(n)}`),u9(e,t);let i=We(t["ech-opts"])?t["ech-opts"]:void 0;if((i?HA(i.enable):Me(t._echConfigList))&&!t["reality-opts"]){let s=zg(i?i.config:t._echConfigList);if(!s)throw Tn("Surge ECH requires an inline ECHConfigList in base64 or base64url");e.append(`,ech-config=${s}`)}}function $X(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=${zi(r)}`)}function c9(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 PX(e){return le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path")}function kX(e){return Number(e.version)===6&&PX(e)}function nh(){return{produce:(t,r,n={})=>{if(t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"]&&!["vmess","trojan","vless"].includes(t.type))throw Tn(`Platform ${Xg} does not support network ${t.network} with http upgrade`);switch(t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return TX(t);case"trojan":return RX(t);case"vmess":case"vless":return HX(t,n["include-unsupported-proxy"]);case"http":return KX(t);case"h2-connect":return UX(t);case"direct":return VX(t);case"socks5":return zX(t);case"snell":return WX(t);case"tuic":return YX(t);case"wireguard-surge":return l9(t);case"hysteria2":return ZX(t);case"ssh":return jX(t);case"trusttunnel":return NX(t);case"masque-surge":return LX(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return XX(t);if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw Tn(`Platform ${Xg} does not support proxy type ${t.type} with network or REALITY`);return OX(t)}throw Tn(`Platform ${Xg} does not support proxy type: ${t.type}`)}}}function TX(e){let t=new Ge(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 Tn(`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 Tn(`plugin ${e.plugin} is not supported`)}return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Ga(t,e,!0),fn(t,e),t.toString()}function RX(e){let t=new Ge(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),WA(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),Gi(t,e),Ga(t,e),fn(t,e),t.toString()}function OX(e){let t=new Ge(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),Gi(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),fn(t,e),t.toString()}function NX(e){let t=new Ge(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 zA(t,e),c9(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),e.network==="h3"&&t.append(",h3=true"),Gi(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),fn(t,e),t.toString()}function LX(e){let t=new Ge(e);return t.append(`${e.name}=masque,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),VA(t,e),Gi(t,e),fn(t,e),t.toString()}function UX(e){let t=new Ge(e);return t.append(`${e.name}=h2-connect,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),zA(t,e),c9(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),Gi(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Ga(t,e),fn(t,e),t.toString()}function HX(e,t){let r=e.type==="vless",n=new Ge(e);if(n.append(`${e.name}=${e.type},${e.server},${e.port}`),n.appendIfPresent(`,username=${e.uuid}`,"uuid"),!r){let i=Yg(e.cipher);i&&n.append(`,encrypt-method=${i}`)}if(r)qX(n,e);else{WA(n,e,t);let i=le(e,"aead")?e.aead:e.alterId===0;n.append(`,vmess-aead=${i}`),n.appendIfPresent(`,tls=${e.tls}`,"tls"),Gi(n,e,!!e.tls)}return Ga(n,e),fn(n,e),n.toString()}function qX(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 Tn(`VLESS network ${r} is unsupported`);if(t.encryption&&/[,\r\n"']/.test(t.encryption))throw Tn("VLESS encryption contains unsupported characters");if(!jg(t))throw Tn("Unsupported VLESS transport, TLS or flow combination");if(r==="ws")WA(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"),a9(e,t),u9(e,t)):(e.appendIfPresent(`,tls=${t.tls}`,"tls"),Gi(e,t,!!i))}function MX(e,t){let r=t["xhttp-opts"];if(r?.["download-settings"])throw Tn("VLESS XHTTP download-settings are unsupported");e.append(",xhttp=true");let n=We(r?.headers)?Object.entries(r.headers):[],i=r?.host??n.find(([a])=>/^host$/i.test(a))?.[1];for(let[a,u]of Object.entries(eh)){let l=a==="host"?i:i9.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 Tn(`VLESS xhttp-${a} contains unsupported characters`);let p=!m||/[,'\s]/.test(m)?zi(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 Tn("VLESS xhttp-headers contain unsupported characters");let s=GA(Object.fromEntries(o),"|");s&&e.append(`,xhttp-headers=${zi(s)}`)}function jX(e){let t=new Ge(e);return t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),$X(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 KX(e){let t=new Ge(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"),zA(t,e),Gi(t,e,!!e.tls),Ga(t,e),fn(t,e),t.toString()}function VX(e){let t=new Ge(e);return t.append(`${e.name}=direct`),fn(t,e),t.toString()}function zX(e){let t=new Ge(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"),Gi(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Ga(t,e),fn(t,e),t.toString()}function zA(e,t){let r=GX(t.headers);Me(r)&&e.append(`,headers=${zi(r)}`)}function GX(e){return GA(e,";")}function GA(e,t){return!e||typeof e!="object"?"":Object.entries(e).filter(([r,n])=>Me(r)&&n!=null).map(([r,n])=>`${r}:${zi(n)}`).join(t)}function WX(e){if(kX(e))return Q.error(`Platform ${Xg} does not support Snell version ${e.version} with obfs`),"";let t=new Ge(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"),Ga(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),fn(t,e),t.toString()}function YX(e){let t=new Ge(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"),VA(t,e),Gi(t,e),Ga(t,e),fn(t,e),t.toString()}function XX(e){let t=Array.isArray(e.peers)&&e.peers.length>0?e.peers:[e],{ip:r,ipv6:n}=_p({ip:e["self-ip"]??e.ip??t[0].ip,ipv6:e["self-ip-v6"]??e.ipv6??t[0].ipv6}),i=Me(e["private-key-keystore-name"])?"private-key-keystore-name":"private-key",o=e[i];if(!gl(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=l9({...e,"section-name":a,"underlying-proxy":s==null?e["underlying-proxy"]:void 0}),l=new Ge(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;Me(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(!gl(g["public-key"])||!w)throw new Error("Surge WireGuard peers require public-key and allowed-ips");let E=g.endpoint;if(!Me(E)&&Me(g.server)&&gl(g.port)){let H=g.server.trim();E=`${Xt(H)?`[${H}]`:H}:${g.port}`}if(!Me(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":zi(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])=>gl(H)).map(([H,K])=>`${H} = ${K}`).join(", ");l.append(`
|
||
peer = (${F})`)}return l.toString()}function l9(e){let t=vt(e["section-name"])?.trim();if(!t)throw new Error("Surge WireGuard requires section-name");let r=t.includes(",")?zi(t):t,n=new Ge(e);return n.append(`${e.name}=wireguard,section-name=${r}`),fn(n,e),n.toString()}function ZX(e){let t={salamander:"salamander-password",gecko:"gecko-password"}[e.obfs];if(e["obfs-password"]&&!t)throw Tn("only salamander and gecko obfs are supported");let r=new Ge(e);return r.append(`${e.name}=hysteria2,${e.server},${e.port}`),r.appendIfPresent(`,password="${e.password}"`,"password"),VA(r,e),e["obfs-password"]&&t&&r.append(`,${t}=${Vi(e["obfs-password"])}`),Gi(r,e),Ga(r,e),r.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),fn(r,e),r.toString()}function WA(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=GA(n,"|");Me(i)&&e.append(`,ws-headers=${zi(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 Tn("reality is unsupported");if(!["tcp"].includes(t.network))throw Tn(`network ${t.network} is unsupported`)}}var ewe=B(x());var zve=B(x()),p9=B(aa());var Lve=B(x());function YA(e){try{return decodeURIComponent(`${e}`.replace(/\+/g,"%20"))}catch{return e}}function Zg(e){let t=e.indexOf("=");return t===-1?{key:YA(e),value:""}:{key:YA(e.slice(0,t)),value:YA(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=Zg(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 vl(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=Zg(o);if(s.key===t&&s.value!=="")return s.value}return""}function XA(e,t){let r=vl(e,t),n=li(r);return n==null?{value:"",parsed:null}:{value:r,parsed:n}}function JX(e,t,r){let n=e.includes("?")?e.endsWith("?")||e.endsWith("&")?"":"&":"?";return`${e}${n}${encodeURIComponent(t)}=${encodeURIComponent(`${r}`)}`}function ZA(e,t,r){let n=e==null||e===""?"/":`${e}`,{path:i}=As(n,t);return JX(i,t,r)}function ec(e){let t=e?.path;if(!e)return;let{value:r,parsed:n}=XA(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 tc(e){e&&delete e["_v2ray-http-upgrade-ed"]}var QX={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function f9(e,t,r){if(!We(t)||!Me(t[pl]))return;let n=Me(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[pl]}"].`)}function eZ(e,t){t!=="internal"&&(f9(e,e["ech-opts"],"ech-opts"),f9(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(!Kg(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(tZ(s)&&s.type==="trusttunnel")return Q.error(`mihomo does not support headers for TrustTunnel proxy ${s.name}. Proxy has been filtered.`),!1;if(Jf(s,["websocket"])){if(s.type==="snell"&&!rZ(s))return!1;if(h9(s)&&(!["ss","snell","vmess","vless","trojan","anytls"].includes(s.type)||!JA(d9(s),["ss","snell"].includes(s.type)?[1,2,3]:[0,1,2,3])))return!1;if(s.type==="vless"&&s.network==="xhttp"&&h9(s["xhttp-opts"]?.["download-settings"])&&!JA(d9(s["xhttp-opts"]["download-settings"]),[0,1,2,3]))return!1;if(nZ(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(eZ(s,n),Vg(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=YI(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=QA(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="/"),ec(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];tc(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"]=QX[s["ip-version"]]||s["ip-version"]),s});return Ho(o,n,i)}}}function tZ(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function JA(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 rZ(e){if(!JA(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&&!We(i))s="obfs-opts must be a mapping";else if(!o.includes(i?.mode??""))s="unsupported obfs-opts.mode";else if(t){let a=p9.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 h9(e){return!!QA(e)}function nZ(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 d9(e){return QA(e)?.version}function QA(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 g9="SurgeMac",v9=nh();function Dp(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return w9(t);default:{if(n.mihomoExternal||t._mihomoExternal)return m9(t,r,n)||"";try{return v9.produce(t,r,n)}catch(i){if(n.useMihomoExternal&&i instanceof rh){let o=m9(t,r,n)||"";if(!o)throw i;return Q.log(`${t.name} is not supported on ${g9}, try to use mihomo(SurgeMac - External Proxy Program) instead`),o}throw i instanceof rh?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 w9(e){let t=new Ge(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 m9(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=v9.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:[]};sZ(e.server)?l.addresses.push(e.server):Q.warn(`Platform ${g9}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),u=w9(l)}return r.localPort=i-1,u}}function sZ(e){return _r(e)||Xt(e)}var owe=B(x());function Jg(){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=Cp(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="/"),ec(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];tc(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 Ho(o,n,i)}}}var dwe=B(x());function Qg(){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(Jf(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=Cp(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="/"),ec(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];tc(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 Ho(o,n,i)}}}var _we=B(x()),_9=B(aa()),C9=B(za());var gwe=B(x()),eS=B(za());var y9={"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"},E9={"session-id-placement":"session-placement","session-id-key":"session-key"},tS={"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"},iZ={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",...tS,...y9,...E9},Fp={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",...y9,"no-grpc-header":"no-grpc-header",...E9,"session-id-table":"session-table","session-id-length":"session-length","seq-placement":"seq-placement","seq-key":"seq-key",...tS,...Object.fromEntries(Object.entries(iZ).map(([e,t])=>[`download-${e}`,`download-settings.${t}`]))};function b9(e){if(e)for(let t of["","download-"]){let r=o=>eS.default.get(e,Fp[`${t}${o}`]);for(let o of Object.keys(tS)){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(qo(n)!=null&&qo(i)!=null){let o=`xhttp-${t}xmux`;throw new Error(`Loon ${o}-max-concurrency and ${o}-max-connections cannot both be positive`)}}}function A9(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(Fp,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}eS.default.set(e,Fp[t],r)}}var Bp="Loon",Hs={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function rS(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${Bp} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return aZ(t);case"ssr":return uZ(t);case"snell":return cZ(t);case"trojan":return lZ(t);case"vmess":return hZ(t,n["include-unsupported-proxy"]);case"vless":return pZ(t,n["include-unsupported-proxy"]);case"http":return mZ(t);case"socks5":return gZ(t);case"wireguard":return wZ(t);case"tailscale":return vZ(t);case"hysteria2":return EZ(t);case"mieru":return yZ(t)}if(t.type==="anytls"){if(t.network&&!["tcp"].includes(t.network))throw new Error(`Platform ${Bp} does not support proxy type ${t.type} with network ${t.network}`);return fZ(t)}throw new Error(`Platform ${Bp} 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 rc(e,t){let r=I9(t);r&&e.append(`,tls-profile=${r}`)}function wl(e,t,r=!1){let n=r?B9(t):F9(t);n&&e.append(`,alpn="${n}"`)}function Wa(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 nS(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");b9(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=B9(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:S9(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:I9(n)}}}e.append(",transport=xhttp");for(let[o,s]of[["path",r?.path],["host",S9(r)]])s!=null&&e.append(`,${o}=${Wa(s)}`);for(let[o,s]of Object.entries(Fp)){let a=C9.default.get(i,s);a!=null&&e.append(`,xhttp-${o}=${Wa(a)}`)}for(let[o,s]of[["xhttp-header",r?.headers],["xhttp-download-header",n?.headers]])if(We(s))for(let[a,u]of Object.entries(s))/^host$/i.test(a)||u==null||e.append(`,${o}=${Wa(`${a}: ${u}`,!0)}`)}function S9(e){if(e?.host!=null)return e.host;if(We(e?.headers))return Object.entries(e.headers).find(([t])=>/^host$/i.test(t))?.[1]}function oZ(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 D9(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}`)}rc(e,t);let o=oZ(t);o&&e.append(`,alpn="${o}"`),e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function e2(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 F9(e){return(Array.isArray(e.alpn)?e.alpn:`${e.alpn||""}`.split(",")).map(r=>`${r}`.trim()).filter(r=>r!=="").join(",")}function B9(e,t=!1){let r=F9(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 I9(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 aZ(e){let t=new Ge(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`)}D9(t,e),e["udp-over-tcp"]&&(e["udp-over-tcp-version"]===2?e.plugin==="obfs"?Q.error(`Platform ${Bp} shadowsocks udp-over-tcp does not support obfs`):t.append(",udp-over-tcp=true"):Q.error(`Platform ${Bp} 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 uZ(e){let t=new Ge(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"),D9(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 cZ(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 Ge(e);n.append(`${e.name}=snell,${e.server},${e.port},${Wa(e.psk,!0)},version=${t}`),r?.mode==="http"&&(n.append(",obfs=http"),r.host!=null&&n.append(`,obfs-host=${Wa(r.host)}`),r.path!=null&&n.append(`,obfs-uri=${Wa(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 lZ(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=new Ge(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)nS(n,e);else throw new Error(`network ${e.network} is unsupported`);n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),rc(n,e),wl(n,e,r),t?e2(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 fZ(e){let t=!!e["reality-opts"],r=new Ge(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"),rc(r,e),wl(r,e),t?e2(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 hZ(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=s9(e.cipher),i=new Ge(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)nS(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)&&rc(i,e),(e.tls||t||r)&&wl(i,e,r),t?e2(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 dZ(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=${Wa(l)}`),u.length&&e.append(`,encryption-padding=${Wa(u.join("."))}`)}function pZ(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 Ge(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)nS(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)&&rc(u,e),(e.tls||n||t||i)&&wl(u,e,i),dZ(u,e.encryption),t&&u.append(`,flow=${e.flow}`),n?e2(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 mZ(e){let t=new Ge(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&&(rc(t,e),wl(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 gZ(e){let t=new Ge(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&&(rc(t,e),wl(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 vZ(e){let t=new Ge(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 wZ(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 Ge(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 yZ(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||_9.Buffer.byteLength(m,"utf8")>64))throw new Error("Loon Mieru username and password must each be 1-64 UTF-8 bytes");let o=new Ge(e),s=Xt(t)?`[${t}]`:t,[a,u]=i.map(m=>Wa(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 EZ(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new Ge(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"),rc(t,e),wl(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 Twe=B(x());function bZ(e,{excludeHost:t=!1}={}){if(!We(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 AZ(e,t){let r=r2(e?.["_v2ray-http-upgrade-ed"]);if(r!=="")return r;let n=r2(As(t||"/","ed").value);return n!==""?n:2560}function t2(e,t){return t?.["v2ray-http-upgrade-fast-open"]?ZA(e||"/","ed",AZ(t,e)):e}function sS(e,t){let r=t?.["max-early-data"],n=r2(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:ZA(e||"/","ed",n)}function r2(e){return e==null||`${e}`==""||li(e)==null?"":`${e}`}function SZ(e){return Xn(e)}function _Z(e){return Ls(e)}function x9({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 n2(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 CZ(e){if(!We(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=SZ(e["h-keep-alive-period"]);return n!=null&&(t.hKeepAlivePeriod=n),Object.keys(t).length>0?t:void 0}function $9(e,t,{excludeHostHeader:r=!0,xmuxTarget:n="root"}={}){if(!We(e)||!We(t))return;let i=bZ(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=ml(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=_Z(t["uplink-chunk-size"]);if(o!=null&&(e.uplinkChunkSize=o),t["sc-max-each-post-bytes"]!=null){let a=ml(t["sc-max-each-post-bytes"]);a!=null&&(e.scMaxEachPostBytes=a)}if(t["sc-min-posts-interval-ms"]!=null){let a=qo(t["sc-min-posts-interval-ms"]);a!=null&&(e.scMinPostsIntervalMs=a)}let s=CZ(t["reuse-settings"]);s&&(n==="extra"?e.extra={...We(e.extra)?e.extra:{},xmux:s}:e.xmux=s)}function DZ(e,t={},r={}){if(!We(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=We(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=qA(e["ech-opts"],void 0,{dnsFieldPath:"xhttp-opts.download-settings.ech-opts._dns",warnDefaultDns:v=>x9({...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=nc(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=n2("xhttp",e)??n2("xhttp",t);p&&(h.host=p);let d=e.mode??t.mode;if(d&&(h.mode=d),$9(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 FZ(e){let t=e["xhttp-opts"]||{},r={};$9(r,t,{excludeHostHeader:!0,xmuxTarget:"root"});let n=DZ(t["download-settings"],t,e);return n&&(r.downloadSettings=n),Object.keys(r).length>0?r:void 0}function nc(e){if(Array.isArray(e))return e.map(nc);if(We(e)){let t={};for(let[r,n]of Object.entries(e))t[r]=nc(n);return t}return e}function BZ(e,t){return e==null?nc(t):Array.isArray(e)||Array.isArray(t)?nc(e):We(e)&&We(t)?P9(e,t):nc(e)}function P9(e,t){let r=We(e)?nc(e):{};if(!We(t))return r;for(let[n,i]of Object.entries(t)){if(!Object.prototype.hasOwnProperty.call(r,n)){r[n]=nc(i);continue}r[n]=BZ(r[n],i)}return r}function k9(e){if(typeof e=="string")return e;if(We(e))return JSON.stringify(e)}function IZ(e){let t=k9(e._extra);if(t!=null)return t;if(e.network!=="xhttp")return e._extra||"";let r=FZ(e),n=P9(r,e._extra_unsupported);return Object.keys(n).length>0?JSON.stringify(n):""}function iS(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=MA(e["ech-opts"],e._echConfigList,{dnsFieldPath:"ech-opts._dns",warnDefaultDns:V=>x9({...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=IZ(e);E&&(w=`&extra=${encodeURIComponent(E)}`);let _="",C=k9(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 M=e[`${e.network}-opts`]||{},L=e.network==="ws"&&M?.["v2ray-http-upgrade"],T=M?.[`${e.network}-service-name`],O=M?.path,R=n2(e.network,M),N=r2(e["ws-opts"]?.["max-early-data"]);Array.isArray(O)&&(O=O[0]),L&&M?.["v2ray-http-upgrade-fast-open"]?O=t2(O,M):e.network==="ws"&&e["ws-opts"]?.["max-early-data"]!=null&&O&&(O=As(O,"ed").path),O&&(I+=`&path=${encodeURIComponent(O)}`),R&&(I+=`&host=${encodeURIComponent(Array.isArray(R)?R[0]:R)}`),T&&(I+=`&serviceName=${encodeURIComponent(T)}`),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 q="",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"":q="&packetEncoding=none";break;case"packetaddr":q="&packetEncoding=packet";break;case"xudp":q="&packetEncoding=xudp";break}return`vless://${e.uuid}@${e.server}:${e.port}?security=${encodeURIComponent(t)}${I}${q}${s}${a}${l}${h}${p}${u}${v}${g}${y}${n}${o}${i}${F}${w}${_}${H}${K}#${encodeURIComponent(e.name)}`}function sh(){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=Sp(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"],Re=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Re)&&(Re=Re[0]),Fe?Re=t2(Re,pe):r.network==="ws"&&(Re=sS(Re,pe)),Re&&(s+=`&path=${encodeURIComponent(Re)}`),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=iS({...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,Re=n2(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=t2(Fe,se):r.network==="ws"&&(Fe=sS(Fe,se)),Fe&&(n.path=Fe),Re&&(n.host=Array.isArray(Re)?r.network==="h2"?Re.join(","):Re[0]:Re))}n="vmess://"+bt.encode(JSON.stringify(n));break;case"vless":n=iS(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"],Re=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Re)&&(Re=Re[0]),Fe?Re=t2(Re,pe):r.network==="ws"&&(Re=sS(Re,pe)),Re&&(E+=`&path=${encodeURIComponent(Re)}`),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="",M="",L="",T="",O="",R="";if(S){T="&security=reality";let se=r["reality-opts"]?.["public-key"];se&&(M=`&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&&(R=`&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}${T}${I}${M}${L}${O}${R}#${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=MA(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 q=[];Object.keys(r).forEach(se=>{if(!["name","type","server","port"].includes(se)){let pe=se.replace(/-/,"_");["alpn"].includes(se)?r[se]&&q.push(`${pe}=${encodeURIComponent(Array.isArray(r[se])?r[se][0]:r[se])}`):["skip-cert-verify"].includes(se)?r[se]&&q.push("insecure=1"):["tfo","fast-open"].includes(se)?r[se]&&!q.includes("fastopen=1")&&q.push("fastopen=1"):["ports"].includes(se)?q.push(`mport=${r[se]}`):["auth-str"].includes(se)?q.push(`auth=${r[se]}`):["up"].includes(se)?q.push(`upmbps=${r[se]}`):["down"].includes(se)?q.push(`downmbps=${r[se]}`):["_obfs"].includes(se)?q.push(`obfs=${r[se]}`):["obfs"].includes(se)?q.push(`obfsParam=${r[se]}`):["sni"].includes(se)?q.push(`peer=${r[se]}`):r[se]&&!/^_/i.test(se)&&q.push(`${pe}=${encodeURIComponent(r[se])}`)}}),n=`hysteria://${r.server}:${r.port}?${q.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=iS({...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[Re,Ve]=Fe.split("=");Re&&(te[Re]=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 Re=[`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]&&Re.push(`${Ve}=${encodeURIComponent(r[Ve])}`);n=`mierus://${pe}:${Fe}@${r.server}?${Re.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 Uwe=B(x());var xZ=sh();function Ip(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(xZ.produce(i))}catch(o){Q.error(`Cannot produce proxy: ${i.name}
|
||
Reason: ${o}`)}}),bt.encode(n.join(`
|
||
`))}}}var jwe=B(x()),oS=B(aa());var s2="QX";function $Z(e){return(Array.isArray(e)?e:`${e}`.split(",")).map(r=>`${r}`.trim()).filter(Boolean).map(r=>{let n=oS.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 Ya(e,t){if(le(t,"tls-alpn")){e.append(`,tls-alpn=${t["tls-alpn"]}`);return}let r=le(t,"alpn")&&$Z(t.alpn);r&&e.append(`,tls-alpn=${r}`)}function xp(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${s2} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return PZ(t);case"ssr":return kZ(t);case"trojan":return TZ(t);case"vmess":return RZ(t);case"http":return UZ(t);case"socks5":return HZ(t);case"vless":return OZ(t);case"anytls":return NZ(t);case"hysteria2":return LZ(t);case"mieru":return qZ(t)}throw new Error(`Platform ${s2} 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 ${s2} 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 aS(e){return["http","vmess-http","vemss-http","shadowsocks-http"].includes(e._qx_obfs_http)?e._qx_obfs_http:"http"}function Xa(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 PZ(e){let t=new Ge(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t),i=Zf(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=${aS(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"),Ya(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"),Xa(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 kZ(e){let t=new Ge(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 TZ(e){let t=new Ge(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"),Ya(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"),Xa(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 Ge(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);r(`vmess=${e.server}:${e.port}`);let i=n9(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=${aS(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"),Ya(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"),Xa(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 OZ(e){if(e.encryption&&e.encryption!=="none")throw new Error("VLESS encryption is not supported");let t=new Ge(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=${aS(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"),Ya(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"),Xa(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 NZ(e){let t=e.network?.trim().toLowerCase();if(t&&t!=="tcp")throw new Error(`Platform ${s2} does not support AnyTLS with transport ${e.network}`);let r=new Ge(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"),Ya(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"),Xa(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 LZ(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 Ge(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(oS.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"),Ya(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"),Xa(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 UZ(e){let t=new Ge(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"),Ya(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"),Xa(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 Ge(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"),Ya(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"),Xa(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 qZ(e){let t=new Ge(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"),Ya(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"),Xa(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 Ywe=B(x());function $p(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>{if(i["include-unsupported-proxy"])return!0;if(Jf(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(Vg(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"?Zf(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="/"),ec(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];tc(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 Ho(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 tye=B(x()),R9=B(za());var Pp="Surfboard";function yl(e){return e!=null&&`${e}`.trim().length>0}function sc(e,t,r=!0){if(!r)return;let n=String(t["tls-fingerprint"]);e.appendIfPresent(`,server-cert-fingerprint-sha256=${n.includes(",")?Vi(n):n}`,"tls-fingerprint"),e.appendIfPresent(`,sni=${Vi(t.sni)}`,"sni"),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify")}function i2(){return{produce:t=>{if(t.type!=="vless"&&t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${Pp} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return GZ(t);case"trojan":return WZ(t);case"vmess":return YZ(t);case"vless":return XZ(t);case"http":return ZZ(t);case"h2-connect":return JZ(t);case"snell":return zZ(t);case"tuic":return jZ(t);case"socks5":return QZ(t);case"hysteria2":return KZ(t);case"wireguard-surge":return eJ(t)}if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw new Error(`Platform ${Pp} does not support proxy type ${t.type} with network or REALITY`);return VZ(t)}throw new Error(`Platform ${Pp} does not support proxy type: ${t.type}`)}}}function jZ(e){if(e.token?.length)throw new Error(`Platform ${Pp} does not support proxy type ${e.type} v4`);let t=new Ge(e);return t.append(`${e.name}=tuic-v5,${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),yl(e.alpn)&&t.append(`,alpn="${Array.isArray(e.alpn)?e.alpn.join(","):e.alpn}"`),yl(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),yl(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),sc(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function KZ(e){if((e.obfs||e["obfs-password"])&&!["salamander","gecko"].includes(e.obfs))throw new Error("Surfboard Hysteria2 supports Salamander and Gecko obfs");let t=new Ge(e);return t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),yl(e.ports)&&t.append(`,port-hopping="${String(e.ports).replace(/,/g,";")}"`),yl(e["hop-interval"])&&t.append(`,port-hopping-interval=${e["hop-interval"]}`),e["obfs-password"]&&t.append(`,${e.obfs}-password=${Vi(e["obfs-password"])}`),sc(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 VZ(e){let t=new Ge(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),sc(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 zZ(e){if(le(e,"version")&&![1,2,3,4,5].includes(Number(e.version)))throw new Error(`Platform ${Pp} does not support snell version ${e.version}`);let t=new Ge(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 GZ(e){let t=new Ge(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 WZ(e){let t=new Ge(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),O9(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),sc(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 YZ(e){let t=String(e.cipher??"").trim().toLowerCase(),r=Yg(t);if(t&&t!==th&&!r)throw new Error(`Surfboard does not support VMess cipher ${t}`);let n=new Ge(e);return n.append(`${e.name}=${e.type},${e.server},${e.port}`),n.appendIfPresent(`,username=${e.uuid}`,"uuid"),r&&n.append(`,encrypt-method=${r}`),O9(n,e),le(e,"aead")?n.append(`,vmess-aead=${e.aead}`):n.append(`,vmess-aead=${e.alterId===0}`),n.appendIfPresent(`,tls=${e.tls}`,"tls"),sc(n,e,!!e.tls),n.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),n.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),n.toString()}function XZ(e){if(!yl(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(!jg(e))throw new Error("Unsupported VLESS transport, TLS or flow combination");let t=new Ge(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)?Vi(u):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",T9(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(eh))r(`xhttp-${l}`,l==="host"?u:R9.default.get(s,h));r("xhttp-headers",T9(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),yl(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 T9(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 ZZ(e){let t=new Ge(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"),sc(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){if(e.plugin)throw new Error("Surfboard HTTP/2 CONNECT does not support plugins");if(e.username==null!=(e.password==null))throw new Error("HTTP/2 CONNECT authentication requires both username and password");let t=new Ge(e);t.append(`${e.name}=h2-connect,${e.server},${e.port}`),t.appendIfPresent(`,username=${Vi(e.username)}`,"username"),t.appendIfPresent(`,password=${Vi(e.password)}`,"password");let r=Object.entries(e.headers??{}).filter(([,i])=>i!=null).map(([i,o])=>{if(!/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(i)||/[;\x00-\x08\x0a-\x1f\x7f]/.test(String(o)))throw new Error("Invalid HTTP/2 CONNECT header name or value");return`${i}:${o}`});if(r.length&&t.append(`,headers=${Vi(r.join(";"))}`),le(e,"max-streams")){let i=Number(String(e["max-streams"]));if(!Number.isSafeInteger(i)||i<1)throw new Error("HTTP/2 CONNECT max-streams must be a positive integer");t.append(`,max-streams=${i}`)}sc(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),["auto","on","off"].includes(e["block-quic"])&&t.append(`,block-quic=${e["block-quic"]}`),t.appendIfPresent(`,underlying-proxy=${Vi(e["underlying-proxy"])}`,"underlying-proxy");let n=t.toString();if(/[\r\n]/.test(n))throw new Error("HTTP/2 CONNECT proxy contains a line break");return n}function QZ(e){let t=new Ge(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"),sc(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function eJ(e){let t=new Ge(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 O9(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("|");Me(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 cye=B(x()),L9=B(aa());var tJ={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=tJ[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})},rJ=e=>{let t=e["control-http-client"];return t==null?!1:typeof t=="string"?t.trim()!=="":We(t)?Object.values(t).some(r=>r!=null&&r!==""):!0},pn=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},Wi=(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},Yi=(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))))},cS=(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}=XA(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},U9=(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},H9=(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},lS=(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},nJ=(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}-----`]},sJ=["chrome","firefox","edge","safari","360","qq","ios","android","random","randomized"],q9=e=>{let t=`${e||""}`.trim().toLowerCase();if(sJ.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=[L9.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}`)},Za=(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=q9(e["client-fingerprint"]);r&&(t.tls.utls={...t.tls.utls,enabled:!0,fingerprint:r})}if(e._ech&&We(e._ech))t.tls.ech=e._ech;else if(e["ech-opts"]&&We(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=nJ(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},iJ=(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},oJ=(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),Za(e,t),hn(e,t),dn(e,t),t},aJ=(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),Wi(e,t),Jn(e,t),pn(e,t),hn(e,t),dn(e,t),t},uJ=(e={})=>{let t=o2(e),r={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:a2(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}),Wi(e,r),Yi(e.smux,r),{type:"ss-with-st",ssPart:r,stPart:uS(e,t)}},a2=(e={})=>`${e.name}_shadowtls`,o2=(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}},N9=e=>{if(typeof e=="string")return e.split(",").map(t=>t.trim()).filter(t=>t!=="");if(Array.isArray(e))return e},uS=(e={},t)=>{if(!t)throw new Error("shadow-tls plugin options are missing");let r=q9(e["client-fingerprint"]),n={tag:a2(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=N9(t.alpn)??N9(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},cJ=(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),Wi(e,t),Jn(e,t),pn(e,t),Yi(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=Sp(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},lJ=(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),Wi(e,t),Jn(e,t),pn(e,t),Yi(e.smux,t),hn(e,t),dn(e,t),t},fJ=e=>{if(e==null)return;let t=`${e}`.trim();return/^\d+$/.test(t)?parseInt(t,10):NaN},hJ=(e={},t=!1)=>{let r=fJ(e.version),n=o2(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),Wi(e,s),n?(s.detour=a2(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},dJ=["","packetaddr","xudp"],pJ=e=>{let t=`${e}`.trim().toLowerCase();if(dJ.includes(t))return t},j9=(e,t)=>{if(e["packet-encoding"]!=null){let r=pJ(e["packet-encoding"]);r!=null&&(t.packet_encoding=r)}else e.xudp?t.packet_encoding="xudp":e["packet-addr"]&&(t.packet_encoding="packetaddr")},mJ=(e,t)=>{j9(e,t),e["global-padding"]!=null&&(t.global_padding=!!e["global-padding"]),e["authenticated-length"]!=null&&(t.authenticated_length=!!e["authenticated-length"])},gJ=(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 mJ(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&cS(e,t),e.network==="h2"&&H9(e,t),e.network==="http"&&U9(e,t),e.network==="grpc"&&lS(e,t),Wi(e,t),Jn(e,t),pn(e,t),Za(e,t),Yi(e.smux,t),hn(e,t),dn(e,t),t},vJ=(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 j9(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&cS(e,t),e.network==="h2"&&H9(e,t),e.network==="http"&&U9(e,t),e.network==="grpc"&&lS(e,t),Wi(e,t),Jn(e,t),pn(e,t),Yi(e.smux,t),Za(e,t),hn(e,t),dn(e,t),t},wJ=(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"&&lS(e,t),e.network==="ws"&&cS(e,t),Wi(e,t),Jn(e,t),pn(e,t),Za(e,t),Yi(e.smux,t),hn(e,t),dn(e,t),t},yJ=(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),Za(e,t),Yi(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},EJ=(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)),Wi(e,t),Za(e,t),pn(e,t),Jn(e,t),Yi(e.smux,t),hn(e,t),dn(e,t),t},bJ=(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"]),Wi(e,t),Za(e,t),Jn(e,t),pn(e,t),Yi(e.smux,t),hn(e,t),dn(e,t),t},AJ=(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`),Wi(e,t),Jn(e,t),pn(e,t),Za(e,t),Yi(e.smux,t),hn(e,t),dn(e,t),t},SJ=(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),Za(e,r),hn(e,r),dn(e,r),r},_J=(e={})=>{let t=rJ(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)),We(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},CJ=(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),Yi(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 u2(){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=o2(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=uS(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(iJ(u));break;case"http":o.push(oJ(u));break;case"socks5":if(u.tls)throw new Error(`Platform sing-box does not support proxy type: ${u.type} with tls`);o.push(aJ(u));break;case"ss":if(u.plugin==="shadow-tls"){let{ssPart:v,stPart:g}=uJ(u);o.push(v),o.push(g)}else o.push(cJ(u));break;case"ssr":if(i["include-unsupported-proxy"])o.push(lJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type}`);break;case"snell":{o.push(hJ(u,i["include-unsupported-proxy"]));let v=o2(u);v&&o.push(uS(u,v));break}case"vmess":if(!u.network||["tcp","ws","grpc","h2","http"].includes(u.network))o.push(gJ(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(vJ(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(wJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with flow ${u.flow}`);break;case"naive":o.push(yJ(u));break;case"hysteria":o.push(EJ(u));break;case"hysteria2":o.push(bJ(u,i["include-unsupported-proxy"]));break;case"tuic":if(!u.token||u.token.length===0)o.push(AJ(u));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":o.push(CJ(u));break;case"anytls":o.push(SJ(u,i["include-unsupported-proxy"]));break;case"tailscale":o.push(_J(u));break;default:throw new Error(`Platform sing-box does not support proxy type: ${u.type}`)}if(d){let v=o[l];v.detour=a2(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 pye=B(x());var DJ={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 c2(){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||!G9(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||!G9(s)||typeof s.flow<"u"&&!["xtls-rprx-vision",""].includes(s.flow))||s.type==="tuic"&&s.token&&s.token.length!==0||s.type==="snell"&&W9(s.version)===null||s.type==="ssr"&&!xJ(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,...K9(s)?{headers:s.headers}:{},tfo:fi(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:El(s)}:{}};else if(s.type==="https")s={type:"https",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,...K9(s)?{headers:s.headers}:{},tfo:fi(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:El(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:Ja(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:El(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:Ja(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:X9(s.cipher),server:s.server,port:s.port,password:s.password,protocol:kp(s.protocol),protocol_param:s["protocol-param"],obfs:kp(s.obfs),obfs_param:s["obfs-param"],tfo:fi(s),udp_relay:Ja(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:Ja(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:Ja(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:El(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:Ja(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:El(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:Y9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=z9(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:Ja(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:Y9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=z9(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:El(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:Ja(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=W9(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:Ja(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=kJ(u);if(m&&(TJ(u,s)&&(s.fingerprint_sha256=m),RJ(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=DJ[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 Ho(o,n,i)}}}function K9(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function fi(e){return!!(e.tfo??e["fast-open"])}function Ja(e){return e.udp??e.udp_relay}function V9(e){if(e!=null&&!(typeof e=="string"&&e.length===0))return e}function El(e){let t=e?.["reality-opts"];if(!t)return;let r={},n=V9(t["public-key"]),i=V9(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 z9(e){return{grpc:{service_name:e["grpc-opts"]?.["grpc-service-name"],sni:e.sni,reality:El(e),skip_tls_verify:e["skip-cert-verify"]}}}function G9(e){if(e.network!=="grpc")return!0;let t=e["grpc-opts"]?.["_grpc-type"];return t==null?!0:`${t}`.trim().toLowerCase()==="gun"}function W9(e){if(e==null)return;let t=`${e}`.trim();return/^[1-5]$/.test(t)?parseInt(t,10):null}var FJ=["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"],BJ=["origin","auth_sha1_v4","auth_aes128_md5","auth_aes128_sha1","auth_chain_a","auth_chain_b"],IJ=["plain","http_simple","http_post","random_head","tls1.2_ticket_auth","tls1.2_ticket_fastauth"];function kp(e){if(e==null)return;let t=`${e}`.trim().toLowerCase();return t.length>0?t:void 0}function X9(e){let t=kp(e);return t==="plain"?"none":t}function xJ(e){if(!FJ.includes(X9(e.cipher)))return!1;let t=kp(e.protocol);if(t!=null&&!BJ.includes(t))return!1;let r=kp(e.obfs);return r==null||IJ.includes(r)}function $J(e,...t){for(let r of t){let n=fS(e?.[r]);if(n)return n}}function PJ(e){return fS(e?.host)||$J(e?.headers,"host","Host")}function Y9(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=fS(i);o!=null&&(t[n]=o)}let r=PJ(e);return r&&(t.Host=r),Object.keys(t).length>0?t:void 0}function fS(e){if(Array.isArray(e))return e[0];if(e!=null)return e}function kJ(e){let t=e?.["tls-fingerprint"];if(typeof t!="string")return;let r=t.trim();return r.length>0?r:void 0}function TJ(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 RJ(e,t){if(e)for(let r of["grpc","http2","tls","wss"])e[r]&&(e[r].fingerprint_sha256=t)}function Z9(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var J9={qx:xp(),QX:xp(),QuantumultX:xp(),surge:nh(),Surge:nh(),SurgeMac:Dp(),Loon:rS(),Clash:Jg(),clash:Jg(),meta:Us(),clashmeta:Us(),"clash.meta":Us(),"Clash.Meta":Us(),ClashMeta:Us(),mihomo:Us(),Mihomo:Us(),uri:sh(),URI:sh(),v2:Ip(),v2ray:Ip(),V2Ray:Ip(),json:Z9(),JSON:Z9(),stash:Qg(),Stash:Qg(),shadowrocket:$p(),Shadowrocket:$p(),ShadowRocket:$p(),surfboard:i2(),Surfboard:i2(),singbox:u2(),"sing-box":u2(),egern:c2(),Egern:c2()};var obe=B(x());var OEe=B(x()),sx=B(w2());var KQ=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 supportsQuotedEscapes() {
|
||
return proxy.type === "vless" || proxy.type === "h2-connect";
|
||
}
|
||
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 h2_credentials? (h2_credential/h2_headers/headers/max_streams/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.tls = true;
|
||
handleShadowTLS();
|
||
}
|
||
h2_connect_address = "h2-connect" address { proxy.type = "h2-connect"; }
|
||
h2_credentials = comma !([a-zA-Z0-9-]+ equals) user:quoted_value comma pass:quoted_value {
|
||
proxy.username = user;
|
||
proxy.password = pass;
|
||
}
|
||
h2_credential = comma key:("username"/"password") equals value:quoted_value { proxy[key] = value; }
|
||
// Keep nested single-quoted Surge header values in the shared header parser.
|
||
h2_headers = comma "headers" equals value:double_quoted_value &{
|
||
return !/(?:^|;)\s*[^:;]+:\s*'.*?'\s*(?:;|$)/.test(value);
|
||
} {
|
||
const entries = [];
|
||
for (const pair of value.split(";")) {
|
||
const separator = pair.indexOf(":");
|
||
if (separator <= 0) continue;
|
||
const key = pair.slice(0, separator).trim();
|
||
if (key) entries.push([key, unescapeQuotedValue(pair.slice(separator + 1).trim())]);
|
||
}
|
||
proxy.headers = Object.fromEntries(entries);
|
||
}
|
||
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/hysteria2_obfs_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 value:quoted_value { proxy["tls-fingerprint"] = value.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:policy_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:double_quoted_value { return supportsQuotedEscapes() ? unescapeQuotedValue(value) : value; }
|
||
/ '"' match:$[^"]* '"' { return match; }
|
||
/ "'" match:$[^']* "'" { return supportsQuotedEscapes() ? unescapeQuotedValue(match) : match; }
|
||
/ value:uri { return value.trim(); }
|
||
double_quoted_value = '"' value:$(("\\" ('"' / "\\") / [^"])*) '"' &(_ ("," / !.)) { return value; }
|
||
vless_quoted_value = &{ return proxy.type === "vless"; } value:quoted_value { return value.trim(); }
|
||
uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); }
|
||
hysteria2_obfs_password = comma mode:("salamander"/"gecko") "-password" equals value:(
|
||
text:double_quoted_value { return unescapeQuotedValue(text); }
|
||
/ quoted_value
|
||
) {
|
||
if (proxy.obfs === "gecko" && mode === "salamander") return;
|
||
proxy.obfs = mode;
|
||
proxy["obfs-password"] = value;
|
||
}
|
||
|
||
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
|
||
comma = _ "," _
|
||
equals = _ "=" _
|
||
_ = [ \r\t]*
|
||
bool = b:("true"/"false") { return b === "true" }
|
||
others = comma [^=,]+ equals [^=,]+
|
||
`,$S;function Kr(){if(!$S){let e=sx.default.generate(KQ);$S={parse:t=>e.parse(t,{normalizeInlineEchConfigList:zg,setSurgeXhttpOption:t9})}}return $S}var UEe=B(x()),ix=B(w2());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-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 [^=,]+)
|
||
`,PS;function Ss(){if(!PS){let e=ix.default.generate(VQ);PS={parse:t=>e.parse(t,{setLoonXhttpOption:A9})}}return PS}var qEe=B(x()),TS=B(aa()),ox=B(w2());function zQ(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=TS.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 GQ=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" }
|
||
`,kS;function pi(){if(!kS){let e=ox.default.generate(GQ);kS={parse(t,r){let n=e.parse(t,{...r,byteLength:TS.Buffer.byteLength}),i=zQ(n["tls-alpn"]);return i&&(n.alpn=i),n}}}return kS}var VEe=B(x());var WQ=new Set(["__proto__","constructor","prototype"]),RS;function eu(e,t,r){if(Object(e)!==e)return e;if(Array.isArray(t)||(t=t.toString().match(/[^.[\]]+/g)||[]),t.some(n=>WQ.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 y2(e){if(e!=null)return/(TRUE)|1/i.test(e)}function ax(e){return li(e)!=null}function OS(e){try{return decodeURIComponent(e)}catch{return e}}function YQ(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=OS(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?OS(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:OS(h.slice(m+1))}if(t["skip-cert-verify"]=y2(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(",")),y2(l.ws)&&(t.network="ws",eu(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=vl(d,"ed");ax(v)&&(d=As(d,"ed").path,h?m=v:p=v)}eu(t,`${t.network}-opts.path`,d)}l.host&&eu(t,`${t.network}-opts.headers.Host`,l.host),h?(m=m||(ax(l.ed)?String(l.ed):""),eu(t,"ws-opts.v2ray-http-upgrade",!0),m&&(eu(t,"ws-opts.v2ray-http-upgrade-fast-open",!0),eu(t,"ws-opts._v2ray-http-upgrade-ed",m))):t.network==="ws"&&p&&(eu(t,"ws-opts.max-early-data",li(p)),eu(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&&eu(t,"reality-opts",d)}}return t.udp=y2(l.udp),t.tfo=y2(l.tfo),t}function NS(){return RS||(RS={parse:YQ}),RS}var qS=B(HS());var jo=B(za());function MS(e){let[t,r,n]=/^(.*?)(?:#(.*?))?$/.exec(e);return{content:r,fragment:n!=null?decodeURIComponent(n):void 0}}function XQ(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 jS(e){return e==null||!/^\d+$/.test(`${e}`)?!1:Number.isSafeInteger(parseInt(`${e}`,10))}function KS(e){let t=vl(e,"ed");return jS(t)?{path:As(e,"ed").path,ed:t}:{path:e,ed:""}}function VS(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 zS(e){if(Array.isArray(e))return e.flatMap(r=>zS(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 ZQ(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 JQ(){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=vl(m,"fp")||vl(m,"client-fingerprint");v&&(d["client-fingerprint"]=v)}return d}}}function QQ(){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 eee(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let{content:i,fragment:o}=MS(n.split("ss://")[1]),s={type:"ss"},a=i.match(/@([^/?]*)(\/|\?|$)/),u=XQ(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",jo.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=KS(C);C=F.path,w?E=F.ed:_=F.ed}jo.default.set(s,s.network+"-opts.path",C)}h.host&&jo.default.set(s,s.network+"-opts.headers.Host",decodeURIComponent(h.host)),w?(E=E||(jS(h.ed)?`${h.ed}`:""),jo.default.set(s,s.network+"-opts.v2ray-http-upgrade",!0),E!==""&&(jo.default.set(s,s.network+"-opts.v2ray-http-upgrade-fast-open",!0),jo.default.set(s,s.network+"-opts._v2ray-http-upgrade-ed",E))):s.network==="ws"&&_!==""&&(jo.default.set(s,s.network+"-opts.max-early-data",VS(_)),jo.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&&jo.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:ya(E.tls),sni:ya(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 tee(){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 ree(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{if(/^vmess:\/\/[^/?#]+@/.test(n))return GS().parse(n,"vmess");let{content:i,fragment:o}=MS(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:ya(u["udp-relay"]),tfo:ya(u["fast-open"]),"skip-cert-verify":vf(u["tls-verification"])?!u["tls-verification"]:void 0};if(vf(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]),Me(h)&&(l["ws-opts"].headers={Host:h})}else throw new Error(`Unsupported obfs: ${u.obfs}`);return Me(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(ya(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(ya(a.aid??a.alterId,0),10),tls:["tls",!0,1,"1"].includes(a.tls),"skip-cert-verify":vf(a.verify_cert)?!a.verify_cert:void 0};!h["skip-cert-verify"]&&vf(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=KS(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=zS(w);E&&(y.host=E)}else y.headers={Host:w};m?(y["v2ray-http-upgrade"]=!0,v=v||(jS(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"]=VS(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,Me(o)&&(h.name=o),h}}}}function GS(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:(n,i="vless")=>{let o=P=>{if(!We(P))return;let q={},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&&(q[te]=typeof ae=="number"?`${ae}`:ae)}let V=Xn(P.hKeepAlivePeriod);return V!=null&&(q["h-keep-alive-period"]=V),Object.keys(q).length>0?q:void 0},s=P=>{if(!We(P))return;let q={};for(let[Y,V]of Object.entries(P))typeof V=="string"&&(q[Y]=V);return Object.keys(q).length>0?q:void 0},a=P=>{if(Array.isArray(P))return P.map(a);if(We(P)){let q={};for(let[Y,V]of Object.entries(P))q[Y]=a(V);return q}return P},u=P=>{if(Array.isArray(P))return P.map(u).filter(Y=>Y!==void 0);if(!We(P))return P;let q={};for(let[Y,V]of Object.entries(P)){let X=u(V);X!==void 0&&(q[Y]=X)}return Object.keys(q).length>0?q:void 0},l=(P,q,Y)=>{let V=u(a(Y));V!==void 0&&(P[q]=V)},h=P=>{if(P==null)return;if(!We(P))return a(P);let q={};for(let[Y,V]of Object.entries(P))typeof V!="string"&&l(q,Y,V);return u(q)},m=(P,q)=>["maxConnections","maxConcurrency","cMaxReuseTimes","hMaxRequestTimes","hMaxReusableSecs"].includes(P)?Ls(q)!=null:P==="hKeepAlivePeriod"?Xn(q)!=null:!1,p=P=>{if(P==null)return;if(!We(P))return a(P);let q={};for(let[Y,V]of Object.entries(P))m(Y,V)||l(q,Y,V);return u(q)},d=P=>{if(P==null)return;if(!We(P))return a(P);let q={};for(let[Y,V]of Object.entries(P))switch(Y){case"headers":{let X=h(V);X!==void 0&&(q.headers=X);break}case"noGRPCHeader":case"xPaddingObfsMode":V!==!0&&l(q,Y,V);break;case"xPaddingBytes":Qf(V)==null&&l(q,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(q,Y,V);break;case"sessionIDTable":typeof V!="string"&&l(q,Y,V);break;case"uplinkChunkSize":Ls(V)==null&&l(q,Y,V);break;case"scMaxEachPostBytes":Qf(V)==null&&l(q,Y,V);break;case"scMinPostsIntervalMs":qo(V)==null&&l(q,Y,V);break;case"sessionIDLength":Qf(V)==null&&l(q,Y,V);break;case"xmux":{let X=p(V);X!==void 0&&(q.xmux=X);break}default:l(q,Y,V);break}return u(q)},v=P=>{if(P==null)return;if(!We(P))return a(P);let q={};Object.prototype.hasOwnProperty.call(P,"path")&&!Me(P.path)&&l(q,"path",P.path),Object.prototype.hasOwnProperty.call(P,"host")&&!Me(P.host)&&l(q,"host",P.host),Object.prototype.hasOwnProperty.call(P,"mode")&&!Me(P.mode)&&l(q,"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(We(V)&&Object.assign(q,V),Object.prototype.hasOwnProperty.call(P,"extra")){let X=d(P.extra);X!==void 0&&(q.extra=X)}return u(q)},g=P=>{if(P==null)return;if(!We(P))return a(P);let q={};for(let[Y,V]of Object.entries(P))switch(Y){case"address":Me(V)||l(q,Y,V);break;case"port":Xn(V,{allowNegative:!1})==null&&l(q,Y,V);break;case"security":{let X=typeof V=="string"?V.toLowerCase():"";["tls","reality"].includes(X)||l(q,Y,V);break}case"tlsSettings":{if(!We(V)){l(q,Y,V);break}let X={},te=UA(V.echConfigList);for(let[me,he]of Object.entries(V))switch(me){case"serverName":case"fingerprint":Me(he)||l(X,me,he);break;case"echConfigList":UA(he)||l(X,me,he);break;case"echForceQuery":(!te||!Gg(he))&&l(X,me,he);break;case"echSockopt":(!te||!We(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&&(q.tlsSettings=ae);break}case"realitySettings":{if(!We(V)){l(q,Y,V);break}let X={};for(let[ae,me]of Object.entries(V))switch(ae){case"publicKey":case"shortId":case"serverName":case"fingerprint":Me(me)||l(X,ae,me);break;default:l(X,ae,me);break}let te=u(X);te!==void 0&&(q.realitySettings=te);break}case"xhttpSettings":{let X=v(V);X!==void 0&&(q.xhttpSettings=X);break}case"network":{let X=typeof V=="string"?V.toLowerCase():"";X!=="xhttp"&&X!=="splithttp"&&l(q,Y,V);break}default:l(q,Y,V);break}return u(q)},y=(P,{parsedDownloadSettings:q}={})=>{if(!We(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,q)=>{if(!We(P)||!We(q))return;let Y=s(q.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)}q.noGRPCHeader===!0&&(P["no-grpc-header"]=!0);let V=Qf(q.xPaddingBytes);V!=null&&(P["x-padding-bytes"]=V),q.xPaddingObfsMode===!0&&(P["x-padding-obfs-mode"]=!0),Me(q.xPaddingKey)&&(P["x-padding-key"]=q.xPaddingKey),Me(q.xPaddingHeader)&&(P["x-padding-header"]=q.xPaddingHeader),Me(q.xPaddingPlacement)&&(P["x-padding-placement"]=q.xPaddingPlacement),Me(q.xPaddingMethod)&&(P["x-padding-method"]=q.xPaddingMethod),Me(q.uplinkHTTPMethod)&&(P["uplink-http-method"]=q.uplinkHTTPMethod),Me(q.sessionIDPlacement)?P["session-placement"]=q.sessionIDPlacement:Me(q.sessionPlacement)&&(P["session-placement"]=q.sessionPlacement),Me(q.sessionIDKey)?P["session-key"]=q.sessionIDKey:Me(q.sessionKey)&&(P["session-key"]=q.sessionKey),typeof q.sessionIDTable=="string"&&(P["session-table"]=q.sessionIDTable);let X=Qf(q.sessionIDLength);X!=null&&(P["session-length"]=X),Me(q.seqPlacement)&&(P["seq-placement"]=q.seqPlacement),Me(q.seqKey)&&(P["seq-key"]=q.seqKey),Me(q.uplinkDataPlacement)&&(P["uplink-data-placement"]=q.uplinkDataPlacement),Me(q.uplinkDataKey)&&(P["uplink-data-key"]=q.uplinkDataKey);let te=Ls(q.uplinkChunkSize);te!=null&&(P["uplink-chunk-size"]=te);let ae=ml(q.scMaxEachPostBytes);ae!=null&&(P["sc-max-each-post-bytes"]=ae);let me=qo(q.scMinPostsIntervalMs);me!=null&&(P["sc-min-posts-interval-ms"]=me);let he=o(q.xmux);he&&(P["reuse-settings"]=he)},E=P=>{if(!We(P))return;let q={},Y=typeof P.network=="string"?P.network.toLowerCase():"";(Y==="xhttp"||Y==="splithttp")&&(q.network="xhttp"),Me(P.address)&&(q.server=P.address);let V=Xn(P.port,{allowNegative:!1});V!=null&&(q.port=V);let X=typeof P.security=="string"?P.security.toLowerCase():"";if((X==="tls"||X==="reality")&&(q.tls=!0),We(P.tlsSettings)){Me(P.tlsSettings.serverName)&&(q.servername=P.tlsSettings.serverName),Me(P.tlsSettings.fingerprint)&&(q["client-fingerprint"]=P.tlsSettings.fingerprint),Array.isArray(P.tlsSettings.alpn)&&P.tlsSettings.alpn.length>0&&P.tlsSettings.alpn.every(me=>typeof me=="string"&&me!=="")&&(q.alpn=P.tlsSettings.alpn),P.tlsSettings.allowInsecure===!0&&(q["skip-cert-verify"]=!0);let ae=Wg({echConfigList:P.tlsSettings.echConfigList,echForceQuery:P.tlsSettings.echForceQuery,echSockopt:P.tlsSettings.echSockopt});ae&&(q["ech-opts"]=ae)}let te;return We(P.realitySettings)&&(te={},Me(P.realitySettings.publicKey)&&(te["public-key"]=P.realitySettings.publicKey),Me(P.realitySettings.shortId)&&(te["short-id"]=P.realitySettings.shortId),Me(P.realitySettings.serverName)&&(q.servername=P.realitySettings.serverName),Me(P.realitySettings.fingerprint)&&(q["client-fingerprint"]=P.realitySettings.fingerprint)),X==="reality"?q["reality-opts"]=te||{}:te&&Object.keys(te).length>0&&(q["reality-opts"]=te),We(P.xhttpSettings)&&(Me(P.xhttpSettings.path)&&(q.path=P.xhttpSettings.path),Me(P.xhttpSettings.host)&&(q.host=P.xhttpSettings.host),Me(P.xhttpSettings.mode)&&(q.mode=P.xhttpSettings.mode),w(q,P.xhttpSettings),We(P.xhttpSettings.extra)&&w(q,P.xhttpSettings.extra)),Object.keys(q).length>0?q:void 0};n=n.split(`${i}://`)[1];let _,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!C){let[P,q,Y]=/^(.*?)(\?.*?$)/.exec(n);n=`${bt.decode(q)}${Y}`,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),_=!0}let[F,H,K,S,I,M="",L]=C;_&&(H=H.replace(/^.*?:/g,"")),S=parseInt(`${S}`,10),H=decodeURIComponent(H),L!=null&&(L=decodeURIComponent(L));let T={type:i,name:L,server:K,port:S,uuid:H,udp:!0},O={};for(let P of M.split("&"))if(P){let[q,...Y]=P.split("=");O[q]=decodeURIComponent(Y.join("="))}if(T.name=L??O.remarks??O.remark??`${i==="vmess"?"VMess":"VLESS"} ${K}:${S}`,T.tls=O.security&&O.security!=="none",O.pbk&&(O.security="reality"),_&&/TRUE|1/i.test(O.tls)&&(T.tls=!0,O.security=O.security??"reality"),T.sni=O.sni||O.peer,T.flow=O.flow,!T.flow&&_&&O.xtls){let P=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][O.xtls];P&&(T.flow=P)}T["client-fingerprint"]=O.fp??O["client-fingerprint"],T.alpn=O.alpn?O.alpn.split(","):void 0,T["skip-cert-verify"]=/(TRUE)|1/i.test(O.allowInsecure)||i==="vless"&&O.allowInsecure==null&&O.insecure==="1",T._echConfigList=ya(O.ech);let R=Wg({echConfigList:O.ech});switch(R&&(T["ech-opts"]=R),T["tls-fingerprint"]=ya(O.pcs),T._vcn=O.vcn?.split(",").map(P=>P.trim()).filter(Boolean),T["name-cert-verify"]=T._vcn?.[0],T._h2=/(TRUE)|1/i.test(O.h2),`${O.packetEncoding||""}`.trim().toLowerCase()){case"none":T["packet-encoding"]="";break;case"packet":T["packet-encoding"]="packetaddr";break;default:T["packet-encoding"]="xudp";break}if(["reality"].includes(O.security)){let P={};if(O.pbk){P["public-key"]=O.pbk;let q=O["support-x25519mlkem768"];["1","t","T","true","TRUE","True"].includes(q)&&(P["support-x25519mlkem768"]=!0)}O.sid&&(P["short-id"]=O.sid),O.spx&&(P["_spider-x"]=O.spx),Object.keys(P).length>0&&(T[`${O.security}-opts`]=P)}let N=!1;if(T.network=O.type||"tcp",T.network==="tcp"&&O.headerType==="http"?T.network="http":T.network==="http"?T.network="h2":T.network==="httpupgrade"&&(T.network="ws",N=!0),!O.type&&_&&O.obfs&&(T.network=O.obfs,["none"].includes(T.network)&&(T.network="tcp")),["websocket"].includes(T.network)?T.network="ws":i==="vless"&&T.network==="splithttp"&&(T.network="xhttp"),T.network&&!["tcp","none"].includes(T.network)){let P={},q="",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(T.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(T.network)&&X&&(P.host=zS(X),delete P.headers.Host,delete P.headers.host,Object.keys(P.headers).length===0&&delete P.headers)}if(O.serviceName?P[`${T.network}-service-name`]=O.serviceName:_&&O.path&&(["ws","http","h2","xhttp"].includes(T.network)||(P[`${T.network}-service-name`]=O.path,delete O.path)),O.path){let X=O.path;if(T.network==="ws"){let te=KS(X);X=te.path,q=te.ed}P.path=X}else T.network==="h2"&&(P.path="/");T.network==="http"&&O.method&&(P.method=O.method),["grpc"].includes(T.network)&&(P["_grpc-type"]=O.mode||"gun",O.authority&&(P["_grpc-authority"]=O.authority)),N&&(P["v2ray-http-upgrade"]=!0);let V=q||O.ed;if(V){let X=VS(V);N?(P["v2ray-http-upgrade-fast-open"]=!0,P["_v2ray-http-upgrade-ed"]=`${V}`):T.network==="ws"&&(P["max-early-data"]=X,P["early-data-header-name"]=O.eh||"Sec-WebSocket-Protocol")}if(O.eh&&(T.network==="ws"||N)&&(P["early-data-header-name"]=O.eh),Object.keys(P).length>0&&(T[`${T.network}-opts`]=P),T.network==="kcp"&&(O.seed&&(T.seed=O.seed),T.headerType=O.headerType||"none"),O.extra&&!["xhttp"].includes(T.network)&&(T._extra=O.extra),["xhttp"].includes(T.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={...T[`${T.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&&(T[`${T.network}-opts`]=ae),te!=null&&(T._extra=te);let he=y(X,{parsedDownloadSettings:me});he&&(T._extra_unsupported=he)}else O.mode&&(T._mode=O.mode)}if(i==="vmess"?(T.cipher=jr(O.encryption),T.alterId=0,delete T.flow):O.encryption&&(T.encryption=O.encryption),O.pqv&&(T._pqv=O.pqv),O.fm)try{let P=JSON.parse(O.fm);T._finalmask=We(P)?P:O.fm}catch{T._finalmask=O.fm}return T}}}function nee(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{let i=GS().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 see(){return{name:"URI Mieru Parser",test:n=>/^mierus:\/\//i.test(n),parse:n=>{let{content:i,fragment:o}=MS(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}=Zg(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 iee(){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=Fd(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=Wg({echConfigList:E.ech});return F&&(w["ech-opts"]=F),w}}}function oee(){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 aee(){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 uee(){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 _=ZQ(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 cee(){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=NS().parse(i);if(Me(o))try{l.name=decodeURIComponent(o)}catch(h){console.log(h)}return l}}}function lee(){return{name:"Clash Parser",test:n=>{let i;try{i=qS.default.parse(n)}catch{i=ks.parse(n)}return!!i?.type},parse:n=>{let i;try{i=qS.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 fee(){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 hee(){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 dee(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function pee(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function mee(){return{name:"QX AnyTLS Parser",test:n=>/^anytls\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function gee(){return{name:"QX Mieru Parser",test:n=>/^mieru\s*=/.test(n),parse:n=>pi().parse(n)}}function vee(){return{name:"QX Hysteria2 Parser",test:n=>/^hysteria2\s*=/.test(n),parse:n=>pi().parse(n)}}function wee(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function yee(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function Eee(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function bee(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>Ss().parse(n)}}function Aee(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>Ss().parse(n)}}var ux=/^[^=,]*=\s*vmess\s*,[^,]*,[^,]*,[^,]*,\s*"/i;function See(){return{name:"Loon VMess Parser",test:n=>ux.test(n),parse:n=>Ss().parse(n)}}function _ee(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Cee(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Dee(){return{name:"Loon AnyTLS Parser",test:n=>/^.*=\s*anytls/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Fee(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Bee(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function Iee(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>Ss().parse(n)}}function xee(){return{name:"Loon Tailscale Parser",test:n=>/^[^=,]*=\s*tailscale\s*(?:,|$)/i.test(n),parse:n=>Ss().parse(n)}}function $ee(){return{name:"Loon Mieru Parser",test:n=>/^[^=,]*=\s*mieru\s*,/i.test(n),parse:n=>Ss().parse(n)}}function Pee(){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 kee(){return{name:"Surge Direct Parser",test:n=>/^[^=,]*=\s*direct\s*$/i.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Tee(){return{name:"Surge AnyTLS Parser",test:n=>/^.*=\s*anytls/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Ree(){return{name:"Surge TrustTunnel Parser",test:n=>/^.*=\s*trust-tunnel/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Oee(){return{name:"Surge MASQUE Parser",test:n=>/^.*=\s*masque/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Nee(){return{name:"Surge HTTP/2 CONNECT Parser",test:n=>/^.*=\s*h2-connect/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Lee(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Uee(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Hee(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1&&!ux.test(n),parse:n=>Kr().parse(n)}}function qee(){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 Mee(){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 cx=/(^|,)\s*(fast-open|over-tls|tls-name|ip-mode|tls-cert-sha256|tls-pubkey-sha256|server-dns)\s*=/i;function jee(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0])&&!cx.test(n),parse:n=>Kr().parse(n)}}function Kee(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0])&&!cx.test(n),parse:n=>Kr().parse(n)}}function Vee(){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(Xee),i}}}function zee(){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 Gee(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Wee(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Yee(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Xee(e){return _r(e)||Xt(e)}var lx=[JQ(),QQ(),eee(),tee(),ree(),GS(),aee(),uee(),oee(),iee(),cee(),nee(),see(),lee(),kee(),Tee(),Ree(),Oee(),Nee(),Lee(),Uee(),Hee(),qee(),Mee(),jee(),zee(),Gee(),Wee(),Yee(),Kee(),Vee(),bee(),Aee(),See(),_ee(),Fee(),Cee(),Dee(),Bee(),Iee(),Pee(),xee(),$ee(),fee(),hee(),dee(),pee(),mee(),gee(),vee(),wee(),yee(),Eee()];var mx=B(HS());var Zee={encrypt:sA,decrypt:Fg,derivePublicKey:oI};function Jee(e){for(let t of kg)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 Qee(e){e=Jee(e);let t=e.split(`
|
||
`),r=[],n=o=>{for(let s of Array.isArray(o)?o:[o])r.push(ute(s))},i;for(let o of t){if(o=o.trim(),o.length===0)continue;let s=!1;if(i){let[a,u]=dx(i,o);u||(n(a),s=!0)}if(!s)for(let a of lx){let[u,l]=dx(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))wm(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 gx(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 ete(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(kA(u.type)){Q.log(`Skipping response transformer during proxy/file processing: "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}if(gx(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 vx(u,s)),!Ap[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=Ap[u.type](l,r,h,n,i,a):m=Ap[u.type](u.args||{},s),e=await VI(m,e)}return e}async function tte(e,t=[],r,n,i,o={}){let s={},a=fx(e);for(let u of t){if(!kA(u.type))continue;if(gx(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 vx(u,o);Q.log(`Applying "${u.type}" with arguments:
|
||
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m=Ap[u.type](l,r,h,n,i,s);a=fx(await KI(m,a))}return a}async function vx(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"?sm:$c,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=go().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 fx(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 hx(e){return e.replace(/[=,]/g,"").replace(/(^|\s)(?:[#;]|\/\/)+/g,"$1").trim()}function rte(e,t,r,n={}){let i=J9[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(!Kg(a,t))return!1;let u=n["include-unsupported-proxy"];if(!u&&a.supported&&a.supported[t]===!1)return!1;if(!u&&nte(a)&&ste(a)&&!ite(a,t))return Q.error(`Target platform ${t} does not support headers for ${ote(a)} proxy ${a.name||`${a.server}:${a.port}`}. Proxy has been filtered.`),!1;if(!u&&Zf(a)&&!["qx","quantumultx","shadowrocket"].includes(o))return!1;if(["vless","vmess"].includes(a.type)){wm(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&&!Me(v["public-key"])){if(d==="xhttp download-settings reality-opts"&&Me(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=hx(a.name)),Me(a.name)||(a.name=`${a.type} ${a.server}:${a.port}`),a["disable-sni"]&&(["surge","surgemac","shadowrocket"].includes(o)||o==="surfboard"&&["h2-connect","vless"].includes(a.type)?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=b2(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=Fd(a.ports))),a.type==="wireguard"&&_p(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(Dp().produce({name:hx(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 nte(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function ste(e){return["http","h2-connect","trusttunnel"].includes(e?.type)}function ite(e,t){let r=`${t}`.toLowerCase();return r.startsWith("surge")?["http","h2-connect","trusttunnel"].includes(e.type):r==="surfboard"?e.type==="h2-connect":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 ote(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:Qee,process:ete,processResponse:tte,produce:rte,age:Zee,ipAddress:vm,getRandomPort:Fd,isIPv4:_r,isIPv6:Xt,isIP:b2,yaml:ks,getFlag:Vf,removeFlag:vp,getISO:wI,MMDB:Og,Gist:Ef,download:ci,downloadFile:vI,isValidUUID:wm,doh:BA,Buffer:E2.Buffer,Base64:bt,JSON5:mx.default,hex_md5:Ur};function dx(e,t){if(!ate(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function ate(e,t){try{return e.test(t)}catch{return!1}}function px(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function ute(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"];Me(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.type!=="h2-connect"||e.udp!=null)&&(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=W8(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),G8(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=>px(a)):o!=null&&(e[`${e.network}-opts`].path=px(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&&!b2(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&&!b2(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=E2.Buffer.from(e.name.data).toString("utf8"):e.name=E2.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"]=CC.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)),_p(e)),e}function b2(e){return _r(e)||Xt(e)}var{parse:$be,produce:Pbe}=Lt;export{$be as parse,Pbe 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) *)
|
||
*/
|