Files
Sub-Store/sub-store-parser.loon.min.js
T
2026-11-26 15:50:27 +00:00

1907 lines
1.2 MiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(()=>{var yO=Object.create;var ew=Object.defineProperty;var EO=Object.getOwnPropertyDescriptor;var bO=Object.getOwnPropertyNames;var AO=Object.getPrototypeOf,SO=Object.prototype.hasOwnProperty;var yu=(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),_O=(e,t)=>{for(var r in t)ew(e,r,{get:t[r],enumerable:!0})},CO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bO(t))!SO.call(e,i)&&i!==r&&ew(e,i,{get:()=>t[i],enumerable:!(n=EO(t,i))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?yO(AO(e)):{},CO(t||!e||!e.__esModule?ew(r,"default",{value:e,enumerable:!0}):r,e));var $s=be((tw,U5)=>{"use strict";var hte=B(x()),Xh=function(e){return e&&e.Math===Math&&e};U5.exports=Xh(typeof globalThis=="object"&&globalThis)||Xh(typeof window=="object"&&window)||Xh(typeof self=="object"&&self)||Xh(typeof global=="object"&&global)||Xh(typeof tw=="object"&&tw)||(function(){return this})()||Function("return this")()});var sa=be((dte,H5)=>{"use strict";var pte=B(x());H5.exports=function(e){try{return!!e()}catch{return!0}}});var Eu=be((mte,M5)=>{"use strict";var gte=B(x()),DO=sa();M5.exports=!DO(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var rw=be((vte,q5)=>{"use strict";var wte=B(x()),FO=sa();q5.exports=!FO(function(){var e=function(){}.bind();return typeof e!="function"||e.hasOwnProperty("prototype")})});var G0=be((yte,j5)=>{"use strict";var Ete=B(x()),BO=rw(),V0=Function.prototype.call;j5.exports=BO?V0.bind(V0):function(){return V0.apply(V0,arguments)}});var z5=be(G5=>{"use strict";var Ate=B(x()),K5={}.propertyIsEnumerable,V5=Object.getOwnPropertyDescriptor,IO=V5&&!K5.call({1:2},1);G5.f=IO?function(t){var r=V5(this,t);return!!r&&r.enumerable}:K5});var nw=be((Ste,W5)=>{"use strict";var _te=B(x());W5.exports=function(e,t){return{enumerable:!(e&1),configurable:!(e&2),writable:!(e&4),value:t}}});var so=be((Cte,Z5)=>{"use strict";var Dte=B(x()),Y5=rw(),X5=Function.prototype,sw=X5.call,xO=Y5&&X5.bind.bind(sw,sw);Z5.exports=Y5?xO:function(e){return function(){return sw.apply(e,arguments)}}});var e4=be((Fte,Q5)=>{"use strict";var Bte=B(x()),J5=so(),$O=J5({}.toString),PO=J5("".slice);Q5.exports=function(e){return PO($O(e),8,-1)}});var r4=be((Ite,t4)=>{"use strict";var xte=B(x()),kO=so(),RO=sa(),TO=e4(),iw=Object,OO=kO("".split);t4.exports=RO(function(){return!iw("z").propertyIsEnumerable(0)})?function(e){return TO(e)==="String"?OO(e,""):iw(e)}:iw});var ow=be(($te,n4)=>{"use strict";var Pte=B(x());n4.exports=function(e){return e==null}});var aw=be((kte,s4)=>{"use strict";var Rte=B(x()),NO=ow(),LO=TypeError;s4.exports=function(e){if(NO(e))throw new LO("Can't call method on "+e);return e}});var z0=be((Tte,i4)=>{"use strict";var Ote=B(x()),UO=r4(),HO=aw();i4.exports=function(e){return UO(HO(e))}});var Si=be((Nte,o4)=>{"use strict";var Lte=B(x()),uw=typeof document=="object"&&document.all;o4.exports=typeof uw>"u"&&uw!==void 0?function(e){return typeof e=="function"||e===uw}:function(e){return typeof e=="function"}});var Kl=be((Ute,a4)=>{"use strict";var Hte=B(x()),MO=Si();a4.exports=function(e){return typeof e=="object"?e!==null:MO(e)}});var lw=be((Mte,u4)=>{"use strict";var qte=B(x()),cw=$s(),qO=Si(),jO=function(e){return qO(e)?e:void 0};u4.exports=function(e,t){return arguments.length<2?jO(cw[e]):cw[e]&&cw[e][t]}});var l4=be((jte,c4)=>{"use strict";var Kte=B(x()),KO=so();c4.exports=KO({}.isPrototypeOf)});var p4=be((Vte,d4)=>{"use strict";var Gte=B(x()),VO=$s(),f4=VO.navigator,h4=f4&&f4.userAgent;d4.exports=h4?String(h4):""});var b4=be((zte,E4)=>{"use strict";var Wte=B(x()),y4=$s(),fw=p4(),m4=y4.process,g4=y4.Deno,v4=m4&&m4.versions||g4&&g4.version,w4=v4&&v4.v8,_i,W0;w4&&(_i=w4.split("."),W0=_i[0]>0&&_i[0]<4?1:+(_i[0]+_i[1]));!W0&&fw&&(_i=fw.match(/Edge\/(\d+)/),(!_i||_i[1]>=74)&&(_i=fw.match(/Chrome\/(\d+)/),_i&&(W0=+_i[1])));E4.exports=W0});var hw=be((Yte,S4)=>{"use strict";var Xte=B(x()),A4=b4(),GO=sa(),zO=$s(),WO=zO.String;S4.exports=!!Object.getOwnPropertySymbols&&!GO(function(){var e=Symbol("symbol detection");return!WO(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&A4&&A4<41})});var dw=be((Zte,_4)=>{"use strict";var Jte=B(x()),YO=hw();_4.exports=YO&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var pw=be((Qte,C4)=>{"use strict";var ere=B(x()),XO=lw(),ZO=Si(),JO=l4(),QO=dw(),eN=Object;C4.exports=QO?function(e){return typeof e=="symbol"}:function(e){var t=XO("Symbol");return ZO(t)&&JO(t.prototype,eN(e))}});var F4=be((tre,D4)=>{"use strict";var rre=B(x()),tN=String;D4.exports=function(e){try{return tN(e)}catch{return"Object"}}});var I4=be((nre,B4)=>{"use strict";var sre=B(x()),rN=Si(),nN=F4(),sN=TypeError;B4.exports=function(e){if(rN(e))return e;throw new sN(nN(e)+" is not a function")}});var $4=be((ire,x4)=>{"use strict";var ore=B(x()),iN=I4(),oN=ow();x4.exports=function(e,t){var r=e[t];return oN(r)?void 0:iN(r)}});var k4=be((are,P4)=>{"use strict";var ure=B(x()),mw=G0(),gw=Si(),vw=Kl(),aN=TypeError;P4.exports=function(e,t){var r,n;if(t==="string"&&gw(r=e.toString)&&!vw(n=mw(r,e))||gw(r=e.valueOf)&&!vw(n=mw(r,e))||t!=="string"&&gw(r=e.toString)&&!vw(n=mw(r,e)))return n;throw new aN("Can't convert object to primitive value")}});var T4=be((cre,R4)=>{"use strict";var lre=B(x());R4.exports=!1});var Y0=be((fre,N4)=>{"use strict";var hre=B(x()),O4=$s(),uN=Object.defineProperty;N4.exports=function(e,t){try{uN(O4,e,{value:t,configurable:!0,writable:!0})}catch{O4[e]=t}return t}});var X0=be((dre,H4)=>{"use strict";var pre=B(x()),cN=T4(),lN=$s(),fN=Y0(),L4="__core-js_shared__",U4=H4.exports=lN[L4]||fN(L4,{});(U4.versions||(U4.versions=[])).push({version:"3.49.0",mode:cN?"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 ww=be((mre,q4)=>{"use strict";var gre=B(x()),M4=X0();q4.exports=function(e,t){return M4[e]||(M4[e]=t||{})}});var K4=be((vre,j4)=>{"use strict";var wre=B(x()),hN=aw(),dN=Object;j4.exports=function(e){return dN(hN(e))}});var ia=be((yre,V4)=>{"use strict";var Ere=B(x()),pN=so(),mN=K4(),gN=pN({}.hasOwnProperty);V4.exports=Object.hasOwn||function(t,r){return gN(mN(t),r)}});var yw=be((bre,G4)=>{"use strict";var Are=B(x()),vN=so(),wN=0,yN=Math.random(),EN=vN(1.1.toString);G4.exports=function(e){return"Symbol("+(e===void 0?"":e)+")_"+EN(++wN+yN,36)}});var Y4=be((Sre,W4)=>{"use strict";var _re=B(x()),bN=$s(),AN=ww(),z4=ia(),SN=yw(),_N=hw(),CN=dw(),Vl=bN.Symbol,Ew=AN("wks"),DN=CN?Vl.for||Vl:Vl&&Vl.withoutSetter||SN;W4.exports=function(e){return z4(Ew,e)||(Ew[e]=_N&&z4(Vl,e)?Vl[e]:DN("Symbol."+e)),Ew[e]}});var Q4=be((Cre,J4)=>{"use strict";var Dre=B(x()),FN=G0(),X4=Kl(),Z4=pw(),BN=$4(),IN=k4(),xN=Y4(),$N=TypeError,PN=xN("toPrimitive");J4.exports=function(e,t){if(!X4(e)||Z4(e))return e;var r=BN(e,PN),n;if(r){if(t===void 0&&(t="default"),n=FN(r,e,t),!X4(n)||Z4(n))return n;throw new $N("Can't convert object to primitive value")}return t===void 0&&(t="number"),IN(e,t)}});var bw=be((Fre,e3)=>{"use strict";var Bre=B(x()),kN=Q4(),RN=pw();e3.exports=function(e){var t=kN(e,"string");return RN(t)?t:t+""}});var n3=be((Ire,r3)=>{"use strict";var xre=B(x()),TN=$s(),t3=Kl(),Aw=TN.document,ON=t3(Aw)&&t3(Aw.createElement);r3.exports=function(e){return ON?Aw.createElement(e):{}}});var Sw=be(($re,s3)=>{"use strict";var Pre=B(x()),NN=Eu(),LN=sa(),UN=n3();s3.exports=!NN&&!LN(function(){return Object.defineProperty(UN("div"),"a",{get:function(){return 7}}).a!==7})});var _w=be(o3=>{"use strict";var Rre=B(x()),HN=Eu(),MN=G0(),qN=z5(),jN=nw(),KN=z0(),VN=bw(),GN=ia(),zN=Sw(),i3=Object.getOwnPropertyDescriptor;o3.f=HN?i3:function(t,r){if(t=KN(t),r=VN(r),zN)try{return i3(t,r)}catch{}if(GN(t,r))return jN(!MN(qN.f,t,r),t[r])}});var u3=be((Tre,a3)=>{"use strict";var Ore=B(x()),WN=Eu(),YN=sa();a3.exports=WN&&YN(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Cw=be((Nre,c3)=>{"use strict";var Lre=B(x()),XN=Kl(),ZN=String,JN=TypeError;c3.exports=function(e){if(XN(e))return e;throw new JN(ZN(e)+" is not an object")}});var J0=be(f3=>{"use strict";var Hre=B(x()),QN=Eu(),eL=Sw(),tL=u3(),Z0=Cw(),l3=bw(),rL=TypeError,Dw=Object.defineProperty,nL=Object.getOwnPropertyDescriptor,Fw="enumerable",Bw="configurable",Iw="writable";f3.f=QN?tL?function(t,r,n){if(Z0(t),r=l3(r),Z0(n),typeof t=="function"&&r==="prototype"&&"value"in n&&Iw in n&&!n[Iw]){var i=nL(t,r);i&&i[Iw]&&(t[r]=n.value,n={configurable:Bw in n?n[Bw]:i[Bw],enumerable:Fw in n?n[Fw]:i[Fw],writable:!1})}return Dw(t,r,n)}:Dw:function(t,r,n){if(Z0(t),r=l3(r),Z0(n),eL)try{return Dw(t,r,n)}catch{}if("get"in n||"set"in n)throw new rL("Accessors not supported");return"value"in n&&(t[r]=n.value),t}});var xw=be((Mre,h3)=>{"use strict";var qre=B(x()),sL=Eu(),iL=J0(),oL=nw();h3.exports=sL?function(e,t,r){return iL.f(e,t,oL(1,r))}:function(e,t,r){return e[t]=r,e}});var m3=be((jre,p3)=>{"use strict";var Kre=B(x()),$w=Eu(),aL=ia(),d3=Function.prototype,uL=$w&&Object.getOwnPropertyDescriptor,Pw=aL(d3,"name"),cL=Pw&&function(){}.name==="something",lL=Pw&&(!$w||$w&&uL(d3,"name").configurable);p3.exports={EXISTS:Pw,PROPER:cL,CONFIGURABLE:lL}});var v3=be((Vre,g3)=>{"use strict";var Gre=B(x()),fL=so(),hL=Si(),kw=X0(),dL=fL(Function.toString);hL(kw.inspectSource)||(kw.inspectSource=function(e){return dL(e)});g3.exports=kw.inspectSource});var E3=be((zre,y3)=>{"use strict";var Wre=B(x()),pL=$s(),mL=Si(),w3=pL.WeakMap;y3.exports=mL(w3)&&/native code/.test(String(w3))});var S3=be((Yre,A3)=>{"use strict";var Xre=B(x()),gL=ww(),vL=yw(),b3=gL("keys");A3.exports=function(e){return b3[e]||(b3[e]=vL(e))}});var Rw=be((Zre,_3)=>{"use strict";var Jre=B(x());_3.exports={}});var B3=be((Qre,F3)=>{"use strict";var ene=B(x()),wL=E3(),D3=$s(),yL=Kl(),EL=xw(),Tw=ia(),Ow=X0(),bL=S3(),AL=Rw(),C3="Object already initialized",Nw=D3.TypeError,SL=D3.WeakMap,Q0,Zh,e1,_L=function(e){return e1(e)?Zh(e):Q0(e,{})},CL=function(e){return function(t){var r;if(!yL(t)||(r=Zh(t)).type!==e)throw new Nw("Incompatible receiver, "+e+" required");return r}};wL||Ow.state?(Ci=Ow.state||(Ow.state=new SL),Ci.get=Ci.get,Ci.has=Ci.has,Ci.set=Ci.set,Q0=function(e,t){if(Ci.has(e))throw new Nw(C3);return t.facade=e,Ci.set(e,t),t},Zh=function(e){return Ci.get(e)||{}},e1=function(e){return Ci.has(e)}):(Sc=bL("state"),AL[Sc]=!0,Q0=function(e,t){if(Tw(e,Sc))throw new Nw(C3);return t.facade=e,EL(e,Sc,t),t},Zh=function(e){return Tw(e,Sc)?e[Sc]:{}},e1=function(e){return Tw(e,Sc)});var Ci,Sc;F3.exports={set:Q0,get:Zh,has:e1,enforce:_L,getterFor:CL}});var P3=be((tne,$3)=>{"use strict";var rne=B(x()),Uw=so(),DL=sa(),FL=Si(),t1=ia(),Lw=Eu(),BL=m3().CONFIGURABLE,IL=v3(),x3=B3(),xL=x3.enforce,$L=x3.get,I3=String,r1=Object.defineProperty,PL=Uw("".slice),kL=Uw("".replace),RL=Uw([].join),TL=Lw&&!DL(function(){return r1(function(){},"length",{value:8}).length!==8}),OL=String(String).split("String"),NL=$3.exports=function(e,t,r){PL(I3(t),0,7)==="Symbol("&&(t="["+kL(I3(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!t1(e,"name")||BL&&e.name!==t)&&(Lw?r1(e,"name",{value:t,configurable:!0}):e.name=t),TL&&r&&t1(r,"arity")&&e.length!==r.arity&&r1(e,"length",{value:r.arity});try{r&&t1(r,"constructor")&&r.constructor?Lw&&r1(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch{}var n=xL(e);return t1(n,"source")||(n.source=RL(OL,typeof t=="string"?t:"")),e};Function.prototype.toString=NL(function(){return FL(this)&&$L(this).source||IL(this)},"toString")});var R3=be((nne,k3)=>{"use strict";var sne=B(x()),LL=Si(),UL=J0(),HL=P3(),ML=Y0();k3.exports=function(e,t,r,n){n||(n={});var i=n.enumerable,o=n.name!==void 0?n.name:t;if(LL(r)&&HL(r,o,n),n.global)i?e[t]=r:ML(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch{}i?e[t]=r:UL.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e}});var O3=be((ine,T3)=>{"use strict";var one=B(x()),qL=Math.ceil,jL=Math.floor;T3.exports=Math.trunc||function(t){var r=+t;return(r>0?jL:qL)(r)}});var Hw=be((ane,N3)=>{"use strict";var une=B(x()),KL=O3();N3.exports=function(e){var t=+e;return t!==t||t===0?0:KL(t)}});var U3=be((cne,L3)=>{"use strict";var lne=B(x()),VL=Hw(),GL=Math.max,zL=Math.min;L3.exports=function(e,t){var r=VL(e);return r<0?GL(r+t,0):zL(r,t)}});var M3=be((fne,H3)=>{"use strict";var hne=B(x()),WL=Hw(),YL=Math.min;H3.exports=function(e){var t=WL(e);return t>0?YL(t,9007199254740991):0}});var j3=be((dne,q3)=>{"use strict";var pne=B(x()),XL=M3();q3.exports=function(e){return XL(e.length)}});var G3=be((mne,V3)=>{"use strict";var gne=B(x()),ZL=z0(),JL=U3(),QL=j3(),K3=function(e){return function(t,r,n){var i=ZL(t),o=QL(i);if(o===0)return!e&&-1;var s=JL(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}};V3.exports={includes:K3(!0),indexOf:K3(!1)}});var Y3=be((vne,W3)=>{"use strict";var wne=B(x()),eU=so(),Mw=ia(),tU=z0(),rU=G3().indexOf,nU=Rw(),z3=eU([].push);W3.exports=function(e,t){var r=tU(e),n=0,i=[],o;for(o in r)!Mw(nU,o)&&Mw(r,o)&&z3(i,o);for(;t.length>n;)Mw(r,o=t[n++])&&(~rU(i,o)||z3(i,o));return i}});var Z3=be((yne,X3)=>{"use strict";var Ene=B(x());X3.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Q3=be(J3=>{"use strict";var Ane=B(x()),sU=Y3(),iU=Z3(),oU=iU.concat("length","prototype");J3.f=Object.getOwnPropertyNames||function(t){return sU(t,oU)}});var t_=be(e_=>{"use strict";var _ne=B(x());e_.f=Object.getOwnPropertySymbols});var n_=be((Cne,r_)=>{"use strict";var Dne=B(x()),aU=lw(),uU=so(),cU=Q3(),lU=t_(),fU=Cw(),hU=uU([].concat);r_.exports=aU("Reflect","ownKeys")||function(t){var r=cU.f(fU(t)),n=lU.f;return n?hU(r,n(t)):r}});var o_=be((Fne,i_)=>{"use strict";var Bne=B(x()),s_=ia(),dU=n_(),pU=_w(),mU=J0();i_.exports=function(e,t,r){for(var n=dU(t),i=mU.f,o=pU.f,s=0;s<n.length;s++){var a=n[s];!s_(e,a)&&!(r&&s_(r,a))&&i(e,a,o(t,a))}}});var u_=be((Ine,a_)=>{"use strict";var xne=B(x()),gU=sa(),vU=Si(),wU=/#|\.prototype\./,Jh=function(e,t){var r=EU[yU(e)];return r===AU?!0:r===bU?!1:vU(t)?gU(t):!!t},yU=Jh.normalize=function(e){return String(e).replace(wU,".").toLowerCase()},EU=Jh.data={},bU=Jh.NATIVE="N",AU=Jh.POLYFILL="P";a_.exports=Jh});var l_=be(($ne,c_)=>{"use strict";var Pne=B(x()),n1=$s(),SU=_w().f,_U=xw(),CU=R3(),DU=Y0(),FU=o_(),BU=u_();c_.exports=function(e,t){var r=e.target,n=e.global,i=e.stat,o,s,a,u,l,h;if(n?s=n1:i?s=n1[r]||DU(r,{}):s=n1[r]&&n1[r].prototype,s)for(a in t){if(l=t[a],e.dontCallGetSet?(h=SU(s,a),u=h&&h.value):u=s[a],o=BU(n?a:r+(i?".":"#")+a,e.forced),!o&&u!==void 0){if(typeof l==typeof u)continue;FU(l,u)}(e.sham||u&&u.sham)&&_U(l,"sham",!0),CU(s,a,l,e)}}});var f_=be(()=>{"use strict";var Tne=B(x()),IU=l_(),xU=ia();IU({target:"Object",stat:!0},{hasOwn:xU})});var d_=be((One,h_)=>{"use strict";var Nne=B(x()),$U=$s();h_.exports=$U});var m_=be((Lne,p_)=>{"use strict";var Une=B(x());f_();var PU=d_();p_.exports=PU.Object.hasOwn});var v_=be((Hne,g_)=>{"use strict";var Mne=B(x()),kU=m_();g_.exports=kU});var x=be((qne,w_)=>{"use strict";var RU=v_();w_.exports=RU});var U_=be(o1=>{"use strict";var Gne=B(x());o1.byteLength=GU;o1.toByteArray=WU;o1.fromByteArray=ZU;var io=[],Zs=[],VU=typeof Uint8Array<"u"?Uint8Array:Array,Gw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_c=0,N_=Gw.length;_c<N_;++_c)io[_c]=Gw[_c],Zs[Gw.charCodeAt(_c)]=_c;var _c,N_;Zs[45]=62;Zs[95]=63;function L_(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 GU(e){var t=L_(e),r=t[0],n=t[1];return(r+n)*3/4-n}function zU(e,t,r){return(t+r)*3/4-r}function WU(e){var t,r=L_(e),n=r[0],i=r[1],o=new VU(zU(e,n,i)),s=0,a=i>0?n-4:n,u;for(u=0;u<a;u+=4)t=Zs[e.charCodeAt(u)]<<18|Zs[e.charCodeAt(u+1)]<<12|Zs[e.charCodeAt(u+2)]<<6|Zs[e.charCodeAt(u+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=Zs[e.charCodeAt(u)]<<2|Zs[e.charCodeAt(u+1)]>>4,o[s++]=t&255),i===1&&(t=Zs[e.charCodeAt(u)]<<10|Zs[e.charCodeAt(u+1)]<<4|Zs[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function YU(e){return io[e>>18&63]+io[e>>12&63]+io[e>>6&63]+io[e&63]}function XU(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(YU(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(XU(e,s,s+o>a?a:s+o));return n===1?(t=e[r-1],i.push(io[t>>2]+io[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(io[t>>10]+io[t>>4&63]+io[t<<2&63]+"=")),i.join("")}});var H_=be(zw=>{var Wne=B(x());zw.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)};zw.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(Zl=>{"use strict";var Zne=B(x());var Ww=U_(),Yl=H_(),M_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Zl.Buffer=ve;Zl.SlowBuffer=nH;Zl.INSPECT_MAX_BYTES=50;var a1=2147483647;Zl.kMaxLength=a1;ve.TYPED_ARRAY_SUPPORT=JU();!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 JU(){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>a1)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 Jw(e)}return V_(e,t,r)}ve.poolSize=8192;function V_(e,t,r){if(typeof e=="string")return eH(e,t);if(ArrayBuffer.isView(e))return tH(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(oo(e,ArrayBuffer)||e&&oo(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(oo(e,SharedArrayBuffer)||e&&oo(e.buffer,SharedArrayBuffer)))return Xw(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=rH(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 V_(e,t,r)};Object.setPrototypeOf(ve.prototype,Uint8Array.prototype);Object.setPrototypeOf(ve,Uint8Array);function G_(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 QU(e,t,r){return G_(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 QU(e,t,r)};function Jw(e){return G_(e),oa(e<0?0:Qw(e)|0)}ve.allocUnsafe=function(e){return Jw(e)};ve.allocUnsafeSlow=function(e){return Jw(e)};function eH(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!ve.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=z_(e,t)|0,n=oa(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function Yw(e){let t=e.length<0?0:Qw(e.length)|0,r=oa(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function tH(e){if(oo(e,Uint8Array)){let t=new Uint8Array(e);return Xw(t.buffer,t.byteOffset,t.byteLength)}return Yw(e)}function Xw(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 rH(e){if(ve.isBuffer(e)){let t=Qw(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"||ty(e.length)?oa(0):Yw(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Yw(e.data)}function Qw(e){if(e>=a1)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a1.toString(16)+" bytes");return e|0}function nH(e){return+e!=e&&(e=0),ve.alloc(+e)}ve.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==ve.prototype};ve.compare=function(t,r){if(oo(t,Uint8Array)&&(t=ve.from(t,t.offset,t.byteLength)),oo(r,Uint8Array)&&(r=ve.from(r,r.offset,r.byteLength)),!ve.isBuffer(t)||!ve.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==r[o]){n=t[o],i=r[o];break}return n<i?-1:i<n?1:0};ve.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};ve.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return ve.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let i=ve.allocUnsafe(r),o=0;for(n=0;n<t.length;++n){let s=t[n];if(oo(s,Uint8Array))o+s.length>i.length?(ve.isBuffer(s)||(s=ve.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(ve.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function z_(e,t){if(ve.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||oo(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Zw(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return rC(e).length;default:if(i)return n?-1:Zw(e).length;t=(""+t).toLowerCase(),i=!0}}ve.byteLength=z_;function sH(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 pH(this,t,r);case"utf8":case"utf-8":return Y_(this,t,r);case"ascii":return hH(this,t,r);case"latin1":case"binary":return dH(this,t,r);case"base64":return lH(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mH(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?Y_(this,0,t):sH.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=Zl.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};M_&&(ve.prototype[M_]=ve.prototype.inspect);ve.prototype.compare=function(t,r,n,i,o){if(oo(t,Uint8Array)&&(t=ve.from(t,t.offset,t.byteLength)),!ve.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;let s=o-i,a=n-r,u=Math.min(s,a),l=this.slice(i,o),h=t.slice(r,n);for(let m=0;m<u;++m)if(l[m]!==h[m]){s=l[m],a=h[m];break}return s<a?-1:a<s?1:0};function W_(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,ty(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:q_(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):q_(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function q_(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 W_(this,t,r,n,!0)};ve.prototype.lastIndexOf=function(t,r,n){return W_(this,t,r,n,!1)};function iH(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(ty(a))return s;e[r+s]=a}return s}function oH(e,t,r,n){return u1(Zw(t,e.length-r),e,r,n)}function aH(e,t,r,n){return u1(yH(t),e,r,n)}function uH(e,t,r,n){return u1(rC(t),e,r,n)}function cH(e,t,r,n){return u1(EH(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 iH(this,t,r,n);case"utf8":case"utf-8":return oH(this,t,r,n);case"ascii":case"latin1":case"binary":return aH(this,t,r,n);case"base64":return uH(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cH(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 lH(e,t,r){return t===0&&r===e.length?Ww.fromByteArray(e):Ww.fromByteArray(e.slice(t,r))}function Y_(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 fH(n)}var j_=4096;function fH(e){let t=e.length;if(t<=j_)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=j_));return r}function hH(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 dH(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 pH(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+=bH[e[o]];return i}function mH(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=bu(function(t){t=t>>>0,Xl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&ed(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=bu(function(t){t=t>>>0,Xl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&ed(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=bu(function(t){t=t>>>0,Xl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&ed(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=bu(function(t){t=t>>>0,Xl(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&ed(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),Yl.read(this,t,!0,23,4)};ve.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Wr(t,4,this.length),Yl.read(this,t,!1,23,4)};ve.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Wr(t,8,this.length),Yl.read(this,t,!0,52,8)};ve.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Wr(t,8,this.length),Yl.read(this,t,!1,52,8)};function cs(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;cs(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;cs(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||cs(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||cs(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||cs(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||cs(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||cs(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 X_(e,t,r,n,i){tC(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 Z_(e,t,r,n,i){tC(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=bu(function(t,r=0){return X_(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});ve.prototype.writeBigUInt64BE=bu(function(t,r=0){return Z_(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);cs(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);cs(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||cs(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||cs(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||cs(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||cs(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||cs(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=bu(function(t,r=0){return X_(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ve.prototype.writeBigInt64BE=bu(function(t,r=0){return Z_(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function J_(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 Q_(e,t,r,n,i){return t=+t,r=r>>>0,i||J_(e,t,r,4,34028234663852886e22,-34028234663852886e22),Yl.write(e,t,r,n,23,4),r+4}ve.prototype.writeFloatLE=function(t,r,n){return Q_(this,t,r,!0,n)};ve.prototype.writeFloatBE=function(t,r,n){return Q_(this,t,r,!1,n)};function eC(e,t,r,n,i){return t=+t,r=r>>>0,i||J_(e,t,r,8,17976931348623157e292,-17976931348623157e292),Yl.write(e,t,r,n,52,8),r+8}ve.prototype.writeDoubleLE=function(t,r,n){return eC(this,t,r,!0,n)};ve.prototype.writeDoubleBE=function(t,r,n){return eC(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 Wl={};function ey(e,t,r){Wl[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}`}}}ey("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ey("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);ey("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=K_(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=K_(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function K_(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 gH(e,t,r){Xl(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&ed(t,e.length-(r+1))}function tC(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 Wl.ERR_OUT_OF_RANGE("value",a,e)}gH(n,i,o)}function Xl(e,t){if(typeof e!="number")throw new Wl.ERR_INVALID_ARG_TYPE(t,"number",e)}function ed(e,t,r){throw Math.floor(e)!==e?(Xl(e,r),new Wl.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new Wl.ERR_BUFFER_OUT_OF_BOUNDS:new Wl.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var vH=/[^+/0-9A-Za-z-_]/g;function wH(e){if(e=e.split("=")[0],e=e.trim().replace(vH,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Zw(e,t){t=t||1/0;let r,n=e.length,i=null,o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function yH(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function EH(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 rC(e){return Ww.toByteArray(wH(e))}function u1(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function oo(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ty(e){return e!==e}var bH=(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 bu(e){return typeof BigInt>"u"?AH:e}function AH(){throw new Error("BigInt not supported")}});var BC=be($e=>{var ese=B(x()),rd={};rd.userAgent=!1;var Jl={},SH="11.1.3",_H="jsrsasign(all) 11.1.3 (2026-04-18) (c) 2010-2023 Kenji Urushima | kjur.github.io/jsrsasign/license";var ke=ke||(function(e,t){var r={},n=r.lib={},i=n.Base=(function(){function d(){}return{extend:function(v){d.prototype=this;var g=new d;return v&&g.mixIn(v),g.hasOwnProperty("init")||(g.init=function(){g.$super.init.apply(this,arguments)}),g.init.prototype=g,g.$super=this,g},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var g in v)v.hasOwnProperty(g)&&(this[g]=v[g]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),o=n.WordArray=i.extend({init:function(d,v){d=this.words=d||[],v!=t?this.sigBytes=v:this.sigBytes=d.length*4},toString:function(d){return(d||a).stringify(this)},concat:function(d){var v=this.words,g=d.words,y=this.sigBytes,w=d.sigBytes;if(this.clamp(),y%4)for(var E=0;E<w;E++){var _=g[E>>>2]>>>24-E%4*8&255;v[y+E>>>2]|=_<<24-(y+E)%4*8}else for(var E=0;E<w;E+=4)v[y+E>>>2]=g[E>>>2];return this.sigBytes+=w,this},clamp:function(){var d=this.words,v=this.sigBytes;d[v>>>2]&=4294967295<<32-v%4*8,d.length=e.ceil(v/4)},clone:function(){var d=i.clone.call(this);return d.words=this.words.slice(0),d},random:function(d){for(var v=[],g=0;g<d;g+=4)v.push(e.random()*4294967296|0);return new o.init(v,d)}}),s=r.enc={},a=s.Hex={stringify:function(d){for(var v=d.words,g=d.sigBytes,y=[],w=0;w<g;w++){var E=v[w>>>2]>>>24-w%4*8&255;y.push((E>>>4).toString(16)),y.push((E&15).toString(16))}return y.join("")},parse:function(d){for(var v=d.length,g=[],y=0;y<v;y+=2)g[y>>>3]|=parseInt(d.substr(y,2),16)<<24-y%8*4;return new o.init(g,v/2)}},u=s.Latin1={stringify:function(d){for(var v=d.words,g=d.sigBytes,y=[],w=0;w<g;w++){var E=v[w>>>2]>>>24-w%4*8&255;y.push(String.fromCharCode(E))}return y.join("")},parse:function(d){for(var v=d.length,g=[],y=0;y<v;y++)g[y>>>2]|=(d.charCodeAt(y)&255)<<24-y%4*8;return new o.init(g,v)}},l=s.Utf8={stringify:function(d){try{return decodeURIComponent(escape(u.stringify(d)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(d){return u.parse(unescape(encodeURIComponent(d)))}},h=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(d){typeof d=="string"&&(d=l.parse(d)),this._data.concat(d),this._nDataBytes+=d.sigBytes},_process:function(d){var v=this._data,g=v.words,y=v.sigBytes,w=this.blockSize,E=w*4,_=y/E;d?_=e.ceil(_):_=e.max((_|0)-this._minBufferSize,0);var C=_*w,F=e.min(C*4,y);if(C){for(var H=0;H<C;H+=w)this._doProcessBlock(g,H);var K=g.splice(0,C);v.sigBytes-=F}return new o.init(K,F)},clone:function(){var d=i.clone.call(this);return d._data=this._data.clone(),d},_minBufferSize:0}),m=n.Hasher=h.extend({cfg:i.extend(),init:function(d){this.cfg=this.cfg.extend(d),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(d){return this._append(d),this._process(),this},finalize:function(d){d&&this._append(d);var v=this._doFinalize();return v},blockSize:512/32,_createHelper:function(d){return function(v,g){return new d.init(g).finalize(v)}},_createHmacHelper:function(d){return function(v,g){return new p.HMAC.init(d,g).finalize(v)}}}),p=r.algo={};return r})(Math);(function(e){var i=ke,t=i.lib,r=t.Base,n=t.WordArray,i=i.x64={};i.Word=r.extend({init:function(o,s){this.high=o,this.low=s}}),i.WordArray=r.extend({init:function(o,s){o=this.words=o||[],this.sigBytes=s!=e?s:8*o.length},toX32:function(){for(var o=this.words,s=o.length,a=[],u=0;u<s;u++){var l=o[u];a.push(l.high),a.push(l.low)}return n.create(a,this.sigBytes)},clone:function(){for(var o=r.clone.call(this),s=o.words=this.words.slice(0),a=s.length,u=0;u<a;u++)s[u]=s[u].clone();return o}})})();ke.lib.Cipher||(function(e){var d=ke,t=d.lib,r=t.Base,n=t.WordArray,i=t.BufferedBlockAlgorithm,o=d.enc.Base64,s=d.algo.EvpKDF,a=t.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(g,y){return this.create(this._ENC_XFORM_MODE,g,y)},createDecryptor:function(g,y){return this.create(this._DEC_XFORM_MODE,g,y)},init:function(g,y,w){this.cfg=this.cfg.extend(w),this._xformMode=g,this._key=y,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(g){return this._append(g),this._process()},finalize:function(g){return g&&this._append(g),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(g){return{encrypt:function(y,w,E){return(typeof w=="string"?v:p).encrypt(g,y,w,E)},decrypt:function(y,w,E){return(typeof w=="string"?v:p).decrypt(g,y,w,E)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var m=d.mode={},u=function(g,y,w){var E=this._iv;E?this._iv=e:E=this._prevBlock;for(var _=0;_<w;_++)g[y+_]^=E[_]},l=(t.BlockCipherMode=r.extend({createEncryptor:function(g,y){return this.Encryptor.create(g,y)},createDecryptor:function(g,y){return this.Decryptor.create(g,y)},init:function(g,y){this._cipher=g,this._iv=y}})).extend();l.Encryptor=l.extend({processBlock:function(g,y){var w=this._cipher,E=w.blockSize;u.call(this,g,y,E),w.encryptBlock(g,y),this._prevBlock=g.slice(y,y+E)}}),l.Decryptor=l.extend({processBlock:function(g,y){var w=this._cipher,E=w.blockSize,_=g.slice(y,y+E);w.decryptBlock(g,y),u.call(this,g,y,E),this._prevBlock=_}}),m=m.CBC=l,l=(d.pad={}).Pkcs7={pad:function(g,y){for(var w=4*y,w=w-g.sigBytes%w,E=w<<24|w<<16|w<<8|w,_=[],C=0;C<w;C+=4)_.push(E);w=n.create(_,w),g.concat(w)},unpad:function(g){g.sigBytes-=g.words[g.sigBytes-1>>>2]&255}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:m,padding:l}),reset:function(){a.reset.call(this);var y=this.cfg,g=y.iv,y=y.mode;if(this._xformMode==this._ENC_XFORM_MODE)var w=y.createEncryptor;else w=y.createDecryptor,this._minBufferSize=1;this._mode=w.call(y,this,g&&g.words)},_doProcessBlock:function(g,y){this._mode.processBlock(g,y)},_doFinalize:function(){var g=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){g.pad(this._data,this.blockSize);var y=this._process(!0)}else y=this._process(!0),g.unpad(y);return y},blockSize:4});var h=t.CipherParams=r.extend({init:function(g){this.mixIn(g)},toString:function(g){return(g||this.formatter).stringify(this)}}),m=(d.format={}).OpenSSL={stringify:function(g){var y=g.ciphertext;return g=g.salt,(g?n.create([1398893684,1701076831]).concat(g).concat(y):y).toString(o)},parse:function(g){g=o.parse(g);var y=g.words;if(y[0]==1398893684&&y[1]==1701076831){var w=n.create(y.slice(2,4));y.splice(0,4),g.sigBytes-=16}return h.create({ciphertext:g,salt:w})}},p=t.SerializableCipher=r.extend({cfg:r.extend({format:m}),encrypt:function(g,y,w,E){E=this.cfg.extend(E);var _=g.createEncryptor(w,E);return y=_.finalize(y),_=_.cfg,h.create({ciphertext:y,key:w,iv:_.iv,algorithm:g,mode:_.mode,padding:_.padding,blockSize:g.blockSize,formatter:E.format})},decrypt:function(g,y,w,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),g.createDecryptor(w,E).finalize(y.ciphertext)},_parse:function(g,y){return typeof g=="string"?y.parse(g,this):g}}),d=(d.kdf={}).OpenSSL={execute:function(g,y,w,E){return E||(E=n.random(8)),g=s.create({keySize:y+w}).compute(g,E),w=n.create(g.words.slice(y),4*w),g.sigBytes=4*y,h.create({key:g,iv:w,salt:E})}},v=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:d}),encrypt:function(g,y,w,E){return E=this.cfg.extend(E),w=E.kdf.execute(w,g.keySize,g.ivSize),E.iv=w.iv,g=p.encrypt.call(this,g,y,w.key,E),g.mixIn(w),g},decrypt:function(g,y,w,E){return E=this.cfg.extend(E),y=this._parse(y,E.format),w=E.kdf.execute(w,g.keySize,g.ivSize,y.salt),E.iv=w.iv,p.decrypt.call(this,g,y,w.key,E)}})})();(function(){for(var e=ke,t=e.lib.BlockCipher,H=e.algo,r=[],n=[],i=[],o=[],s=[],a=[],u=[],l=[],h=[],m=[],p=[],d=0;256>d;d++)p[d]=128>d?d<<1:d<<1^283;for(var v=0,g=0,d=0;256>d;d++){var y=g^g<<1^g<<2^g<<3^g<<4,y=y>>>8^y&255^99;r[v]=y,n[y]=v;var w=p[v],E=p[w],_=p[E],C=257*p[y]^16843008*y;i[v]=C<<24|C>>>8,o[v]=C<<16|C>>>16,s[v]=C<<8|C>>>24,a[v]=C,C=16843009*_^65537*E^257*w^16843008*v,u[y]=C<<24|C>>>8,l[y]=C<<16|C>>>16,h[y]=C<<8|C>>>24,m[y]=C,v?(v=w^p[p[p[_^w]]],g^=p[p[g]]):v=g=1}var F=[0,1,2,4,8,16,32,64,128,27,54],H=H.AES=t.extend({_doReset:function(){for(var I=this._key,K=I.words,S=I.sigBytes/4,I=4*((this._nRounds=S+6)+1),q=this._keySchedule=[],L=0;L<I;L++)if(L<S)q[L]=K[L];else{var R=q[L-1];L%S?6<S&&L%S==4&&(R=r[R>>>24]<<24|r[R>>>16&255]<<16|r[R>>>8&255]<<8|r[R&255]):(R=R<<8|R>>>24,R=r[R>>>24]<<24|r[R>>>16&255]<<16|r[R>>>8&255]<<8|r[R&255],R^=F[L/S|0]<<24),q[L]=q[L-S]^R}for(K=this._invKeySchedule=[],S=0;S<I;S++)L=I-S,R=S%4?q[L]:q[L-4],K[S]=4>S||4>=L?R:u[r[R>>>24]]^l[r[R>>>16&255]]^h[r[R>>>8&255]]^m[r[R&255]]},encryptBlock:function(K,S){this._doCryptBlock(K,S,this._keySchedule,i,o,s,a,r)},decryptBlock:function(K,S){var I=K[S+1];K[S+1]=K[S+3],K[S+3]=I,this._doCryptBlock(K,S,this._invKeySchedule,u,l,h,m,n),I=K[S+1],K[S+1]=K[S+3],K[S+3]=I},_doCryptBlock:function(K,S,I,q,L,R,O,T){for(var N=this._nRounds,ae=K[S]^I[0],me=K[S+1]^I[1],he=K[S+2]^I[2],te=K[S+3]^I[3],P=4,M=1;M<N;M++)var Y=q[ae>>>24]^L[me>>>16&255]^R[he>>>8&255]^O[te&255]^I[P++],V=q[me>>>24]^L[he>>>16&255]^R[te>>>8&255]^O[ae&255]^I[P++],X=q[he>>>24]^L[te>>>16&255]^R[ae>>>8&255]^O[me&255]^I[P++],te=q[te>>>24]^L[ae>>>16&255]^R[me>>>8&255]^O[he&255]^I[P++],ae=Y,me=V,he=X;Y=(T[ae>>>24]<<24|T[me>>>16&255]<<16|T[he>>>8&255]<<8|T[te&255])^I[P++],V=(T[me>>>24]<<24|T[he>>>16&255]<<16|T[te>>>8&255]<<8|T[ae&255])^I[P++],X=(T[he>>>24]<<24|T[te>>>16&255]<<16|T[ae>>>8&255]<<8|T[me&255])^I[P++],te=(T[te>>>24]<<24|T[ae>>>16&255]<<16|T[me>>>8&255]<<8|T[he&255])^I[P++],K[S]=Y,K[S+1]=V,K[S+2]=X,K[S+3]=te},keySize:8});e.AES=t._createHelper(H)})();(function(){function e(p,d){var v=(this._lBlock>>>p^this._rBlock)&d;this._rBlock^=v,this._lBlock^=v<<p}function t(p,d){var v=(this._rBlock>>>p^this._lBlock)&d;this._lBlock^=v,this._rBlock^=v<<p}var r=ke,i=r.lib,n=i.WordArray,i=i.BlockCipher,o=r.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],m=o.DES=i.extend({_doReset:function(){for(var p=this._key.words,d=[],v=0;56>v;v++){var g=s[v]-1;d[v]=p[g>>>5]>>>31-g%32&1}for(p=this._subKeys=[],g=0;16>g;g++){for(var y=p[g]=[],w=u[g],v=0;24>v;v++)y[v/6|0]|=d[(a[v]-1+w)%28]<<31-v%6,y[4+(v/6|0)]|=d[28+(a[v+24]-1+w)%28]<<31-v%6;for(y[0]=y[0]<<1|y[0]>>>31,v=1;7>v;v++)y[v]>>>=4*(v-1)+3;y[7]=y[7]<<5|y[7]>>>27}for(d=this._invSubKeys=[],v=0;16>v;v++)d[v]=p[15-v]},encryptBlock:function(p,d){this._doCryptBlock(p,d,this._subKeys)},decryptBlock:function(p,d){this._doCryptBlock(p,d,this._invSubKeys)},_doCryptBlock:function(p,d,v){this._lBlock=p[d],this._rBlock=p[d+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var g=0;16>g;g++){for(var y=v[g],w=this._lBlock,E=this._rBlock,_=0,C=0;8>C;C++)_|=l[C][((E^y[C])&h[C])>>>0];this._lBlock=E,this._rBlock=w^_}v=this._lBlock,this._lBlock=this._rBlock,this._rBlock=v,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),p[d]=this._lBlock,p[d+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(m),o=o.TripleDES=i.extend({_doReset:function(){var p=this._key.words;this._des1=m.createEncryptor(n.create(p.slice(0,2))),this._des2=m.createEncryptor(n.create(p.slice(2,4))),this._des3=m.createEncryptor(n.create(p.slice(4,6)))},encryptBlock:function(p,d){this._des1.encryptBlock(p,d),this._des2.decryptBlock(p,d),this._des3.encryptBlock(p,d)},decryptBlock:function(p,d){this._des3.decryptBlock(p,d),this._des2.encryptBlock(p,d),this._des1.decryptBlock(p,d)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(o)})();(function(){var e=ke,t=e.lib.WordArray;e.enc.Base64={stringify:function(r){var n=r.words,i=r.sigBytes,o=this._map;r.clamp(),r=[];for(var s=0;s<i;s+=3)for(var a=(n[s>>>2]>>>24-8*(s%4)&255)<<16|(n[s+1>>>2]>>>24-8*((s+1)%4)&255)<<8|n[s+2>>>2]>>>24-8*((s+2)%4)&255,u=0;4>u&&s+.75*u<i;u++)r.push(o.charAt(a>>>6*(3-u)&63));if(n=o.charAt(64))for(;r.length%4;)r.push(n);return r.join("")},parse:function(r){var n=r.length,i=this._map,o=i.charAt(64);o&&(o=r.indexOf(o),o!=-1&&(n=o));for(var o=[],s=0,a=0;a<n;a++)if(a%4){var u=i.indexOf(r.charAt(a-1))<<2*(a%4),l=i.indexOf(r.charAt(a))>>>6-2*(a%4);o[s>>>2]|=(u|l)<<24-8*(s%4),s++}return t.create(o,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();(function(e){function t(m,p,d,v,g,y,w){return m=m+(p&d|~p&v)+g+w,(m<<y|m>>>32-y)+p}function r(m,p,d,v,g,y,w){return m=m+(p&v|d&~v)+g+w,(m<<y|m>>>32-y)+p}function n(m,p,d,v,g,y,w){return m=m+(p^d^v)+g+w,(m<<y|m>>>32-y)+p}function i(m,p,d,v,g,y,w){return m=m+(d^(p|~v))+g+w,(m<<y|m>>>32-y)+p}for(var o=ke,u=o.lib,s=u.WordArray,a=u.Hasher,u=o.algo,l=[],h=0;64>h;h++)l[h]=4294967296*e.abs(e.sin(h+1))|0;u=u.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,p){for(var d=0;16>d;d++){var v=p+d,g=m[v];m[v]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var d=this._hash.words,v=m[p+0],g=m[p+1],y=m[p+2],w=m[p+3],E=m[p+4],_=m[p+5],C=m[p+6],F=m[p+7],H=m[p+8],K=m[p+9],S=m[p+10],I=m[p+11],q=m[p+12],L=m[p+13],R=m[p+14],O=m[p+15],T=d[0],M=d[1],P=d[2],N=d[3],T=t(T,M,P,N,v,7,l[0]),N=t(N,T,M,P,g,12,l[1]),P=t(P,N,T,M,y,17,l[2]),M=t(M,P,N,T,w,22,l[3]),T=t(T,M,P,N,E,7,l[4]),N=t(N,T,M,P,_,12,l[5]),P=t(P,N,T,M,C,17,l[6]),M=t(M,P,N,T,F,22,l[7]),T=t(T,M,P,N,H,7,l[8]),N=t(N,T,M,P,K,12,l[9]),P=t(P,N,T,M,S,17,l[10]),M=t(M,P,N,T,I,22,l[11]),T=t(T,M,P,N,q,7,l[12]),N=t(N,T,M,P,L,12,l[13]),P=t(P,N,T,M,R,17,l[14]),M=t(M,P,N,T,O,22,l[15]),T=r(T,M,P,N,g,5,l[16]),N=r(N,T,M,P,C,9,l[17]),P=r(P,N,T,M,I,14,l[18]),M=r(M,P,N,T,v,20,l[19]),T=r(T,M,P,N,_,5,l[20]),N=r(N,T,M,P,S,9,l[21]),P=r(P,N,T,M,O,14,l[22]),M=r(M,P,N,T,E,20,l[23]),T=r(T,M,P,N,K,5,l[24]),N=r(N,T,M,P,R,9,l[25]),P=r(P,N,T,M,w,14,l[26]),M=r(M,P,N,T,H,20,l[27]),T=r(T,M,P,N,L,5,l[28]),N=r(N,T,M,P,y,9,l[29]),P=r(P,N,T,M,F,14,l[30]),M=r(M,P,N,T,q,20,l[31]),T=n(T,M,P,N,_,4,l[32]),N=n(N,T,M,P,H,11,l[33]),P=n(P,N,T,M,I,16,l[34]),M=n(M,P,N,T,R,23,l[35]),T=n(T,M,P,N,g,4,l[36]),N=n(N,T,M,P,E,11,l[37]),P=n(P,N,T,M,F,16,l[38]),M=n(M,P,N,T,S,23,l[39]),T=n(T,M,P,N,L,4,l[40]),N=n(N,T,M,P,v,11,l[41]),P=n(P,N,T,M,w,16,l[42]),M=n(M,P,N,T,C,23,l[43]),T=n(T,M,P,N,K,4,l[44]),N=n(N,T,M,P,q,11,l[45]),P=n(P,N,T,M,O,16,l[46]),M=n(M,P,N,T,y,23,l[47]),T=i(T,M,P,N,v,6,l[48]),N=i(N,T,M,P,F,10,l[49]),P=i(P,N,T,M,R,15,l[50]),M=i(M,P,N,T,_,21,l[51]),T=i(T,M,P,N,q,6,l[52]),N=i(N,T,M,P,w,10,l[53]),P=i(P,N,T,M,S,15,l[54]),M=i(M,P,N,T,g,21,l[55]),T=i(T,M,P,N,H,6,l[56]),N=i(N,T,M,P,O,10,l[57]),P=i(P,N,T,M,C,15,l[58]),M=i(M,P,N,T,L,21,l[59]),T=i(T,M,P,N,E,6,l[60]),N=i(N,T,M,P,I,10,l[61]),P=i(P,N,T,M,y,15,l[62]),M=i(M,P,N,T,K,21,l[63]);d[0]=d[0]+T|0,d[1]=d[1]+M|0,d[2]=d[2]+P|0,d[3]=d[3]+N|0},_doFinalize:function(){var m=this._data,p=m.words,d=8*this._nDataBytes,v=8*m.sigBytes;p[v>>>5]|=128<<24-v%32;var g=e.floor(d/4294967296);for(p[(v+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,p[(v+64>>>9<<4)+14]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360,m.sigBytes=4*(p.length+1),this._process(),m=this._hash,p=m.words,d=0;4>d;d++)v=p[d],p[d]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360;return m},clone:function(){var m=a.clone.call(this);return m._hash=this._hash.clone(),m}}),o.MD5=a._createHelper(u),o.HmacMD5=a._createHmacHelper(u)})(Math);(function(){var e=ke,i=e.lib,t=i.WordArray,r=i.Hasher,n=[],i=e.algo.SHA1=r.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(o,s){for(var a=this._hash.words,u=a[0],l=a[1],h=a[2],m=a[3],p=a[4],d=0;80>d;d++){if(16>d)n[d]=o[s+d]|0;else{var v=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=v<<1|v>>>31}v=(u<<5|u>>>27)+p+n[d],v=20>d?v+((l&h|~l&m)+1518500249):40>d?v+((l^h^m)+1859775393):60>d?v+((l&h|l&m|h&m)-1894007588):v+((l^h^m)-899497514),p=m,m=h,h=l<<30|l>>>2,l=u,u=v}a[0]=a[0]+u|0,a[1]=a[1]+l|0,a[2]=a[2]+h|0,a[3]=a[3]+m|0,a[4]=a[4]+p|0},_doFinalize:function(){var o=this._data,s=o.words,a=8*this._nDataBytes,u=8*o.sigBytes;return s[u>>>5]|=128<<24-u%32,s[(u+64>>>9<<4)+14]=Math.floor(a/4294967296),s[(u+64>>>9<<4)+15]=a,o.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var o=r.clone.call(this);return o._hash=this._hash.clone(),o}});e.SHA1=r._createHelper(i),e.HmacSHA1=r._createHmacHelper(i)})();(function(e){for(var t=ke,d=t.lib,r=d.WordArray,n=d.Hasher,d=t.algo,i=[],o=[],s=function(g){return 4294967296*(g-(g|0))|0},a=2,u=0;64>u;){var l;e:{l=a;for(var h=e.sqrt(l),m=2;m<=h;m++)if(!(l%m)){l=!1;break e}l=!0}l&&(8>u&&(i[u]=s(e.pow(a,.5))),o[u]=s(e.pow(a,1/3)),u++),a++}var p=[],d=d.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(v,g){for(var y=this._hash.words,w=y[0],E=y[1],_=y[2],C=y[3],F=y[4],H=y[5],K=y[6],S=y[7],I=0;64>I;I++){if(16>I)p[I]=v[g+I]|0;else{var q=p[I-15],L=p[I-2];p[I]=((q<<25|q>>>7)^(q<<14|q>>>18)^q>>>3)+p[I-7]+((L<<15|L>>>17)^(L<<13|L>>>19)^L>>>10)+p[I-16]}q=S+((F<<26|F>>>6)^(F<<21|F>>>11)^(F<<7|F>>>25))+(F&H^~F&K)+o[I]+p[I],L=((w<<30|w>>>2)^(w<<19|w>>>13)^(w<<10|w>>>22))+(w&E^w&_^E&_),S=K,K=H,H=F,F=C+q|0,C=_,_=E,E=w,w=q+L|0}y[0]=y[0]+w|0,y[1]=y[1]+E|0,y[2]=y[2]+_|0,y[3]=y[3]+C|0,y[4]=y[4]+F|0,y[5]=y[5]+H|0,y[6]=y[6]+K|0,y[7]=y[7]+S|0},_doFinalize:function(){var v=this._data,g=v.words,y=8*this._nDataBytes,w=8*v.sigBytes;return g[w>>>5]|=128<<24-w%32,g[(w+64>>>9<<4)+14]=e.floor(y/4294967296),g[(w+64>>>9<<4)+15]=y,v.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var v=n.clone.call(this);return v._hash=this._hash.clone(),v}});t.SHA256=n._createHelper(d),t.HmacSHA256=n._createHmacHelper(d)})(Math);(function(){var e=ke,t=e.lib.WordArray,n=e.algo,r=n.SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var i=r._doFinalize.call(this);return i.sigBytes-=4,i}});e.SHA224=r._createHelper(n),e.HmacSHA224=r._createHmacHelper(n)})();(function(){function e(){return n.create.apply(n,arguments)}for(var t=ke,r=t.lib.Hasher,o=t.x64,n=o.Word,i=o.WordArray,o=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=e();o=o.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(l,h){for(var E=this._hash.words,m=E[0],p=E[1],d=E[2],v=E[3],g=E[4],y=E[5],w=E[6],E=E[7],_=m.high,C=m.low,F=p.high,H=p.low,K=d.high,S=d.low,I=v.high,q=v.low,L=g.high,R=g.low,O=y.high,T=y.low,N=w.high,P=w.low,M=E.high,Y=E.low,V=_,X=C,te=F,ae=H,me=K,he=S,De=I,Pe=q,Ie=L,se=R,pe=O,Fe=T,Te=N,Ve=P,Oe=M,pt=Y,Qe=0;80>Qe;Qe++){var or=a[Qe];if(16>Qe)var ct=or.high=l[h+2*Qe]|0,Re=or.low=l[h+2*Qe+1]|0;else{var ct=a[Qe-15],Re=ct.high,lt=ct.low,ct=(Re>>>1|lt<<31)^(Re>>>8|lt<<24)^Re>>>7,lt=(lt>>>1|Re<<31)^(lt>>>8|Re<<24)^(lt>>>7|Re<<25),Pr=a[Qe-2],Re=Pr.high,Dt=Pr.low,Pr=(Re>>>19|Dt<<13)^(Re<<3|Dt>>>29)^Re>>>6,Dt=(Dt>>>19|Re<<13)^(Dt<<3|Re>>>29)^(Dt>>>6|Re<<26),Re=a[Qe-7],mn=Re.high,gr=a[Qe-16],Ze=gr.high,gr=gr.low,Re=lt+Re.low,ct=ct+mn+(Re>>>0<lt>>>0?1:0),Re=Re+Dt,ct=ct+Pr+(Re>>>0<Dt>>>0?1:0),Re=Re+gr,ct=ct+Ze+(Re>>>0<gr>>>0?1:0);or.high=ct,or.low=Re}var mn=Ie&pe^~Ie&Te,gr=se&Fe^~se&Ve,or=V&te^V&me^te&me,vr=X&ae^X&he^ae&he,lt=(V>>>28|X<<4)^(V<<30|X>>>2)^(V<<25|X>>>7),Pr=(X>>>28|V<<4)^(X<<30|V>>>2)^(X<<25|V>>>7),Dt=s[Qe],es=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+es+(Dt>>>0<mi>>>0?1:0),Dt=Dt+Re,Ze=Ze+ct+(Dt>>>0<Re>>>0?1:0),Re=Pr+vr,or=lt+or+(Re>>>0<Pr>>>0?1:0),Oe=Te,pt=Ve,Te=pe,Ve=Fe,pe=Ie,Fe=se,se=Pe+Dt|0,Ie=De+Ze+(se>>>0<Pe>>>0?1:0)|0,De=me,Pe=he,me=te,he=ae,te=V,ae=X,X=Dt+Re|0,V=Ze+or+(X>>>0<Dt>>>0?1:0)|0}C=m.low=C+X,m.high=_+V+(C>>>0<X>>>0?1:0),H=p.low=H+ae,p.high=F+te+(H>>>0<ae>>>0?1:0),S=d.low=S+he,d.high=K+me+(S>>>0<he>>>0?1:0),q=v.low=q+Pe,v.high=I+De+(q>>>0<Pe>>>0?1:0),R=g.low=R+se,g.high=L+Ie+(R>>>0<se>>>0?1:0),T=y.low=T+Fe,y.high=O+pe+(T>>>0<Fe>>>0?1:0),P=w.low=P+Ve,w.high=N+Te+(P>>>0<Ve>>>0?1:0),Y=E.low=Y+pt,E.high=M+Oe+(Y>>>0<pt>>>0?1:0)},_doFinalize:function(){var l=this._data,h=l.words,m=8*this._nDataBytes,p=8*l.sigBytes;return h[p>>>5]|=128<<24-p%32,h[(p+128>>>10<<5)+30]=Math.floor(m/4294967296),h[(p+128>>>10<<5)+31]=m,l.sigBytes=4*h.length,this._process(),this._hash.toX32()},clone:function(){var l=r.clone.call(this);return l._hash=this._hash.clone(),l},blockSize:32}),t.SHA512=r._createHelper(o),t.HmacSHA512=r._createHmacHelper(o)})();(function(){var e=ke,i=e.x64,t=i.Word,r=i.WordArray,i=e.algo,n=i.SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var o=n._doFinalize.call(this);return o.sigBytes-=16,o}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)})();(function(){var e=ke,l=e.lib,t=l.WordArray,r=l.Hasher,l=e.algo,n=t.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),i=t.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),o=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),s=t.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),a=t.create([0,1518500249,1859775393,2400959708,2840853838]),u=t.create([1352829926,1548603684,1836072691,2053994217,0]),l=l.RIPEMD160=r.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,m){for(var p=0;16>p;p++){var d=m+p,v=h[d];h[d]=(v<<8|v>>>24)&16711935|(v<<24|v>>>8)&4278255360}var d=this._hash.words,v=a.words,g=u.words,y=n.words,w=i.words,E=o.words,_=s.words,C,F,H,K,S,I,q,L,R,O;I=C=d[0],q=F=d[1],L=H=d[2],R=K=d[3],O=S=d[4];for(var T,p=0;80>p;p+=1)T=C+h[m+y[p]]|0,T=16>p?T+((F^H^K)+v[0]):32>p?T+((F&H|~F&K)+v[1]):48>p?T+(((F|~H)^K)+v[2]):64>p?T+((F&K|H&~K)+v[3]):T+((F^(H|~K))+v[4]),T|=0,T=T<<E[p]|T>>>32-E[p],T=T+S|0,C=S,S=K,K=H<<10|H>>>22,H=F,F=T,T=I+h[m+w[p]]|0,T=16>p?T+((q^(L|~R))+g[0]):32>p?T+((q&R|L&~R)+g[1]):48>p?T+(((q|~L)^R)+g[2]):64>p?T+((q&L|~q&R)+g[3]):T+((q^L^R)+g[4]),T|=0,T=T<<_[p]|T>>>32-_[p],T=T+O|0,I=O,O=R,R=L<<10|L>>>22,L=q,q=T;T=d[1]+H+R|0,d[1]=d[2]+K+O|0,d[2]=d[3]+S+I|0,d[3]=d[4]+C+q|0,d[4]=d[0]+F+L|0,d[0]=T},_doFinalize:function(){var h=this._data,m=h.words,p=8*this._nDataBytes,d=8*h.sigBytes;for(m[d>>>5]|=128<<24-d%32,m[(d+64>>>9<<4)+14]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360,h.sigBytes=4*(m.length+1),this._process(),h=this._hash,m=h.words,p=0;5>p;p++)d=m[p],m[p]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;return h},clone:function(){var h=r.clone.call(this);return h._hash=this._hash.clone(),h}});e.RIPEMD160=r._createHelper(l),e.HmacRIPEMD160=r._createHmacHelper(l)})(Math);(function(){var e=ke,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(r,n){r=this._hasher=new r.init,typeof n=="string"&&(n=t.parse(n));var i=r.blockSize,o=4*i;n.sigBytes>o&&(n=r.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),a=this._iKey=n.clone(),u=s.words,l=a.words,h=0;h<i;h++)u[h]^=1549556828,l[h]^=909522486;s.sigBytes=a.sigBytes=o,this.reset()},reset:function(){var r=this._hasher;r.reset(),r.update(this._iKey)},update:function(r){return this._hasher.update(r),this},finalize:function(r){var n=this._hasher;return r=n.finalize(r),n.reset(),n.finalize(this._oKey.clone().concat(r))}})})();(function(){var e=ke,n=e.lib,t=n.Base,r=n.WordArray,n=e.algo,i=n.HMAC,o=n.PBKDF2=t.extend({cfg:t.extend({keySize:4,hasher:n.SHA1,iterations:1}),init:function(s){this.cfg=this.cfg.extend(s)},compute:function(s,a){for(var v=this.cfg,u=i.create(v.hasher,s),l=r.create(),h=r.create([1]),m=l.words,p=h.words,d=v.keySize,v=v.iterations;m.length<d;){var g=u.update(a).finalize(h);u.reset();for(var y=g.words,w=y.length,E=g,_=1;_<v;_++){E=u.finalize(E),u.reset();for(var C=E.words,F=0;F<w;F++)y[F]^=C[F]}l.concat(g),p[0]++}return l.sigBytes=4*d,l}});e.PBKDF2=function(s,a,u){return o.create(u).compute(s,a)}})();var Ql="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sy="=";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+=Ql.charAt(r>>6)+Ql.charAt(r&63);if(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=Ql.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=Ql.charAt(r>>2)+Ql.charAt((r&3)<<4)),sy)for(;(n.length&3)>0;)n+=sy;return n}function tf(e){var t="",r,n=0,i,o;for(r=0;r<e.length&&e.charAt(r)!=sy;++r)o=Ql.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 oC(e){var t=tf(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 Su,CH=0xdeadbeefcafe,nC=(CH&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 DH(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 FH(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 BH(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}nC&&rd.appName=="Microsoft Internet Explorer"?(ne.prototype.am=FH,Su=30):nC&&rd.appName!="Netscape"?(ne.prototype.am=DH,Su=26):(ne.prototype.am=BH,Su=28);ne.prototype.DB=Su;ne.prototype.DM=(1<<Su)-1;ne.prototype.DV=1<<Su;var uy=52;ne.prototype.FV=Math.pow(2,uy);ne.prototype.F1=uy-Su;ne.prototype.F2=2*Su-uy;var IH="0123456789abcdefghijklmnopqrstuvwxyz",p1=new Array,rf,Js;rf=48;for(Js=0;Js<=9;++Js)p1[rf++]=Js;rf=97;for(Js=10;Js<36;++Js)p1[rf++]=Js;rf=65;for(Js=10;Js<36;++Js)p1[rf++]=Js;function ca(e){return IH.charAt(e)}function aC(e,t){var r=p1[e.charCodeAt(t)];return r??-1}function xH(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function $H(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 Au(e){var t=Pt();return t.fromInt(e),t}function PH(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:aC(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 kH(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function RH(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 TH(){var e=Pt();return ne.ZERO.subTo(this,e),e}function OH(){return this.s<0?this.negate():this}function NH(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 m1(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 LH(){return this.t<=0?0:this.DB*(this.t-1)+m1(this[this.t-1]^this.s&this.DM)}function UH(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 HH(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 MH(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 qH(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 jH(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 KH(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 VH(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 GH(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-m1(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 zH(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 WH(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function YH(e){return e}function XH(e){e.divRemTo(this.m,null,e)}function ZH(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function JH(e,t){e.squareTo(t),this.reduce(t)}Dc.prototype.convert=WH;Dc.prototype.revert=YH;Dc.prototype.reduce=XH;Dc.prototype.mulTo=ZH;Dc.prototype.sqrTo=JH;function QH(){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 eM(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 tM(e){var t=Pt();return e.copyTo(t),this.reduce(t),t}function rM(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 nM(e,t){e.squareTo(t),this.reduce(t)}function sM(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Fc.prototype.convert=eM;Fc.prototype.revert=tM;Fc.prototype.reduce=rM;Fc.prototype.mulTo=sM;Fc.prototype.sqrTo=nM;function iM(){return(this.t>0?this[0]&1:this.s)==0}function oM(e,t){if(e>4294967295||e<1)return ne.ONE;var r=Pt(),n=Pt(),i=t.convert(this),o=m1(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 aM(e,t){var r;return e<256||t.isEven()?r=new Dc(t):r=new Fc(t),this.exp(e,r)}ne.prototype.copyTo=xH;ne.prototype.fromInt=$H;ne.prototype.fromString=PH;ne.prototype.clamp=kH;ne.prototype.dlShiftTo=UH;ne.prototype.drShiftTo=HH;ne.prototype.lShiftTo=MH;ne.prototype.rShiftTo=qH;ne.prototype.subTo=jH;ne.prototype.multiplyTo=KH;ne.prototype.squareTo=VH;ne.prototype.divRemTo=GH;ne.prototype.invDigit=QH;ne.prototype.isEven=iM;ne.prototype.exp=oM;ne.prototype.toString=RH;ne.prototype.negate=TH;ne.prototype.abs=OH;ne.prototype.compareTo=NH;ne.prototype.bitLength=LH;ne.prototype.mod=zH;ne.prototype.modPowInt=aM;ne.ZERO=Au(0);ne.ONE=Au(1);function uM(){var e=Pt();return this.copyTo(e),e}function cM(){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 lM(){return this.t==0?this.s:this[0]<<24>>24}function fM(){return this.t==0?this.s:this[0]<<16>>16}function hM(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function dM(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function pM(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=Au(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 mM(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=aC(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 gM(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),cy,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 vM(){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 wM(e){return this.compareTo(e)==0}function yM(e){return this.compareTo(e)<0?this:e}function EM(e){return this.compareTo(e)>0?this:e}function bM(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 AM(e,t){return e&t}function SM(e){var t=Pt();return this.bitwiseTo(e,AM,t),t}function cy(e,t){return e|t}function _M(e){var t=Pt();return this.bitwiseTo(e,cy,t),t}function uC(e,t){return e^t}function CM(e){var t=Pt();return this.bitwiseTo(e,uC,t),t}function cC(e,t){return e&~t}function DM(e){var t=Pt();return this.bitwiseTo(e,cC,t),t}function FM(){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 BM(e){var t=Pt();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function IM(e){var t=Pt();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function xM(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 $M(){for(var e=0;e<this.t;++e)if(this[e]!=0)return e*this.DB+xM(this[e]);return this.s<0?this.t*this.DB:-1}function PM(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function kM(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=PM(this[r]^t);return e}function RM(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<e%this.DB)!=0}function TM(e,t){var r=ne.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function OM(e){return this.changeBit(e,cy)}function NM(e){return this.changeBit(e,cC)}function LM(e){return this.changeBit(e,uC)}function UM(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 HM(e){var t=Pt();return this.addTo(e,t),t}function MM(e){var t=Pt();return this.subTo(e,t),t}function qM(e){var t=Pt();return this.multiplyTo(e,t),t}function jM(){var e=Pt();return this.squareTo(e),e}function KM(e){var t=Pt();return this.divRemTo(e,t,null),t}function VM(e){var t=Pt();return this.divRemTo(e,null,t),t}function GM(e){var t=Pt(),r=Pt();return this.divRemTo(e,t,r),new Array(t,r)}function zM(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function WM(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 sd(){}function lC(e){return e}function YM(e,t,r){e.multiplyTo(t,r)}function XM(e,t){e.squareTo(t)}sd.prototype.convert=lC;sd.prototype.revert=lC;sd.prototype.mulTo=YM;sd.prototype.sqrTo=XM;function ZM(e){return this.exp(e,new sd)}function JM(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 QM(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 nf(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 eq(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 tq(e){return e}function rq(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 nq(e,t){e.squareTo(t),this.reduce(t)}function sq(e,t,r){e.multiplyTo(t,r),this.reduce(r)}nf.prototype.convert=eq;nf.prototype.revert=tq;nf.prototype.reduce=rq;nf.prototype.mulTo=sq;nf.prototype.sqrTo=nq;function iq(e,t){if(e.signum()<0)return this.modInverse(t).modPow(e.negate(),t);var r=e.bitLength(),n,i=Au(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 nf(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=m1(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 oq(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 aq(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 uq(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=Au(1),s=Au(0),a=Au(0),u=Au(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],cq=(1<<26)/Kn[Kn.length-1];function lq(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<cq;)n*=Kn[i++];for(n=r.modInt(n);t<i;)if(n%Kn[t++]==0)return!1}return r.millerRabin(e)}function fq(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=hM;ne.prototype.toRadix=pM;ne.prototype.fromRadix=mM;ne.prototype.fromNumber=gM;ne.prototype.bitwiseTo=bM;ne.prototype.changeBit=TM;ne.prototype.addTo=UM;ne.prototype.dMultiply=zM;ne.prototype.dAddOffset=WM;ne.prototype.multiplyLowerTo=JM;ne.prototype.multiplyUpperTo=QM;ne.prototype.modInt=aq;ne.prototype.millerRabin=fq;ne.prototype.clone=uM;ne.prototype.intValue=cM;ne.prototype.byteValue=lM;ne.prototype.shortValue=fM;ne.prototype.signum=dM;ne.prototype.toByteArray=vM;ne.prototype.equals=wM;ne.prototype.min=yM;ne.prototype.max=EM;ne.prototype.and=SM;ne.prototype.or=_M;ne.prototype.xor=CM;ne.prototype.andNot=DM;ne.prototype.not=FM;ne.prototype.shiftLeft=BM;ne.prototype.shiftRight=IM;ne.prototype.getLowestSetBit=$M;ne.prototype.bitCount=kM;ne.prototype.testBit=RM;ne.prototype.setBit=OM;ne.prototype.clearBit=NM;ne.prototype.flipBit=LM;ne.prototype.add=HM;ne.prototype.subtract=MM;ne.prototype.multiply=qM;ne.prototype.divide=KM;ne.prototype.remainder=VM;ne.prototype.divideAndRemainder=GM;ne.prototype.modPow=iq;ne.prototype.modInverse=uq;ne.prototype.pow=ZM;ne.prototype.gcd=oq;ne.prototype.isProbablePrime=lq;ne.prototype.square=jM;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 ly(){this.i=0,this.j=0,this.S=new Array}function hq(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 dq(){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]}ly.prototype.init=hq;ly.prototype.next=dq;function pq(){return new ly}var td=256;var c1,ls,Ar;function mq(e){ls[Ar++]^=e&255,ls[Ar++]^=e>>8&255,ls[Ar++]^=e>>16&255,ls[Ar++]^=e>>24&255,Ar>=td&&(Ar-=td)}function fy(){mq(new Date().getTime())}if(ls==null){if(ls=new Array,Ar=0,typeof Jl<"u"&&(Jl.crypto!==void 0||Jl.msCrypto!==void 0)){if(la=Jl.crypto||Jl.msCrypto,la.getRandomValues)for(ry=new Uint8Array(32),la.getRandomValues(ry),bn=0;bn<32;++bn)ls[Ar++]=ry[bn];else if(rd.appName=="Netscape"&&rd.appVersion<"5")for(ny=Jl.crypto.random(32),bn=0;bn<ny.length;++bn)ls[Ar++]=ny.charCodeAt(bn)&255}if(Ar<td&&typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)for(l1=new Uint8Array(td-Ar),globalThis.crypto.getRandomValues(l1),bn=0;bn<l1.length;++bn)ls[Ar++]=l1[bn];for(;Ar<td;)bn=Math.floor(65536*Math.random()),ls[Ar++]=bn>>>8,ls[Ar++]=bn&255;Ar=0,fy()}var bn,la,ry,ny,l1;function gq(){if(c1==null){for(fy(),c1=pq(),c1.init(ls),Ar=0;Ar<ls.length;++Ar)ls[Ar]=0;Ar=0}return c1.next()}function vq(e){var t;for(t=0;t<e.length;++t)e[t]=gq()}function sf(){}sf.prototype.nextBytes=vq;function hs(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 wq(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=hs(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 yq(e){return e.modPowInt(this.e,this.n)}at.prototype.doPublic=yq;at.prototype.setPublic=wq;at.prototype.type="RSA";function Eq(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=hs(e,16),this.e=parseInt(t,16),this.d=hs(r,16);else throw"Invalid RSA private key"}function bq(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=hs(e,16),this.e=parseInt(t,16),this.d=hs(r,16),this.p=hs(n,16),this.q=hs(i,16),this.dmp1=hs(o,16),this.dmq1=hs(s,16),this.coeff=hs(a,16);else throw"Invalid RSA private key in RSASetPrivateEx"}function Aq(e,t){var r=new sf,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 Sq(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=Sq;at.prototype.setPrivate=Eq;at.prototype.setPrivateEx=bq;at.prototype.generate=Aq;function Nr(e,t){this.x=t,this.q=e}function _q(e){return e==this?!0:this.q.equals(e.q)&&this.x.equals(e.x)}function Cq(){return this.x}function Dq(){return new Nr(this.q,this.x.negate().mod(this.q))}function Fq(e){return new Nr(this.q,this.x.add(e.toBigInteger()).mod(this.q))}function Bq(e){return new Nr(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))}function Iq(e){return new Nr(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))}function xq(){return new Nr(this.q,this.x.square().mod(this.q))}function $q(e){return new Nr(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))}Nr.prototype.equals=_q;Nr.prototype.toBigInteger=Cq;Nr.prototype.negate=Dq;Nr.prototype.add=Fq;Nr.prototype.subtract=Bq;Nr.prototype.multiply=Iq;Nr.prototype.square=xq;Nr.prototype.divide=$q;Nr.prototype.sqrt=function(){return new Nr(this.q,this.x.sqrt().mod(this.q))};function Lt(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 Pq(){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 kq(){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 Rq(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 Tq(){return this.x==null&&this.y==null?!0:this.z.equals(ne.ZERO)&&!this.y.toBigInteger().equals(ne.ZERO)}function Oq(){return new Lt(this.curve,this.x,this.y.negate(),this.z)}function Nq(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 Lt(this.curve,this.curve.fromBigInteger(p),this.curve.fromBigInteger(d),v)}function Lq(){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 Lt(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),l)}function Uq(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 Lt(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 Hq(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}Lt.prototype.getX=Pq;Lt.prototype.getY=kq;Lt.prototype.equals=Rq;Lt.prototype.isInfinity=Tq;Lt.prototype.negate=Oq;Lt.prototype.add=Nq;Lt.prototype.twice=Lq;Lt.prototype.multiply=Uq;Lt.prototype.multiplyTwo=Hq;function ha(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new Lt(this,null,null)}function Mq(){return this.q}function qq(){return this.a}function jq(){return this.b}function Kq(e){return e==this?!0:this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)}function Vq(){return this.infinity}function Gq(e){return new Nr(this.q,e)}function zq(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 Lt(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 Lt(this,this.fromBigInteger(new ne(l,16)),this.fromBigInteger(new ne(h,16)));default:return null}}ha.prototype.getQ=Mq;ha.prototype.getA=qq;ha.prototype.getB=jq;ha.prototype.equals=Kq;ha.prototype.getInfinity=Vq;ha.prototype.fromBigInteger=Gq;ha.prototype.decodePointHex=zq;Nr.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};Lt.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};Lt.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 Lt(e,e.fromBigInteger(s),e.fromBigInteger(a))};Lt.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 Lt(e,e.fromBigInteger(s),e.fromBigInteger(a))};Lt.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 Lt(this.curve,i,o)};Lt.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 Lt(this.curve,n,i)};Lt.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};Lt.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)};Lt.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};Lt.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 fC=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",t='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',r='(?:"'+t+'*")',n=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+r+")","g"),i=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),o={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:`
`,r:"\r",t:" "};function s(m,p,d){return p?o[p]:String.fromCharCode(parseInt(d,16))}var a=new String(""),u="\\",l={"{":Object,"[":Array},h=Object.hasOwnProperty;return function(m,p){var d=m.match(n),v,g=d[0],y=!1;g==="{"?v={}:g==="["?v=[]:(v=[],y=!0);for(var w,E=[v],_=1-y,C=d.length;_<C;++_){g=d[_];var F;switch(g.charCodeAt(0)){default:F=E[0],F[w||F.length]=+g,w=void 0;break;case 34:if(g=g.substring(1,g.length-1),g.indexOf(u)!==-1&&(g=g.replace(i,s)),F=E[0],!w)if(F instanceof Array)w=F.length;else{w=g||a;break}F[w]=g,w=void 0;break;case 91:F=E[0],E.unshift(F[w||F.length]=[]),w=void 0;break;case 93:E.shift();break;case 102:F=E[0],F[w||F.length]=!1,w=void 0;break;case 110:F=E[0],F[w||F.length]=null,w=void 0;break;case 116:F=E[0],F[w||F.length]=!0,w=void 0;break;case 123:F=E[0],E.unshift(F[w||F.length]={}),w=void 0;break;case 125:E.shift();break}}if(y){if(E.length!==1)throw new Error;v=v[0]}else if(E.length)throw new Error;if(p){var H=function(K,S){var I=K[S];if(I&&typeof I=="object"){var q=null;for(var L in I)if(h.call(I,L)&&I!==K){var R=H(I,L);R!==void 0?I[L]=R:(q||(q=[]),q.push(L))}if(q)for(var O=q.length;--O>=0;)delete I[q[O]]}return p.call(K,S,I)};v=H({"":v},"")}return v}})();(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});A.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){return ad(e)},this.getPEMStringFromHex=function(e,t){return An(e,t)},this.newObject=function(e){var t=A,r=t.asn1,n=r.ASN1Object,i=r.DERBoolean,o=r.DERInteger,s=r.DERBitString,a=r.DEROctetString,u=r.DERNull,l=r.DERObjectIdentifier,h=r.DEREnumerated,m=r.DERUTF8String,p=r.DERNumericString,d=r.DERPrintableString,v=r.DERTeletexString,g=r.DERIA5String,y=r.DERUTCTime,w=r.DERGeneralizedTime,E=r.DERVisibleString,_=r.DERBMPString,C=r.DERSequence,F=r.DERSet,H=r.DERTaggedObject,K=r.ASN1Util.newObject;if(e instanceof r.ASN1Object)return e;var S=Object.keys(e);if(S.length!=1)throw new Error("key of param shall be only one.");var I=S[0];if(":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+I+":")==-1)throw new Error("undefined key: "+I);if(I=="bool")return new i(e[I]);if(I=="int")return new o(e[I]);if(I=="bitstr")return new s(e[I]);if(I=="octstr")return new a(e[I]);if(I=="null")return new u(e[I]);if(I=="oid")return new l(e[I]);if(I=="enum")return new h(e[I]);if(I=="utf8str")return new m(e[I]);if(I=="numstr")return new p(e[I]);if(I=="prnstr")return new d(e[I]);if(I=="telstr")return new v(e[I]);if(I=="ia5str")return new g(e[I]);if(I=="utctime")return new y(e[I]);if(I=="gentime")return new w(e[I]);if(I=="visstr")return new E(e[I]);if(I=="bmpstr")return new _(e[I]);if(I=="asn1")return new n(e[I]);if(I=="seq"){for(var q=e[I],L=[],R=0;R<q.length;R++){var O=K(q[R]);L.push(O)}return new C({array:L})}if(I=="set"){for(var q=e[I],L=[],R=0;R<q.length;R++){var O=K(q[R]);L.push(O)}return new F({array:L})}if(I=="tag"){var T=e[I];if(Object.prototype.toString.call(T)==="[object Array]"&&T.length==3){var N=K(T[2]);return new H({tag:T[0],explicit:T[1],obj:N})}else return new H(T)}},this.jsonToASN1HEX=function(e){var t=this.newObject(e);return t.tohex()}};A.asn1.ASN1Util.oidHexToInt=function(e){for(var i="",t=parseInt(e.substr(0,2),16),r=Math.floor(t/40),n=t%40,i=r+"."+n,o="",s=2;s<e.length;s+=2){var a=parseInt(e.substr(s,2),16),u=("00000000"+a.toString(2)).slice(-8);if(o=o+u.substr(1,7),u.substr(0,1)=="0"){var l=new ne(o,2);i=i+"."+l.toString(10),o=""}}return i};A.asn1.ASN1Util.oidIntToHex=function(e){var t=function(a){var u=a.toString(16);return u.length==1&&(u="0"+u),u},r=function(a){var u="",l=new ne(a,10),h=l.toString(2),m=7-h.length%7;m==7&&(m=0);for(var p="",d=0;d<m;d++)p+="0";h=p+h;for(var d=0;d<h.length-1;d+=7){var v=h.substr(d,7);d!=h.length-7&&(v="1"+v),u+=t(parseInt(v,2))}return u};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var n="",i=e.split("."),o=parseInt(i[0])*40+parseInt(i[1]);n+=t(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n};A.asn1.ASN1Object=function(e){var t=!0,r=null,n="00",i="00",o="";this.params=null,this.getLengthHexFromValue=function(){if(typeof this.hV>"u"||this.hV==null)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+o.length+",v="+this.hV);var s=this.hV.length/2,a=s.toString(16);if(a.length%2==1&&(a="0"+a),s<128)return a;var u=a.length/2;if(u>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+s.toString(16));var l=128+u;return l.toString(16)+a},this.tohex=function(){return(this.hTLV==null||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(s){this.params=s},e!=null&&e.tlv!=null&&(this.hTLV=e.tlv,this.isModified=!1)};A.asn1.DERAbstractString=function(e){A.asn1.DERAbstractString.superclass.constructor.call(this);var t=null,r=null;this.getString=function(){return this.s},this.setString=function(n){this.hTLV=null,this.isModified=!0,this.s=n,this.hV=v1(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=ad;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=EC(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=ad(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=ds(t);else throw new Error("malformed string for UTCTime: "+t);else if(t.str!=null)this.hV=ds(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=ds(this.formatDate(r,"utc",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=ds(this.formatDate(t.date,"utc",n))}else t instanceof Date&&(this.hV=ds(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=ds(t);else throw new Error("malformed string for GeneralizedTime: "+t);else if(t.str!=null)this.hV=ds(t.str);else if(t.date==null&&t.millis==!0){var r=new Date;this.hV=ds(this.formatDate(r,"gen",!0))}else if(t.date!=null&&t.date instanceof Date){var n=t.millis===!0;this.hV=ds(this.formatDate(t.date,"gen",n))}else t instanceof Date&&(this.hV=ds(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=v1(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):AC(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 A1(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 ps(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 '"+zt(o(u,r))+`'
`;if(F=="13")return n+"PrintableString '"+zt(o(u,r))+`'
`;if(F=="14")return n+"TeletexString '"+zt(o(u,r))+`'
`;if(F=="16")return n+"IA5String '"+zt(o(u,r))+`'
`;if(F=="17")return n+"UTCTime "+zt(o(u,r))+`
`;if(F=="18")return n+"GeneralizedTime "+zt(o(u,r))+`
`;if(F=="1a")return n+"VisualString '"+zt(o(u,r))+`'
`;if(F=="1e")return n+"BMPString '"+my(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=zt(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=zt,m=my,p=Qq,d={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},v=function(I){for(var q=[],L=s(I,0),R=0;R<L.length;R++){var O=L[R],T=o(I,O),N=r(T);q.push(N)}return q},g=e.substr(0,2),y={},w=i(e,0);if(g=="01")return e=="0101ff"?{bool:!0}:{bool:!1};if(g=="02")return{int:{hex:w}};if(g=="03")try{if(w.substr(0,2)!="00")throw"not encap";var E=w.substr(2);if(!n(E))throw"not encap";return{bitstr:{obj:r(E)}}}catch{var _=null;return w.length<=10&&(_=_C(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 d1(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=py(K)}catch(q){throw new p("malformed IP address: "+d.ip+":"+q.message)}g=new l({hex:H})}else throw new p("improper params");var I=new h({tag:v,explicit:y,obj:g});return I.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.GeneralName,A.asn1.ASN1Object);A.asn1.x509.GeneralNames=function(e){A.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=null,r=A,n=r.asn1;this.setByParamArray=function(i){for(var o=0;o<i.length;o++){var s=new n.x509.GeneralName(i[o]);this.asn1Array.push(s)}},this.tohex=function(){var i=new n.DERSequence({array:this.asn1Array});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,typeof e<"u"&&this.setByParamArray(e)};Ee(A.asn1.x509.GeneralNames,A.asn1.ASN1Object);A.asn1.x509.OtherName=function(e){A.asn1.x509.OtherName.superclass.constructor.call(this);var t=null,r=null,n=A,i=n.asn1,o=i.DERObjectIdentifier,s=i.DERSequence,a=i.ASN1Util.newObject;this.params=null,this.setByParam=function(u){this.params=u},this.tohex=function(){var u=this.params;if(u.oid==null||u.value==null)throw new Error("oid or value not specified");var l=new o({oid:u.oid}),h=a({tag:{tag:"a0",explicit:!0,obj:u.value}}),m=new s({array:[l,h]});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!==void 0&&this.setByParam(e)};Ee(A.asn1.x509.OtherName,A.asn1.ASN1Object);A.asn1.x509.OID=new function(){var e=A.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(t){if(typeof this.objCache[t]<"u")return this.objCache[t];if(typeof this.name2oidList[t]>"u")throw"Name of ObjectIdentifier not defined: "+t;var r=this.name2oidList[t],n=new e({oid:r});return this.objCache[t]=n,n},this.atype2obj=function(t){if(this.objCache[t]!==void 0)return this.objCache[t];var r;if(t.match(/^\d+\.\d+\.[0-9.]+$/))r=t;else if(this.atype2oidList[t]!==void 0)r=this.atype2oidList[t];else if(this.name2oidList[t]!==void 0)r=this.name2oidList[t];else throw new Error("AttributeType name undefined: "+t);var n=new e({oid:r});return this.objCache[t]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var r in t)this.name2oidList[r]=t[r]},this.checkOIDs=function(t){try{var r=Object.keys(t);return r.length==0?!1:(r.map(function(n,i,o){var s=this[n];if(!s.match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch{return!1}}};A.asn1.x509.OID.oid2name=function(e){var t=A.asn1.x509.OID.name2oidList;for(var r in t)if(t[r]==e)return r;return""};A.asn1.x509.OID.oid2atype=function(e){var t=A.asn1.x509.OID.atype2oidList;for(var r in t)if(t[r]==e)return r;return e};A.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=A.asn1.x509.OID.name2oidList;return t[e]===void 0?"":t[e]};A.asn1.x509.X509Util={};A.asn1.x509.X509Util.newCertPEM=function(e){var t=A.asn1.x509,r=t.TBSCertificate,n=t.Certificate,i=new n(e);return i.getPEM()};(typeof A>"u"||!A)&&(A={});(typeof A.asn1>"u"||!A.asn1)&&(A.asn1={});(typeof A.asn1.cms>"u"||!A.asn1.cms)&&(A.asn1.cms={});A.asn1.cms.Attribute=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.DERSet,s=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(a){this.params=a},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.tohex=function(){var a=new s({oid:this.typeOid}),u=new o({array:this.getValueArray()}),l=new i({array:[a,u]});return l.tohex()},this.getEncodedHex=function(){return this.tohex()}};Ee(A.asn1.cms.Attribute,A.asn1.ASN1Object);A.asn1.cms.ContentType=function(e){var t=A,r=t.asn1;r.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){var n=new r.DERObjectIdentifier(this.params.type);return[n]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ContentType,A.asn1.cms.Attribute);A.asn1.cms.MessageDigest=function(e){var t=A,r=t.asn1,n=r.DEROctetString,i=r.cms;i.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){var o=new n(this.params);return[o]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.MessageDigest,A.asn1.cms.Attribute);A.asn1.cms.SigningTime=function(e){var t=A,r=t.asn1;r.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){var n=new r.x509.Time(this.params);return[n]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SigningTime,A.asn1.cms.Attribute);A.asn1.cms.SigningCertificate=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.cms,s=o.ESSCertID,a=r.crypto;o.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new t("parameter 'array' not specified");for(var u=this.params.array,l=[],h=0;h<u.length;h++){var m=u[h];e.hasis==!1&&typeof m=="string"&&(m.indexOf("-----BEGIN")!=-1||xe.isASN1HEX(m))&&(m={cert:m}),m.hasis!=!1&&e.hasis==!1&&(m.hasis=!1),l.push(new s(m))}var p=new i({array:l}),d=new i({array:[p]});return[d]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SigningCertificate,A.asn1.cms.Attribute);A.asn1.cms.ESSCertID=function(e){A.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,i=n.DEROctetString,o=n.DERSequence,s=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(a,u){if(a.hash!=null)return a.hash;if(typeof a=="string"&&a.indexOf("-----BEGIN")==-1&&!xe.isASN1HEX(a))return a;var l;if(typeof a=="string")l=a;else if(a.cert!=null)l=a.cert;else throw new t("hash nor cert unspecified");var h;l.indexOf("-----BEGIN")!=-1?h=lr(l):h=l,typeof a=="string"&&(a.indexOf("-----BEGIN")!=-1?h=lr(a):xe.isASN1HEX(a)&&(h=a));var m;if(a.alg!=null)m=a.alg;else if(u!=null)m=u;else throw new t("hash alg unspecified");return r.crypto.Util.hashHex(h,m)},this.tohex=function(){var a=this.params,u=this.getCertHash(a,"sha1"),l=[];l.push(new i({hex:u})),(typeof a=="string"&&a.indexOf("-----BEGIN")!=-1||a.cert!=null&&a.hasis!=!1||a.issuer!=null&&a.serial!=null)&&l.push(new s(a));var h=new o({array:l});return h.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ESSCertID,A.asn1.ASN1Object);A.asn1.cms.SigningCertificateV2=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSequence,o=n.x509,s=n.cms,a=s.ESSCertIDv2,u=r.crypto;s.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(this.params==null||this.params==null||this.params.array==null)throw new t("parameter 'array' not specified");for(var l=this.params.array,h=[],m=0;m<l.length;m++){var p=l[m];(e.alg!=null||e.hasis==!1)&&typeof p=="string"&&(p.indexOf("-----BEGIN")!=-1||xe.isASN1HEX(p))&&(p={cert:p}),p.alg==null&&e.alg!=null&&(p.alg=e.alg),p.hasis!=!1&&e.hasis==!1&&(p.hasis=!1),h.push(new a(p))}var d=new i({array:h}),v=new i({array:[d]});return[v]},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SigningCertificateV2,A.asn1.cms.Attribute);A.asn1.cms.ESSCertIDv2=function(e){A.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,i=n.DEROctetString,o=n.DERSequence,s=n.cms.IssuerSerial,a=n.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var u=this.params,l=this.getCertHash(u,"sha256"),h=[];u.alg!=null&&u.alg!="sha256"&&h.push(new a({name:u.alg})),h.push(new i({hex:l})),(typeof u=="string"&&u.indexOf("-----BEGIN")!=-1||u.cert!=null&&u.hasis!=!1||u.issuer!=null&&u.serial!=null)&&h.push(new s(u));var m=new o({array:h});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ESSCertIDv2,A.asn1.cms.ESSCertID);A.asn1.cms.IssuerSerial=function(e){var t=Error,r=A,n=r.asn1,i=n.DERInteger,o=n.DERSequence,s=n.cms,a=n.x509,u=a.GeneralNames,l=tt;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(h){this.params=h},this.tohex=function(){var h=this.params,m,p;if(typeof h=="string"&&h.indexOf("-----BEGIN")!=-1||h.cert!=null){var d;h.cert!=null?d=h.cert:d=h;var v=new l;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(h.issuer!=null&&h.serial)m=h.issuer,p=h.serial;else throw new t("cert or issuer and serial parameter not specified");var g=new u([{dn:m}]),y=new i(p),w=new o({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.IssuerSerial,A.asn1.ASN1Object);A.asn1.cms.SignerIdentifier=function(e){var t=A,r=t.asn1,n=r.DERInteger,i=r.DERSequence,o=r.cms,s=o.IssuerAndSerialNumber,a=o.SubjectKeyIdentifier,u=r.x509,l=u.X500Name,h=tt,m=Error;o.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var p=this.params;if(p.type=="isssn"){var d=new s(p);return d.tohex()}else if(p.type=="skid"){var v=new a(p);return v.tohex()}else throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SignerIdentifier,A.asn1.ASN1Object);A.asn1.cms.IssuerAndSerialNumber=function(e){var t=A,r=t.asn1,n=r.DERInteger,i=r.DERSequence,o=r.cms,s=r.x509,a=s.X500Name,u=tt,l=Error;o.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var h=this.params,m,p;if(typeof h=="string"&&h.indexOf("-----BEGIN")!=-1||h.cert!=null){var d;h.cert!=null?d=h.cert:d=h;var v=new u;v.readCertPEM(d),m=v.getIssuer(),p={hex:v.getSerialNumberHex()}}else if(h.issuer!=null&&h.serial)m=h.issuer,p=h.serial;else throw new l("cert or issuer and serial parameter not specified");var g=new a(m),y=new n(p),w=new i({array:[g,y]});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(h){this.params=h},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.IssuerAndSerialNumber,A.asn1.ASN1Object);A.asn1.cms.SubjectKeyIdentifier=function(e){var t=A,r=t.asn1,n=r.DERInteger,i=r.DERSequence,o=r.ASN1Util.newObject,s=r.cms,a=s.IssuerAndSerialName,u=s.SubjectKeyIdentifier,l=r.x509,h=l.X500Name,m=tt,p=Error;s.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var d=this.params;if(d.cert==null&&d.skid==null)throw new p("property cert nor skid undefined");var v;if(d.cert!=null){var g=new m(d.cert),y=g.getExtSubjectKeyIdentifier();v=y.kid.hex}else d.skid!=null&&(v=d.skid);var w=o({tag:{tage:"a0",obj:{octstr:{hex:v}}}});return w.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SubjectKeyIdentifier,A.asn1.ASN1Object);A.asn1.cms.AttributeList=function(e){var t=Error,r=A,n=r.asn1,i=n.DERSet,o=n.cms;o.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(s){this.params=s},this.tohex=function(){var s=this.params;if(this.hTLV!=null)return this.hTLV;var a=!0;s.sortflag!=null&&(a=s.sortflag);for(var u=s.array,l=[],h=0;h<u.length;h++){var m=u[h],p=m.attr;if(p=="contentType")l.push(new o.ContentType(m));else if(p=="messageDigest")l.push(new o.MessageDigest(m));else if(p=="signingTime")l.push(new o.SigningTime(m));else if(p=="signingCertificate")l.push(new o.SigningCertificate(m));else if(p=="signingCertificateV2")l.push(new o.SigningCertificateV2(m));else if(p=="signaturePolicyIdentifier")l.push(new A.asn1.cades.SignaturePolicyIdentifier(m));else if(p=="signatureTimeStamp"||p=="timeStampToken")l.push(new A.asn1.cades.SignatureTimeStamp(m));else throw new t("unknown attr: "+p)}var d=new i({array:l,sortflag:a});return this.hTLV=d.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.AttributeList,A.asn1.ASN1Object);A.asn1.cms.SignerInfo=function(e){var t=Error,r=A,n=r.asn1,i=n.DERInteger,o=n.DEROctetString,s=n.DERSequence,a=n.DERTaggedObject,u=n.cms,l=u.SignerIdentifier,h=u.AttributeList,m=u.ContentType,p=u.EncapsulatedContentInfo,d=u.MessageDigest,v=u.SignedData,g=n.x509,y=g.AlgorithmIdentifier,w=r.crypto,E=_t;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var _=this.params,C=_.sigalg,F=new h(_.sattrs).tohex(),H=E.getKey(_.signkey),K=new w.Signature({alg:C});K.init(H),K.updateHex(F);var S=K.sign();_.sighex=S},this.tohex=function(){var _=this.params,C=[];if(C.push(new i({int:_.version})),C.push(new l(_.id)),C.push(new y({name:_.hashalg})),_.sattrs!=null){var F=new h(_.sattrs);try{C.push(new a({tag:"a0",explicit:!1,obj:F}))}catch(K){throw new t("si sattr error: "+K)}}if(_.sigalgfield!=null?C.push(new y({name:_.sigalgfield})):C.push(new y({name:_.sigalg})),_.sighex==null&&_.signkey!=null&&this.sign(),C.push(new o({hex:_.sighex})),_.uattrs!=null){var F=new h(_.uattrs);try{C.push(new a({tag:"a1",explicit:!1,obj:F}))}catch(S){throw new t("si uattr error: "+S)}}var H=new s({array:C});return H.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SignerInfo,A.asn1.ASN1Object);A.asn1.cms.EncapsulatedContentInfo=function(e){var t=A,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,o=r.DERObjectIdentifier,s=r.DEROctetString,a=r.cms;a.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];if(l.push(new o(u.type)),u.content!=null&&(u.content.hex!=null||u.content.str!=null)&&u.isDetached!=!0){var h=new s(u.content),m=new n({tag:"a0",explicit:!0,obj:h});l.push(m)}var p=new i({array:l});return p.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.EncapsulatedContentInfo,A.asn1.ASN1Object);A.asn1.cms.ContentInfo=function(e){var t=A,r=t.asn1,n=r.DERTaggedObject,i=r.DERSequence,o=r.DERObjectIdentifier,s=r.x509,a=s.OID.name2obj;A.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var u=this.params,l=[];l.push(new o(u.type));var h=new n({tag:"a0",explicit:!0,obj:u.obj});l.push(h);var m=new i({array:l});return m.tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(u){this.params=u},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.ContentInfo,A.asn1.ASN1Object);A.asn1.cms.SignedData=function(e){var t=Error,r=A,n=r.asn1,i=n.ASN1Object,o=n.DERInteger,s=n.DERSet,a=n.DERSequence,u=n.DERTaggedObject,l=n.cms,h=l.EncapsulatedContentInfo,m=l.SignerInfo,p=l.ContentInfo,d=l.CertificateSet,v=l.RevocationInfoChoices,g=n.x509,y=g.AlgorithmIdentifier;A.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var w=this.params;this._setDigestAlgs(w),this._setContentTypeByEContent(w),this._setMessageDigestByEContent(w),this._setSignerInfoVersion(w),this._setSignedDataVersion(w)},this._setDigestAlgs=function(w){for(var E={},_=w.sinfos,C=0;C<_.length;C++){var F=_[C];E[F.hashalg]=1}w.hashalgs=Object.keys(E).sort()},this._setContentTypeByEContent=function(w){for(var E=w.econtent.type,_=w.sinfos,C=0;C<_.length;C++){var F=_[C],H=this._getAttrParamByName(F,"contentType");H.type=E}},this._setMessageDigestByEContent=function(w){var E=w.econtent,_=w.econtent.type,C=E.content.hex;C==null&&E.type=="data"&&E.content.str!=null&&(C=ao(E.content.str));for(var F=w.sinfos,H=0;H<F.length;H++){var K=F[H],S=K.hashalg,I=this._getAttrParamByName(K,"messageDigest"),q=A.crypto.Util.hashHex(C,S);I.hex=q}},this._getAttrParamByName=function(w,E){for(var _=w.sattrs.array,C=0;C<_.length;C++)if(_[C].attr==E)return _[C]},this._setSignerInfoVersion=function(w){for(var E=w.sinfos,_=0;_<E.length;_++){var C=E[_],F=1;C.id.type=="skid"&&(F=3),C.version=F}},this._setSignedDataVersion=function(w){var E=this._getSignedDataVersion(w);w.version=E},this._getSignedDataVersion=function(w){if(w.revinfos!=null)for(var E=w.revinfos,_=0;_<E.length;_++){var C=E[_];if(C.ocsp!=null)return 5}for(var F=w.sinfos,_=0;_<F.length;_++){var H=w.sinfos[_];if(H.version==3)return 3}return w.econtent.type!="data"?3:1},this.tohex=function(){var w=this.params;this.getEncodedHexPrepare!=null&&this.getEncodedHexPrepare(),w.fixed!=!0&&this.checkAndFixParam();var E=[];E.push(new o({int:w.version}));for(var _=[],C=0;C<w.hashalgs.length;C++){var F=w.hashalgs[C];_.push(new y({name:F}))}E.push(new s({array:_})),E.push(new h(w.econtent)),w.certs!=null&&E.push(new d(w.certs)),w.revinfos!=null&&E.push(new v(w.revinfos));for(var H=[],C=0;C<w.sinfos.length;C++){var K=w.sinfos[C];H.push(new m(K))}E.push(new s({array:H}));var S=new a({array:E});return S.tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){var w=new p({type:"signed-data",obj:this});return w},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.SignedData,A.asn1.ASN1Object);A.asn1.cms.CertificateSet=function(e){A.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,r=A.asn1,n=r.DERTaggedObject,i=r.DERSet,o=r.ASN1Object;this.params=null,this.tohex=function(){var s=this.params,a=[],u;if(s instanceof Array)u=s;else if(s.array!=null)u=s.array;else throw new t("cert array not specified");for(var l=0;l<u.length;l++){var h=u[l],m=lr(h),p=new o;p.hTLV=m,a.push(p)}var d={array:a};s.sortflag==!1&&(d.sortflag=!1);var v=new i(d),g=new n({tag:"a0",explicit:!1,obj:v});return g.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.CertificateSet,A.asn1.ASN1Object);A.asn1.cms.RevocationInfoChoices=function(e){A.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var r=[],n=0;n<t.length;n++)r.push(new A.asn1.cms.RevocationInfoChoice(t[n]));var i=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:r}}});return i.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.RevocationInfoChoices,A.asn1.ASN1Object);A.asn1.cms.RevocationInfoChoice=function(e){A.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(t.crl!=null&&typeof t.crl=="string"){var r=t.crl;return t.crl.indexOf("-----BEGIN")!=-1&&(r=lr(t.crl)),r}else if(t.ocsp!=null){var n=A.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new A.asn1.cms.OtherRevocationFormat(t)}});return n.tohex()}else throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.RevocationInfoChoice,A.asn1.ASN1Object);A.asn1.cms.OtherRevocationFormat=function(e){A.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,r=A,n=r.asn1,i=n.ASN1Util.newObject,o=r.lang.String.isHex;this.params=null,this.tohex=function(){var s=this.params;if(s.ocsp==null)throw new t("property ocsp not specified");if(!o(s.ocsp)||!xe.isASN1HEX(s.ocsp))throw new t("ocsp value not ASN.1 hex string");var a=i({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:s.ocsp}}]});return a.tohex()},this.getEncodedHex=function(){return this.tohex()},e!=null&&this.setByParam(e)};Ee(A.asn1.cms.OtherRevocationFormat,A.asn1.ASN1Object);A.asn1.cms.CMSUtil=new function(){};A.asn1.cms.CMSUtil.newSignedData=function(e){return new A.asn1.cms.SignedData(e)};A.asn1.cms.CMSUtil.verifySignedData=function(e){var t=A,r=t.asn1,n=r.cms,i=n.SignerInfo,o=n.SignedData,s=n.SigningTime,a=n.SigningCertificate,u=n.SigningCertificateV2,l=r.cades,h=l.SignaturePolicyIdentifier,m=t.lang.String.isHex,p=xe,d=p.getVbyList,v=p.getTLVbyList,g=p.getIdxbyList,y=p.getChildIdx,w=p.getTLV,E=p.oidname,_=t.crypto.Util.hashHex;e.cms===void 0&&m(e.cms);var C=e.cms,F=function(N,P){for(var M,Y=3;Y<6;Y++)if(M=g(N,0,[1,0,Y]),M!==void 0){var V=N.substr(M,2);V==="a0"&&(P.certsIdx=M),V==="a1"&&(P.revinfosIdx=M),V==="31"&&(P.signerinfosIdx=M)}},H=function(N,P){var M=P.signerinfosIdx;if(M!==void 0){var Y=y(N,M);P.signerInfoIdxList=Y;for(var V=0;V<Y.length;V++){var X=Y[V],te={idx:X};K(N,te),P.signerInfos.push(te)}}},K=function(N,P){var M=P.idx;P.signerid_issuer1=v(N,M,[1,0],"30"),P.signerid_serial1=d(N,M,[1,1],"02"),P.hashalg=E(d(N,M,[2,0],"06"));var Y=g(N,M,[3],"a0");P.idxSignedAttrs=Y,S(N,P,Y);var V=y(N,M),X=V.length;if(X<6)throw"malformed SignerInfo";P.sigalg=E(d(N,M,[X-2,0],"06")),P.sigval=d(N,M,[X-1],"04")},S=function(N,P,M){var Y=y(N,M);P.signedAttrIdxList=Y;for(var V=0;V<Y.length;V++){var X=Y[V],te=d(N,X,[0],"06"),ae;te==="2a864886f70d010905"?(ae=zt(d(N,X,[1,0])),P.saSigningTime=ae):te==="2a864886f70d010904"&&(ae=d(N,X,[1,0],"04"),P.saMessageDigest=ae)}},I=function(N,P){if(d(N,0,[0],"06")!=="2a864886f70d010702")return P;P.cmsType="signedData",P.econtent=d(N,0,[1,0,2,1,0]),F(N,P),P.signerInfos=[],H(N,P)},q=function(N,P){for(var M=P.parse.signerInfos,Y=M.length,V=!0,X=0;X<Y;X++){var te=M[X];R(N,P,te,X),te.isValid||(V=!1)}P.isValid=V},L=function(N,P,M,Y){var V=P.parse.certsIdx,X;if(P.certs===void 0){X=[],P.certkeys=[];for(var te=y(N,V),ae=0;ae<te.length;ae++){var me=w(N,te[ae]),he=new tt;he.readCertHex(me),X[ae]=he,P.certkeys[ae]=he.getPublicKey()}P.certs=X}else X=P.certs;P.cccc=X.length,P.cccci=te.length;for(var ae=0;ae<X.length;ae++){var De=he.getIssuerHex(),Pe=he.getSerialNumberHex();M.signerid_issuer1===De&&M.signerid_serial1===Pe&&(M.certkey_idx=ae)}},R=function(N,P,M,Y){M.verifyDetail={};var V=M.verifyDetail,X=P.parse.econtent,te=M.hashalg,ae=M.saMessageDigest;V.validMessageDigest=!1,_(X,te)===ae&&(V.validMessageDigest=!0),L(N,P,M,Y),V.validSignatureValue=!1;var me=M.sigalg,he="31"+w(N,M.idxSignedAttrs).substr(2);M.signedattrshex=he;var De=P.certs[M.certkey_idx].getPublicKey(),Pe=new A.crypto.Signature({alg:me});Pe.init(De),Pe.updateHex(he);var Ie=Pe.verify(M.sigval);V.validSignatureValue_isValid=Ie,Ie===!0&&(V.validSignatureValue=!0),M.isValid=!1,V.validMessageDigest&&V.validSignatureValue&&(M.isValid=!0)},O=function(){},T={isValid:!1,parse:{}};return I(C,T.parse),q(C,T),T};A.asn1.cms.CMSParser=function(){var e=Error,t=tt,r=new t,n=xe,i=n.getV,o=n.getTLV,s=n.getIdxbyList,a=n.getTLVbyList,u=n.getTLVbyListEx,l=n.getVbyList,h=n.getVbyListEx,m=n.getChildIdx;this.getCMSSignedData=function(p){var d=a(p,0,[1,0]),v=this.getSignedData(d);return v},this.getSignedData=function(p){var d=m(p,0),v={},g=i(p,d[0]),y=parseInt(g,16);v.version=y;var w=o(p,d[1]);v.hashalgs=this.getHashAlgArray(w);var E=o(p,d[2]);v.econtent=this.getEContent(E);var _=u(p,0,["[0]"]);_!=null&&(v.certs=this.getCertificateSet(_));var C=u(p,0,["[1]"]);C!=null;var F=u(p,0,[3]);return v.sinfos=this.getSignerInfos(F),v},this.getHashAlgArray=function(p){for(var d=m(p,0),v=new t,g=[],y=0;y<d.length;y++){var w=o(p,d[y]),E=v.getAlgorithmIdentifierName(w);g.push(E)}return g},this.getEContent=function(p){var d={},v=l(p,0,[0]),g=l(p,0,[1,0]);return d.type=A.asn1.x509.OID.oid2name(xe.hextooidstr(v)),d.content={hex:g},d},this.getSignerInfos=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var y=o(p,v[g]),w=this.getSignerInfo(y);d.push(w)}return d},this.getSignerInfo=function(p){var d={},v=m(p,0),g=n.getInt(p,v[0],-1);g!=-1&&(d.version=g);var y=o(p,v[1]),w=this.getIssuerAndSerialNumber(y);d.id=w;var E=o(p,v[2]),_=r.getAlgorithmIdentifierName(E);d.hashalg=_;var C=u(p,0,["[0]"]);if(C!=null){var F=this.getAttributeList(C);d.sattrs=F}var H=u(p,0,[3]),K=r.getAlgorithmIdentifierName(H);d.sigalg=K;var S=h(p,0,[4]);d.sighex=S;var I=u(p,0,["[1]"]);if(I!=null){var q=this.getAttributeList(I);d.uattrs=q}return d},this.getSignerIdentifier=function(p){if(p.substr(0,2)=="30")return this.getIssuerAndSerialNumber(p);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(p){var d={type:"isssn"},v=m(p,0),g=o(p,v[0]);d.issuer=r.getX500Name(g);var y=i(p,v[1]);return d.serial={hex:y},d},this.getAttributeList=function(p){for(var d=[],v=m(p,0),g=0;g<v.length;g++){var y=o(p,v[g]),w=this.getAttribute(y);d.push(w)}return{array:d}},this.getAttribute=function(p){var d={},v=m(p,0),g=n.getOID(p,v[0]),y=A.asn1.x509.OID.oid2name(g);d.attr=y;var w=o(p,v[1]),E=m(w,0);if(E.length==1)d.valhex=o(w,E[0]);else{for(var _=[],C=0;C<E.length;C++)_.push(o(w,E[C]));d.valhex=_}return y=="contentType"?this.setContentType(d):y=="messageDigest"?this.setMessageDigest(d):y=="signingTime"?this.setSigningTime(d):y=="signingCertificate"?this.setSigningCertificate(d):y=="signingCertificateV2"?this.setSigningCertificateV2(d):y=="signaturePolicyIdentifier"&&this.setSignaturePolicyIdentifier(d),d},this.setContentType=function(p){var d=n.getOIDName(p.valhex,0,null);d!=null&&(p.type=d,delete p.valhex)},this.setSigningTime=function(p){var d=i(p.valhex,0),v=zt(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 d1([u],a);if(typeof u=="object"&&u.length!=null)return d1(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=A1(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:zt(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=zt(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=zt(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=zt(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(A1(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=zt(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=zt(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=zt(_)}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=zt(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 hC(e){for(var t=new Array,r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function dC(e){for(var t="",r=0;r<e.length;r++)t=t+String.fromCharCode(e[r]);return t}function g1(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 ds(e){return g1(hC(e))}function Wq(e){return fa(ds(e))}function Yq(e){return ef(fa(ds(e)))}function Xq(e){return dC(oC(od(e)))}function ef(e){return e=e.replace(/\=/g,""),e=e.replace(/\+/g,"-"),e=e.replace(/\//g,"_"),e}function od(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),ef(fa(e))}function rr(e){return tf(od(e))}var nd,Di;typeof Buffer=="function"?(nd=function(e){return ef(Buffer.from(e,"utf8").toString("base64"))},Di=function(e){return Buffer.from(od(e),"base64").toString("utf8")}):(nd=function(e){return Or(y1(b1(e)))},Di=function(e){return decodeURIComponent(E1(rr(e)))});function Zq(e){return fa(y1(b1(e)))}function Jq(e){return decodeURIComponent(E1(tf(e)))}function v1(e){return y1(b1(e)).toLowerCase()}function zt(e){try{return decodeURIComponent(E1(e))}catch{return null}}function Qq(e){return zt(ej(e))}function ej(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 ps(e){for(var t="",r=0;r<e.length-1;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t}function ao(e){for(var t="",r=0;r<e.length;r++)t+=("0"+e.charCodeAt(r).toString(16)).slice(-2);return t}function hy(e){return fa(e)}function tj(e){return w1(hy(e),64)}function w1(e,t){return e=e.replace(new RegExp("(.{"+t+"})","g"),`$1\r
`),e=e.replace(/\s+$/,""),e}function pC(e){var t=e.replace(/[^0-9A-Za-z\/+=]*/g,""),r=tf(t);return r}function rj(e,t){return"-----BEGIN "+t+`-----\r
`+w1(e,64)+`\r
-----END `+t+`-----\r
`}function An(e,t){return"-----BEGIN "+t+`-----\r
`+w1(hy(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 [^-]+-----[^]*$/,"")),pC(e)}function nj(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 sj(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 ij(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 dy(e){var t,r,n,i,o,s,a,u,l,h,m,p;if(e=gC(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 oj(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 mC(e){return Math.round(dy(e)/1e3)}function aj(e){return new Date(dy(e))}function uj(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 gC(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 y1(e){return e.replace(/%/g,"")}function E1(e){return e.replace(/(..)/g,"%$1")}function iy(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 oy(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 f1(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 f1(e.substr(0,8))+"/"+sC(e.substr(8))}catch{throw t}else{if(e.length==32)return oy(e);if(e.length==64){try{return oy(e.substr(0,32))+"/"+sC(e.substr(32))}catch{throw t}return}else return e}}function sC(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 py(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 py(s[0])+iC(parseInt(s[1]),32)}else{if(e.match(/^[0-9a-f:]+$/)&&e.indexOf(":")!==-1)return iy(e);if(e.match(/^[0-9a-f:]+\/[0-9]+$/)&&e.indexOf(":")!==-1){var s=e.split("/");return iy(s[0])+iC(parseInt(s[1]),128)}else throw t}}function iC(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 my(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 zt(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 zt(a.toString(16)+u.toString(16)+l.toString(16))}var r=e.match(/.{4}/g),n=r.map(t);return n.join("")}function b1(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+"%"+ds(t[n]);return r}function cj(e){return e=e.replace(/\r\n/mg,`
`),e}function lj(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 vC(e)};function vC(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=od(e),A.lang.String.isBase64(e))};function gy(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 ay(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function fj(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 hj=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 wC(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 yC(e,t)}function yC(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 EC(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 A1(e){if(!vC(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+h1((o[s]&127).toString(2),7):(u=u+h1((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 bC(e){var t=new ne(String(e),10);return ad(t)}function ad(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 h1=function(e,t,r){return r==null&&(r="0"),e.length>=t?e:new Array(t-e.length+1).join(r)+e};function AC(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 SC(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+h1("",r,"0");var n=parseInt(t,2).toString(16);n.length%2==1&&(n="0"+n);var i="0"+r;return i+n}function _C(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 dj(e){if(typeof e!="string"||e.match(/^[01]+$/)==null)return null;try{var t=parseInt(e,2);return SC(t)}catch{return null}}function d1(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 sf;A.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return A.crypto.Util.SECURERANDOMGEN.nextBytes(t),g1(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],g1(n)};A.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new ne(A.crypto.Util.getRandomHexOfNbits(e),16)};A.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var r=A.crypto.Util.getRandomBigIntegerOfNbits(t);if(e.compareTo(r)>=0)return r}};A.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var r=e.compareTo(t);if(r>0)throw"biMin is greater than biMax";if(r==0)return e;var n=t.subtract(e),i=A.crypto.Util.getRandomBigIntegerZeroToMax(n);return i.add(e)};A.crypto.MessageDigest=function(e){var t=null,r=null,n=null;this.setAlgAndProvider=function(i,o){if(i=A.crypto.MessageDigest.getCanonicalAlgName(i),i!==null&&o===void 0&&(o=A.crypto.Util.DEFAULTPROVIDER[i]),":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(i)!=-1&&o=="cryptojs"){try{this.md=A.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[i].create()}catch(s){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+s}this.updateString=function(s){this.md.update(s)},this.updateHex=function(s){var a=ke.enc.Hex.parse(s);this.md.update(a)},this.digest=function(){var s=this.md.finalize();return s.toString(ke.enc.Hex)},this.digestString=function(s){return this.updateString(s),this.digest()},this.digestHex=function(s){return this.updateHex(s),this.digest()}}if(":sha256:".indexOf(i)!=-1&&o=="sjcl"){try{this.md=new sjcl.hash.sha256}catch(s){throw"setAlgAndProvider hash alg set fail alg="+i+"/"+s}this.updateString=function(s){this.md.update(s)},this.updateHex=function(s){var a=sjcl.codec.hex.toBits(s);this.md.update(a)},this.digest=function(){var s=this.md.finalize();return sjcl.codec.hex.fromBits(s)},this.digestString=function(s){return this.updateString(s),this.digest()},this.digestHex=function(s){return this.updateHex(s),this.digest()}}},this.updateString=function(i){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(i){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(i){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(i){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},e!==void 0&&e.alg!==void 0&&(this.algName=e.alg,e.prov===void 0&&(this.provName=A.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))};A.crypto.MessageDigest.getCanonicalAlgName=function(e){return typeof e=="string"&&(e=e.toLowerCase(),e=e.replace(/-/,"")),e};A.crypto.MessageDigest.getHashLength=function(e){var t=A.crypto.MessageDigest,r=t.getCanonicalAlgName(e);if(t.HASHLENGTH[r]===void 0)throw"not supported algorithm: "+e;return t.HASHLENGTH[r]};A.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20};A.crypto.Mac=function(e){var t=null,r=null,n=null,i=null,o=null;this.setAlgAndProvider=function(s,a){if(s=s.toLowerCase(),s==null&&(s="hmacsha1"),s=s.toLowerCase(),s.substr(0,4)!="hmac")throw"setAlgAndProvider unsupported HMAC alg: "+s;a===void 0&&(a=A.crypto.Util.DEFAULTPROVIDER[s]),this.algProv=s+"/"+a;var u=s.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(u)!=-1&&a=="cryptojs"){try{var l=A.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[u];this.mac=ke.algo.HMAC.create(l,this.pass)}catch(h){throw"setAlgAndProvider hash alg set fail hashAlg="+u+"/"+h}this.updateString=function(h){this.mac.update(h)},this.updateHex=function(h){var m=ke.enc.Hex.parse(h);this.mac.update(m)},this.doFinal=function(){var h=this.mac.finalize();return h.toString(ke.enc.Hex)},this.doFinalString=function(h){return this.updateString(h),this.doFinal()},this.doFinalHex=function(h){return this.updateHex(h),this.doFinal()}}},this.updateString=function(s){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(s){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(s){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(s){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(s){if(typeof s=="string"){var a=s;(s.length%2==1||!s.match(/^[0-9A-Fa-f]+$/))&&(a=ao(s)),this.pass=ke.enc.Hex.parse(a);return}if(typeof s!="object")throw"KJUR.crypto.Mac unsupported password type: "+s;var a=null;if(s.hex!==void 0){if(s.hex.length%2!=0||!s.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+s.hex;a=s.hex}if(s.utf8!==void 0&&(a=v1(s.utf8)),s.rstr!==void 0&&(a=ao(s.rstr)),s.b64!==void 0&&(a=tf(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=Lt,u=A.crypto.ECDSA,l=A.crypto.ECParameterDB,h=u.getName,m=xe,p=m.getVbyListEx,d=m.isASN1HEX,v=new sf,g=null;this.type="EC",this.isPrivate=!1,this.isPublic=!1;function y(w,E,_,C){for(var F=Math.max(E.bitLength(),C.bitLength()),H=w.add2D(_),K=w.curve.getInfinity(),S=F-1;S>=0;--S)K=K.twice2D(),K.z=s.ONE,E.testBit(S)?C.testBit(S)?K=K.add2D(H):K=K.add2D(w):C.testBit(S)&&(K=K.add2D(_));return K}this.getBigRandom=function(w){return new s(w.bitLength(),v).mod(w.subtract(s.ONE)).add(s.ONE)},this.setNamedCurve=function(w){this.ecparams=l.getByName(w),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=w},this.setPrivateKeyHex=function(w){this.isPrivate=!0,this.prvKeyHex=w},this.setPublicKeyHex=function(w){this.isPublic=!0,this.pubKeyHex=w},this.getPublicKeyXYHex=function(){var w=this.pubKeyHex;if(w.substr(0,2)!=="04")throw"this method supports uncompressed format(04) only";var E=this.ecparams.keycharlen;if(w.length!==2+E*2)throw"malformed public key hex length";var _={};return _.x=w.substr(2,E),_.y=w.substr(2+E),_},this.getShortNISTPCurveName=function(){var w=this.curveName;return w==="secp256r1"||w==="NIST P-256"||w==="P-256"||w==="prime256v1"?"P-256":w==="secp384r1"||w==="NIST P-384"||w==="P-384"?"P-384":w==="secp521r1"||w==="NIST P-521"||w==="P-521"?"P-521":null},this.generateKeyPairHex=function(){var w=this.ecparams.n,E=this.getBigRandom(w),_=this.ecparams.keycharlen,C=("0000000000"+E.toString(16)).slice(-_);this.setPrivateKeyHex(C);var F=this.generatePublicKeyHex();return{ecprvhex:C,ecpubhex:F}},this.generatePublicKeyHex=function(){var w=new s(this.prvKeyHex,16),E=this.ecparams.G.multiply(w),_=E.getX().toBigInteger(),C=E.getY().toBigInteger(),F=this.ecparams.keycharlen,H=("0000000000"+_.toString(16)).slice(-F),K=("0000000000"+C.toString(16)).slice(-F),S="04"+H+K;return this.setPublicKeyHex(S),S},this.signWithMessageHash=function(w){return this.signHex(w,this.prvKeyHex)},this.signHex=function(w,E){var _=new s(E,16),C=this.ecparams.n,F=new s(w.substring(0,this.ecparams.keycharlen),16);do var H=this.getBigRandom(C),K=this.ecparams.G,S=K.multiply(H),I=S.getX().toBigInteger().mod(C);while(I.compareTo(s.ZERO)<=0);var q=H.modInverse(C).multiply(F.add(_.multiply(I))).mod(C);return u.biRSSigToASN1Sig(I,q)},this.sign=function(w,E){var _=E,C=this.ecparams.n,F=s.fromByteArrayUnsigned(w);do var H=this.getBigRandom(C),K=this.ecparams.G,S=K.multiply(H),I=S.getX().toBigInteger().mod(C);while(I.compareTo(ne.ZERO)<=0);var q=H.modInverse(C).multiply(F.add(_.multiply(I))).mod(C);return this.serializeSig(I,q)},this.verifyWithMessageHash=function(w,E){return this.verifyHex(w,E,this.pubKeyHex)},this.verifyHex=function(w,E,_){try{var C,F,H=u.parseSigHex(E);C=H.r,F=H.s;var K=a.decodeFromHex(this.ecparams.curve,_),S=new s(w.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(S,C,F,K)}catch{return!1}},this.verify=function(w,E,_){var C,F;if(Bitcoin.Util.isArray(E)){var H=this.parseSig(E);C=H.r,F=H.s}else if(typeof E=="object"&&E.r&&E.s)C=E.r,F=E.s;else throw"Invalid value for signature";var K;if(_ instanceof Lt)K=_;else if(Bitcoin.Util.isArray(_))K=a.decodeFrom(this.ecparams.curve,_);else throw"Invalid format for pubkey value, must be byte array or ECPointFp";var S=s.fromByteArrayUnsigned(w);return this.verifyRaw(S,C,F,K)},this.verifyRaw=function(w,E,_,C){var F=this.ecparams.n,H=this.ecparams.G;if(E.compareTo(s.ONE)<0||E.compareTo(F)>=0||_.compareTo(s.ONE)<0||_.compareTo(F)>=0)return!1;var K=_.modInverse(F),S=w.multiply(K).mod(F),I=E.multiply(K).mod(F),q=H.multiply(S).add(C.multiply(I)),L=q.getX().toBigInteger().mod(F);return L.equals(E)},this.serializeSig=function(w,E){var _=w.toByteArraySigned(),C=E.toByteArraySigned(),F=[];return F.push(2),F.push(_.length),F=F.concat(_),F.push(2),F.push(C.length),F=F.concat(C),F.unshift(F.length),F.unshift(48),F},this.parseSig=function(w){var E;if(w[0]!=48)throw new Error("Signature not a valid DERSequence");if(E=2,w[E]!=2)throw new Error("First element in signature must be a DERInteger");var _=w.slice(E+2,E+2+w[E+1]);if(E+=2+w[E+1],w[E]!=2)throw new Error("Second element in signature must be a DERInteger");var C=w.slice(E+2,E+2+w[E+1]);E+=2+w[E+1];var F=s.fromByteArrayUnsigned(_),H=s.fromByteArrayUnsigned(C);return{r:F,s:H}},this.parseSigCompact=function(w){if(w.length!==65)throw"Signature has the wrong length";var E=w[0]-27;if(E<0||E>7)throw"Invalid signature type";var _=this.ecparams.n,C=s.fromByteArrayUnsigned(w.slice(1,33)).mod(_),F=s.fromByteArrayUnsigned(w.slice(33,65)).mod(_);return{r:C,s:F,i:E}},this.readPKCS5PrvKeyHex=function(w){if(d(w)===!1)throw new Error("not ASN.1 hex string");var E,_,C;try{E=p(w,0,["[0]",0],"06"),_=p(w,0,[1],"04");try{C=p(w,0,["[1]",0],"03")}catch{}}catch{throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=h(E),this.curveName===void 0)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(C),this.setPrivateKeyHex(_),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,_,C,F;try{E=p(w,0,[1,0],"06"),_=p(w,0,[1,1],"06"),C=p(w,0,[2,0,1],"04");try{F=p(w,0,[2,0,"[1]",0],"03")}catch{}}catch{throw new o("malformed PKCS#8 plain ECC private key")}if(this.curveName=h(_),this.curveName===void 0)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(F),this.setPrivateKeyHex(C),this.isPublic=!1},this.readPKCS8PubKeyHex=function(w){if(d(w)===!1)throw new o("not ASN.1 hex string");var E,_,C;try{E=p(w,0,[0,0],"06"),_=p(w,0,[0,1],"06"),C=p(w,0,[1],"03")}catch{throw new o("malformed PKCS#8 ECC public key")}if(this.curveName=h(_),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},this.readCertPubKeyHex=function(w,E){if(d(w)===!1)throw new o("not ASN.1 hex string");var _,C;try{_=p(w,0,[0,5,0,1],"06"),C=p(w,0,[0,5,1],"03")}catch{throw new o("malformed X.509 certificate ECC public key")}if(this.curveName=h(_),this.curveName===null)throw new o("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(C)},e!==void 0&&e.curve!==void 0&&(this.curveName=e.curve),this.curveName===void 0&&(this.curveName=t),this.setNamedCurve(this.curveName),e!==void 0&&(e.prv!==void 0&&this.setPrivateKeyHex(e.prv),e.pub!==void 0&&this.setPublicKeyHex(e.pub))};A.crypto.ECDSA.parseSigHex=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=new ne(t.r,16),n=new ne(t.s,16);return{r,s:n}};A.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=xe,r=t.getChildIdx,n=t.getV;if(t.checkStrictDER(e,0),e.substr(0,2)!="30")throw new Error("signature is not a ASN.1 sequence");var i=r(e,0);if(i.length!=2)throw new Error("signature shall have two elements");var o=i[0],s=i[1];if(e.substr(o,2)!="02")throw new Error("1st item not ASN.1 integer");if(e.substr(s,2)!="02")throw new Error("2nd item not ASN.1 integer");var a=n(e,o),u=n(e,s);return{r:a,s:u}};A.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=A.crypto.ECDSA.parseSigHexInHexRS(e),r=t.r,n=t.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");r.substr(0,2)=="00"&&(r=r.substr(2)),n.substr(0,2)=="00"&&(n=n.substr(2));var i=Math.max(r.length,n.length);return r=("000000"+r).slice(-i),n=("000000"+n).slice(-i),r+n}if(r.substr(0,2)=="00"&&r.length%32==2&&(r=r.substr(2)),n.substr(0,2)=="00"&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n};A.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var t=e.substr(0,e.length/2),r=e.substr(e.length/2);return A.crypto.ECDSA.hexRSSigToASN1Sig(t,r)};A.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new ne(e,16),n=new ne(t,16);return A.crypto.ECDSA.biRSSigToASN1Sig(r,n)};A.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=A.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t}),o=new r.DERSequence({array:[n,i]});return o.tohex()};A.crypto.ECDSA.getName=function(e){return e==="2b8104001f"?"secp192k1":e==="2a8648ce3d030107"?"secp256r1":e==="2b8104000a"?"secp256k1":e==="2b81040021"?"secp224r1":e==="2b81040022"?"secp384r1":e==="2b81040023"?"secp521r1":"|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)!==-1?"secp256r1":"|secp256k1|".indexOf(e)!==-1?"secp256k1":"|secp224r1|NIST P-224|P-224|".indexOf(e)!==-1?"secp224r1":"|secp384r1|NIST P-384|P-384|".indexOf(e)!==-1?"secp384r1":"|secp521r1|NIST P-521|P-521|".indexOf(e)!==-1?"secp521r1":null};(typeof A>"u"||!A)&&(A={});(typeof A.crypto>"u"||!A.crypto)&&(A.crypto={});A.crypto.ECParameterDB=new function(){var e={},t={};function r(n){return new ne(n,16)}this.getByName=function(n){var i=n;if(typeof t[i]<"u"&&(i=t[n]),typeof e[i]<"u")return e[i];throw"unregistered EC curve name: "+i},this.regist=function(n,i,o,s,a,u,l,h,m,p,d,v){e[n]={};var g=r(o),y=r(s),w=r(a),E=r(u),_=r(l),C=new 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 q="";if((typeof E>"u"||E==null)&&(E="AES-256-CBC"),typeof u[E]>"u")throw new Error("KEYUTIL unsupported algorithm: "+E);if(typeof _>"u"||_==null){var C=u[E].ivlen,F=h(C);_=F.toUpperCase()}var H=p(E,w,_),K=H.keyhex,S=v(y,E,K,_),I=S.replace(/(.{64})/g,`$1\r
`),q="-----BEGIN "+g+` PRIVATE KEY-----\r
`;return q+=`Proc-Type: 4,ENCRYPTED\r
`,q+="DEK-Info: "+E+","+_+`\r
`,q+=`\r
`,q+=I,q+=`\r
-----END `+g+` PRIVATE KEY-----\r
`,q},getEncryptedPKCS8PEM:function(g,y,w){var E=this.getEncryptedPKCS8Hex(g,y,w);return An(E,"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(g,y,w){var E;w==null||w==null?E={}:E=JSON.parse(JSON.stringify(w)),E.plain=g,this.initPBES2Param(E),this.encryptPBES2Param(E,y);var _=this.generatePBES2ASN1Param(E);return A.asn1.ASN1Util.newObject(_).tohex()},initPBES2Param:function(g){if(Jt(g,"encalg")==null&&(g.encalg="aes256-CBC"),Jt(g,"iter")==null&&(g.iter=2048),Jt(g,"prf")==null&&(g.prf="hmacWithSHA256"),Jt(g,"salt")==null&&(g.salt=ke.enc.Hex.stringify(ke.lib.WordArray.random(8))),Jt(g,"enciv")==null){var y;g.encalg=="des-EDE3-CBC"&&(y=8),g.encalg=="aes128-CBC"&&(y=16),g.encalg=="aes256-CBC"&&(y=16),g.enciv=ke.enc.Hex.stringify(ke.lib.WordArray.random(y))}},encryptPBES2Param:function(g,y){var w=_t.getDKFromPBES2Param(g,y);try{var E=A.crypto.Cipher.encrypt(g.plain,w,g.encalg,{iv:g.enciv})}catch{throw new Error("encrypt error: "+g.plain+" "+w+" "+g.encalg+" "+g.enciv)}g.enc=E},generatePBES2ASN1Param:function(g){var y={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:g.salt}},{int:{hex:bC(g.iter)}}]}]},{seq:[{oid:g.encalg},{octstr:{hex:g.enciv}}]}]}]},{octstr:{hex:g.enc}}]};return g.prf!="hmacWithSHA1"&&y.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:g.prf},{null:""}]}),y},parseHexOfEncryptedPKCS8:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={},C=w(g,0);if(C.length!=2)throw new Error("malformed format: SEQUENCE(0).items != 2: "+C.length);_.ciphertext=E(g,C[1]);var F=w(g,C[0]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+F.length);if(E(g,F[0])!="2a864886f70d01050d")throw new Error("this only supports pkcs5PBES2");var H=w(g,F[1]);if(F.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+H.length);var K=w(g,H[1]);if(K.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+K.length);if(E(g,K[0])!="2a864886f70d0307")throw"this only supports TripleDES";_.encryptionSchemeAlg="TripleDES",_.encryptionSchemeIV=E(g,K[1]);var S=w(g,H[0]);if(S.length!=2)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+S.length);if(E(g,S[0])!="2a864886f70d01050c")throw new Error("this only supports pkcs5PBKDF2");var I=w(g,S[1]);if(I.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+I.length);_.pbkdf2Salt=E(g,I[0]);var q=E(g,I[1]);try{_.pbkdf2Iter=parseInt(q,16)}catch{throw new Error("malformed format pbkdf2Iter: "+q)}return _},getPBKDF2KeyHexFromParam:function(g,y){var w=ke.enc.Hex.parse(g.pbkdf2Salt),E=g.pbkdf2Iter,_=ke.PBKDF2(y,w,{keySize:192/32,iterations:E}),C=ke.enc.Hex.stringify(_);return C},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(g,y){var w=lr(g,"ENCRYPTED PRIVATE KEY"),E=this.parseHexOfEncryptedPKCS8(w),_=_t.getPBKDF2KeyHexFromParam(E,y),C={};C.ciphertext=ke.enc.Hex.parse(E.ciphertext);var F=ke.enc.Hex.parse(_),H=ke.enc.Hex.parse(E.encryptionSchemeIV),K=ke.TripleDES.decrypt(C,F,{iv:H}),S=ke.enc.Hex.stringify(K);return S},parsePBES2:function(g){var y=xe.parse(g);if(Jt(y,"seq.0.seq.0.oid")!="pkcs5PBES2"||Jt(y,"seq.0.seq.1.seq.0.seq.0.oid")!="pkcs5PBKDF2")throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var w=Jt(y,"seq.0.seq.1.seq.0.seq.1.seq");if(w==null)throw new Error("PBKDF2 parameter not found");var E=Jt(w,"0.octstr.hex"),_=Jt(w,"1.int.hex"),C=Jt(w,"2.seq.0.oid","hmacWithSHA1"),F=-1;try{F=parseInt(_,16)}catch{throw new Error("iter not proper value")}var H=Jt(y,"seq.0.seq.1.seq.1.seq.0.oid"),K=Jt(y,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),S=Jt(y,"seq.1.octstr.hex");if(H==null||K==null||S==null)throw new Error("encalg, enciv or enc is undefined");var I={salt:E,iter:F,prf:C,encalg:H,enciv:K,enc:S};return I},getDKFromPBES2Param:function(g,y){var w={hmacWithSHA1:ke.algo.SHA1,hmacWithSHA224:ke.algo.SHA224,hmacWithSHA256:ke.algo.SHA256,hmacWithSHA384:ke.algo.SHA384,hmacWithSHA512:ke.algo.SHA512},E={"des-EDE3-CBC":192/32,"aes128-CBC":128/32,"aes256-CBC":256/32},_=w[g.prf];if(_==null)throw new Error("unsupported prf");var C=E[g.encalg];if(C==null)throw new Error("unsupported encalg");var F=ke.enc.Hex.parse(g.salt),H=g.iter;try{var K=ke.PBKDF2(y,F,{keySize:C,iterations:H,hasher:_});return ke.enc.Hex.stringify(K)}catch(S){throw new Error("PBKDF2 error: "+S+" "+JSON.stringify(g)+" "+y)}},getPlainHexFromEncryptedPKCS8PEM:function(g,y){if(g.indexOf("BEGIN ENCRYPTED PRIVATE KEY")==-1)throw new Error("not Encrypted PKCS#8 PEM string");var w=lr(g),E;try{E=_t.parsePBES2(w)}catch(C){throw new Error("malformed PBES2 format: "+C.message)}var _=_t.getDKFromPBES2Param(E,y);return A.crypto.Cipher.decrypt(E.enc,_,E.encalg,{iv:E.enciv})},getKeyFromEncryptedPKCS8PEM:function(g,y){var w=this.getPlainHexFromEncryptedPKCS8PEM(g,y),E=this.getKeyFromPlainPrivatePKCS8Hex(w);return E},parsePlainPrivatePKCS8Hex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={};if(_.algparam=null,g.substr(0,2)!="30")throw new Error("malformed plain PKCS8 private key(code:001)");var C=w(g,0);if(C.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if(g.substr(C[1],2)!="30")throw new Error("malformed PKCS8 private key(code:003)");var F=w(g,C[1]);if(F.length!=2)throw new Error("malformed PKCS8 private key(code:004)");if(g.substr(F[0],2)!="06")throw new Error("malformed PKCS8 private key(code:005)");if(_.algoid=E(g,F[0]),g.substr(F[1],2)=="06"&&(_.algparam=E(g,F[1])),g.substr(C[2],2)!="04")throw new Error("malformed PKCS8 private key(code:006)");return _.keyidx=y.getVidx(g,C[2]),_},getKeyFromPlainPrivatePKCS8PEM:function(g){var y=lr(g,"PRIVATE KEY"),w=this.getKeyFromPlainPrivatePKCS8Hex(y);return w},getKeyFromPlainPrivatePKCS8Hex:function(g){var y=this.parsePlainPrivatePKCS8Hex(g),w;if(y.algoid=="2a864886f70d010101")w=new at;else if(y.algoid=="2a8648ce380401")w=new A.crypto.DSA;else if(y.algoid=="2a8648ce3d0201")w=new A.crypto.ECDSA;else throw new Error("unsupported private key algorithm");return w.readPKCS8PrvKeyHex(g),w},_getKeyFromPublicPKCS8Hex:function(g){var y,w=xe.getVbyList(g,0,[0,0],"06");if(w==="2a864886f70d010101")y=new at;else if(w==="2a8648ce380401")y=new A.crypto.DSA;else if(w==="2a8648ce3d0201")y=new A.crypto.ECDSA;else throw new Error("unsupported PKCS#8 public key hex");return y.readPKCS8PubKeyHex(g),y},parsePublicRawRSAKeyHex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={};if(g.substr(0,2)!="30")throw new Error("malformed RSA key(code:001)");var C=w(g,0);if(C.length!=2)throw new Error("malformed RSA key(code:002)");if(g.substr(C[0],2)!="02")throw new Error("malformed RSA key(code:003)");if(_.n=E(g,C[0]),g.substr(C[1],2)!="02")throw new Error("malformed RSA key(code:004)");return _.e=E(g,C[1]),_},parsePublicPKCS8Hex:function(g){var y=xe,w=y.getChildIdx,E=y.getV,_={};_.algparam=null;var C=w(g,0);if(C.length!=2)throw new Error("outer DERSequence shall have 2 elements: "+C.length);var F=C[0];if(g.substr(F,2)!="30")throw new Error("malformed PKCS8 public key(code:001)");var H=w(g,F);if(H.length!=2)throw new Error("malformed PKCS8 public key(code:002)");if(g.substr(H[0],2)!="06")throw new Error("malformed PKCS8 public key(code:003)");if(_.algoid=E(g,H[0]),g.substr(H[1],2)=="06"?_.algparam=E(g,H[1]):g.substr(H[1],2)=="30"&&(_.algparam={},_.algparam.p=y.getVbyList(g,H[1],[0],"02"),_.algparam.q=y.getVbyList(g,H[1],[1],"02"),_.algparam.g=y.getVbyList(g,H[1],[2],"02")),g.substr(C[1],2)!="03")throw new Error("malformed PKCS8 public key(code:004)");return _.key=E(g,C[1]).substr(2),_}}})();_t.getKey=function(e,t,r){var n=xe,i=n.getChildIdx,o=n.getV,s=n.getVbyList,a=A.crypto,u=a.ECDSA,l=a.DSA,h=at,m=lr,p=_t;if(typeof h<"u"&&e instanceof h||typeof u<"u"&&e instanceof u||typeof l<"u"&&e instanceof l)return e;if(e.curve!==void 0&&e.xy!==void 0&&e.d===void 0)return new u({pub:e.xy,curve:e.curve});if(e.curve!==void 0&&e.d!==void 0)return new u({prv:e.d,curve:e.curve});if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var d=new h;return d.setPublic(e.n,e.e),d}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.co!==void 0&&e.qi===void 0){var d=new h;return d.setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),d}if(e.kty===void 0&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p===void 0){var d=new h;return d.setPrivate(e.n,e.e,e.d),d}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x===void 0){var d=new l;return d.setPublic(e.p,e.q,e.g,e.y),d}if(e.p!==void 0&&e.q!==void 0&&e.g!==void 0&&e.y!==void 0&&e.x!==void 0){var d=new l;return d.setPrivate(e.p,e.q,e.g,e.y,e.x),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d===void 0){var d=new h;return d.setPublic(rr(e.n),rr(e.e)),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0&&e.p!==void 0&&e.q!==void 0&&e.dp!==void 0&&e.dq!==void 0&&e.qi!==void 0){var d=new h;return d.setPrivateEx(rr(e.n),rr(e.e),rr(e.d),rr(e.p),rr(e.q),rr(e.dp),rr(e.dq),rr(e.qi)),d}if(e.kty==="RSA"&&e.n!==void 0&&e.e!==void 0&&e.d!==void 0){var d=new h;return d.setPrivate(rr(e.n),rr(e.e),rr(e.d)),d}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d===void 0){var v=new u({curve:e.crv}),g=v.ecparams.keycharlen,y=("0000000000"+rr(e.x)).slice(-g),w=("0000000000"+rr(e.y)).slice(-g),E="04"+y+w;return v.setPublicKeyHex(E),v}if(e.kty==="EC"&&e.crv!==void 0&&e.x!==void 0&&e.y!==void 0&&e.d!==void 0){var v=new u({curve:e.crv}),g=v.ecparams.keycharlen,y=("0000000000"+rr(e.x)).slice(-g),w=("0000000000"+rr(e.y)).slice(-g),E="04"+y+w,_=("0000000000"+rr(e.d)).slice(-g);return v.setPublicKeyHex(E),v.setPrivateKeyHex(_),v}if(r==="pkcs5prv"){var C=e,n=xe,F,d;if(F=i(C,0),F.length===9)d=new h,d.readPKCS5PrvKeyHex(C);else if(F.length===6)d=new l,d.readPKCS5PrvKeyHex(C);else if(F.length>2&&C.substr(F[1],2)==="04")d=new u,d.readPKCS5PrvKeyHex(C);else throw new Error("unsupported PKCS#1/5 hexadecimal key");return d}if(r==="pkcs8prv"){var d=p.getKeyFromPlainPrivatePKCS8Hex(e);return d}if(r==="pkcs8pub")return p._getKeyFromPublicPKCS8Hex(e);if(r==="x509pub")return tt.getPublicKeyFromCertHex(e);if(e.indexOf("-END CERTIFICATE-",0)!=-1||e.indexOf("-END X509 CERTIFICATE-",0)!=-1||e.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1)return tt.getPublicKeyFromCertPEM(e);if(e.indexOf("-END PUBLIC KEY-")!=-1){var H=lr(e,"PUBLIC KEY");return p._getKeyFromPublicPKCS8Hex(H)}if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var K=m(e,"RSA PRIVATE KEY");return p.getKey(K,null,"pkcs5prv")}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var S=m(e,"DSA PRIVATE KEY"),I=s(S,0,[1],"02"),q=s(S,0,[2],"02"),L=s(S,0,[3],"02"),R=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new ne(I,16),new ne(q,16),new ne(L,16),new ne(R,16),new ne(O,16)),d}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")==-1){var K=m(e,"EC PRIVATE KEY");return p.getKey(K,null,"pkcs5prv")}if(e.indexOf("-END PRIVATE KEY-")!=-1)return p.getKeyFromPlainPrivatePKCS8PEM(e);if(e.indexOf("-END RSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var T=p.getDecryptedKeyHex(e,t),N=new at;return N.readPKCS5PrvKeyHex(T),N}if(e.indexOf("-END EC PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),d=s(S,0,[1],"04"),P=s(S,0,[2,0],"06"),M=s(S,0,[3,0],"03").substr(2),Y="";if(A.crypto.OID.oidhex2name[P]!==void 0)Y=A.crypto.OID.oidhex2name[P];else throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+P);var v=new u({curve:Y});return v.setPublicKeyHex(M),v.setPrivateKeyHex(d),v.isPublic=!1,v}if(e.indexOf("-END DSA PRIVATE KEY-")!=-1&&e.indexOf("4,ENCRYPTED")!=-1){var S=p.getDecryptedKeyHex(e,t),I=s(S,0,[1],"02"),q=s(S,0,[2],"02"),L=s(S,0,[3],"02"),R=s(S,0,[4],"02"),O=s(S,0,[5],"02"),d=new l;return d.setPrivate(new ne(I,16),new ne(q,16),new ne(L,16),new ne(R,16),new ne(O,16)),d}if(e.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1)return p.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")};_t.generateKeypair=function(e,t){if(e=="RSA"){var r=t,n=new at;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new at,o=n.n.toString(16),s=n.e.toString(16);i.setPublic(o,s),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}else if(e=="EC"){var u=t,l=new A.crypto.ECDSA({curve:u}),h=l.generateKeyPairHex(),n=new A.crypto.ECDSA({curve:u});n.setPublicKeyHex(h.ecpubhex),n.setPrivateKeyHex(h.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new A.crypto.ECDSA({curve:u});i.setPublicKeyHex(h.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}else throw new Error("unknown algorithm: "+e)};_t.getPEM=function(e,t,r,n,i,o){var s=A,a=s.asn1,u=a.DERObjectIdentifier,l=a.DERInteger,h=a.ASN1Util.newObject,m=a.x509,p=m.SubjectPublicKeyInfo,d=s.crypto,v=d.DSA,g=d.ECDSA,y=at;function w(N){var P=h({seq:[{int:0},{int:{bigint:N.n}},{int:N.e},{int:{bigint:N.d}},{int:{bigint:N.p}},{int:{bigint:N.q}},{int:{bigint:N.dmp1}},{int:{bigint:N.dmq1}},{int:{bigint:N.coeff}}]});return P}function E(N){var P=h({seq:[{int:1},{octstr:{hex:N.prvKeyHex}},{tag:["a0",!0,{oid:{name:N.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+N.pubKeyHex}}]}]});return P}function _(N){var P=h({seq:[{int:0},{int:{bigint:N.p}},{int:{bigint:N.q}},{int:{bigint:N.g}},{int:{bigint:N.y}},{int:{bigint:N.x}}]});return P}if((y!==void 0&&e instanceof y||v!==void 0&&e instanceof v||g!==void 0&&e instanceof g)&&e.isPublic==!0&&(t===void 0||t=="PKCS8PUB")){var C=new p(e),F=C.tohex();return An(F,"PUBLIC KEY")}if(t=="PKCS1PRV"&&y!==void 0&&e instanceof y&&(r===void 0||r==null)&&e.isPrivate==!0){var C=w(e),F=C.tohex();return An(F,"RSA PRIVATE KEY")}if(t=="PKCS1PRV"&&g!==void 0&&e instanceof g&&(r===void 0||r==null)&&e.isPrivate==!0){var H=new u({name:e.curveName}),K=H.tohex(),S=E(e),I=S.tohex(),q="";return q+=An(K,"EC PARAMETERS"),q+=An(I,"EC PRIVATE KEY"),q}if(t=="PKCS1PRV"&&v!==void 0&&e instanceof v&&(r===void 0||r==null)&&e.isPrivate==!0){var C=_(e),F=C.tohex();return An(F,"DSA PRIVATE KEY")}if(t=="PKCS5PRV"&&y!==void 0&&e instanceof y&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=w(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",F,r,n,o)}if(t=="PKCS5PRV"&&g!==void 0&&e instanceof g&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=E(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",F,r,n,o)}if(t=="PKCS5PRV"&&v!==void 0&&e instanceof v&&r!==void 0&&r!=null&&e.isPrivate==!0){var C=_(e),F=C.tohex();return n===void 0&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",F,r,n,o)}var L=function(N,P){if(typeof P=="string")return _t.getEncryptedPKCS8PEM(N,P);if(typeof P=="object"&&Jt(P,"passcode")!=null){var M=JSON.parse(JSON.stringify(P)),Y=M.passcode;return delete M.passcode,_t.getEncryptedPKCS8PEM(N,Y,M)}};if(t=="PKCS8PRV"&&y!=null&&e instanceof y&&e.isPrivate==!0){var R=w(e),O=R.tohex(),C=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:O}}]}),F=C.tohex();return r===void 0||r==null?An(F,"PRIVATE KEY"):L(F,r)}if(t=="PKCS8PRV"&&g!==void 0&&e instanceof g&&e.isPrivate==!0){var T={seq:[{int:1},{octstr:{hex:e.prvKeyHex}}]};typeof e.pubKeyHex=="string"&&T.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]});var R=new h(T),O=R.tohex(),C=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:O}}]}),F=C.tohex();return r===void 0||r==null?An(F,"PRIVATE KEY"):L(F,r)}if(t=="PKCS8PRV"&&v!==void 0&&e instanceof v&&e.isPrivate==!0){var R=new l({bigint:e.x}),O=R.tohex(),C=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:O}}]}),F=C.tohex();return r===void 0||r==null?An(F,"PRIVATE KEY"):L(F,r)}throw new Error("unsupported object nor format")};_t.getKeyFromCSRPEM=function(e){var t=lr(e,"CERTIFICATE REQUEST"),r=_t.getKeyFromCSRHex(t);return r};_t.getKeyFromCSRHex=function(e){var t=_t.parseCSRHex(e),r=_t.getKey(t.p8pubkeyhex,null,"pkcs8pub");return r};_t.parseCSRHex=function(e){var t=xe,r=t.getChildIdx,n=t.getTLV,i={},o=e;if(o.substr(0,2)!="30")throw new Error("malformed CSR(code:001)");var s=r(o,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if(o.substr(s[0],2)!="30")throw new Error("malformed CSR(code:003)");var a=r(o,s[0]);if(a.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(o,a[2]),i};_t.getKeyID=function(e){var t=_t,r=xe;typeof e=="string"&&e.indexOf("BEGIN ")!=-1&&(e=t.getKey(e));var n=lr(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),o=r.getV(n,i).substring(2);return A.crypto.Util.hashHex(o,"sha1")};_t.getJWK=function(e,t,r,n,i){var o,s={},a,u=A.crypto.Util.hashHex;if(typeof e=="string")o=_t.getKey(e),e.indexOf("CERTIFICATE")!=-1&&(a=lr(e));else if(typeof e=="object")e instanceof tt?(o=e.getPublicKey(),a=e.hex):o=e;else throw new Error("unsupported keyinfo type");if(o instanceof at&&o.isPrivate)s.kty="RSA",s.n=Or(o.n.toString(16)),s.e=Or(o.e.toString(16)),s.d=Or(o.d.toString(16)),s.p=Or(o.p.toString(16)),s.q=Or(o.q.toString(16)),s.dp=Or(o.dmp1.toString(16)),s.dq=Or(o.dmq1.toString(16)),s.qi=Or(o.coeff.toString(16));else if(o instanceof at&&o.isPublic)s.kty="RSA",s.n=Or(o.n.toString(16)),s.e=Or(o.e.toString(16));else if(o instanceof A.crypto.ECDSA&&o.isPrivate){var l=o.getShortNISTPCurveName();if(l!=="P-256"&&l!=="P-384"&&l!=="P-521")throw new Error("unsupported curve name for JWT: "+l);var h=o.getPublicKeyXYHex();s.kty="EC",s.crv=l,s.x=Or(h.x),s.y=Or(h.y),s.d=Or(o.prvKeyHex)}else if(o instanceof A.crypto.ECDSA&&o.isPublic){var l=o.getShortNISTPCurveName();if(l!=="P-256"&&l!=="P-384"&&l!=="P-521")throw new Error("unsupported curve name for JWT: "+l);var h=o.getPublicKeyXYHex();s.kty="EC",s.crv=l,s.x=Or(h.x),s.y=Or(h.y)}if(s.kty==null)throw new Error("unsupported keyinfo");return!o.isPrivate&&t!=!0&&(s.kid=A.jws.JWS.getJWKthumbprint(s)),a!=null&&r!=!0&&(s.x5c=[fa(a)]),a!=null&&n!=!0&&(s.x5t=ef(fa(u(a,"sha1")))),a!=null&&i!=!0&&(s["x5t#S256"]=ef(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 Jne=new RegExp("[^0-9a-f]","gi");function CC(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=hs(r,16),i=this.doPrivate(n),o=i.toString(16);return CC(o,this.n.bitLength())};function DC(e,t,r){for(var n="",i=0;n.length<t;)n+=ps(r(ao(e+String.fromCharCode.apply(String,[(i&4278190080)>>24,(i&16711680)>>16,(i&65280)>>8,i&255])))),i+=1;return n}at.prototype.signPSS=function(e,t,r){var n=function(o){return A.crypto.Util.hashHex(o,t)},i=n(ao(e));return r===void 0&&(r=-1),this.signWithMessageHashPSS(i,t,r)};at.prototype.signWithMessageHashPSS=function(e,t,r){var n=ps(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 sf().nextBytes(l),l=String.fromCharCode.apply(String,l));var h=ps(u(ao("\0\0\0\0\0\0\0\0"+n+l))),m=[];for(a=0;a<s-r-i-2;a+=1)m[a]=0;var p=String.fromCharCode.apply(String,m)+""+l,d=DC(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),CC(this.doPrivate(new ne(v)).toString(16),this.n.bitLength())};function FC(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=hs(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=FC(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=hs(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),o=FC(i);if(o.length==0)return!1;var s=o[0],a=o[1];return a==e};at.prototype.verifyPSS=function(e,t,r,n){var i=function(s){return A.crypto.Util.hashHex(s,r)},o=i(ao(e));return n===void 0&&(n=-1),this.verifyWithMessageHashPSS(o,t,r,n)};at.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i=new ne(t,16),o=function(E){return A.crypto.Util.hashHex(E,r)},s=ps(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=DC(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===ps(o(ao("\0\0\0\0\0\0\0\0"+s+String.fromCharCode.apply(String,y.slice(-n)))))};at.SALT_LEN_HLEN=-1;at.SALT_LEN_MAX=-2;at.SALT_LEN_RECOVER=-2;function tt(e){var t=xe,r=t.getChildIdx,n=t.getV,i=t.dump,o=t.parse,s=t.getTLV,a=t.getVbyList,u=t.getVbyListEx,l=t.getTLVbyList,h=t.getTLVbyListEx,m=t.getIdxbyList,p=t.getIdxbyListEx,d=t.getVidx,v=t.getInt,g=t.oidname,y=t.hextooidstr,w=tt,E=lr,_,C=Error;try{_=A.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch{}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(this.hex===null||this.version!==0)return this.version;var S=l(this.hex,0,[0,0]);if(S.substr(0,2)=="a0"){var I=l(S,0,[0]),q=v(I,0);if(q<0||2<q)throw new Error("malformed version field");return this.version=q+1,this.version}else return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var S=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(S)},this.getAlgorithmIdentifierName=function(S){for(var I in _)if(S===_[I])return I;return g(u(S,0,[0],"06"))},this.getIssuer=function(S,I){return this.getX500Name(this.getIssuerHex(),S,I)},this.getIssuerHex=function(){return l(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){var S=this.getIssuer();return S.str},this.getSubject=function(S,I){return this.getX500Name(this.getSubjectHex(),S,I)},this.getSubjectHex=function(){return l(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){var S=this.getSubject();return S.str},this.getNotBefore=function(){var S=a(this.hex,0,[0,4+this.foffset,0]);return S=S.replace(/(..)/g,"%$1"),S=decodeURIComponent(S),S},this.getNotAfter=function(){var S=a(this.hex,0,[0,4+this.foffset,1]);return S=S.replace(/(..)/g,"%$1"),S=decodeURIComponent(S),S},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var S=this.getSPKI();return S==null?null:a(S,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return m(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var S=this.getPublicKeyIdx();return m(this.hex,S,[1,0],"30")},this.getPublicKey=function(){return _t.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var S=l(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(S)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(S){var I=this.getSignatureAlgorithmField(),q=this.getSignatureValueHex(),L=l(this.hex,0,[0],"30"),R=new A.crypto.Signature({alg:I});return R.init(S),R.updateHex(L),R.verify(q)},this.parseExt=function(S){var I,q,L;if(S===void 0){if(L=this.hex,this.version!==3)return-1;I=m(L,0,[0,7,0],"30"),q=r(L,I)}else{L=lr(S);var R=m(L,0,[0,3,0,0],"06");if(n(L,R)!="2a864886f70d01090e"){this.aExtInfo=new Array;return}I=m(L,0,[0,3,0,1,0],"30"),q=r(L,I),this.hex=L}this.aExtInfo=new Array;for(var O=0;O<q.length;O++){var T={};T.critical=!1;var N=r(L,q[O]),P=0;N.length===3&&(T.critical=!0,P=1),T.oid=t.hextooidstr(a(L,q[O],[0],"06"));var M=m(L,q[O],[1+P]);T.vidx=d(L,M),this.aExtInfo.push(T)}},this.getExtInfo=function(S){var I=this.aExtInfo,q=S;if(S.match(/^[0-9.]+$/)||(q=A.asn1.x509.OID.name2oid(S)),q!==""){for(var L=0;L<I.length;L++)if(I[L].oid===q)return I[L]}},this.getCriticalExtV=function(S,I,q){if(I!=null)return[I,q];var L=this.getExtInfo(S);return L==null?[null,null]:[s(this.hex,L.vidx),L.critical]},this.getExtBasicConstraints=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("basicConstraints");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"basicConstraints"};if(I&&(L.critical=!0),S==="3000")return L;if(S==="30030101ff")return L.cA=!0,L;if(S.substr(0,12)==="30060101ff02"){var R=n(S,10),O=parseInt(R,16);return L.cA=!0,L.pathLen=O,L}throw new Error("hExtV parse error: "+S)},this.getExtNameConstraints=function(S,I){var q=this.getCriticalExtV("nameConstraints",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"nameConstraints"};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){for(var T=[],N=r(S,R[O]),P=0;P<N.length;P++){var M=s(S,N[P]),Y=this.getGeneralSubtree(M);T.push(Y)}var V=S.substr(R[O],2);V=="a0"?L.permit=T:V=="a1"&&(L.exclude=T)}return L}},this.getGeneralSubtree=function(S){var I=r(S,0),q=I.length;if(q<1||2<q)throw new Error("wrong num elements");for(var L=this.getGeneralName(s(S,I[0])),R=1;R<q;R++){var O=S.substr(I[R],2),T=n(S,I[R]),N=parseInt(T,16);O=="80"&&(L.min=N),O=="81"&&(L.max=N)}return L},this.getExtKeyUsage=function(S,I){var q=this.getCriticalExtV("keyUsage",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"keyUsage"};return I&&(L.critical=!0),L.names=this.getExtKeyUsageString(S).split(","),L}},this.getExtKeyUsageBin=function(S){if(S===void 0){var I=this.getExtInfo("keyUsage");if(I===void 0)return"";S=s(this.hex,I.vidx)}if(S.length!=8&&S.length!=10)throw new Error("malformed key usage value: "+S);var q="000000000000000"+parseInt(S.substr(6),16).toString(2);return S.length==8&&(q=q.slice(-8)),S.length==10&&(q=q.slice(-16)),q=q.replace(/0+$/,""),q==""&&(q="0"),q},this.getExtKeyUsageString=function(S){for(var I=this.getExtKeyUsageBin(S),q=new Array,L=0;L<I.length;L++)I.substr(L,1)=="1"&&q.push(tt.KEYUSAGE_NAME[L]);return q.join(",")},this.getExtSubjectKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectKeyIdentifier");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectKeyIdentifier"};I&&(L.critical=!0);var R=n(S,0);return L.kid={hex:R},L},this.getExtAuthorityKeyIdentifier=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("authorityKeyIdentifier");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"authorityKeyIdentifier"};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=S.substr(R[O],2);if(T==="80"&&(L.kid={hex:n(S,R[O])}),T==="a1"){var N=s(S,R[O]),P=this.getGeneralNames(N);L.issuer=P[0].dn}T==="82"&&(L.sn={hex:n(S,R[O])})}return L},this.getExtExtKeyUsage=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("extKeyUsage");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"extKeyUsage",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++)L.array.push(g(n(S,R[O])));return L},this.getExtExtKeyUsageName=function(){var S=this.getExtInfo("extKeyUsage");if(S===void 0)return S;var I=new Array,q=s(this.hex,S.vidx);if(q==="")return I;for(var L=r(q,0),R=0;R<L.length;R++)I.push(g(n(q,L[R])));return I},this.getExtSubjectAltName=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectAltName");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectAltName",array:[]};return I&&(L.critical=!0),L.array=this.getGeneralNames(S),L},this.getExtIssuerAltName=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("issuerAltName");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"issuerAltName",array:[]};return I&&(L.critical=!0),L.array=this.getGeneralNames(S),L},this.getGeneralNames=function(S){for(var I=r(S,0),q=[],L=0;L<I.length;L++){var R=this.getGeneralName(s(S,I[L]));R!==void 0&&q.push(R)}return q},this.getGeneralName=function(S){var I=S.substr(0,2),q=n(S,0),L=ps(q);if(I=="81")return{rfc822:L};if(I=="82")return{dns:L};if(I=="86")return{uri:L};if(I=="87")return{ip:f1(q)};if(I=="a4")return{dn:this.getX500Name(q)};if(I=="a0")return{other:this.getOtherName(S)}},this.getExtSubjectAltName2=function(){var S,I,q,L=this.getExtInfo("subjectAltName");if(L===void 0)return L;for(var R=new Array,O=s(this.hex,L.vidx),T=r(O,0),N=0;N<T.length;N++)q=O.substr(T[N],2),S=n(O,T[N]),q==="81"&&(I=zt(S),R.push(["MAIL",I])),q==="82"&&(I=zt(S),R.push(["DNS",I])),q==="84"&&(I=tt.hex2dn(S,0),R.push(["DN",I])),q==="86"&&(I=zt(S),R.push(["URI",I])),q==="87"&&(I=f1(S),R.push(["IP",I]));return R},this.getExtCRLDistributionPoints=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("cRLDistributionPoints");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"cRLDistributionPoints",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=s(S,R[O]);L.array.push(this.getDistributionPoint(T))}return L},this.getDistributionPoint=function(S){for(var I={},q=r(S,0),L=0;L<q.length;L++){var R=S.substr(q[L],2),O=s(S,q[L]);R=="a0"&&(I.dpname=this.getDistributionPointName(O))}return I},this.getDistributionPointName=function(S){for(var I={},q=r(S,0),L=0;L<q.length;L++){var R=S.substr(q[L],2),O=s(S,q[L]);R=="a0"&&(I.full=this.getGeneralNames(O))}return I},this.getExtCRLDistributionPointsURI=function(){var S=this.getExtCRLDistributionPoints();if(S==null)return S;for(var I=S.array,q=[],L=0;L<I.length;L++)try{I[L].dpname.full[0].uri!=null&&q.push(I[L].dpname.full[0].uri)}catch{}return q},this.getExtAIAInfo=function(){var S=this.getExtInfo("authorityInfoAccess");if(S===void 0)return S;for(var I={ocsp:[],caissuer:[]},q=r(this.hex,S.vidx),L=0;L<q.length;L++){var R=a(this.hex,q[L],[0],"06"),O=a(this.hex,q[L],[1],"86");R==="2b06010505073001"&&I.ocsp.push(zt(O)),R==="2b06010505073002"&&I.caissuer.push(zt(O))}return I},this.getExtAuthorityInfoAccess=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("authorityInfoAccess");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"authorityInfoAccess",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=u(S,R[O],[0],"06"),N=a(S,R[O],[1],"86"),P=zt(N);if(T=="2b06010505073001")L.array.push({ocsp:P});else if(T=="2b06010505073002")L.array.push({caissuer:P});else throw new Error("unknown method: "+T)}return L},this.getExtCertificatePolicies=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("certificatePolicies");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"certificatePolicies",array:[]};I&&(L.critical=!0);for(var R=r(S,0),O=0;O<R.length;O++){var T=s(S,R[O]),N=this.getPolicyInformation(T);L.array.push(N)}return L},this.getPolicyInformation=function(S){var I={},q=a(S,0,[0],"06");I.policyoid=g(q);var L=p(S,0,[1],"30");if(L!=-1){I.array=[];for(var R=r(S,L),O=0;O<R.length;O++){var T=s(S,R[O]),N=this.getPolicyQualifierInfo(T);I.array.push(N)}}return I},this.getOtherName=function(S){var I={},q=r(S,0),L=a(S,q[0],[],"06"),R=a(S,q[1],[]);return I.oid=g(L),I.value=o(R),I},this.getPolicyQualifierInfo=function(S){var I={},q=a(S,0,[0],"06");if(q==="2b06010505070201"){var L=u(S,0,[1],"16");I.cps=ps(L)}else if(q==="2b06010505070202"){var R=l(S,0,[1],"30");I.unotice=this.getUserNotice(R)}return I},this.getUserNotice=function(S){var I=null,q={};try{I=t.parse(S);var L=this._asn1ToUnotice(I);return L}catch{return}},this._asn1ToUnotice=function(S){try{for(var I={},q=Jt(S,"seq"),L=0;L<q.length;L++){var R=this._asn1ToNoticeRef(q[L]);R!=null&&(I.noticeref=R);var O=this.asn1ToDisplayText(q[L]);O!=null&&(I.exptext=O)}return Object.keys(I).length>0?I:void 0}catch{return}},this._asn1ToNoticeRef=function(S){try{for(var I={},q=Jt(S,"seq"),L=0;L<q.length;L++){var R=this._asn1ToNoticeNum(q[L]);R!=null&&(I.noticenum=R);var O=this.asn1ToDisplayText(q[L]);O!=null&&(I.org=O)}return Object.keys(I).length>0?I:void 0}catch{return}},this._asn1ToNoticeNum=function(S){try{for(var I=Jt(S,"seq"),q=[],L=0;L<I.length;L++){var R=I[L];q.push(parseInt(Jt(R,"int.hex"),16))}return q}catch{return}},this.getDisplayText=function(S){var I={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"},q={};return q.type=I[S.substr(0,2)],q.str=ps(n(S,0)),q},this.asn1ToDisplayText=function(S){if(S.utf8str!=null)return{type:"utf8",str:S.utf8str.str};if(S.ia5str!=null)return{type:"ia5",str:S.ia5str.str};if(S.visstr!=null)return{type:"vis",str:S.visstr.str};if(S.bmpstr!=null)return{type:"bmp",str:S.bmpstr.str};if(S.prnstr!=null)return{type:"prn",str:S.prnstr.str}},this.getExtPolicyMappings=function(S,I){var q=this.getCriticalExtV("policyMappings",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"policyMappings"};I&&(L.critical=!0);try{for(var R=o(S),O=R.seq,T=[],N=0;N<O.length;N++){var P=O[N].seq;T.push([P[0].oid,P[1].oid])}L.array=T}catch{throw new C("malformed policyMappings")}return L}},this.getExtPolicyConstraints=function(S,I){var q=this.getCriticalExtV("policyConstraints",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"policyConstraints"};I&&(L.critical=!0);var R=o(S);try{for(var O=R.seq,T=0;T<O.length;T++){var N=O[T].tag;N.explicit==!1&&(N.tag=="80"&&(L.reqexp=parseInt(N.hex,16)),N.tag=="81"&&(L.inhibit=parseInt(N.hex,16)))}}catch{return new C("malformed policyConstraints value")}return L}},this.getExtInhibitAnyPolicy=function(S,I){var q=this.getCriticalExtV("inhibitAnyPolicy",S,I);if(S=q[0],I=q[1],S!=null){var L={extname:"inhibitAnyPolicy"};I&&(L.critical=!0);var R=v(S,0);return R==-1?new C("wrong value"):(L.skip=R,L)}},this.getExtCRLNumber=function(S,I){var q={extname:"cRLNumber"};if(I&&(q.critical=!0),S.substr(0,2)=="02")return q.num={hex:n(S,0)},q;throw new C("hExtV parse error: "+S)},this.getExtCRLReason=function(S,I){var q={extname:"cRLReason"};if(I&&(q.critical=!0),S.substr(0,2)=="0a")return q.code=parseInt(n(S,0),16),q;throw new Error("hExtV parse error: "+S)},this.getExtOcspNonce=function(S,I){var q={extname:"ocspNonce"};I&&(q.critical=!0);var L=n(S,0);return q.hex=L,q},this.getExtOcspNoCheck=function(S,I){var q={extname:"ocspNoCheck"};return I&&(q.critical=!0),q},this.getExtAdobeTimeStamp=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("adobeTimeStamp");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"adobeTimeStamp"};I&&(L.critical=!0);var R=r(S,0);if(R.length>1){var O=s(S,R[1]),T=this.getGeneralName(O);T.uri!=null&&(L.uri=T.uri)}if(R.length>2){var N=s(S,R[2]);N=="0101ff"&&(L.reqauth=!0),N=="010100"&&(L.reqauth=!1)}return L},this.getExtSubjectDirectoryAttributes=function(S,I){if(S===void 0&&I===void 0){var q=this.getExtInfo("subjectDirectoryAttributes");if(q===void 0)return;S=s(this.hex,q.vidx),I=q.critical}var L={extname:"subjectDirectoryAttributes"};I&&(L.critical=!0);try{for(var R=o(S),O=[],T=0;T<R.seq.length;T++){var N=R.seq[T],P=Jt(N,"seq.0.oid"),M=Jt(N,"seq.1.set");if(P==null||M==null)throw"error";O.push({attr:P,array:M})}return L.array=O,L}catch{throw new Error("malformed subjectDirectoryAttributes extension value")}};var F=function(S){var I={};try{var q=S.seq[0].oid,L=A.asn1.x509.OID.name2oid(q);I.type=A.asn1.x509.OID.oid2atype(L);var R=S.seq[1];if(R.utf8str!=null)I.ds="utf8",I.value=R.utf8str.str;else if(R.numstr!=null)I.ds="num",I.value=R.numstr.str;else if(R.telstr!=null)I.ds="tel",I.value=R.telstr.str;else if(R.prnstr!=null)I.ds="prn",I.value=R.prnstr.str;else if(R.ia5str!=null)I.ds="ia5",I.value=R.ia5str.str;else if(R.visstr!=null)I.ds="vis",I.value=R.visstr.str;else if(R.bmpstr!=null)I.ds="bmp",I.value=R.bmpstr.str;else throw"error";return I}catch{throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},H=function(S){try{return S.set.map(function(I){return F(I)})}catch(I){throw new Error("improper ASN.1 parsed RDN: "+I)}},K=function(S){try{return S.seq.map(function(I){return H(I)})}catch(I){throw new Error("improper ASN.1 parsed X500Name: "+I)}};this.getX500NameRule=function(S){for(var I=!0,q=!0,L=!1,R="",O="",T=null,N=[],P=0;P<S.length;P++)for(var M=S[P],Y=0;Y<M.length;Y++)N.push(M[Y]);for(var P=0;P<N.length;P++){var V=N[P],X=V.ds,te=V.value,ae=V.type;if(R+=":"+X,X!="prn"&&X!="utf8"&&X!="ia5")return"mixed";if(X=="ia5"){if(ae!="CN")return"mixed";if(A.lang.String.isMail(te))continue;return"mixed"}if(ae=="C"){if(X=="prn")continue;return"mixed"}if(O+=":"+X,T==null)T=X;else if(T!==X)return"mixed"}return T??"prn"},this.getAttrTypeAndValue=function(S){var I=o(S);return F(I)},this.getRDN=function(S){var I=o(S);return H(I)},this.getX500NameArray=function(S){var I=o(S);return K(I)},this.getX500Name=function(S,I,q){var L=this.getX500NameArray(S),R=this.dnarraytostr(L),O={str:R};return O.array=L,q==!0&&(O.hex=S),I==!0&&(O.canon=this.c14nRDNArray(L)),O},this.readCertPEM=function(S){this.readCertHex(E(S))},this.readCertHex=function(S){this.hex=S,this.getVersion();try{m(this.hex,0,[0,7],"a3"),this.parseExt()}catch{}},this.getParam=function(S){var I={};return S==null&&(S={}),I.version=this.getVersion(),I.serial={hex:this.getSerialNumberHex()},I.sigalg=this.getSignatureAlgorithmField(),I.issuer=this.getIssuer(S.dncanon,S.dnhex),I.notbefore=this.getNotBefore(),I.notafter=this.getNotAfter(),I.subject=this.getSubject(S.dncanon,S.dnhex),I.sbjpubkey=An(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo!=null&&this.aExtInfo.length>0&&(I.ext=this.getExtParamArray()),I.sighex=this.getSignatureValueHex(),S.tbshex==!0&&(I.tbshex=l(this.hex,0,[0])),S.nodnarray==!0&&(delete I.issuer.array,delete I.subject.array),I},this.getExtParamArray=function(S){if(S==null){var I=p(this.hex,0,[0,"[3]"]);I!=-1&&(S=h(this.hex,0,[0,"[3]",0],"30"))}for(var q=[],L=r(S,0),R=0;R<L.length;R++){var O=s(S,L[R]),T=this.getExtParam(O);T!=null&&q.push(T)}return q},this.getExtParam=function(S){var I={},q=r(S,0),L=q.length;if(L!=2&&L!=3)throw new Error("wrong number elements in Extension: "+L+" "+S);var R=y(a(S,0,[0],"06")),O=!1;L==3&&l(S,0,[1])=="0101ff"&&(O=!0);var T=l(S,0,[L-1,0]),N=void 0;if(R=="2.5.29.14"?N=this.getExtSubjectKeyIdentifier(T,O):R=="2.5.29.15"?N=this.getExtKeyUsage(T,O):R=="2.5.29.17"?N=this.getExtSubjectAltName(T,O):R=="2.5.29.18"?N=this.getExtIssuerAltName(T,O):R=="2.5.29.19"?N=this.getExtBasicConstraints(T,O):R=="2.5.29.30"?N=this.getExtNameConstraints(T,O):R=="2.5.29.31"?N=this.getExtCRLDistributionPoints(T,O):R=="2.5.29.32"?N=this.getExtCertificatePolicies(T,O):R=="2.5.29.33"?N=this.getExtPolicyMappings(T,O):R=="2.5.29.35"?N=this.getExtAuthorityKeyIdentifier(T,O):R=="2.5.29.36"?N=this.getExtPolicyConstraints(T,O):R=="2.5.29.37"?N=this.getExtExtKeyUsage(T,O):R=="2.5.29.54"?N=this.getExtInhibitAnyPolicy(T,O):R=="1.3.6.1.5.5.7.1.1"?N=this.getExtAuthorityInfoAccess(T,O):R=="2.5.29.20"?N=this.getExtCRLNumber(T,O):R=="2.5.29.21"?N=this.getExtCRLReason(T,O):R=="2.5.29.9"?N=this.getExtSubjectDirectoryAttributes(T,O):R=="1.3.6.1.5.5.7.48.1.2"?N=this.getExtOcspNonce(T,O):R=="1.3.6.1.5.5.7.48.1.5"?N=this.getExtOcspNoCheck(T,O):R=="1.2.840.113583.1.1.9.1"?N=this.getExtAdobeTimeStamp(T,O):tt.EXT_PARSER[R]!=null&&(N=tt.EXT_PARSER[R](R,O,T)),N!=null)return N;var P={extname:R,extn:T};try{P.extn=o(T)}catch{}return O&&(P.critical=!0),P},this.findExt=function(S,I){for(var q=0;q<S.length;q++)if(S[q].extname==I)return S[q];return null},this.updateExtCDPFullURI=function(S,I){var q=this.findExt(S,"cRLDistributionPoints");if(q!=null&&q.array!=null){for(var L=q.array,R=0;R<L.length;R++)if(L[R].dpname!=null&&L[R].dpname.full!=null)for(var O=L[R].dpname.full,T=0;T<O.length;T++){var N=O[R];N.uri!=null&&(N.uri=I)}}},this.updateExtAIAOCSP=function(S,I){var q=this.findExt(S,"authorityInfoAccess");if(q!=null&&q.array!=null)for(var L=q.array,R=0;R<L.length;R++)L[R].ocsp!=null&&(L[R].ocsp=I)},this.updateExtAIACAIssuer=function(S,I){var q=this.findExt(S,"authorityInfoAccess");if(q!=null&&q.array!=null)for(var L=q.array,R=0;R<L.length;R++)L[R].caissuer!=null&&(L[R].caissuer=I)},this.dnarraytostr=function(S){function I(L){return L.map(function(R){return q(R).replace(/\+/,"\\+")}).join("+")}function q(L){return L.type+"="+L.value}return"/"+S.map(function(L){return I(L).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(S){var I;if(S.str!=null&&S.array==null){var q=new A.asn1.x509.X500Name({str:S.str}),L=q.tohex();I=this.getX500NameArray(L)}else I=S.array;S.canon==null&&(S.canon=this.c14nRDNArray(I))},this.c14nRDNArray=function(S){for(var I=[],q=0;q<S.length;q++){for(var L=S[q],R=[],O=0;O<L.length;O++){var T=L[O],N=T.value;N=N.replace(/^\s*/,""),N=N.replace(/\s*$/,""),N=N.replace(/\s+/g," "),N=N.toLowerCase(),R.push(T.type.toLowerCase()+"="+N)}I.push(R.join("+"))}return"/"+I.join("/")},this.getInfo=function(){var S=function(pe){for(var Fe="",Te=" ",Ve=`
`,Oe=pe.array,pt=0;pt<Oe.length;pt++){var Qe=Oe[pt];if(Qe.dn!=null&&(Fe+=Te+"dn: "+Qe.dn.str+Ve),Qe.ip!=null&&(Fe+=Te+"ip: "+Qe.ip+Ve),Qe.rfc822!=null&&(Fe+=Te+"rfc822: "+Qe.rfc822+Ve),Qe.dns!=null&&(Fe+=Te+"dns: "+Qe.dns+Ve),Qe.uri!=null&&(Fe+=Te+"uri: "+Qe.uri+Ve),Qe.other!=null){var ct=Qe.other.oid,mn=JSON.stringify(Qe.other.value).replace(/\"/g,"");Fe+=Te+"other: "+ct+"="+mn+Ve}}return Fe=Fe.replace(/\n$/,""),Fe},I=function(pe){for(var Fe="",Te=pe.array,Ve=0;Ve<Te.length;Ve++){var Oe=Te[Ve];if(Fe+=" policy oid: "+Oe.policyoid+`
`,Oe.array!==void 0)for(var pt=0;pt<Oe.array.length;pt++){var Qe=Oe.array[pt];Qe.cps!==void 0&&(Fe+=" cps: "+Qe.cps+`
`)}}return Fe},q=function(pe){for(var Fe="",Te=pe.array,Ve=0;Ve<Te.length;Ve++){var Oe=Te[Ve];try{Oe.dpname.full[0].uri!==void 0&&(Fe+=" "+Oe.dpname.full[0].uri+`
`)}catch{}try{Oe.dname.full[0].dn.hex!==void 0&&(Fe+=" "+tt.hex2dn(Oe.dpname.full[0].dn.hex)+`
`)}catch{}}return Fe},L=function(pe){for(var Fe="",Te=pe.array,Ve=0;Ve<Te.length;Ve++){var Oe=Te[Ve];Oe.caissuer!==void 0&&(Fe+=" caissuer: "+Oe.caissuer+`
`),Oe.ocsp!==void 0&&(Fe+=" ocsp: "+Oe.ocsp+`
`)}return Fe},R=tt,O,T,N;if(O=`Basic Fields
`,O+=" serial number: "+this.getSerialNumberHex()+`
`,O+=" signature algorithm: "+this.getSignatureAlgorithmField()+`
`,O+=" issuer: "+this.getIssuerString()+`
`,O+=" notBefore: "+this.getNotBefore()+`
`,O+=" notAfter: "+this.getNotAfter()+`
`,O+=" subject: "+this.getSubjectString()+`
`,O+=` subject public key info:
`,T=this.getPublicKey(),O+=" key algorithm: "+T.type+`
`,T.type==="RSA"&&(O+=" n="+ay(T.n.toString(16)).substr(0,16)+`...
`,O+=" e="+ay(T.e.toString(16))+`
`),N=this.aExtInfo,N!=null){O+=`X509v3 Extensions:
`;for(var P=0;P<N.length;P++){var M=N[P],Y=A.asn1.x509.OID.oid2name(M.oid);Y===""&&(Y=M.oid);var V="";if(M.critical===!0&&(V="CRITICAL"),O+=" "+Y+" "+V+`:
`,Y==="basicConstraints"){var X=this.getExtBasicConstraints();X.cA===void 0?O+=` {}
`:(O+=" cA=true",X.pathLen!==void 0&&(O+=", pathLen="+X.pathLen),O+=`
`)}else if(Y=="policyMappings"){var te=this.getExtPolicyMappings().array,ae=te.map(function(pe){var Fe=pe;return Fe[0]+":"+Fe[1]}).join(", ");O+=" "+ae+`
`}else if(Y=="policyConstraints"){var me=this.getExtPolicyConstraints();O+=" ",me.reqexp!=null&&(O+=" reqexp="+me.reqexp),me.inhibit!=null&&(O+=" inhibit="+me.inhibit),O+=`
`}else if(Y=="inhibitAnyPolicy"){var me=this.getExtInhibitAnyPolicy();O+=" skip="+me.skip+`
`}else if(Y=="keyUsage")O+=" "+this.getExtKeyUsageString()+`
`;else if(Y=="subjectKeyIdentifier")O+=" "+this.getExtSubjectKeyIdentifier().kid.hex+`
`;else if(Y=="authorityKeyIdentifier"){var he=this.getExtAuthorityKeyIdentifier();he.kid!==void 0&&(O+=" kid="+he.kid.hex+`
`)}else if(Y=="extKeyUsage"){var De=this.getExtExtKeyUsage().array;O+=" "+De.join(", ")+`
`}else if(Y=="subjectAltName"){var Pe=S(this.getExtSubjectAltName());O+=Pe+`
`}else if(Y=="cRLDistributionPoints"){var Ie=this.getExtCRLDistributionPoints();O+=q(Ie)}else if(Y=="authorityInfoAccess"){var se=this.getExtAuthorityInfoAccess();O+=L(se)}else Y=="certificatePolicies"&&(O+=I(this.getExtCertificatePolicies()))}}return O+="signature algorithm: "+this.getSignatureAlgorithmName()+`
`,O+="signature: "+this.getSignatureValueHex().substr(0,16)+`...
`,O},typeof e=="string"&&(e.indexOf("-----BEGIN")!=-1?this.readCertPEM(e):A.lang.String.isHex(e)&&this.readCertHex(e))}tt.EXT_PARSER={};tt.registExtParser=function(e,t){tt.EXT_PARSER[e]=t};tt.hex2dn=function(e,t){t===void 0&&(t=0);var r=new tt,n=xe.getTLV(e,t),i=r.getX500Name(e);return i.str};tt.hex2rdn=function(e,t){if(t===void 0&&(t=0),e.substr(t,2)!=="31")throw new Error("malformed RDN");for(var r=new Array,n=xe.getChildIdx(e,t),i=0;i<n.length;i++)r.push(tt.hex2attrTypeValue(e,n[i]));return r=r.map(function(o){return o.replace("+","\\+")}),r.join("+")};tt.hex2attrTypeValue=function(e,t){var r=xe,n=r.getV;if(t===void 0&&(t=0),e.substr(t,2)!=="30")throw new Error("malformed attribute type and value");var i=r.getChildIdx(e,t);i.length!==2||e.substr(i[0],2);var o=n(e,i[0]),s=A.asn1.ASN1Util.oidHexToInt(o),a=A.asn1.x509.OID.oid2atype(s),u=n(e,i[1]),l=ps(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 pj=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=ps(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:ps(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=ps(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=hs(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 _=nd(g),C=nd(w),F=_+"."+C,H="";if(E.substr(0,4)=="Hmac"){if(n===void 0)throw"mac key shall be specified for HS* alg";var K=new p({alg:E,prov:"cryptojs",pass:n});K.updateString(F),H=K.doFinal()}else if(E.indexOf("withECDSA")!=-1){var S=new d({alg:E});S.init(n,i),S.updateString(F);var I=S.sign();H=A.crypto.ECDSA.asn1SigToConcatSig(I)}else if(E!="none"){var S=new d({alg:E});S.init(n,i),S.updateString(F),H=S.sign()}var q=Or(H);return F+"."+q};A.jws.JWS.verify=function(e,t,r){var n=A,i=n.jws,o=i.JWS,s=o.readSafeJSONString,a=n.crypto,u=a.ECDSA,l=a.Mac,h=a.Signature,m;if(typeof at!==void 0&&(m=at),!gy(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(),wC(y,S)}else if(F.indexOf("withECDSA")!=-1){var q=null;try{q=u.concatSigToASN1Sig(y)}catch{return!1}var L=new h({alg:F});return L.init(t),L.updateString(g),L.verify(q)}else{var L=new h({alg:F});return L.init(t),L.updateString(g),L.verify(y)}};A.jws.JWS.parse=function(e){var t=e.split("."),r={},n,i,o;if(t.length!=2&&t.length!=3)throw"malformed sJWS: wrong number of '.' splitted elements";return n=t[0],i=t[1],t.length==3&&(o=t[2]),r.headerObj=A.jws.JWS.readSafeJSONString(Di(n)),r.payloadObj=A.jws.JWS.readSafeJSONString(Di(i)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadObj==null?r.payloadPP=Di(i):r.payloadPP=JSON.stringify(r.payloadObj,null," "),o!==void 0&&(r.sigHex=rr(o)),r};A.jws.JWS.verifyJWT=function(e,t,r){var n=A,i=n.jws,o=i.JWS,s=o.readSafeJSONString,a=o.inArray,u=o.includedArray;if(!gy(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=fC(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=fC(e),typeof t!="object"||t.constructor===Array?null:t}catch{return null}};A.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(t==null)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]};A.jws.JWS.getJWKthumbprint=function(e){if(e.kty!=="RSA"&&e.kty!=="EC"&&e.kty!=="oct")throw new Error("unsupported algorithm for JWK Thumprint");var t="{";if(e.kty==="RSA"){if(typeof e.n!="string"||typeof e.e!="string")throw new Error("wrong n and e value for RSA key");t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if(e.kty==="EC"){if(typeof e.crv!="string"||typeof e.x!="string"||typeof e.y!="string")throw new Error("wrong crv, x and y value for EC key");t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if(e.kty==="oct"){if(typeof e.k!="string")throw new Error("wrong k value for oct(symmetric) key");t+='"k":"'+e.k+'",',t+='"kty":"'+e.kty+'"}'}var r=ao(t),n=A.crypto.Util.hashHex(r,"sha256"),i=Or(n);return i};A.jws.IntDate={};A.jws.IntDate.get=function(e){var t=A.jws.IntDate,r=t.getNow,n=t.getZulu;if(e=="now")return r();if(e=="now + 1hour")return r()+3600;if(e=="now + 1day")return r()+3600*24;if(e=="now + 1month")return r()+3600*24*30;if(e=="now + 1year")return r()+3600*24*365;if(e.match(/Z$/))return n(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e};A.jws.IntDate.getZulu=function(e){return mC(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=sf;$e.rng_seed_time=fy;$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=pj;$e.CryptoJS=ke;$e.b64tohex=tf;$e.b64toBA=oC;$e.ECFieldElementFp=Nr;$e.ECPointFp=Lt;$e.ECCurveFp=ha;$e.stoBA=hC;$e.BAtos=dC;$e.BAtohex=g1;$e.stohex=ds;$e.stob64=Wq;$e.stob64u=Yq;$e.b64utos=Xq;$e.b64tob64u=ef;$e.b64utob64=od;$e.hex2b64=fa;$e.hextob64u=Or;$e.b64utohex=rr;$e.utf8tob64u=nd;$e.b64utoutf8=Di;$e.utf8tob64=Zq;$e.b64toutf8=Jq;$e.utf8tohex=v1;$e.hextoutf8=zt;$e.hextorstr=ps;$e.rstrtohex=ao;$e.hextob64=hy;$e.hextob64nl=tj;$e.b64nltohex=pC;$e.hextopem=An;$e.pemtohex=lr;$e.hextoArrayBuffer=sj;$e.ArrayBuffertohex=ij;$e.zulutomsec=dy;$e.msectozulu=oj;$e.zulutosec=mC;$e.zulutodate=aj;$e.datetozulu=uj;$e.uricmptohex=y1;$e.hextouricmp=E1;$e.ipv6tohex=iy;$e.hextoipv6=oy;$e.hextoip=f1;$e.iptohex=py;$e.ucs2hextoutf8=my;$e.encodeURIComponentAll=b1;$e.newline_toUnix=cj;$e.newline_toDos=lj;$e.hextoposhex=ay;$e.intarystrtohex=fj;$e.strdiffidx=hj;$e.oidtohex=EC;$e.hextooid=A1;$e.strpad=h1;$e.bitstrtoint=AC;$e.inttobitstr=SC;$e.bitstrtobinstr=_C;$e.binstrtobitstr=dj;$e.isBase64URLDot=gy;$e.namearraytobinstr=d1;$e.extendClass=Ee;$e.foldnl=w1;$e.b64topem=rj;$e.pemtob64=nj;$e.timeogen=gC;$e.aryval=Jt;$e.inttohex=bC;$e.twoscompl=ad;$e.timingSafeEqual=wC;$e.timingSafeEqualImpl=yC;$e.KJUR=A;$e.crypto=A.crypto;$e.asn1=A.asn1;$e.jws=A.jws;$e.lang=A.lang;$e.VERSION=SH;$e.VERSION_FULL=_H});var Id=be(hm=>{"use strict";var _fe=B(x());Object.defineProperty(hm,"__esModule",{value:!0});hm.AddressError=void 0;var Jy=class extends Error{constructor(t,r){super(t),this.name="AddressError",this.parseMessage=r}};hm.AddressError=Jy});var dm=be(ti=>{"use strict";var Dfe=B(x());Object.defineProperty(ti,"__esModule",{value:!0});ti.isInSubnet=IK;ti.isHostInSubnet=Qy;ti.isGloballyReachable=xK;ti.offsetBigInt=$K;ti.isCorrect=PK;ti.prefixLengthFromMask=kK;ti.assertByteArray=RK;ti.numberToPaddedHex=M8;ti.stringToPaddedHex=TK;ti.testBit=OK;var Tc=Id();function IK(e){return this.subnetMask<e.subnetMask?!1:Qy.call(this,e)}function Qy(e){return this.binaryZeroPad().length!==e.binaryZeroPad().length?!1:this.mask(e.subnetMask)===e.mask()}function xK(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];n.reachable!==null&&Qy.call(this,n.subnet)&&(t===null||n.subnet.subnetMask>t.subnet.subnetMask)&&(t=n)}return t===null?!0:t.reachable}function $K(e,t,r,n){if(typeof t=="number"&&!Number.isSafeInteger(t))throw new Tc.AddressError(`${n} offset must be an integer`);if(typeof t!="number"&&typeof t!="bigint")throw new Tc.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 Tc.AddressError(`${n} offset leaves the address space`);return i}function PK(e){return function(){return this.addressMinusSuffix!==this.correctForm()?!1:this.subnetMask===e&&!this.parsedSubnet?!0:this.parsedSubnet===String(this.subnetMask)}}function kK(e,t){let r=e.toString(2).padStart(t,"0");if(r.length>t)throw new Tc.AddressError("Invalid subnet mask.");let n=r.indexOf("0");if(n===-1)return t;if(r.slice(n).includes("1"))throw new Tc.AddressError("Invalid subnet mask.");return n}function RK(e,t,r,n){if(e.length!==t)throw new Tc.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 Tc.AddressError(`All bytes must be integers between ${n} and 255`)}function M8(e){return e.toString(16).padStart(2,"0")}function TK(e){return M8(parseInt(e,10))}function OK(e,t){let{length:r}=e;if(t>=r)return!1;let n=r-t-1;return e.substring(n,n+1)==="1"}});var eE=be(ri=>{"use strict";var Bfe=B(x());Object.defineProperty(ri,"__esModule",{value:!0});ri.SPECIAL_PURPOSE=ri.RE_SUBNET_STRING=ri.RE_ADDRESS=ri.GROUPS=ri.BITS=void 0;ri.BITS=32;ri.GROUPS=4;ri.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;ri.RE_SUBNET_STRING=/\/\d{1,2}$/;ri.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 tE=be(yo=>{"use strict";var xfe=B(x()),NK=yo&&yo.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),LK=yo&&yo.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),q8=yo&&yo.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&NK(t,e,r);return LK(t,e),t};Object.defineProperty(yo,"__esModule",{value:!0});yo.Address4=void 0;var Ts=q8(dm()),fr=q8(eE()),Ti=Id(),UK=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=UK,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 Ti.AddressError("Invalid subnet mask.");t=t.replace(fr.RE_SUBNET_STRING,"")}let n=fr.GROUPS*4-1;if(t.length>n)throw new Ti.AddressError(`IPv4 addresses are at most ${n} characters.`);this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}static isValid(t){try{return new e(t),!0}catch{return!1}}parse(t){let r=t.split(".");if(r.some(n=>/^0\d/.test(n)))throw new Ti.AddressError("IPv4 addresses can't have leading zeroes.");if(!t.match(fr.RE_ADDRESS))throw new Ti.AddressError("Invalid IPv4 address.");return r}correctForm(){return this.parsedAddress.map(t=>parseInt(t,10)).join(".")}static fromAddressAndMask(t,r){let n=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 Ti.AddressError("Wildcard pattern must have 4 octets");let n=-1;for(let a=0;a<r.length;a++)if(r[a]==="*")n===-1&&(n=a);else if(n!==-1)throw new Ti.AddressError("Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)");let i=n===-1?0:r.length-n,o=r.map(a=>a==="*"?"0":a),s=fr.BITS-i*8;return new e(`${o.join(".")}/${s}`)}static fromHex(t){let r=t.replace(/:/g,"");if(!/^[0-9a-fA-F]{8}$/.test(r))throw new Ti.AddressError("IPv4 hex must be exactly 8 hex digits");let n=[];for(let i=0;i<8;i+=2)n.push(parseInt(r.slice(i,i+2),16));return new e(n.join("."))}static fromInteger(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new Ti.AddressError("IPv4 integer must be in the range 0 to 2**32 - 1");return e.fromHex(t.toString(16).padStart(8,"0"))}static fromArpa(t){let r=fr.GROUPS*4-1+3+14;if(t.length>r)throw new Ti.AddressError(`in-addr.arpa names are at most ${r} characters.`);let i=t.replace(/(\.in-addr\.arpa)?\.?$/i,"").split(".").reverse().join(".");return new e(i)}toHex(){return this.parsedAddress.map(t=>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 Ti.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");return e.fromHex(t.toString(16).padStart(8,"0"))}static fromByteArray(t){return Ts.assertByteArray(t,4,"IPv4",0),this.fromUnsignedByteArray(t)}static fromUnsignedByteArray(t){if(t.length!==4)throw new Ti.AddressError("IPv4 addresses require exactly 4 bytes");let r=t.join(".");return new e(r)}mask(t){return t===void 0&&(t=this.subnetMask),this.getBitsBase2(0,t)}getBitsBase2(t,r){return this.binaryZeroPad().slice(t,r)}reverseForm(t){t||(t={});let r=this.correctForm().split(".").reverse().join(".");return t.omitSuffix?r:`${r}.in-addr.arpa.`}isMulticast(){return this.isHostInSubnet(HK)}isPrivate(){return MK.some(t=>this.isHostInSubnet(t))}isLoopback(){return this.isHostInSubnet(qK)}isLinkLocal(){return this.isHostInSubnet(jK)}isUnspecified(){return this.isHostInSubnet(KK)}isBroadcast(){return this.isHostInSubnet(VK)}isCGNAT(){return this.isHostInSubnet(GK)}isDocumentation(){return zK.some(t=>this.isHostInSubnet(t))}isBenchmarking(){return this.isHostInSubnet(WK)}isReserved(){return this.isHostInSubnet(YK)}isGlobal(){return!this.isMulticast()&&Ts.isGloballyReachable.call(this,XK)}binaryZeroPad(){return this._binaryZeroPad===void 0&&(this._binaryZeroPad=this.bigInt().toString(2).padStart(fr.BITS,"0")),this._binaryZeroPad}groupForV6(){let t=this.parsedAddress;return this.correctForm().replace(fr.RE_ADDRESS,`<span class="hover-group group-v4 group-6">${t.slice(0,2).join(".")}</span>.<span class="hover-group group-v4 group-7">${t.slice(2,4).join(".")}</span>`)}};yo.Address4=Yr;var HK=new Yr("224.0.0.0/4"),MK=[new Yr("10.0.0.0/8"),new Yr("172.16.0.0/12"),new Yr("192.168.0.0/16")],qK=new Yr("127.0.0.0/8"),jK=new Yr("169.254.0.0/16"),KK=new Yr("0.0.0.0/32"),VK=new Yr("255.255.255.255/32"),GK=new Yr("100.64.0.0/10"),zK=[new Yr("192.0.2.0/24"),new Yr("198.51.100.0/24"),new Yr("203.0.113.0/24")],WK=new Yr("198.18.0.0/15"),YK=new Yr("240.0.0.0/4"),XK=fr.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new Yr(e),reachable:t}))});var rE=be(sr=>{"use strict";var Pfe=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 nE=be(Oc=>{"use strict";var Rfe=B(x());Object.defineProperty(Oc,"__esModule",{value:!0});Oc.escapeHtml=pm;Oc.spanAllZeroes=j8;Oc.spanAll=ZK;Oc.spanLeadingZeroes=JK;Oc.simpleGroup=QK;function pm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function j8(e){return pm(e).replace(/(0+)/g,'<span class="zero">$1</span>')}function ZK(e,t=0){return e.split("").map((n,i)=>`<span class="digit value-${pm(n)} position-${i+t}">${j8(n)}</span>`).join("")}function K8(e){return pm(e).replace(/^(0+)/,'<span class="zero">$1</span>')}function JK(e){return e.split(":").map(r=>K8(r)).join(":")}function QK(e,t=0){return e.split(":").map((n,i)=>/group-v4/.test(n)?n:`<span class="hover-group group-${i+t}">${K8(n)}</span>`)}});var V8=be(ws=>{"use strict";var Ofe=B(x()),eV=ws&&ws.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),tV=ws&&ws.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),rV=ws&&ws.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&eV(t,e,r);return tV(t,e),t};Object.defineProperty(ws,"__esModule",{value:!0});ws.ADDRESS_BOUNDARY=void 0;ws.groupPossibilities=gm;ws.padGroup=mm;ws.simpleRegularExpression=sV;ws.possibleElisions=iV;var nV=rV(rE());function gm(e){return`(${e.join("|")})`}function mm(e){return e.length<4?`0{0,${4-e.length}}${e}`:e}ws.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]";function sV(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===nV.GROUPS-1?":":"";return gm([mm(i),s])}return mm(i)}).join(":"));return r.push(e.map(mm).join(":")),gm(r)}function iV(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 gm(o)}});var Y8=be(Ao=>{"use strict";var Lfe=B(x()),oV=Ao&&Ao.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),aV=Ao&&Ao.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),ym=Ao&&Ao.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&oV(t,e,r);return aV(t,e),t};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.Address6=void 0;var bo=ym(dm()),sE=ym(eE()),Ct=ym(rE()),Nc=ym(nE()),Eo=tE(),Lc=V8(),Xr=Id(),vm=dm(),uV=bo.isCorrect(Ct.BITS);function wm(e){if(!e)throw new Error("Assertion failed.")}function cV(e){let t=/(\d+)(\d{3})/;for(;t.test(e);)e=e.replace(t,"$1,$2");return e}function lV(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 fV(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 G8(e){return parseInt(e,16).toString(16).padStart(4,"0")}function z8(e){return e&255}var In=class e{constructor(t,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=bo.isInSubnet,this.isHostInSubnet=bo.isHostInSubnet,this.isCorrect=uV,r===void 0?this.groups=Ct.GROUPS:this.groups=r,this.address=t;let n=Ct.RE_SUBNET_STRING.exec(t);if(n){if(this.parsedSubnet=n[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>Ct.BITS)throw new Xr.AddressError("Invalid subnet mask.");t=t.replace(Ct.RE_SUBNET_STRING,"")}if(/\//.test(t))throw new Xr.AddressError("Invalid subnet mask.");let i=t.indexOf("%");i!==-1&&/^.*$/.test(t.slice(i))&&(this.zone=t.slice(i),t=t.slice(0,i));let o=this.groups*5+5;if(t.length>o)throw new Xr.AddressError(`IPv6 addresses are at most ${o} characters.`);this.addressMinusSuffix=t,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(t){try{return new e(t),!0}catch{return!1}}static fromBigInt(t){if(t<BigInt(0)||t>(BigInt(1)<<BigInt(Ct.BITS))-BigInt(1))throw new Xr.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");let r=t.toString(16).padStart(32,"0"),n=[];for(let i=0;i<Ct.GROUPS;i++)n.push(r.slice(i*4,(i+1)*4));return new e(n.join(":"))}static fromURL(t){var r;let n,i=null,o,s,a=t.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"");if(a.indexOf("[")!==-1&&a.indexOf("]:")!==-1){if(s="failed to parse address with port",o=Ct.RE_URL_WITH_PORT.exec(a),o===null)return{error:s,address:null,port:null};n=o[1],i=o[2]}else{if(s="failed to parse address from URL",o=Ct.RE_URL.exec(a),o===null)return{error:s,address:null,port:null};n=(r=o[1])!==null&&r!==void 0?r:o[2]}i?(i=parseInt(i,10),(i<0||i>65535)&&(i=null)):i=null;let u;try{u=new e(n)}catch{return{error:s,address:null,port:null}}return{address:u,port:i}}static fromAddressAndMask(t,r){let n=bo.prefixLengthFromMask(new e(r).bigInt(),Ct.BITS);return new e(`${t}/${n}`)}static fromAddressAndWildcardMask(t,r){let n=new e(r).bigInt(),i=(BigInt(1)<<BigInt(Ct.BITS))-BigInt(1),o=n^i,s=bo.prefixLengthFromMask(o,Ct.BITS);return new e(`${t}/${s}`)}static fromWildcard(t){if(t.includes("%")||t.includes("/"))throw new Xr.AddressError("Wildcard pattern must not include a zone or CIDR suffix");let r=t.split("::");if(r.length>2)throw new Xr.AddressError("Wildcard pattern cannot contain more than one '::'");let n;if(r.length===2){let u=r[0]===""?[]:r[0].split(":"),l=r[1]===""?[]:r[1].split(":"),h=Ct.GROUPS-u.length-l.length;if(h<1)throw new Xr.AddressError("Wildcard pattern with '::' has too many groups");n=[...u,...new Array(h).fill("0"),...l]}else n=t.split(":");if(n.length!==Ct.GROUPS)throw new Xr.AddressError("Wildcard pattern must have 8 groups");let i=-1;for(let u=0;u<n.length;u++)if(n[u]==="*")i===-1&&(i=u);else if(i!==-1)throw new Xr.AddressError("Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)");let o=i===-1?0:n.length-i,s=n.map(u=>u==="*"?"0":u),a=Ct.BITS-o*16;return new e(`${s.join(":")}/${a}`)}static fromAddress4(t){let r=new Eo.Address4(t),n=Ct.BITS-(sE.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":cV((BigInt("2")**BigInt(i)).toString(10))}_startAddress(){return BigInt(`0b${this.mask()+"0".repeat(Ct.BITS-this.subnetMask)}`)}startAddress(){return e.fromBigInt(this._startAddress())}startAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._startAddress()+t)}_endAddress(){return BigInt(`0b${this.mask()+"1".repeat(Ct.BITS-this.subnetMask)}`)}endAddress(){return e.fromBigInt(this._endAddress())}endAddressExclusive(){let t=BigInt("1");return e.fromBigInt(this._endAddress()-t)}offset(t){return e.fromBigInt(bo.offsetBigInt(this.bigInt(),t,Ct.BITS,"IPv6")).withSubnetMask(this.subnetMask)}nextNetwork(){return e.fromBigInt(bo.offsetBigInt(this._endAddress(),1,Ct.BITS,"IPv6")).withSubnetMask(this.subnetMask)}withSubnetMask(t){return new e(`${this.correctForm()}/${t}`)}subnetMaskAddress(){return e.fromBigInt(BigInt(`0b${"1".repeat(this.subnetMask)}${"0".repeat(Ct.BITS-this.subnetMask)}`))}wildcardMask(){return e.fromBigInt(BigInt(`0b${"0".repeat(this.subnetMask)}${"1".repeat(Ct.BITS-this.subnetMask)}`))}networkForm(){return`${this.startAddress().correctForm()}/${this.subnetMask}`}getScope(){let t=this.getType();return t==="Multicast"||t.startsWith("Multicast ")?Ct.SCOPES[parseInt(this.getBits(12,16).toString(10),10)]||"Unknown":t==="Link-local unicast"||t==="Loopback"?"Link local":t==="Unspecified"?"Unknown":"Global"}getType(){for(let t=0;t<W8.length;t++){let r=W8[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=fV(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===sE.GROUPS&&i.every(s=>/^\d{1,3}$/.test(s))&&i.some(s=>/^0\d/.test(s))){let s=i.map(lV).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(sE.RE_ADDRESS);if(o){this.parsedAddress4=o[0];let s=this.subnetMask>=96?`/${this.subnetMask-96}`:"";this.address4=new Eo.Address4(`${this.parsedAddress4}${s}`),this.v4=!0,r[r.length-1]=this.address4.toGroup6(),t=r.join(":")}return t}parse(t){t=this.parse4in6(t);let r=t.match(Ct.RE_BAD_CHARACTERS);if(r)throw new Xr.AddressError(`Bad character${r.length>1?"s":""} detected in address: ${r.join("")}`,t.replace(Ct.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let n=t.match(Ct.RE_BAD_ADDRESS);if(n)throw new Xr.AddressError(`Address failed regex: ${n.join("")}`,t.replace(Ct.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let i=[],o=t.split("::");if(o.length===2){let s=o[0].split(":"),a=o[1].split(":");s.length===1&&s[0]===""&&(s=[]),a.length===1&&a[0]===""&&(a=[]);let u=this.groups-(s.length+a.length);if(!u)throw new Xr.AddressError("Error parsing groups");this.elidedGroups=u,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,i=i.concat(s);for(let l=0;l<u;l++)i.push("0");i=i.concat(a)}else if(o.length===1)i=t.split(":"),this.elidedGroups=0;else throw new Xr.AddressError("Too many :: groups found");if(i=i.map(s=>parseInt(s,16).toString(16)),i.length!==this.groups)throw new Xr.AddressError("Incorrect number of groups found");return i}canonicalForm(){return this.parsedAddress.map(G8).join(":")}decimal(){return this.parsedAddress.map(t=>parseInt(t,16).toString(10).padStart(5,"0")).join(":")}bigInt(){return BigInt(`0x${this.parsedAddress.map(G8).join("")}`)}to4(){let t=this.binaryZeroPad().split(""),r=BigInt(`0b${t.slice(96,128).join("")}`).toString(16).padStart(8,"0");if(this.subnetMask>=96){let n=this.subnetMask-96,i=[];for(let o=0;o<8;o+=2)i.push(parseInt(r.slice(o,o+2),16));return new Eo.Address4(`${i.join(".")}/${n}`)}return Eo.Address4.fromHex(r)}to4in6(){let t=this.to4(),n=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),i="";return/:$/.test(n)||(i=":"),n+i+t.correctForm()}inspectTeredo(){let t=this.getBitsBase16(0,32),n=(this.getBits(80,96)^BigInt("0xffff")).toString(),i=Eo.Address4.fromHex(this.getBitsBase16(32,64)),o=this.getBits(96,128),s=Eo.Address4.fromHex((o^BigInt("0xffffffff")).toString(16).padStart(8,"0")),a=this.getBitsBase2(64,80),u=(0,vm.testBit)(a,15),l=(0,vm.testBit)(a,14),h=(0,vm.testBit)(a,8),m=(0,vm.testBit)(a,9),p=BigInt(`0b${a.slice(2,6)+a.slice(8,16)}`).toString(10);return{prefix:`${t.slice(0,4)}:${t.slice(4,8)}`,server4:i.address,client4:s.address,flags:a,coneNat:u,microsoft:{reserved:l,universalLocal:m,groupIndividual:h,nonce:p},udpPort:n}}inspect6to4(){let t=this.getBitsBase16(0,16),r=Eo.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:t.slice(0,4),gateway:r.address}}to6to4(){if(!this.is4())return null;let t=["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":");return new e(t)}static fromAddress4Nat64(t,r="64:ff9b::/96"){let n=new Eo.Address4(t),i=new e(r),o=i.subnetMask;if(o!==32&&o!==40&&o!==48&&o!==56&&o!==64&&o!==96)throw new Xr.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");let s=i.binaryZeroPad(),a=n.binaryZeroPad(),u;if(o===96)u=s.slice(0,96)+a;else{let m=64-o;u=[s.slice(0,o),a.slice(0,m),"00000000",a.slice(m),"0".repeat(56-(32-m))].join("")}let l=BigInt(`0b${u}`).toString(16).padStart(32,"0"),h=[];for(let m=0;m<8;m++)h.push(l.slice(m*4,(m+1)*4));return new e(h.join(":"))}toAddress4Nat64(t="64:ff9b::/96"){let r=new e(t),n=r.subnetMask;if(n!==32&&n!==40&&n!==48&&n!==56&&n!==64&&n!==96)throw new Xr.AddressError("NAT64 prefix length must be 32, 40, 48, 56, 64, or 96");if(!this.isHostInSubnet(r))return null;let i=this.binaryZeroPad(),o;if(n===96)o=i.slice(96,128);else{let a=64-n;o=i.slice(n,n+a)+i.slice(72,72+(32-a))}let s=[];for(let a=0;a<4;a++)s.push(parseInt(o.slice(a*8,(a+1)*8),2).toString());return new Eo.Address4(s.join("."))}toByteArray(){let t=this.bigInt().toString(16).padStart(Ct.BITS/4,"0"),r=[];for(let n=0,i=t.length;n<i;n+=2)r.push(parseInt(t.substring(n,n+2),16));return r}toUnsignedByteArray(){return this.toByteArray().map(z8)}static fromByteArray(t){return bo.assertByteArray(t,16,"IPv6",-128),this.fromUnsignedByteArray(t.map(z8))}static fromUnsignedByteArray(t){bo.assertByteArray(t,16,"IPv6",0);let r=BigInt("256"),n=BigInt("0"),i=BigInt("1");for(let o=t.length-1;o>=0;o--)n+=i*BigInt(t[o].toString(10)),i*=r;return e.fromBigInt(n)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){let t=this.embeddedIPv4();return t?t.isLinkLocal():this.isHostInSubnet(mV)}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(EV)}embeddedIPv4(){return this.isMapped4()||this.isHostInSubnet(bV)?this.to4():null}isTeredo(){return this.isHostInSubnet(hV)}is6to4(){return this.isHostInSubnet(dV)}isLoopback(){let t=this.embeddedIPv4();return t?t.isLoopback():this.getType()==="Loopback"}isULA(){return this.isHostInSubnet(pV)}isPrivate(){let t=this.embeddedIPv4();return t?t.isPrivate():this.isULA()||this.isHostInSubnet(AV)}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 gV.some(t=>this.isHostInSubnet(t))}isBenchmarking(){let t=this.embeddedIPv4();return t?t.isBenchmarking():this.isHostInSubnet(vV)}isGlobal(){let t=this.embeddedIPv4();return t?t.isGlobal():this.isHostInSubnet(wV)&&bo.isGloballyReachable.call(this,yV)}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(":");wm(typeof this.elidedGroups=="number"),wm(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()&&(wm(this.address4 instanceof Eo.Address4),t.pop(),t.push(this.address4.groupForV6())),t.join(":")}regularExpressionString(t=!1){let r=[],n=new e(this.correctForm());if(n.elidedGroups===0)r.push((0,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(":"))),wm(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")}};Ao.Address6=In;var W8=Object.keys(Ct.TYPES).map(e=>[new In(e),Ct.TYPES[e]]),hV=new In("2001::/32"),dV=new In("2002::/16"),pV=new In("fc00::/7"),mV=new In("fe80::/10"),gV=[new In("2001:db8::/32"),new In("3fff::/20")],vV=new In("2001:2::/48"),wV=new In("2000::/3"),yV=Ct.SPECIAL_PURPOSE.map(([e,,t])=>({subnet:new In(e),reachable:t})),EV=new In("::ffff:0:0/96"),bV=new In("64:ff9b::/96"),AV=new In("64:ff9b:1::/48")});var X8=be(xn=>{"use strict";var Hfe=B(x()),SV=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]})),_V=xn&&xn.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),CV=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)&&SV(t,e,r);return _V(t,e),t};Object.defineProperty(xn,"__esModule",{value:!0});xn.v6=xn.AddressError=xn.Address6=xn.Address4=void 0;var DV=tE();Object.defineProperty(xn,"Address4",{enumerable:!0,get:function(){return DV.Address4}});var FV=Y8();Object.defineProperty(xn,"Address6",{enumerable:!0,get:function(){return FV.Address6}});var BV=Id();Object.defineProperty(xn,"AddressError",{enumerable:!0,get:function(){return BV.AddressError}});var IV=CV(nE());xn.v6={helpers:IV}});var eD=be(Q8=>{"use strict";var Kfe=B(x());(function(e){function t(){}function r(){}var n=String.fromCharCode,i={}.toString,o=i.call(e.SharedArrayBuffer),s=i(),a=e.Uint8Array,u=a||Array,l=a?ArrayBuffer:u,h=l.isView||function(v){return v&&"length"in v},m=i.call(l.prototype);l=r.prototype;var p=e.TextEncoder,d=new(a?Uint16Array:u)(32);t.prototype.decode=function(v){if(!h(v)){var g=i.call(v);if(g!==m&&g!==o&&g!==s)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");v=a?new u(v):v||[]}for(var y=g="",w=0,E=v.length|0,_=E-32|0,C,F,H=0,K=0,S,I=0,q=-1;w<E;){for(C=w<=_?32:E-w|0;I<C;w=w+1|0,I=I+1|0){switch(F=v[w]&255,F>>4){case 15:if(S=v[w=w+1|0]&255,S>>6!==2||247<F){w=w-1|0;break}H=(F&7)<<6|S&63,K=5,F=256;case 14:S=v[w=w+1|0]&255,H<<=6,H|=(F&15)<<6|S&63,K=S>>6===2?K+4|0:24,F=F+256&768;case 13:case 12:S=v[w=w+1|0]&255,H<<=6,H|=(F&31)<<6|S&63,K=K+7|0,w<E&&S>>6===2&&H>>K&&1114112>H?(F=H,H=H-65536|0,0<=H&&(q=(H>>10)+55296|0,F=(H&1023)+56320|0,31>I?(d[I]=q,I=I+1|0,q=-1):(S=q,q=F,F=S))):(F>>=8,w=w-F-1|0,F=65533),H=K=0,C=w<=_?32:E-w|0;default:d[I]=F;continue;case 11:case 10:case 9:case 8:}d[I]=65533}if(y+=n(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15],d[16],d[17],d[18],d[19],d[20],d[21],d[22],d[23],d[24],d[25],d[26],d[27],d[28],d[29],d[30],d[31]),32>I&&(y=y.slice(0,I-32|0)),w<E){if(d[0]=q,I=~q>>>31,q=-1,y.length<g.length)continue}else q!==-1&&(y+=n(q));g+=y,y=""}return g},l.encode=function(v){v=v===void 0?"":""+v;var g=v.length|0,y=new u((g<<1)+8|0),w,E=0,_=!a;for(w=0;w<g;w=w+1|0,E=E+1|0){var C=v.charCodeAt(w)|0;if(127>=C)y[E]=C;else{if(2047>=C)y[E]=192|C>>6;else{e:{if(55296<=C)if(56319>=C){var F=v.charCodeAt(w=w+1|0)|0;if(56320<=F&&57343>=F){if(C=(C<<10)+F-56613888|0,65535<C){y[E]=240|C>>18,y[E=E+1|0]=128|C>>12&63,y[E=E+1|0]=128|C>>6&63,y[E=E+1|0]=128|C&63;continue}break e}C=65533}else 57343>=C&&(C=65533);!_&&w<<1<E&&w<<1<(E-7|0)&&(_=!0,F=new u(3*g),F.set(y),y=F)}y[E]=224|C>>12,y[E=E+1|0]=128|C>>6&63}y[E=E+1|0]=128|C&63}}return a?y.subarray(0,E):y.slice(0,E)},p||(e.TextDecoder=t,e.TextEncoder=r)})(typeof global>"u"?typeof self>"u"?Q8:self:global)});var SI=be(wA=>{"use strict";var v2e=B(x());wA.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};wA.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 _I=be(yA=>{"use strict";var y2e=B(x());yA.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};yA.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 CI=be(EA=>{"use strict";var b2e=B(x());EA.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};EA.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 DI=be(bA=>{"use strict";var S2e=B(x());bA.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};bA.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 FI=be(AA=>{"use strict";var C2e=B(x());AA.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}`};AA.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 xI=be((II,SA)=>{var D2e=B(x()),BI=(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 BI}):typeof SA=="object"&&typeof II=="object"&&(SA.exports=BI)});var kI=be(Ye=>{"use strict";var B2e=B(x()),Xe=aa().Buffer,Ga=SI(),SY=_I(),_Y=CI(),Ug=DI(),_A=FI(),ll=xI(),CY=0,$I=32768,CA=32768,DY=~CA,PI=32768,FY=~PI,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"?$I:CY;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&$I?"response":"query",flags:r&32767,flag_qr:(r>>15&1)===1,opcode:_Y.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:SY.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 Na=Ye.unknown={};Na.encode=function(e,t,r){return t||(t=Xe.alloc(Na.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),Na.encode.bytes=e.length+2,t};Na.encode.bytes=0;Na.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return Na.decode.bytes=r+2,n};Na.decode.bytes=0;Na.encodingLength=function(e){return e.length+2};var La=Ye.ns={};La.encode=function(e,t,r){return t||(t=Xe.alloc(La.encodingLength(e))),r||(r=0),Le.encode(e,t,r+2),t.writeUInt16BE(Le.encode.bytes,r),La.encode.bytes=Le.encode.bytes+2,t};La.encode.bytes=0;La.decode=function(e,t){t||(t=0);let r=e.readUInt16BE(t),n=Le.decode(e,t+2);return La.decode.bytes=r+2,n};La.decode.bytes=0;La.encodingLength=function(e){return Le.encodingLength(e)+2};var Ua=Ye.soa={};Ua.encode=function(e,t,r){t||(t=Xe.alloc(Ua.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),Ua.encode.bytes=r-n,t};Ua.encode.bytes=0;Ua.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,Ua.decode.bytes=t-r,n};Ua.decode.bytes=0;Ua.encodingLength=function(e){return 22+Le.encodingLength(e.mname)+Le.encodingLength(e.rname)};var Ha=Ye.txt={};Ha.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(Ha.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),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=[];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 Ha.decode.bytes=t-r,i};Ha.decode.bytes=0;Ha.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 Ma=Ye.null={};Ma.encode=function(e,t,r){t||(t=Xe.alloc(Ma.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),Ma.encode.bytes=r-n,t};Ma.encode.bytes=0;Ma.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,Ma.decode.bytes=t-r,i};Ma.decode.bytes=0;Ma.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 qi=Ye.ptr={},BY=Ye.cname=qi,IY=Ye.dname=qi;qi.encode=function(e,t,r){return t||(t=Xe.alloc(qi.encodingLength(e))),r||(r=0),Le.encode(e,t,r+2),t.writeUInt16BE(Le.encode.bytes,r),qi.encode.bytes=Le.encode.bytes+2,t};qi.encode.bytes=0;qi.decode=function(e,t){t||(t=0);let r=Le.decode(e,t+2);return qi.decode.bytes=Le.decode.bytes+2,r};qi.decode.bytes=0;qi.encodingLength=function(e){return Le.encodingLength(e)+2};var ja=Ye.srv={};ja.encode=function(e,t,r){t||(t=Xe.alloc(ja.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),ja.encode.bytes=n+2,t};ja.encode.bytes=0;ja.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),ja.decode.bytes=r+2,n};ja.decode.bytes=0;ja.encodingLength=function(e){return 8+Le.encodingLength(e.target)};var Os=Ye.caa={};Os.ISSUER_CRITICAL=128;Os.encode=function(e,t,r){let n=Os.encodingLength(e);return t||(t=Xe.alloc(Os.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=Os.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),Os.encode.bytes=n,t};Os.encode.bytes=0;Os.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&Os.ISSUER_CRITICAL),Os.decode.bytes=r+2,i};Os.decode.bytes=0;Os.encodingLength=function(e){return St.encodingLength(e.tag)+St.encodingLength(e.value)+2};var ec=Ye.mx={};ec.encode=function(e,t,r){t||(t=Xe.alloc(ec.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),ec.encode.bytes=r-n,t};ec.encode.bytes=0;ec.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,ec.decode.bytes=t-r,n};ec.encodingLength=function(e){return 4+Le.encodingLength(e.exchange)};var Ka=Ye.a={};Ka.encode=function(e,t,r){return t||(t=Xe.alloc(Ka.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,ll.v4.encode(e,t,r),Ka.encode.bytes=6,t};Ka.encode.bytes=0;Ka.decode=function(e,t){t||(t=0),t+=2;let r=ll.v4.decode(e,t);return Ka.decode.bytes=6,r};Ka.decode.bytes=0;Ka.encodingLength=function(){return 6};var Va=Ye.aaaa={};Va.encode=function(e,t,r){return t||(t=Xe.alloc(Va.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,ll.v6.encode(e,t,r),Va.encode.bytes=18,t};Va.encode.bytes=0;Va.decode=function(e,t){t||(t=0),t+=2;let r=ll.v6.decode(e,t);return Va.decode.bytes=18,r};Va.decode.bytes=0;Va.encodingLength=function(){return 18};var bs=Ye.option={};bs.encode=function(e,t,r){t||(t=Xe.alloc(bs.encodingLength(e))),r||(r=0);let n=r,i=_A.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 bs.encode.bytes=r-n,t};bs.encode.bytes=0;bs.decode=function(e,t){t||(t=0);let r={};r.code=e.readUInt16BE(t),r.type=_A.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 bs.decode.bytes=n+4,r};bs.decode.bytes=0;bs.encodingLength=function(e){if(e.data)return e.data.length+4;switch(_A.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 Ls=Ye.opt={};Ls.encode=function(e,t,r){t||(t=Xe.alloc(Ls.encodingLength(e))),r||(r=0);let n=r,i=Yf(e,bs);return t.writeUInt16BE(i,r),r=bp(e,bs,t,r+2),Ls.encode.bytes=r-n,t};Ls.encode.bytes=0;Ls.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++]=bs.decode(e,t),t+=bs.decode.bytes,i-=bs.decode.bytes;return Ls.decode.bytes=t-r,n};Ls.decode.bytes=0;Ls.encodingLength=function(e){return 2+Yf(e||[],bs)};var Xn=Ye.dnskey={};Xn.PROTOCOL_DNSSEC=3;Xn.ZONE_KEY=128;Xn.SECURE_ENTRYPOINT=32768;Xn.encode=function(e,t,r){t||(t=Xe.alloc(Xn.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(Xn.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,Xn.encode.bytes=r-n,t.writeUInt16BE(Xn.encode.bytes-2,n),t};Xn.encode.bytes=0;Xn.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)!==Xn.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,Xn.decode.bytes=t-r,n};Xn.decode.bytes=0;Xn.encodingLength=function(e){return 6+Xe.byteLength(e.key)};var $o=Ye.rrsig={};$o.encode=function(e,t,r){t||(t=Xe.alloc($o.encodingLength(e))),r||(r=0);let n=r,i=e.signature;if(!Xe.isBuffer(i))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(Ga.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,Le.encode(e.signersName,t,r),r+=Le.encode.bytes,i.copy(t,r,0,i.length),r+=i.length,$o.encode.bytes=r-n,t.writeUInt16BE($o.encode.bytes-2,n),t};$o.encode.bytes=0;$o.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.typeCovered=Ga.toString(e.readUInt16BE(t)),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.labels=e.readUInt8(t),t+=1,n.originalTTL=e.readUInt32BE(t),t+=4,n.expiration=e.readUInt32BE(t),t+=4,n.inception=e.readUInt32BE(t),t+=4,n.keyTag=e.readUInt16BE(t),t+=2,n.signersName=Le.decode(e,t),t+=Le.decode.bytes,n.signature=e.slice(t,r+i+2),t+=n.signature.length,$o.decode.bytes=t-r,n};$o.decode.bytes=0;$o.encodingLength=function(e){return 20+Le.encodingLength(e.signersName)+Xe.byteLength(e.signature)};var Po=Ye.rp={};Po.encode=function(e,t,r){t||(t=Xe.alloc(Po.encodingLength(e))),r||(r=0);let n=r;return r+=2,Le.encode(e.mbox||".",t,r,{mail:!0}),r+=Le.encode.bytes,Le.encode(e.txt||".",t,r),r+=Le.encode.bytes,Po.encode.bytes=r-n,t.writeUInt16BE(Po.encode.bytes-2,n),t};Po.encode.bytes=0;Po.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.mbox=Le.decode(e,t,{mail:!0})||".",t+=Le.decode.bytes,n.txt=Le.decode(e,t)||".",t+=Le.decode.bytes,Po.decode.bytes=t-r,n};Po.decode.bytes=0;Po.encodingLength=function(e){return 2+Le.encodingLength(e.mbox||".")+Le.encodingLength(e.txt||".")};var Jr={};Jr.encode=function(e,t,r){t||(t=Xe.alloc(Jr.encodingLength(e))),r||(r=0);let n=r;for(var i=[],o=0;o<e.length;o++){var s=Ga.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=Ga.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=Ga.toType(e[r]);t[n>>8]=Math.max(t[n>>8]||0,n&255)}var i=0;for(r=0;r<t.length;r++)t[r]!==void 0&&(i+=2+Math.ceil((t[r]+1)/8));return i};var ko=Ye.nsec={};ko.encode=function(e,t,r){t||(t=Xe.alloc(ko.encodingLength(e))),r||(r=0);let n=r;return r+=2,Le.encode(e.nextDomain,t,r),r+=Le.encode.bytes,Jr.encode(e.rrtypes,t,r),r+=Jr.encode.bytes,ko.encode.bytes=r-n,t.writeUInt16BE(ko.encode.bytes-2,n),t};ko.encode.bytes=0;ko.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.nextDomain=Le.decode(e,t),t+=Le.decode.bytes,n.rrtypes=Jr.decode(e,t,i-(t-r)),t+=Jr.decode.bytes,ko.decode.bytes=t-r,n};ko.decode.bytes=0;ko.encodingLength=function(e){return 2+Le.encodingLength(e.nextDomain)+Jr.encodingLength(e.rrtypes)};var Ro=Ye.nsec3={};Ro.encode=function(e,t,r){t||(t=Xe.alloc(Ro.encodingLength(e))),r||(r=0);let n=r,i=e.salt;if(!Xe.isBuffer(i))throw new Error("salt must be a Buffer");let o=e.nextDomain;if(!Xe.isBuffer(o))throw new Error("nextDomain must be a Buffer");return r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.flags,r),r+=1,t.writeUInt16BE(e.iterations,r),r+=2,t.writeUInt8(i.length,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,t.writeUInt8(o.length,r),r+=1,o.copy(t,r,0,o.length),r+=o.length,Jr.encode(e.rrtypes,t,r),r+=Jr.encode.bytes,Ro.encode.bytes=r-n,t.writeUInt16BE(Ro.encode.bytes-2,n),t};Ro.encode.bytes=0;Ro.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);t+=2,n.algorithm=e.readUInt8(t),t+=1,n.flags=e.readUInt8(t),t+=1,n.iterations=e.readUInt16BE(t),t+=2;let o=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+o),t+=o;let s=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=Jr.decode(e,t,i-(t-r)),t+=Jr.decode.bytes,Ro.decode.bytes=t-r,n};Ro.decode.bytes=0;Ro.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+Jr.encodingLength(e.rrtypes)};var To=Ye.ds={};To.encode=function(e,t,r){t||(t=Xe.alloc(To.encodingLength(e))),r||(r=0);let n=r,i=e.digest;if(!Xe.isBuffer(i))throw new Error("Digest must be a Buffer");return r+=2,t.writeUInt16BE(e.keyTag,r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.digestType,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,To.encode.bytes=r-n,t.writeUInt16BE(To.encode.bytes-2,n),t};To.encode.bytes=0;To.decode=function(e,t){t||(t=0);let r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.keyTag=e.readUInt16BE(t),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.digestType=e.readUInt8(t),t+=1,n.digest=e.slice(t,r+i+2),t+=n.digest.length,To.decode.bytes=t-r,n};To.decode.bytes=0;To.encodingLength=function(e){return 6+Xe.byteLength(e.digest)};var Ns=Ye.sshfp={};Ns.getFingerprintLengthForHashType=function(t){switch(t){case 1:return 20;case 2:return 32}};Ns.encode=function(t,r,n){r||(r=Xe.alloc(Ns.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!==Ns.getFingerprintLengthForHashType(t.hash))throw new Error("Invalid fingerprint length");return o.copy(r,n),n+=o.byteLength,Ns.encode.bytes=n-i,r.writeUInt16BE(Ns.encode.bytes-2,i),r};Ns.encode.bytes=0;Ns.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=Ns.getFingerprintLengthForHashType(i.hash);return i.fingerprint=t.slice(r,r+o).toString("hex").toUpperCase(),r+=o,Ns.decode.bytes=r-n,i};Ns.decode.bytes=0;Ns.encodingLength=function(e){return 4+Xe.from(e.fingerprint,"hex").byteLength};var Oo=Ye.naptr={};Oo.encode=function(e,t,r){t||(t=Xe.alloc(Oo.encodingLength(e))),r||(r=0);let n=r;return r+=2,t.writeUInt16BE(e.order||0,r),r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,St.encode(e.flags,t,r),r+=St.encode.bytes,St.encode(e.services,t,r),r+=St.encode.bytes,St.encode(e.regexp,t,r),r+=St.encode.bytes,Le.encode(e.replacement,t,r),r+=Le.encode.bytes,Oo.encode.bytes=r-n,t.writeUInt16BE(Oo.encode.bytes-2,n),t};Oo.encode.bytes=0;Oo.decode=function(e,t){t||(t=0);let r=t,n={};return t+=2,n.order=e.readUInt16BE(t),t+=2,n.preference=e.readUInt16BE(t),t+=2,n.flags=St.decode(e,t),t+=St.decode.bytes,n.services=St.decode(e,t),t+=St.decode.bytes,n.regexp=St.decode(e,t),t+=St.decode.bytes,n.replacement=Le.decode(e,t),t+=Le.decode.bytes,Oo.decode.bytes=t-r,n};Oo.decode.bytes=0;Oo.encodingLength=function(e){return St.encodingLength(e.flags)+St.encodingLength(e.services)+St.encodingLength(e.regexp)+Le.encodingLength(e.replacement)+6};var No=Ye.tlsa={};No.encode=function(e,t,r){t||(t=Xe.alloc(No.encodingLength(e))),r||(r=0);let n=r,i=e.certificate;if(!Xe.isBuffer(i))throw new Error("Certificate must be a Buffer");return r+=2,t.writeUInt8(e.usage,r),r+=1,t.writeUInt8(e.selector,r),r+=1,t.writeUInt8(e.matchingType,r),r+=1,i.copy(t,r,0,i.length),r+=i.length,No.encode.bytes=r-n,t.writeUInt16BE(No.encode.bytes-2,n),t};No.encode.bytes=0;No.decode=function(e,t){t||(t=0);let r=t,n={},i=e.readUInt16BE(t);return t+=2,n.usage=e.readUInt8(t),t+=1,n.selector=e.readUInt8(t),t+=1,n.matchingType=e.readUInt8(t),t+=1,n.certificate=e.slice(t,r+i+2),t+=n.certificate.length,No.decode.bytes=t-r,n};No.decode.bytes=0;No.encodingLength=function(e){return 5+Xe.byteLength(e.certificate)};var DA=Ye.record=function(e){switch(e.toUpperCase()){case"A":return Ka;case"PTR":return qi;case"CNAME":return BY;case"DNAME":return IY;case"TXT":return Ha;case"NULL":return Ma;case"AAAA":return Va;case"SRV":return ja;case"HINFO":return qa;case"CAA":return Os;case"NS":return La;case"SOA":return Ua;case"MX":return ec;case"OPT":return Ls;case"DNSKEY":return Xn;case"RRSIG":return $o;case"RP":return Po;case"NSEC":return ko;case"NSEC3":return Ro;case"SSHFP":return Ns;case"DS":return To;case"NAPTR":return Oo;case"TLSA":return No}return Na},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(Ga.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,Ls.encode(e.options||[],t,r),r+=Ls.encode.bytes}else{let i=Ug.toClass(e.class===void 0?"IN":e.class);e.flush&&(i|=CA),t.writeUInt16BE(i,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;let o=DA(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=Ga.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=Ls.decode(e,t+8),t+=8+Ls.decode.bytes;else{let i=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=Ug.toString(i&DY),r.flush=!!(i&CA);let o=DA(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+DA(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(Ga.toType(e.type),r),r+=2,t.writeUInt16BE(Ug.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=Ga.toString(e.readUInt16BE(t)),t+=2,n.class=Ug.toString(e.readUInt16BE(t)),t+=2,!!(n.class&PI)&&(n.class&=FY),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=bp(e.questions,ji,t,r),r=bp(e.answers,ln,t,r),r=bp(e.authorities,ln,t,r),r=bp(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=Lg(n.questions,ji,e,t),t=Lg(n.answers,ln,e,t),t=Lg(n.authorities,ln,e,t),t=Lg(n.additionals,ln,e,t),Ye.decode.bytes=t-r,n};Ye.decode.bytes=0;Ye.encodingLength=function(e){return Ki.encodingLength(e)+Yf(e.questions||[],ji)+Yf(e.answers||[],ln)+Yf(e.authorities||[],ln)+Yf(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 Yf(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function bp(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 Lg(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((Zf,Sp)=>{var V2e=B(x());(function(){var e,t="4.18.1",r=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",o="Invalid `variable` option passed into `_.template`",s="Invalid `imports` option passed into `_.template`",a="__lodash_hash_undefined__",u=500,l="__lodash_placeholder__",h=1,m=2,p=4,d=1,v=2,g=1,y=2,w=4,E=8,_=16,C=32,F=64,H=128,K=256,S=512,I=30,q="...",L=800,R=16,O=1,T=2,N=3,P=1/0,M=9007199254740991,Y=17976931348623157e292,V=NaN,X=4294967295,te=X-1,ae=X>>>1,me=[["ary",H],["bind",g],["bindKey",y],["curry",E],["curryRight",_],["flip",S],["partial",C],["partialRight",F],["rearg",K]],he="[object Arguments]",De="[object Array]",Pe="[object AsyncFunction]",Ie="[object Boolean]",se="[object Date]",pe="[object DOMException]",Fe="[object Error]",Te="[object Function]",Ve="[object GeneratorFunction]",Oe="[object Map]",pt="[object Number]",Qe="[object Null]",ct="[object Object]",mn="[object Promise]",gr="[object Proxy]",vr="[object RegExp]",lt="[object Set]",Pr="[object String]",es="[object Symbol]",mi="[object Undefined]",Dt="[object WeakMap]",Ze="[object WeakSet]",Re="[object ArrayBuffer]",or="[object DataView]",Tn="[object Float32Array]",mt="[object Float64Array]",cc="[object Int8Array]",On="[object Int16Array]",Se="[object Int32Array]",ru="[object Uint8Array]",Ut="[object Uint8ClampedArray]",gn="[object Uint16Array]",Yi="[object Uint32Array]",Sl=/\b__p \+= '';/g,nu=/\b(__p \+=) '' \+/g,lh=/(__e\(.*?\)|\b__t\)) \+\n'';/g,su=/&(?:amp|lt|gt|quot|#39);/g,Xi=/[&<>"']/g,Kt=RegExp(su.source),js=RegExp(Xi.source),_l=/<%-([\s\S]+?)%>/g,fh=/<%([\s\S]+?)%>/g,lc=/<%=([\s\S]+?)%>/g,iu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hh=/^\w*$/,Cl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fc=/[\\^$.*+?()[\]{}|]/g,dh=RegExp(fc.source),ie=/^\s+/,we=/\s/,je=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Me=/\{\n\/\* \[wrapped with (.+)\] \*/,et=/,? & /,gt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,wt=/[()=,{}\[\]\/\s]/,kr=/\\(\\)?/g,ar=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ks=/\w*$/,Zi=/^[-+]0x[0-9a-f]+$/i,Nn=/^0b[01]+$/i,ts=/^\[object .+?Constructor\]$/,Fr=/^0o[0-7]+$/i,Ln=/^(?:0|[1-9]\d*)$/,ou=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,au=/($^)/,ph=/['\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",rs="\\xac\\xb1\\xd7\\xf7",Cs="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Vs="\\u2000-\\u206f",gi=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ji="A-Z\\xc0-\\xd6\\xd8-\\xde",Dl="\\ufe0e\\ufe0f",jp=rs+Cs+Vs+gi,mh="['\u2019]",C2="["+vn+"]",Kp="["+jp+"]",Fl="["+ur+"]",Vp="\\d+",D2="["+wn+"]",gh="["+nr+"]",vh="[^"+vn+jp+Vp+wn+nr+Ji+"]",wh="\\ud83c[\\udffb-\\udfff]",F2="(?:"+Fl+"|"+wh+")",Gp="[^"+vn+"]",yh="(?:\\ud83c[\\udde6-\\uddff]){2}",uu="[\\ud800-\\udbff][\\udc00-\\udfff]",cu="["+Ji+"]",zp="\\u200d",Wp="(?:"+gh+"|"+vh+")",B2="(?:"+cu+"|"+vh+")",Yp="(?:"+mh+"(?:d|ll|m|re|s|t|ve))?",Xp="(?:"+mh+"(?:D|LL|M|RE|S|T|VE))?",Zp=F2+"?",Jp="["+Dl+"]?",I2="(?:"+zp+"(?:"+[Gp,yh,uu].join("|")+")"+Jp+Zp+")*",x2="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",$2="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Qp=Jp+Zp+I2,P2="(?:"+[D2,yh,uu].join("|")+")"+Qp,k2="(?:"+[Gp+Fl+"?",Fl,yh,uu,C2].join("|")+")",R2=RegExp(mh,"g"),T2=RegExp(Fl,"g"),Eh=RegExp(wh+"(?="+wh+")|"+k2+Qp,"g"),O2=RegExp([cu+"?"+gh+"+"+Yp+"(?="+[Kp,cu,"$"].join("|")+")",B2+"+"+Xp+"(?="+[Kp,cu+Wp,"$"].join("|")+")",cu+"?"+Wp+"+"+Yp,cu+"+"+Xp,$2,x2,Vp,P2].join("|"),"g"),N2=RegExp("["+zp+vn+ur+Dl+"]"),L2=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,U2=["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"],H2=-1,er={};er[Tn]=er[mt]=er[cc]=er[On]=er[Se]=er[ru]=er[Ut]=er[gn]=er[Yi]=!0,er[he]=er[De]=er[Re]=er[Ie]=er[or]=er[se]=er[Fe]=er[Te]=er[Oe]=er[pt]=er[ct]=er[vr]=er[lt]=er[Pr]=er[Dt]=!1;var Zt={};Zt[he]=Zt[De]=Zt[Re]=Zt[or]=Zt[Ie]=Zt[se]=Zt[Tn]=Zt[mt]=Zt[cc]=Zt[On]=Zt[Se]=Zt[Oe]=Zt[pt]=Zt[ct]=Zt[vr]=Zt[lt]=Zt[Pr]=Zt[es]=Zt[ru]=Zt[Ut]=Zt[gn]=Zt[Yi]=!0,Zt[Fe]=Zt[Te]=Zt[Dt]=!1;var M2={\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"},q2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},j2={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},K2={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},V2=parseFloat,G2=parseInt,e0=typeof global=="object"&&global&&global.Object===Object&&global,z2=typeof self=="object"&&self&&self.Object===Object&&self,Ir=e0||z2||Function("return this")(),bh=typeof Zf=="object"&&Zf&&!Zf.nodeType&&Zf,Ko=bh&&typeof Sp=="object"&&Sp&&!Sp.nodeType&&Sp,t0=Ko&&Ko.exports===bh,Ah=t0&&e0.process,ns=(function(){try{var oe=Ko&&Ko.require&&Ko.require("util").types;return oe||Ah&&Ah.binding&&Ah.binding("util")}catch{}})(),r0=ns&&ns.isArrayBuffer,n0=ns&&ns.isDate,s0=ns&&ns.isMap,i0=ns&&ns.isRegExp,o0=ns&&ns.isSet,a0=ns&&ns.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 W2(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 Rr(oe,ye){for(var de=-1,He=oe==null?0:oe.length,ot=0,xt=[];++de<He;){var wr=oe[de];ye(wr,de,oe)&&(xt[ot++]=wr)}return xt}function lu(oe,ye){var de=oe==null?0:oe.length;return!!de&&fu(oe,ye,0)>-1}function ce(oe,ye,de){for(var He=-1,ot=oe==null?0:oe.length;++He<ot;)if(de(ye,oe[He]))return!0;return!1}function Wt(oe,ye){for(var de=-1,He=oe==null?0:oe.length,ot=Array(He);++de<He;)ot[de]=ye(oe[de],de,oe);return ot}function Qi(oe,ye){for(var de=-1,He=ye.length,ot=oe.length;++de<He;)oe[ot+de]=ye[de];return oe}function u0(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 JS(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 QS=Ae("length");function Sh(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 Bl(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 fu(oe,ye,de){return ye===ye?Q2(oe,ye,de):Bl(oe,_h,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 _h(oe){return oe!==oe}function hu(oe,ye){var de=oe==null?0:oe.length;return de?Fh(oe,ye)/de:V}function Ae(oe){return function(ye){return ye==null?e:ye[oe]}}function Ch(oe){return function(ye){return oe==null?e:oe[ye]}}function Dh(oe,ye,de,He,ot){return ot(oe,function(xt,wr,Vt){de=He?(He=!1,xt):ye(de,xt,wr,Vt)}),de}function c0(oe,ye){var de=oe.length;for(oe.sort(ye);de--;)oe[de]=oe[de].value;return oe}function Fh(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 Bh(oe,ye){for(var de=-1,He=Array(oe);++de<oe;)He[de]=ye(de);return He}function l0(oe,ye){return Wt(ye,function(de){return[de,oe[de]]})}function Ih(oe){return oe&&oe.slice(0,kh(oe)+1).replace(ie,"")}function Qr(oe){return function(ye){return oe(ye)}}function xh(oe,ye){return Wt(ye,function(de){return oe[de]})}function Vo(oe,ye){return oe.has(ye)}function f0(oe,ye){for(var de=-1,He=oe.length;++de<He&&fu(ye,oe[de],0)>-1;);return de}function $h(oe,ye){for(var de=oe.length;de--&&fu(ye,oe[de],0)>-1;);return de}function Ph(oe,ye){for(var de=oe.length,He=0;de--;)oe[de]===ye&&++He;return He}var Y2=Ch(M2),h0=Ch(q2);function X2(oe){return"\\"+K2[oe]}function d0(oe,ye){return oe==null?e:oe[ye]}function du(oe){return N2.test(oe)}function Z2(oe){return L2.test(oe)}function J2(oe){for(var ye,de=[];!(ye=oe.next()).done;)de.push(ye.value);return de}function Gr(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 Go(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=He}),de}function p0(oe){var ye=-1,de=Array(oe.size);return oe.forEach(function(He){de[++ye]=[He,He]}),de}function Q2(oe,ye,de){for(var He=de-1,ot=oe.length;++He<ot;)if(oe[He]===ye)return He;return-1}function m0(oe,ye,de){for(var He=de+1;He--;)if(oe[He]===ye)return He;return He}function zo(oe){return du(oe)?ev(oe):QS(oe)}function Hn(oe){return du(oe)?tv(oe):Sh(oe)}function kh(oe){for(var ye=oe.length;ye--&&we.test(oe.charAt(ye)););return ye}var g0=Ch(j2);function ev(oe){for(var ye=Eh.lastIndex=0;Eh.test(oe);)++ye;return ye}function tv(oe){return oe.match(Eh)||[]}function rv(oe){return oe.match(O2)||[]}var Rh=(function oe(ye){ye=ye==null?Ir:wi.defaults(Ir.Object(),ye,wi.pick(Ir,U2));var de=ye.Array,He=ye.Date,ot=ye.Error,xt=ye.Function,wr=ye.Math,Vt=ye.Object,Th=ye.RegExp,nv=ye.String,ss=ye.TypeError,pc=de.prototype,v0=xt.prototype,Ds=Vt.prototype,Il=ye["__core-js_shared__"],Wo=v0.toString,Nt=Ds.hasOwnProperty,Oh=0,w0=(function(){var c=/[^.]+$/.exec(Il&&Il.keys&&Il.keys.IE_PROTO||"");return c?"Symbol(src)_1."+c:""})(),xl=Ds.toString,sv=Wo.call(Vt),iv=Ir._,ov=Th("^"+Wo.call(Nt).replace(fc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$l=t0?ye.Buffer:e,eo=ye.Symbol,Pl=ye.Uint8Array,y0=$l?$l.allocUnsafe:e,kl=dc(Vt.getPrototypeOf,Vt),E0=Vt.create,Yt=Ds.propertyIsEnumerable,Rl=pc.splice,Tl=eo?eo.isConcatSpreadable:e,mc=eo?eo.iterator:e,Yo=eo?eo.toStringTag:e,D=(function(){try{var c=Ec(Vt,"defineProperty");return c({},"",{}),c}catch{}})(),G=ye.clearTimeout!==Ir.clearTimeout&&ye.clearTimeout,ee=He&&He.now!==Ir.Date.now&&He.now,Z=ye.setTimeout!==Ir.setTimeout&&ye.setTimeout,fe=wr.ceil,ge=wr.floor,Mt=Vt.getOwnPropertySymbols,yr=$l?$l.isBuffer:e,e6=ye.isFinite,Sx=pc.join,_x=dc(Vt.keys,Vt),Tr=wr.max,yn=wr.min,Cx=He.now,Dx=ye.parseInt,t6=wr.random,Fx=pc.reverse,av=Ec(ye,"DataView"),Nh=Ec(ye,"Map"),uv=Ec(ye,"Promise"),Ol=Ec(ye,"Set"),Lh=Ec(ye,"WeakMap"),Uh=Ec(Vt,"create"),b0=Lh&&new Lh,Nl={},Bx=bc(av),Ix=bc(Nh),xx=bc(uv),$x=bc(Ol),Px=bc(Lh),A0=eo?eo.prototype:e,Hh=A0?A0.valueOf:e,r6=A0?A0.toString:e;function z(c){if(hr(c)&&!ht(c)&&!(c instanceof Bt)){if(c instanceof Gs)return c;if(Nt.call(c,"__wrapped__"))return n5(c)}return new Gs(c)}var Ll=(function(){function c(){}return function(f){if(!cr(f))return{};if(E0)return E0(f);c.prototype=f;var b=new c;return c.prototype=e,b}})();function S0(){}function Gs(c,f){this.__wrapped__=c,this.__actions__=[],this.__chain__=!!f,this.__index__=0,this.__values__=e}z.templateSettings={escape:_l,evaluate:fh,interpolate:lc,variable:"",imports:{_:z}},z.prototype=S0.prototype,z.prototype.constructor=z,Gs.prototype=Ll(S0.prototype),Gs.prototype.constructor=Gs;function Bt(c){this.__wrapped__=c,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=X,this.__views__=[]}function kx(){var c=new Bt(this.__wrapped__);return c.__actions__=is(this.__actions__),c.__dir__=this.__dir__,c.__filtered__=this.__filtered__,c.__iteratees__=is(this.__iteratees__),c.__takeCount__=this.__takeCount__,c.__views__=is(this.__views__),c}function Rx(){if(this.__filtered__){var c=new Bt(this);c.__dir__=-1,c.__filtered__=!0}else c=this.clone(),c.__dir__*=-1;return c}function Tx(){var c=this.__wrapped__.value(),f=this.__dir__,b=ht(c),k=f<0,j=b?c.length:0,W=z$(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,Ge=yn(ue,this.__takeCount__);if(!b||!k&&j==ue&&Ge==ue)return D6(c,this.__actions__);var it=[];e:for(;ue--&&Ne<Ge;){_e+=f;for(var Et=-1,nt=c[_e];++Et<Be;){var Ft=Ce[Et],$t=Ft.iteratee,Is=Ft.type,jn=$t(nt);if(Is==T)nt=jn;else if(!jn){if(Is==O)continue e;break e}}it[Ne++]=nt}return it}Bt.prototype=Ll(S0.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 Ox(){this.__data__=Uh?Uh(null):{},this.size=0}function Nx(c){var f=this.has(c)&&delete this.__data__[c];return this.size-=f?1:0,f}function Lx(c){var f=this.__data__;if(Uh){var b=f[c];return b===a?e:b}return Nt.call(f,c)?f[c]:e}function Ux(c){var f=this.__data__;return Uh?f[c]!==e:Nt.call(f,c)}function Hx(c,f){var b=this.__data__;return this.size+=this.has(c)?0:1,b[c]=Uh&&f===e?a:f,this}gc.prototype.clear=Ox,gc.prototype.delete=Nx,gc.prototype.get=Lx,gc.prototype.has=Ux,gc.prototype.set=Hx;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 Mx(){this.__data__=[],this.size=0}function qx(c){var f=this.__data__,b=_0(f,c);if(b<0)return!1;var k=f.length-1;return b==k?f.pop():Rl.call(f,b,1),--this.size,!0}function jx(c){var f=this.__data__,b=_0(f,c);return b<0?e:f[b][1]}function Kx(c){return _0(this.__data__,c)>-1}function Vx(c,f){var b=this.__data__,k=_0(b,c);return k<0?(++this.size,b.push([c,f])):b[k][1]=f,this}Xo.prototype.clear=Mx,Xo.prototype.delete=qx,Xo.prototype.get=jx,Xo.prototype.has=Kx,Xo.prototype.set=Vx;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 Gx(){this.size=0,this.__data__={hash:new gc,map:new(Nh||Xo),string:new gc}}function zx(c){var f=O0(this,c).delete(c);return this.size-=f?1:0,f}function Wx(c){return O0(this,c).get(c)}function Yx(c){return O0(this,c).has(c)}function Xx(c,f){var b=O0(this,c),k=b.size;return b.set(c,f),this.size+=b.size==k?0:1,this}Zo.prototype.clear=Gx,Zo.prototype.delete=zx,Zo.prototype.get=Wx,Zo.prototype.has=Yx,Zo.prototype.set=Xx;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 Jx(c){return this.__data__.has(c)}vc.prototype.add=vc.prototype.push=Zx,vc.prototype.has=Jx;function yi(c){var f=this.__data__=new Xo(c);this.size=f.size}function Qx(){this.__data__=new Xo,this.size=0}function e$(c){var f=this.__data__,b=f.delete(c);return this.size=f.size,b}function t$(c){return this.__data__.get(c)}function r$(c){return this.__data__.has(c)}function n$(c,f){var b=this.__data__;if(b instanceof Xo){var k=b.__data__;if(!Nh||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=Qx,yi.prototype.delete=e$,yi.prototype.get=t$,yi.prototype.has=r$,yi.prototype.set=n$;function n6(c,f){var b=ht(c),k=!b&&Ac(c),j=!b&&!k&&wu(c),W=!b&&!k&&!j&&ql(c),J=b||k||j||W,re=J?Bh(c.length,nv):[],ue=re.length;for(var _e in c)(f||Nt.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 s6(c){var f=c.length;return f?c[yv(0,f-1)]:e}function s$(c,f){return N0(is(c),wc(f,0,c.length))}function i$(c){return N0(is(c))}function cv(c,f,b){(b!==e&&!bi(c[f],b)||b===e&&!(f in c))&&to(c,f,b)}function Mh(c,f,b){var k=c[f];(!(Nt.call(c,f)&&bi(k,b))||b===e&&!(f in c))&&to(c,f,b)}function _0(c,f){for(var b=c.length;b--;)if(bi(c[b][0],f))return b;return-1}function o$(c,f,b,k){return pu(c,function(j,W,J){f(k,j,b(j),J)}),k}function i6(c,f){return c&&no(f,zr(f),c)}function a$(c,f){return c&&no(f,as(f),c)}function to(c,f,b){f=="__proto__"&&D?D(c,f,{configurable:!0,enumerable:!0,value:b,writable:!0}):c[f]=b}function lv(c,f){for(var b=-1,k=f.length,j=de(k),W=c==null;++b<k;)j[b]=W?e:Vv(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=Y$(c),!re)return is(c,J)}else{var Be=En(c),Ne=Be==Te||Be==Ve;if(wu(c))return I6(c,re);if(Be==ct||Be==he||Ne&&!j){if(J=ue||Ne?{}:W6(c),!re)return ue?L$(c,a$(J,c)):N$(c,i6(J,c))}else{if(!Zt[Be])return j?c:{};J=X$(c,Be,re)}}W||(W=new yi);var Ge=W.get(c);if(Ge)return Ge;W.set(c,J),S5(c)?c.forEach(function(nt){J.add(zs(nt,f,b,nt,c,W))}):b5(c)&&c.forEach(function(nt,Ft){J.set(Ft,zs(nt,f,b,Ft,c,W))});var it=_e?ue?xv:Iv:ue?as:zr,Et=Ce?e:it(c);return U(Et||c,function(nt,Ft){Et&&(Ft=nt,nt=c[Ft]),Mh(J,Ft,zs(nt,f,b,Ft,c,W))}),J}function u$(c){var f=zr(c);return function(b){return o6(b,c,f)}}function o6(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 a6(c,f,b){if(typeof c!="function")throw new ss(i);return Wh(function(){c.apply(e,b)},f)}function qh(c,f,b,k){var j=-1,W=lu,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 pu=R6(ro),u6=R6(hv,!0);function c$(c,f){var b=!0;return pu(c,function(k,j,W){return b=!!f(k,j,W),b}),b}function C0(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&&!Bs(J):b(J,re)))var re=J,ue=W}return ue}function l$(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:C5(k);b<k;)c[b++]=f;return c}function c6(c,f){var b=[];return pu(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=J$),j||(j=[]);++W<J;){var re=c[W];f>0&&b(re)?f>1?tn(re,f-1,b,k,j):Qi(j,re):k||(j[j.length]=re)}return j}var fv=T6(),l6=T6(!0);function ro(c,f){return c&&fv(c,f,zr)}function hv(c,f){return c&&l6(c,f,zr)}function D0(c,f){return Rr(f,function(b){return ta(c[b])})}function yc(c,f){f=gu(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 f6(c,f,b){var k=f(c);return ht(c)?k:Qi(k,b(c))}function Mn(c){return c==null?c===e?mi:Qe:Yo&&Yo in Vt(c)?G$(c):iP(c)}function dv(c,f){return c>f}function f$(c,f){return c!=null&&Nt.call(c,f)}function h$(c,f){return c!=null&&f in Vt(c)}function d$(c,f,b){return c>=yn(f,b)&&c<Tr(f,b)}function pv(c,f,b){for(var k=b?ce:lu,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 Ge=Ce[Be],it=f?f(Ge):Ge;if(Ge=b||Ge!==0?Ge: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(Ge)}}return _e}function p$(c,f,b,k){return ro(c,function(j,W,J){f(k,b(j),W,J)}),k}function jh(c,f,b){f=gu(f,c),c=J6(c,f);var k=c==null?c:c[Ei(Ys(f))];return k==null?e:Un(k,c,b)}function h6(c){return hr(c)&&Mn(c)==he}function m$(c){return hr(c)&&Mn(c)==Re}function g$(c){return hr(c)&&Mn(c)==se}function Kh(c,f,b,k,j){return c===f?!0:c==null||f==null||!hr(c)&&!hr(f)?c!==c&&f!==f:v$(c,f,b,k,Kh,j)}function v$(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&&wu(c)){if(!wu(f))return!1;J=!0,Ce=!1}if(Ne&&!Ce)return W||(W=new yi),J||ql(c)?V6(c,f,b,k,j,W):K$(c,f,ue,b,k,j,W);if(!(b&d)){var Ge=Ce&&Nt.call(c,"__wrapped__"),it=Be&&Nt.call(f,"__wrapped__");if(Ge||it){var Et=Ge?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),V$(c,f,b,k,j,W)):!1}function w$(c){return hr(c)&&En(c)==Oe}function mv(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?Kh(Ce,_e,d|v,k,Be):Ne))return!1}}return!0}function d6(c){if(!cr(c)||eP(c))return!1;var f=ta(c)?ov:ts;return f.test(bc(c))}function y$(c){return hr(c)&&Mn(c)==vr}function E$(c){return hr(c)&&En(c)==lt}function b$(c){return hr(c)&&j0(c.length)&&!!er[Mn(c)]}function p6(c){return typeof c=="function"?c:c==null?us:typeof c=="object"?ht(c)?v6(c[0],c[1]):g6(c):N5(c)}function gv(c){if(!zh(c))return _x(c);var f=[];for(var b in Vt(c))Nt.call(c,b)&&b!="constructor"&&f.push(b);return f}function A$(c){if(!cr(c))return sP(c);var f=zh(c),b=[];for(var k in c)k=="constructor"&&(f||!Nt.call(c,k))||b.push(k);return b}function vv(c,f){return c<f}function m6(c,f){var b=-1,k=os(c)?de(c.length):[];return pu(c,function(j,W,J){k[++b]=f(j,W,J)}),k}function g6(c){var f=Pv(c);return f.length==1&&f[0][2]?X6(f[0][0],f[0][1]):function(b){return b===c||mv(b,c,f)}}function v6(c,f){return Rv(c)&&Y6(f)?X6(Ei(c),f):function(b){var k=Vv(b,c);return k===e&&k===f?Gv(b,c):Kh(f,k,d|v)}}function F0(c,f,b,k,j){c!==f&&fv(f,function(W,J){if(j||(j=new yi),cr(W))S$(c,f,J,b,F0,k,j);else{var re=k?k(Ov(c,J),W,J+"",c,f,j):e;re===e&&(re=W),cv(c,J,re)}},as)}function S$(c,f,b,k,j,W,J){var re=Ov(c,b),ue=Ov(f,b),_e=J.get(ue);if(_e){cv(c,b,_e);return}var Ce=W?W(re,ue,b+"",c,f,J):e,Be=Ce===e;if(Be){var Ne=ht(ue),Ge=!Ne&&wu(ue),it=!Ne&&!Ge&&ql(ue);Ce=ue,Ne||Ge||it?ht(re)?Ce=re:Er(re)?Ce=is(re):Ge?(Be=!1,Ce=I6(ue,!0)):it?(Be=!1,Ce=x6(ue,!0)):Ce=[]:Yh(ue)||Ac(ue)?(Ce=re,Ac(re)?Ce=D5(re):(!cr(re)||ta(re))&&(Ce=W6(ue))):Be=!1}Be&&(J.set(ue,Ce),j(Ce,ue,k,W,J),J.delete(ue)),cv(c,b,Ce)}function w6(c,f){var b=c.length;if(b)return f+=f<0?b:0,ea(f,b)?c[f]:e}function y6(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=[us];var k=-1;f=Wt(f,Qr(st()));var j=m6(c,function(W,J,re){var ue=Wt(f,function(_e){return _e(W)});return{criteria:ue,index:++k,value:W}});return c0(j,function(W,J){return O$(W,J,b)})}function _$(c,f){return E6(c,f,function(b,k){return Gv(c,k)})}function E6(c,f,b){for(var k=-1,j=f.length,W={};++k<j;){var J=f[k],re=yc(c,J);b(re,J)&&Vh(W,gu(J,c),re)}return W}function C$(c){return function(f){return yc(f,c)}}function wv(c,f,b,k){var j=k?vi:fu,W=-1,J=f.length,re=c;for(c===f&&(f=is(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&&Rl.call(re,ue,1),Rl.call(c,ue,1);return c}function b6(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)?Rl.call(c,j,1):Av(c,j)}}return c}function yv(c,f){return c+ge(t6()*(f-c+1))}function D$(c,f,b,k){for(var j=-1,W=Tr(fe((f-c)/(b||1)),0),J=de(W);W--;)J[k?W:++j]=c,c+=b;return J}function Ev(c,f){var b="";if(!c||f<1||f>M)return b;do f%2&&(b+=c),f=ge(f/2),f&&(c+=c);while(f);return b}function At(c,f){return Nv(Z6(c,f,us),c+"")}function F$(c){return s6(jl(c))}function B$(c,f){var b=jl(c);return N0(b,wc(f,0,b.length))}function Vh(c,f,b,k){if(!cr(c))return c;f=gu(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])?[]:{})}Mh(re,ue,_e),re=re[ue]}return c}var A6=b0?function(c,f){return b0.set(c,f),c}:us,I$=D?function(c,f){return D(c,"toString",{configurable:!0,enumerable:!1,value:Wv(f),writable:!0})}:us;function x$(c){return N0(jl(c))}function Ws(c,f,b){var k=-1,j=c.length;f<0&&(f=-f>j?0:j+f),b=b>j?j:b,b<0&&(b+=j),j=f>b?0:b-f>>>0,f>>>=0;for(var W=de(j);++k<j;)W[k]=c[k+f];return W}function $$(c,f){var b;return pu(c,function(k,j,W){return b=f(k,j,W),!b}),!!b}function B0(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&&!Bs(J)&&(b?J<=f:J<f)?k=W+1:j=W}return j}return bv(c,f,us,b)}function bv(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=Bs(f),_e=f===e;j<W;){var Ce=ge((j+W)/2),Be=b(c[Ce]),Ne=Be!==e,Ge=Be===null,it=Be===Be,Et=Bs(Be);if(J)var nt=k||it;else _e?nt=it&&(k||Ne):re?nt=it&&Ne&&(k||!Ge):ue?nt=it&&Ne&&!Ge&&(k||!Et):Ge||Et?nt=!1:nt=k?Be<=f:Be<f;nt?j=Ce+1:W=Ce}return yn(W,te)}function S6(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 _6(c){return typeof c=="number"?c:Bs(c)?V:+c}function Fs(c){if(typeof c=="string")return c;if(ht(c))return Wt(c,Fs)+"";if(Bs(c))return r6?r6.call(c):"";var f=c+"";return f=="0"&&1/c==-P?"-0":f}function mu(c,f,b){var k=-1,j=lu,W=c.length,J=!0,re=[],ue=re;if(b)J=!1,j=ce;else if(W>=r){var _e=f?null:q$(c);if(_e)return Go(_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 Av(c,f){f=gu(f,c);var b=-1,k=f.length;if(!k)return!0;for(;++b<k;){var j=Ei(f[b]);if(j==="__proto__"&&!Nt.call(c,"__proto__")||(j==="constructor"||j==="prototype")&&b<k-1)return!1}var W=J6(c,f);return W==null||delete W[Ei(Ys(f))]}function C6(c,f,b,k){return Vh(c,f,b(yc(c,f)),k)}function I0(c,f,b,k){for(var j=c.length,W=k?j:-1;(k?W--:++W<j)&&f(c[W],W,c););return b?Ws(c,k?0:W,k?W+1:j):Ws(c,k?W+1:0,k?j:W)}function D6(c,f){var b=c;return b instanceof Bt&&(b=b.value()),u0(f,function(k,j){return j.func.apply(j.thisArg,Qi([k],j.args))},b)}function Sv(c,f,b){var k=c.length;if(k<2)return k?mu(c[0]):[];for(var j=-1,W=de(k);++j<k;)for(var J=c[j],re=-1;++re<k;)re!=j&&(W[j]=qh(W[j]||J,c[re],f,b));return mu(tn(W,1),f,b)}function F6(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 _v(c){return Er(c)?c:[]}function Cv(c){return typeof c=="function"?c:us}function gu(c,f){return ht(c)?c:Rv(c,f)?[c]:r5(Gt(c))}var P$=At;function vu(c,f,b){var k=c.length;return b=b===e?k:b,!f&&b>=k?c:Ws(c,f,b)}var B6=G||function(c){return Ir.clearTimeout(c)};function I6(c,f){if(f)return c.slice();var b=c.length,k=y0?y0(b):new c.constructor(b);return c.copy(k),k}function Dv(c){var f=new c.constructor(c.byteLength);return new Pl(f).set(new Pl(c)),f}function k$(c,f){var b=f?Dv(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.byteLength)}function R$(c){var f=new c.constructor(c.source,Ks.exec(c));return f.lastIndex=c.lastIndex,f}function T$(c){return Hh?Vt(Hh.call(c)):{}}function x6(c,f){var b=f?Dv(c.buffer):c.buffer;return new c.constructor(b,c.byteOffset,c.length)}function $6(c,f){if(c!==f){var b=c!==e,k=c===null,j=c===c,W=Bs(c),J=f!==e,re=f===null,ue=f===f,_e=Bs(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 O$(c,f,b){for(var k=-1,j=c.criteria,W=f.criteria,J=j.length,re=b.length;++k<J;){var ue=$6(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 P6(c,f,b,k){for(var j=-1,W=c.length,J=b.length,re=-1,ue=f.length,_e=Tr(W-J,0),Ce=de(ue+_e),Be=!k;++re<ue;)Ce[re]=f[re];for(;++j<J;)(Be||j<W)&&(Ce[b[j]]=c[j]);for(;_e--;)Ce[re++]=c[j++];return Ce}function k6(c,f,b,k){for(var j=-1,W=c.length,J=-1,re=b.length,ue=-1,_e=f.length,Ce=Tr(W-re,0),Be=de(Ce+_e),Ne=!k;++j<Ce;)Be[j]=c[j];for(var Ge=j;++ue<_e;)Be[Ge+ue]=f[ue];for(;++J<re;)(Ne||j<W)&&(Be[Ge+b[J]]=c[j++]);return Be}function is(c,f){var b=-1,k=c.length;for(f||(f=de(k));++b<k;)f[b]=c[b];return f}function no(c,f,b,k){var j=!b;b||(b={});for(var W=-1,J=f.length;++W<J;){var re=f[W],ue=k?k(b[re],c[re],re,b,c):e;ue===e&&(ue=c[re]),j?to(b,re,ue):Mh(b,re,ue)}return b}function N$(c,f){return no(c,kv(c),f)}function L$(c,f){return no(c,G6(c),f)}function x0(c,f){return function(b,k){var j=ht(b)?W2:o$,W=f?f():{};return j(b,c,st(k,2),W)}}function Ul(c){return At(function(f,b){var k=-1,j=b.length,W=j>1?b[j-1]:e,J=j>2?b[2]:e;for(W=c.length>3&&typeof W=="function"?(j--,W):e,J&&qn(b[0],b[1],J)&&(W=j<3?e:W,j=1),f=Vt(f);++k<j;){var re=b[k];re&&c(f,re,k,W)}return f})}function R6(c,f){return function(b,k){if(b==null)return b;if(!os(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 T6(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 U$(c,f,b){var k=f&g,j=Gh(c);function W(){var J=this&&this!==Ir&&this instanceof W?j:c;return J.apply(k?b:this,arguments)}return W}function O6(c){return function(f){f=Gt(f);var b=du(f)?Hn(f):e,k=b?b[0]:f.charAt(0),j=b?vu(b,1).join(""):f.slice(1);return k[c]()+j}}function Hl(c){return function(f){return u0(T5(R5(f).replace(R2,"")),c,"")}}function Gh(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=Ll(c.prototype),k=c.apply(b,f);return cr(k)?k:b}}function H$(c,f,b){var k=Gh(c);function j(){for(var W=arguments.length,J=de(W),re=W,ue=Ml(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 M6(c,f,$0,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 N6(c){return function(f,b,k){var j=Vt(f);if(!os(f)){var W=st(b,3);f=zr(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 L6(c){return Qo(function(f){var b=f.length,k=b,j=Gs.prototype.thru;for(c&&f.reverse();k--;){var W=f[k];if(typeof W!="function")throw new ss(i);if(j&&!J&&T0(W)=="wrapper")var J=new Gs([],!0)}for(k=J?k:b;++k<b;){W=f[k];var re=T0(W),ue=re=="wrapper"?$v(W):e;ue&&Tv(ue[0])&&ue[1]==(H|E|C|K)&&!ue[4].length&&ue[9]==1?J=J[T0(ue[0])].apply(J,ue[3]):J=W.length==1&&Tv(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 $0(c,f,b,k,j,W,J,re,ue,_e){var Ce=f&H,Be=f&g,Ne=f&y,Ge=f&(E|_),it=f&S,Et=Ne?e:Gh(c);function nt(){for(var Ft=arguments.length,$t=de(Ft),Is=Ft;Is--;)$t[Is]=arguments[Is];if(Ge)var jn=Ml(nt),xs=Ph($t,jn);if(k&&($t=P6($t,k,j,Ge)),W&&($t=k6($t,W,J,Ge)),Ft-=xs,Ge&&Ft<_e){var br=en($t,jn);return M6(c,f,$0,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=oP($t,re):it&&Ft>1&&$t.reverse(),Ce&&ue<Ft&&($t.length=ue),this&&this!==Ir&&this instanceof nt&&(na=Et||Gh(na)),na.apply(Ai,$t)}return nt}function U6(c,f){return function(b,k){return p$(b,c,f(k),{})}}function P0(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=Fs(b),k=Fs(k)):(b=_6(b),k=_6(k)),j=c(b,k)}return j}}function Fv(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 k0(c,f){f=f===e?" ":Fs(f);var b=f.length;if(b<2)return b?Ev(f,c):f;var k=Ev(f,fe(c/zo(f)));return du(f)?vu(Hn(k),0,c).join(""):k.slice(0,c)}function M$(c,f,b,k){var j=f&g,W=Gh(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 H6(c){return function(f,b,k){return k&&typeof k!="number"&&qn(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),D$(f,b,k,c)}}function R0(c){return function(f,b){return typeof f=="string"&&typeof b=="string"||(f=Xs(f),b=Xs(b)),c(f,b)}}function M6(c,f,b,k,j,W,J,re,ue,_e){var Ce=f&E,Be=Ce?J:e,Ne=Ce?e:J,Ge=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,Ge,Be,it,Ne,re,ue,_e],nt=b.apply(e,Et);return Tv(c)&&Q6(nt,Et),nt.placeholder=k,e5(nt,c,f)}function Bv(c){var f=wr[c];return function(b,k){if(b=Xs(b),k=k==null?0:yn(yt(k),292),k&&e6(b)){var j=(Gt(b)+"e").split("e"),W=f(j[0]+"e"+(+j[1]+k));return j=(Gt(W)+"e").split("e"),+(j[0]+"e"+(+j[1]-k))}return f(b)}}var q$=Ol&&1/Go(new Ol([,-0]))[1]==P?function(c){return new Ol(c)}:Zv;function q6(c){return function(f){var b=En(f);return b==Oe?Gr(f):b==lt?p0(f):l0(f,c(f))}}function Jo(c,f,b,k,j,W,J,re){var ue=f&y;if(!ue&&typeof c!="function")throw new ss(i);var _e=k?k.length:0;if(_e||(f&=~(C|F),k=j=e),J=J===e?J:Tr(yt(J),0),re=re===e?re:yt(re),_e-=j?j.length:0,f&F){var Ce=k,Be=j;k=j=e}var Ne=ue?e:$v(c),Ge=[c,f,b,k,j,Ce,Be,W,J,re];if(Ne&&nP(Ge,Ne),c=Ge[0],f=Ge[1],b=Ge[2],k=Ge[3],j=Ge[4],re=Ge[9]=Ge[9]===e?ue?0:c.length:Tr(Ge[9]-_e,0),!re&&f&(E|_)&&(f&=~(E|_)),!f||f==g)var it=U$(c,f,b);else f==E||f==_?it=H$(c,f,re):(f==C||f==(g|C))&&!j.length?it=M$(c,f,b,k):it=$0.apply(e,Ge);var Et=Ne?A6:Q6;return e5(Et(it,Ge),c,f)}function j6(c,f,b,k){return c===e||bi(c,Ds[b])&&!Nt.call(k,b)?f:c}function K6(c,f,b,k,j,W){return cr(c)&&cr(f)&&(W.set(f,c),F0(c,f,e,K6,W),W.delete(f)),c}function j$(c){return Yh(c)?e:c}function V6(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,Ge=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(Ge){if(!tr(f,function(Ft,$t){if(!Vo(Ge,$t)&&(it===Ft||j(it,Ft,b,k,W)))return Ge.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 K$(c,f,b,k,j,W,J){switch(b){case or:if(c.byteLength!=f.byteLength||c.byteOffset!=f.byteOffset)return!1;c=c.buffer,f=f.buffer;case Re:return!(c.byteLength!=f.byteLength||!W(new Pl(c),new Pl(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=Gr;case lt:var ue=k&d;if(re||(re=Go),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=V6(re(c),re(f),k,j,W,J);return J.delete(c),Ce;case es:if(Hh)return Hh.call(c)==Hh.call(f)}return!1}function V$(c,f,b,k,j,W){var J=b&d,re=Iv(c),ue=re.length,_e=Iv(f),Ce=_e.length;if(ue!=Ce&&!J)return!1;for(var Be=ue;Be--;){var Ne=re[Be];if(!(J?Ne in f:Nt.call(f,Ne)))return!1}var Ge=W.get(c),it=W.get(f);if(Ge&&it)return Ge==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 Is=J?k($t,Ft,Ne,f,c,W):k(Ft,$t,Ne,c,f,W);if(!(Is===e?Ft===$t||j(Ft,$t,b,k,W):Is)){Et=!1;break}nt||(nt=Ne=="constructor")}if(Et&&!nt){var jn=c.constructor,xs=f.constructor;jn!=xs&&"constructor"in c&&"constructor"in f&&!(typeof jn=="function"&&jn instanceof jn&&typeof xs=="function"&&xs instanceof xs)&&(Et=!1)}return W.delete(c),W.delete(f),Et}function Qo(c){return Nv(Z6(c,e,o5),c+"")}function Iv(c){return f6(c,zr,kv)}function xv(c){return f6(c,as,G6)}var $v=b0?function(c){return b0.get(c)}:Zv;function T0(c){for(var f=c.name+"",b=Nl[f],k=Nt.call(Nl,f)?b.length:0;k--;){var j=b[k],W=j.func;if(W==null||W==c)return j.name}return f}function Ml(c){var f=Nt.call(z,"placeholder")?z:c;return f.placeholder}function st(){var c=z.iteratee||Yv;return c=c===Yv?p6:c,arguments.length?c(arguments[0],arguments[1]):c}function O0(c,f){var b=c.__data__;return Q$(f)?b[typeof f=="string"?"string":"hash"]:b.map}function Pv(c){for(var f=zr(c),b=f.length;b--;){var k=f[b],j=c[k];f[b]=[k,j,Y6(j)]}return f}function Ec(c,f){var b=d0(c,f);return d6(b)?b:e}function G$(c){var f=Nt.call(c,Yo),b=c[Yo];try{c[Yo]=e;var k=!0}catch{}var j=xl.call(c);return k&&(f?c[Yo]=b:delete c[Yo]),j}var kv=Mt?function(c){return c==null?[]:(c=Vt(c),Rr(Mt(c),function(f){return Yt.call(c,f)}))}:Jv,G6=Mt?function(c){for(var f=[];c;)Qi(f,kv(c)),c=kl(c);return f}:Jv,En=Mn;(av&&En(new av(new ArrayBuffer(1)))!=or||Nh&&En(new Nh)!=Oe||uv&&En(uv.resolve())!=mn||Ol&&En(new Ol)!=lt||Lh&&En(new Lh)!=Dt)&&(En=function(c){var f=Mn(c),b=f==ct?c.constructor:e,k=b?bc(b):"";if(k)switch(k){case Bx:return or;case Ix:return Oe;case xx:return mn;case $x:return lt;case Px:return Dt}return f});function z$(c,f,b){for(var k=-1,j=b.length;++k<j;){var W=b[k],J=W.size;switch(W.type){case"drop":c+=J;break;case"dropRight":f-=J;break;case"take":f=yn(f,c+J);break;case"takeRight":c=Tr(c,f-J);break}}return{start:c,end:f}}function W$(c){var f=c.match(Me);return f?f[1].split(et):[]}function z6(c,f,b){f=gu(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&&j0(j)&&ea(J,j)&&(ht(c)||Ac(c)))}function Y$(c){var f=c.length,b=new c.constructor(f);return f&&typeof c[0]=="string"&&Nt.call(c,"index")&&(b.index=c.index,b.input=c.input),b}function W6(c){return typeof c.constructor=="function"&&!zh(c)?Ll(kl(c)):{}}function X$(c,f,b){var k=c.constructor;switch(f){case Re:return Dv(c);case Ie:case se:return new k(+c);case or:return k$(c,b);case Tn:case mt:case cc:case On:case Se:case ru:case Ut:case gn:case Yi:return x6(c,b);case Oe:return new k;case pt:case Pr:return new k(c);case vr:return R$(c);case lt:return new k;case es:return T$(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 J$(c){return ht(c)||Ac(c)||!!(Tl&&c&&c[Tl])}function ea(c,f){var b=typeof c;return f=f??M,!!f&&(b=="number"||b!="symbol"&&Ln.test(c))&&c>-1&&c%1==0&&c<f}function qn(c,f,b){if(!cr(b))return!1;var k=typeof f;return(k=="number"?os(b)&&ea(f,b.length):k=="string"&&f in b)?bi(b[f],c):!1}function Rv(c,f){if(ht(c))return!1;var b=typeof c;return b=="number"||b=="symbol"||b=="boolean"||c==null||Bs(c)?!0:hh.test(c)||!iu.test(c)||f!=null&&c in Vt(f)}function Q$(c){var f=typeof c;return f=="string"||f=="number"||f=="symbol"||f=="boolean"?c!=="__proto__":c===null}function Tv(c){var f=T0(c),b=z[f];if(typeof b!="function"||!(f in Bt.prototype))return!1;if(c===b)return!0;var k=$v(b);return!!k&&c===k[0]}function eP(c){return!!w0&&w0 in c}var tP=Il?ta:Qv;function zh(c){var f=c&&c.constructor,b=typeof f=="function"&&f.prototype||Ds;return c===b}function Y6(c){return c===c&&!cr(c)}function X6(c,f){return function(b){return b==null?!1:b[c]===f&&(f!==e||c in Vt(b))}}function rP(c){var f=M0(c,function(k){return b.size===u&&b.clear(),k}),b=f.cache;return f}function nP(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?P6(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?k6(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 sP(c){var f=[];if(c!=null)for(var b in Vt(c))f.push(b);return f}function iP(c){return xl.call(c)}function Z6(c,f,b){return f=Tr(f===e?c.length-1:f,0),function(){for(var k=arguments,j=-1,W=Tr(k.length-f,0),J=de(W);++j<W;)J[j]=k[f+j];j=-1;for(var re=de(f+1);++j<f;)re[j]=k[j];return re[f]=b(J),Un(c,this,re)}}function J6(c,f){return f.length<2?c:yc(c,Ws(f,0,-1))}function oP(c,f){for(var b=c.length,k=yn(f.length,b),j=is(c);k--;){var W=f[k];c[k]=ea(W,b)?j[W]:e}return c}function Ov(c,f){if(!(f==="constructor"&&typeof c[f]=="function")&&f!="__proto__")return c[f]}var Q6=t5(A6),Wh=Z||function(c,f){return Ir.setTimeout(c,f)},Nv=t5(I$);function e5(c,f,b){var k=f+"";return Nv(c,Z$(k,aP(W$(k),b)))}function t5(c){var f=0,b=0;return function(){var k=Cx(),j=R-(k-b);if(b=k,j>0){if(++f>=L)return arguments[0]}else f=0;return c.apply(e,arguments)}}function N0(c,f){var b=-1,k=c.length,j=k-1;for(f=f===e?k:f;++b<f;){var W=yv(b,j),J=c[W];c[W]=c[b],c[b]=J}return c.length=f,c}var r5=rP(function(c){var f=[];return c.charCodeAt(0)===46&&f.push(""),c.replace(Cl,function(b,k,j,W){f.push(j?W.replace(kr,"$1"):k||b)}),f});function Ei(c){if(typeof c=="string"||Bs(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 aP(c,f){return U(me,function(b){var k="_."+b[0];f&b[1]&&!lu(c,k)&&c.push(k)}),c.sort()}function n5(c){if(c instanceof Bt)return c.clone();var f=new Gs(c.__wrapped__,c.__chain__);return f.__actions__=is(c.__actions__),f.__index__=c.__index__,f.__values__=c.__values__,f}function uP(c,f,b){(b?qn(c,f,b):f===e)?f=1:f=Tr(yt(f),0);var k=c==null?0:c.length;if(!k||f<1)return[];for(var j=0,W=0,J=de(fe(k/f));j<k;)J[W++]=Ws(c,j,j+=f);return J}function cP(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 lP(){var c=arguments.length;if(!c)return[];for(var f=de(c-1),b=arguments[0],k=c;k--;)f[k-1]=arguments[k];return Qi(ht(b)?is(b):[b],tn(f,1))}var fP=At(function(c,f){return Er(c)?qh(c,tn(f,1,Er,!0)):[]}),hP=At(function(c,f){var b=Ys(f);return Er(b)&&(b=e),Er(c)?qh(c,tn(f,1,Er,!0),st(b,2)):[]}),dP=At(function(c,f){var b=Ys(f);return Er(b)&&(b=e),Er(c)?qh(c,tn(f,1,Er,!0),e,b):[]});function pP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),Ws(c,f<0?0:f,k)):[]}function mP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),f=k-f,Ws(c,0,f<0?0:f)):[]}function gP(c,f){return c&&c.length?I0(c,st(f,3),!0,!0):[]}function vP(c,f){return c&&c.length?I0(c,st(f,3),!0):[]}function wP(c,f,b,k){var j=c==null?0:c.length;return j?(b&&typeof b!="number"&&qn(c,f,b)&&(b=0,k=j),l$(c,f,b,k)):[]}function s5(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=b==null?0:yt(b);return j<0&&(j=Tr(k+j,0)),Bl(c,st(f,3),j)}function i5(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=k-1;return b!==e&&(j=yt(b),j=b<0?Tr(k+j,0):yn(j,k-1)),Bl(c,st(f,3),j,!0)}function o5(c){var f=c==null?0:c.length;return f?tn(c,1):[]}function yP(c){var f=c==null?0:c.length;return f?tn(c,P):[]}function EP(c,f){var b=c==null?0:c.length;return b?(f=f===e?1:yt(f),tn(c,f)):[]}function bP(c){for(var f=-1,b=c==null?0:c.length,k={};++f<b;){var j=c[f];to(k,j[0],j[1])}return k}function a5(c){return c&&c.length?c[0]:e}function AP(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=b==null?0:yt(b);return j<0&&(j=Tr(k+j,0)),fu(c,f,j)}function SP(c){var f=c==null?0:c.length;return f?Ws(c,0,-1):[]}var _P=At(function(c){var f=Wt(c,_v);return f.length&&f[0]===c[0]?pv(f):[]}),CP=At(function(c){var f=Ys(c),b=Wt(c,_v);return f===Ys(b)?f=e:b.pop(),b.length&&b[0]===c[0]?pv(b,st(f,2)):[]}),DP=At(function(c){var f=Ys(c),b=Wt(c,_v);return f=typeof f=="function"?f:e,f&&b.pop(),b.length&&b[0]===c[0]?pv(b,e,f):[]});function FP(c,f){return c==null?"":Sx.call(c,f)}function Ys(c){var f=c==null?0:c.length;return f?c[f-1]:e}function BP(c,f,b){var k=c==null?0:c.length;if(!k)return-1;var j=k;return b!==e&&(j=yt(b),j=j<0?Tr(k+j,0):yn(j,k-1)),f===f?m0(c,f,j):Bl(c,_h,j,!0)}function IP(c,f){return c&&c.length?w6(c,yt(f)):e}var xP=At(u5);function u5(c,f){return c&&c.length&&f&&f.length?wv(c,f):c}function $P(c,f,b){return c&&c.length&&f&&f.length?wv(c,f,st(b,2)):c}function PP(c,f,b){return c&&c.length&&f&&f.length?wv(c,f,e,b):c}var kP=Qo(function(c,f){var b=c==null?0:c.length,k=lv(c,f);return b6(c,Wt(f,function(j){return ea(j,b)?+j:j}).sort($6)),k});function RP(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 b6(c,j),b}function Lv(c){return c==null?c:Fx.call(c)}function TP(c,f,b){var k=c==null?0:c.length;return k?(b&&typeof b!="number"&&qn(c,f,b)?(f=0,b=k):(f=f==null?0:yt(f),b=b===e?k:yt(b)),Ws(c,f,b)):[]}function OP(c,f){return B0(c,f)}function NP(c,f,b){return bv(c,f,st(b,2))}function LP(c,f){var b=c==null?0:c.length;if(b){var k=B0(c,f);if(k<b&&bi(c[k],f))return k}return-1}function UP(c,f){return B0(c,f,!0)}function HP(c,f,b){return bv(c,f,st(b,2),!0)}function MP(c,f){var b=c==null?0:c.length;if(b){var k=B0(c,f,!0)-1;if(bi(c[k],f))return k}return-1}function qP(c){return c&&c.length?S6(c):[]}function jP(c,f){return c&&c.length?S6(c,st(f,2)):[]}function KP(c){var f=c==null?0:c.length;return f?Ws(c,1,f):[]}function VP(c,f,b){return c&&c.length?(f=b||f===e?1:yt(f),Ws(c,0,f<0?0:f)):[]}function GP(c,f,b){var k=c==null?0:c.length;return k?(f=b||f===e?1:yt(f),f=k-f,Ws(c,f<0?0:f,k)):[]}function zP(c,f){return c&&c.length?I0(c,st(f,3),!1,!0):[]}function WP(c,f){return c&&c.length?I0(c,st(f,3)):[]}var YP=At(function(c){return mu(tn(c,1,Er,!0))}),XP=At(function(c){var f=Ys(c);return Er(f)&&(f=e),mu(tn(c,1,Er,!0),st(f,2))}),ZP=At(function(c){var f=Ys(c);return f=typeof f=="function"?f:e,mu(tn(c,1,Er,!0),e,f)});function JP(c){return c&&c.length?mu(c):[]}function QP(c,f){return c&&c.length?mu(c,st(f,2)):[]}function ek(c,f){return f=typeof f=="function"?f:e,c&&c.length?mu(c,e,f):[]}function Uv(c){if(!(c&&c.length))return[];var f=0;return c=Rr(c,function(b){if(Er(b))return f=Tr(b.length,f),!0}),Bh(f,function(b){return Wt(c,Ae(b))})}function c5(c,f){if(!(c&&c.length))return[];var b=Uv(c);return f==null?b:Wt(b,function(k){return Un(f,e,k)})}var tk=At(function(c,f){return Er(c)?qh(c,f):[]}),rk=At(function(c){return Sv(Rr(c,Er))}),nk=At(function(c){var f=Ys(c);return Er(f)&&(f=e),Sv(Rr(c,Er),st(f,2))}),sk=At(function(c){var f=Ys(c);return f=typeof f=="function"?f:e,Sv(Rr(c,Er),e,f)}),ik=At(Uv);function ok(c,f){return F6(c||[],f||[],Mh)}function ak(c,f){return F6(c||[],f||[],Vh)}var uk=At(function(c){var f=c.length,b=f>1?c[f-1]:e;return b=typeof b=="function"?(c.pop(),b):e,c5(c,b)});function l5(c){var f=z(c);return f.__chain__=!0,f}function ck(c,f){return f(c),c}function L0(c,f){return f(c)}var lk=Qo(function(c){var f=c.length,b=f?c[0]:0,k=this.__wrapped__,j=function(W){return lv(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:L0,args:[j],thisArg:e}),new Gs(k,this.__chain__).thru(function(W){return f&&!W.length&&W.push(e),W}))});function fk(){return l5(this)}function hk(){return new Gs(this.value(),this.__chain__)}function dk(){this.__values__===e&&(this.__values__=_5(this.value()));var c=this.__index__>=this.__values__.length,f=c?e:this.__values__[this.__index__++];return{done:c,value:f}}function pk(){return this}function mk(c){for(var f,b=this;b instanceof S0;){var k=n5(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 gk(){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:L0,args:[Lv],thisArg:e}),new Gs(f,this.__chain__)}return this.thru(Lv)}function vk(){return D6(this.__wrapped__,this.__actions__)}var wk=x0(function(c,f,b){Nt.call(c,b)?++c[b]:to(c,b,1)});function yk(c,f,b){var k=ht(c)?hc:c$;return b&&qn(c,f,b)&&(f=e),k(c,st(f,3))}function Ek(c,f){var b=ht(c)?Rr:c6;return b(c,st(f,3))}var bk=N6(s5),Ak=N6(i5);function Sk(c,f){return tn(U0(c,f),1)}function _k(c,f){return tn(U0(c,f),P)}function Ck(c,f,b){return b=b===e?1:yt(b),tn(U0(c,f),b)}function f5(c,f){var b=ht(c)?U:pu;return b(c,st(f,3))}function h5(c,f){var b=ht(c)?ft:u6;return b(c,st(f,3))}var Dk=x0(function(c,f,b){Nt.call(c,b)?c[b].push(f):to(c,b,[f])});function Fk(c,f,b,k){c=os(c)?c:jl(c),b=b&&!k?yt(b):0;var j=c.length;return b<0&&(b=Tr(j+b,0)),K0(c)?b<=j&&c.indexOf(f,b)>-1:!!j&&fu(c,f,b)>-1}var Bk=At(function(c,f,b){var k=-1,j=typeof f=="function",W=os(c)?de(c.length):[];return pu(c,function(J){W[++k]=j?Un(f,J,b):jh(J,f,b)}),W}),Ik=x0(function(c,f,b){to(c,b,f)});function U0(c,f){var b=ht(c)?Wt:m6;return b(c,st(f,3))}function xk(c,f,b,k){return c==null?[]:(ht(f)||(f=f==null?[]:[f]),b=k?e:b,ht(b)||(b=b==null?[]:[b]),y6(c,f,b))}var $k=x0(function(c,f,b){c[b?0:1].push(f)},function(){return[[],[]]});function Pk(c,f,b){var k=ht(c)?u0:Dh,j=arguments.length<3;return k(c,st(f,4),b,j,pu)}function kk(c,f,b){var k=ht(c)?JS:Dh,j=arguments.length<3;return k(c,st(f,4),b,j,u6)}function Rk(c,f){var b=ht(c)?Rr:c6;return b(c,q0(st(f,3)))}function Tk(c){var f=ht(c)?s6:F$;return f(c)}function Ok(c,f,b){(b?qn(c,f,b):f===e)?f=1:f=yt(f);var k=ht(c)?s$:B$;return k(c,f)}function Nk(c){var f=ht(c)?i$:x$;return f(c)}function Lk(c){if(c==null)return 0;if(os(c))return K0(c)?zo(c):c.length;var f=En(c);return f==Oe||f==lt?c.size:gv(c).length}function Uk(c,f,b){var k=ht(c)?tr:$$;return b&&qn(c,f,b)&&(f=e),k(c,st(f,3))}var Hk=At(function(c,f){if(c==null)return[];var b=f.length;return b>1&&qn(c,f[0],f[1])?f=[]:b>2&&qn(f[0],f[1],f[2])&&(f=[f[0]]),y6(c,tn(f,1),[])}),H0=ee||function(){return Ir.Date.now()};function Mk(c,f){if(typeof f!="function")throw new ss(i);return c=yt(c),function(){if(--c<1)return f.apply(this,arguments)}}function d5(c,f,b){return f=b?e:f,f=c&&f==null?c.length:f,Jo(c,H,e,e,e,e,f)}function p5(c,f){var b;if(typeof f!="function")throw new ss(i);return c=yt(c),function(){return--c>0&&(b=f.apply(this,arguments)),c<=1&&(f=e),b}}var Hv=At(function(c,f,b){var k=g;if(b.length){var j=en(b,Ml(Hv));k|=C}return Jo(c,k,f,b,j)}),m5=At(function(c,f,b){var k=g|y;if(b.length){var j=en(b,Ml(m5));k|=C}return Jo(f,k,c,b,j)});function g5(c,f,b){f=b?e:f;var k=Jo(c,E,e,e,e,e,e,f);return k.placeholder=g5.placeholder,k}function v5(c,f,b){f=b?e:f;var k=Jo(c,_,e,e,e,e,e,f);return k.placeholder=v5.placeholder,k}function w5(c,f,b){var k,j,W,J,re,ue,_e=0,Ce=!1,Be=!1,Ne=!0;if(typeof c!="function")throw new ss(i);f=Xs(f)||0,cr(b)&&(Ce=!!b.leading,Be="maxWait"in b,W=Be?Tr(Xs(b.maxWait)||0,f):W,Ne="trailing"in b?!!b.trailing:Ne);function Ge(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=Wh(Ft,f),Ce?Ge(br):J}function Et(br){var Ai=br-ue,na=br-_e,L5=f-Ai;return Be?yn(L5,W-na):L5}function nt(br){var Ai=br-ue,na=br-_e;return ue===e||Ai>=f||Ai<0||Be&&na>=W}function Ft(){var br=H0();if(nt(br))return $t(br);re=Wh(Ft,Et(br))}function $t(br){return re=e,Ne&&k?Ge(br):(k=j=e,J)}function Is(){re!==e&&B6(re),_e=0,k=ue=j=re=e}function jn(){return re===e?J:$t(H0())}function xs(){var br=H0(),Ai=nt(br);if(k=arguments,j=this,ue=br,Ai){if(re===e)return it(ue);if(Be)return B6(re),re=Wh(Ft,f),Ge(ue)}return re===e&&(re=Wh(Ft,f)),J}return xs.cancel=Is,xs.flush=jn,xs}var qk=At(function(c,f){return a6(c,1,f)}),jk=At(function(c,f,b){return a6(c,Xs(f)||0,b)});function Kk(c){return Jo(c,S)}function M0(c,f){if(typeof c!="function"||f!=null&&typeof f!="function")throw new ss(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(M0.Cache||Zo),b}M0.Cache=Zo;function q0(c){if(typeof c!="function")throw new ss(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 Vk(c){return p5(2,c)}var Gk=P$(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)})}),Mv=At(function(c,f){var b=en(f,Ml(Mv));return Jo(c,C,e,f,b)}),y5=At(function(c,f){var b=en(f,Ml(y5));return Jo(c,F,e,f,b)}),zk=Qo(function(c,f){return Jo(c,K,e,e,e,f)});function Wk(c,f){if(typeof c!="function")throw new ss(i);return f=f===e?f:yt(f),At(c,f)}function Yk(c,f){if(typeof c!="function")throw new ss(i);return f=f==null?0:Tr(yt(f),0),At(function(b){var k=b[f],j=vu(b,0,f);return k&&Qi(j,k),Un(c,this,j)})}function Xk(c,f,b){var k=!0,j=!0;if(typeof c!="function")throw new ss(i);return cr(b)&&(k="leading"in b?!!b.leading:k,j="trailing"in b?!!b.trailing:j),w5(c,f,{leading:k,maxWait:f,trailing:j})}function Zk(c){return d5(c,1)}function Jk(c,f){return Mv(Cv(f),c)}function Qk(){if(!arguments.length)return[];var c=arguments[0];return ht(c)?c:[c]}function eR(c){return zs(c,p)}function tR(c,f){return f=typeof f=="function"?f:e,zs(c,p,f)}function rR(c){return zs(c,h|p)}function nR(c,f){return f=typeof f=="function"?f:e,zs(c,h|p,f)}function sR(c,f){return f==null||o6(c,f,zr(f))}function bi(c,f){return c===f||c!==c&&f!==f}var iR=R0(dv),oR=R0(function(c,f){return c>=f}),Ac=h6((function(){return arguments})())?h6:function(c){return hr(c)&&Nt.call(c,"callee")&&!Yt.call(c,"callee")},ht=de.isArray,aR=r0?Qr(r0):m$;function os(c){return c!=null&&j0(c.length)&&!ta(c)}function Er(c){return hr(c)&&os(c)}function uR(c){return c===!0||c===!1||hr(c)&&Mn(c)==Ie}var wu=yr||Qv,cR=n0?Qr(n0):g$;function lR(c){return hr(c)&&c.nodeType===1&&!Yh(c)}function fR(c){if(c==null)return!0;if(os(c)&&(ht(c)||typeof c=="string"||typeof c.splice=="function"||wu(c)||ql(c)||Ac(c)))return!c.length;var f=En(c);if(f==Oe||f==lt)return!c.size;if(zh(c))return!gv(c).length;for(var b in c)if(Nt.call(c,b))return!1;return!0}function hR(c,f){return Kh(c,f)}function dR(c,f,b){b=typeof b=="function"?b:e;var k=b?b(c,f):e;return k===e?Kh(c,f,e,b):!!k}function qv(c){if(!hr(c))return!1;var f=Mn(c);return f==Fe||f==pe||typeof c.message=="string"&&typeof c.name=="string"&&!Yh(c)}function pR(c){return typeof c=="number"&&e6(c)}function ta(c){if(!cr(c))return!1;var f=Mn(c);return f==Te||f==Ve||f==Pe||f==gr}function E5(c){return typeof c=="number"&&c==yt(c)}function j0(c){return typeof c=="number"&&c>-1&&c%1==0&&c<=M}function cr(c){var f=typeof c;return c!=null&&(f=="object"||f=="function")}function hr(c){return c!=null&&typeof c=="object"}var b5=s0?Qr(s0):w$;function mR(c,f){return c===f||mv(c,f,Pv(f))}function gR(c,f,b){return b=typeof b=="function"?b:e,mv(c,f,Pv(f),b)}function vR(c){return A5(c)&&c!=+c}function wR(c){if(tP(c))throw new ot(n);return d6(c)}function yR(c){return c===null}function ER(c){return c==null}function A5(c){return typeof c=="number"||hr(c)&&Mn(c)==pt}function Yh(c){if(!hr(c)||Mn(c)!=ct)return!1;var f=kl(c);if(f===null)return!0;var b=Nt.call(f,"constructor")&&f.constructor;return typeof b=="function"&&b instanceof b&&Wo.call(b)==sv}var jv=i0?Qr(i0):y$;function bR(c){return E5(c)&&c>=-M&&c<=M}var S5=o0?Qr(o0):E$;function K0(c){return typeof c=="string"||!ht(c)&&hr(c)&&Mn(c)==Pr}function Bs(c){return typeof c=="symbol"||hr(c)&&Mn(c)==es}var ql=a0?Qr(a0):b$;function AR(c){return c===e}function SR(c){return hr(c)&&En(c)==Dt}function _R(c){return hr(c)&&Mn(c)==Ze}var CR=R0(vv),DR=R0(function(c,f){return c<=f});function _5(c){if(!c)return[];if(os(c))return K0(c)?Hn(c):is(c);if(mc&&c[mc])return J2(c[mc]());var f=En(c),b=f==Oe?Gr:f==lt?Go:jl;return b(c)}function ra(c){if(!c)return c===0?c:0;if(c=Xs(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 C5(c){return c?wc(yt(c),0,X):0}function Xs(c){if(typeof c=="number")return c;if(Bs(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=Ih(c);var b=Nn.test(c);return b||Fr.test(c)?G2(c.slice(2),b?2:8):Zi.test(c)?V:+c}function D5(c){return no(c,as(c))}function FR(c){return c?wc(yt(c),-M,M):c===0?c:0}function Gt(c){return c==null?"":Fs(c)}var BR=Ul(function(c,f){if(zh(f)||os(f)){no(f,zr(f),c);return}for(var b in f)Nt.call(f,b)&&Mh(c,b,f[b])}),F5=Ul(function(c,f){no(f,as(f),c)}),B5=Ul(function(c,f,b,k){no(f,as(f),c,k)}),Kv=Ul(function(c,f,b,k){no(f,zr(f),c,k)}),IR=Qo(lv);function xR(c,f){var b=Ll(c);return f==null?b:i6(b,f)}var $R=At(function(c,f){c=Vt(c);var b=-1,k=f.length,j=k>2?f[2]:e;for(j&&qn(f[0],f[1],j)&&(k=1);++b<k;)for(var W=f[b],J=as(W),re=-1,ue=J.length;++re<ue;){var _e=J[re],Ce=c[_e];(Ce===e||bi(Ce,Ds[_e])&&!Nt.call(c,_e))&&(c[_e]=W[_e])}return c}),PR=At(function(c){return c.push(e,K6),Un(I5,e,c)});function kR(c,f){return Vr(c,st(f,3),ro)}function RR(c,f){return Vr(c,st(f,3),hv)}function TR(c,f){return c==null?c:fv(c,st(f,3),as)}function OR(c,f){return c==null?c:l6(c,st(f,3),as)}function NR(c,f){return c&&ro(c,st(f,3))}function LR(c,f){return c&&hv(c,st(f,3))}function UR(c){return c==null?[]:D0(c,zr(c))}function HR(c){return c==null?[]:D0(c,as(c))}function Vv(c,f,b){var k=c==null?e:yc(c,f);return k===e?b:k}function MR(c,f){return c!=null&&z6(c,f,f$)}function Gv(c,f){return c!=null&&z6(c,f,h$)}var qR=U6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=xl.call(f)),c[f]=b},Wv(us)),jR=U6(function(c,f,b){f!=null&&typeof f.toString!="function"&&(f=xl.call(f)),Nt.call(c,f)?c[f].push(b):c[f]=[b]},st),KR=At(jh);function zr(c){return os(c)?n6(c):gv(c)}function as(c){return os(c)?n6(c,!0):A$(c)}function VR(c,f){var b={};return f=st(f,3),ro(c,function(k,j,W){to(b,f(k,j,W),k)}),b}function GR(c,f){var b={};return f=st(f,3),ro(c,function(k,j,W){to(b,j,f(k,j,W))}),b}var zR=Ul(function(c,f,b){F0(c,f,b)}),I5=Ul(function(c,f,b,k){F0(c,f,b,k)}),WR=Qo(function(c,f){var b={};if(c==null)return b;var k=!1;f=Wt(f,function(W){return W=gu(W,c),k||(k=W.length>1),W}),no(c,xv(c),b),k&&(b=zs(b,h|m|p,j$));for(var j=f.length;j--;)Av(b,f[j]);return b});function YR(c,f){return x5(c,q0(st(f)))}var XR=Qo(function(c,f){return c==null?{}:_$(c,f)});function x5(c,f){if(c==null)return{};var b=Wt(xv(c),function(k){return[k]});return f=st(f),E6(c,b,function(k,j){return f(k,j[0])})}function ZR(c,f,b){f=gu(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 JR(c,f,b){return c==null?c:Vh(c,f,b)}function QR(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:Vh(c,f,b,k)}var $5=q6(zr),P5=q6(as);function eT(c,f,b){var k=ht(c),j=k||wu(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)?Ll(kl(c)):{}:b={}}return(j?U:ro)(c,function(J,re,ue){return f(b,J,re,ue)}),b}function tT(c,f){return c==null?!0:Av(c,f)}function rT(c,f,b){return c==null?c:C6(c,f,Cv(b))}function nT(c,f,b,k){return k=typeof k=="function"?k:e,c==null?c:C6(c,f,Cv(b),k)}function jl(c){return c==null?[]:xh(c,zr(c))}function sT(c){return c==null?[]:xh(c,as(c))}function iT(c,f,b){return b===e&&(b=f,f=e),b!==e&&(b=Xs(b),b=b===b?b:0),f!==e&&(f=Xs(f),f=f===f?f:0),wc(Xs(c),f,b)}function oT(c,f,b){return f=ra(f),b===e?(b=f,f=0):b=ra(b),c=Xs(c),d$(c,f,b)}function aT(c,f,b){if(b&&typeof b!="boolean"&&qn(c,f,b)&&(f=b=e),b===e&&(typeof f=="boolean"?(b=f,f=e):typeof c=="boolean"&&(b=c,c=e)),c===e&&f===e?(c=0,f=1):(c=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=t6();return yn(c+j*(f-c+V2("1e-"+((j+"").length-1))),f)}return yv(c,f)}var uT=Hl(function(c,f,b){return f=f.toLowerCase(),c+(b?k5(f):f)});function k5(c){return zv(Gt(c).toLowerCase())}function R5(c){return c=Gt(c),c&&c.replace(ou,Y2).replace(T2,"")}function cT(c,f,b){c=Gt(c),f=Fs(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 lT(c){return c=Gt(c),c&&js.test(c)?c.replace(Xi,h0):c}function fT(c){return c=Gt(c),c&&dh.test(c)?c.replace(fc,"\\$&"):c}var hT=Hl(function(c,f,b){return c+(b?"-":"")+f.toLowerCase()}),dT=Hl(function(c,f,b){return c+(b?" ":"")+f.toLowerCase()}),pT=O6("toLowerCase");function mT(c,f,b){c=Gt(c),f=yt(f);var k=f?zo(c):0;if(!f||k>=f)return c;var j=(f-k)/2;return k0(ge(j),b)+c+k0(fe(j),b)}function gT(c,f,b){c=Gt(c),f=yt(f);var k=f?zo(c):0;return f&&k<f?c+k0(f-k,b):c}function vT(c,f,b){c=Gt(c),f=yt(f);var k=f?zo(c):0;return f&&k<f?k0(f-k,b)+c:c}function wT(c,f,b){return b||f==null?f=0:f&&(f=+f),Dx(Gt(c).replace(ie,""),f||0)}function yT(c,f,b){return(b?qn(c,f,b):f===e)?f=1:f=yt(f),Ev(Gt(c),f)}function ET(){var c=arguments,f=Gt(c[0]);return c.length<3?f:f.replace(c[1],c[2])}var bT=Hl(function(c,f,b){return c+(b?"_":"")+f.toLowerCase()});function AT(c,f,b){return b&&typeof b!="number"&&qn(c,f,b)&&(f=b=e),b=b===e?X:b>>>0,b?(c=Gt(c),c&&(typeof f=="string"||f!=null&&!jv(f))&&(f=Fs(f),!f&&du(c))?vu(Hn(c),0,b):c.split(f,b)):[]}var ST=Hl(function(c,f,b){return c+(b?" ":"")+zv(f)});function _T(c,f,b){return c=Gt(c),b=b==null?0:wc(yt(b),0,c.length),f=Fs(f),c.slice(b,b+f.length)==f}function CT(c,f,b){var k=z.templateSettings;b&&qn(c,f,b)&&(f=e),c=Gt(c),f=Kv({},f,k,j6);var j=Kv({},f.imports,k.imports,j6),W=zr(j),J=xh(j,W);U(W,function(nt){if(wt.test(nt))throw new ot(s)});var re,ue,_e=0,Ce=f.interpolate||au,Be="__p += '",Ne=Th((f.escape||au).source+"|"+Ce.source+"|"+(Ce===lc?ar:au).source+"|"+(f.evaluate||au).source+"|$","g"),Ge="//# sourceURL="+(Nt.call(f,"sourceURL")?(f.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++H2+"]")+`
`;c.replace(Ne,function(nt,Ft,$t,Is,jn,xs){return $t||($t=Is),Be+=c.slice(_e,xs).replace(ph,X2),Ft&&(re=!0,Be+=`' +
__e(`+Ft+`) +
'`),jn&&(ue=!0,Be+=`';
`+jn+`;
__p += '`),$t&&(Be+=`' +
((__t = (`+$t+`)) == null ? '' : __t) +
'`),_e=xs+nt.length,nt}),Be+=`';
`;var it=Nt.call(f,"variable")&&f.variable;if(!it)Be=`with (obj) {
`+Be+`
}
`;else if(wt.test(it))throw new ot(o);Be=(ue?Be.replace(Sl,""):Be).replace(nu,"$1").replace(lh,"$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=O5(function(){return xt(W,Ge+"return "+Be).apply(e,J)});if(Et.source=Be,qv(Et))throw Et;return Et}function DT(c){return Gt(c).toLowerCase()}function FT(c){return Gt(c).toUpperCase()}function BT(c,f,b){if(c=Gt(c),c&&(b||f===e))return Ih(c);if(!c||!(f=Fs(f)))return c;var k=Hn(c),j=Hn(f),W=f0(k,j),J=$h(k,j)+1;return vu(k,W,J).join("")}function IT(c,f,b){if(c=Gt(c),c&&(b||f===e))return c.slice(0,kh(c)+1);if(!c||!(f=Fs(f)))return c;var k=Hn(c),j=$h(k,Hn(f))+1;return vu(k,0,j).join("")}function xT(c,f,b){if(c=Gt(c),c&&(b||f===e))return c.replace(ie,"");if(!c||!(f=Fs(f)))return c;var k=Hn(c),j=f0(k,Hn(f));return vu(k,j).join("")}function $T(c,f){var b=I,k=q;if(cr(f)){var j="separator"in f?f.separator:j;b="length"in f?yt(f.length):b,k="omission"in f?Fs(f.omission):k}c=Gt(c);var W=c.length;if(du(c)){var J=Hn(c);W=J.length}if(b>=W)return c;var re=b-zo(k);if(re<1)return k;var ue=J?vu(J,0,re).join(""):c.slice(0,re);if(j===e)return ue+k;if(J&&(re+=ue.length-re),jv(j)){if(c.slice(re).search(j)){var _e,Ce=ue;for(j.global||(j=Th(j.source,Gt(Ks.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(Fs(j),re)!=re){var Ne=ue.lastIndexOf(j);Ne>-1&&(ue=ue.slice(0,Ne))}return ue+k}function PT(c){return c=Gt(c),c&&Kt.test(c)?c.replace(su,g0):c}var kT=Hl(function(c,f,b){return c+(b?" ":"")+f.toUpperCase()}),zv=O6("toUpperCase");function T5(c,f,b){return c=Gt(c),f=b?e:f,f===e?Z2(c)?rv(c):rt(c):c.match(f)||[]}var O5=At(function(c,f){try{return Un(c,e,f)}catch(b){return qv(b)?b:new ot(b)}}),RT=Qo(function(c,f){return U(f,function(b){b=Ei(b),to(c,b,Hv(c[b],c))}),c});function TT(c){var f=c==null?0:c.length,b=st();return c=f?Wt(c,function(k){if(typeof k[1]!="function")throw new ss(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 OT(c){return u$(zs(c,h))}function Wv(c){return function(){return c}}function NT(c,f){return c==null||c!==c?f:c}var LT=L6(),UT=L6(!0);function us(c){return c}function Yv(c){return p6(typeof c=="function"?c:zs(c,h))}function HT(c){return g6(zs(c,h))}function MT(c,f){return v6(c,zs(f,h))}var qT=At(function(c,f){return function(b){return jh(b,c,f)}}),jT=At(function(c,f){return function(b){return jh(c,b,f)}});function Xv(c,f,b){var k=zr(f),j=D0(f,k);b==null&&!(cr(f)&&(j.length||!k.length))&&(b=f,f=c,c=this,j=D0(f,zr(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__=is(this.__actions__);return Be.push({func:ue,args:arguments,thisArg:c}),Ce.__chain__=_e,Ce}return ue.apply(c,Qi([this.value()],arguments))})}),c}function KT(){return Ir._===this&&(Ir._=iv),this}function Zv(){}function VT(c){return c=yt(c),At(function(f){return w6(f,c)})}var GT=Fv(Wt),zT=Fv(hc),WT=Fv(tr);function N5(c){return Rv(c)?Ae(Ei(c)):C$(c)}function YT(c){return function(f){return c==null?e:yc(c,f)}}var XT=H6(),ZT=H6(!0);function Jv(){return[]}function Qv(){return!1}function JT(){return{}}function QT(){return""}function eO(){return!0}function tO(c,f){if(c=yt(c),c<1||c>M)return[];var b=X,k=yn(c,X);f=st(f),c-=X;for(var j=Bh(k,f);++b<c;)f(b);return j}function rO(c){return ht(c)?Wt(c,Ei):Bs(c)?[c]:is(r5(Gt(c)))}function nO(c){var f=++Oh;return Gt(c)+f}var sO=P0(function(c,f){return c+f},0),iO=Bv("ceil"),oO=P0(function(c,f){return c/f},1),aO=Bv("floor");function uO(c){return c&&c.length?C0(c,us,dv):e}function cO(c,f){return c&&c.length?C0(c,st(f,2),dv):e}function lO(c){return hu(c,us)}function fO(c,f){return hu(c,st(f,2))}function hO(c){return c&&c.length?C0(c,us,vv):e}function dO(c,f){return c&&c.length?C0(c,st(f,2),vv):e}var pO=P0(function(c,f){return c*f},1),mO=Bv("round"),gO=P0(function(c,f){return c-f},0);function vO(c){return c&&c.length?Fh(c,us):0}function wO(c,f){return c&&c.length?Fh(c,st(f,2)):0}return z.after=Mk,z.ary=d5,z.assign=BR,z.assignIn=F5,z.assignInWith=B5,z.assignWith=Kv,z.at=IR,z.before=p5,z.bind=Hv,z.bindAll=RT,z.bindKey=m5,z.castArray=Qk,z.chain=l5,z.chunk=uP,z.compact=cP,z.concat=lP,z.cond=TT,z.conforms=OT,z.constant=Wv,z.countBy=wk,z.create=xR,z.curry=g5,z.curryRight=v5,z.debounce=w5,z.defaults=$R,z.defaultsDeep=PR,z.defer=qk,z.delay=jk,z.difference=fP,z.differenceBy=hP,z.differenceWith=dP,z.drop=pP,z.dropRight=mP,z.dropRightWhile=gP,z.dropWhile=vP,z.fill=wP,z.filter=Ek,z.flatMap=Sk,z.flatMapDeep=_k,z.flatMapDepth=Ck,z.flatten=o5,z.flattenDeep=yP,z.flattenDepth=EP,z.flip=Kk,z.flow=LT,z.flowRight=UT,z.fromPairs=bP,z.functions=UR,z.functionsIn=HR,z.groupBy=Dk,z.initial=SP,z.intersection=_P,z.intersectionBy=CP,z.intersectionWith=DP,z.invert=qR,z.invertBy=jR,z.invokeMap=Bk,z.iteratee=Yv,z.keyBy=Ik,z.keys=zr,z.keysIn=as,z.map=U0,z.mapKeys=VR,z.mapValues=GR,z.matches=HT,z.matchesProperty=MT,z.memoize=M0,z.merge=zR,z.mergeWith=I5,z.method=qT,z.methodOf=jT,z.mixin=Xv,z.negate=q0,z.nthArg=VT,z.omit=WR,z.omitBy=YR,z.once=Vk,z.orderBy=xk,z.over=GT,z.overArgs=Gk,z.overEvery=zT,z.overSome=WT,z.partial=Mv,z.partialRight=y5,z.partition=$k,z.pick=XR,z.pickBy=x5,z.property=N5,z.propertyOf=YT,z.pull=xP,z.pullAll=u5,z.pullAllBy=$P,z.pullAllWith=PP,z.pullAt=kP,z.range=XT,z.rangeRight=ZT,z.rearg=zk,z.reject=Rk,z.remove=RP,z.rest=Wk,z.reverse=Lv,z.sampleSize=Ok,z.set=JR,z.setWith=QR,z.shuffle=Nk,z.slice=TP,z.sortBy=Hk,z.sortedUniq=qP,z.sortedUniqBy=jP,z.split=AT,z.spread=Yk,z.tail=KP,z.take=VP,z.takeRight=GP,z.takeRightWhile=zP,z.takeWhile=WP,z.tap=ck,z.throttle=Xk,z.thru=L0,z.toArray=_5,z.toPairs=$5,z.toPairsIn=P5,z.toPath=rO,z.toPlainObject=D5,z.transform=eT,z.unary=Zk,z.union=YP,z.unionBy=XP,z.unionWith=ZP,z.uniq=JP,z.uniqBy=QP,z.uniqWith=ek,z.unset=tT,z.unzip=Uv,z.unzipWith=c5,z.update=rT,z.updateWith=nT,z.values=jl,z.valuesIn=sT,z.without=tk,z.words=T5,z.wrap=Jk,z.xor=rk,z.xorBy=nk,z.xorWith=sk,z.zip=ik,z.zipObject=ok,z.zipObjectDeep=ak,z.zipWith=uk,z.entries=$5,z.entriesIn=P5,z.extend=F5,z.extendWith=B5,Xv(z,z),z.add=sO,z.attempt=O5,z.camelCase=uT,z.capitalize=k5,z.ceil=iO,z.clamp=iT,z.clone=eR,z.cloneDeep=rR,z.cloneDeepWith=nR,z.cloneWith=tR,z.conformsTo=sR,z.deburr=R5,z.defaultTo=NT,z.divide=oO,z.endsWith=cT,z.eq=bi,z.escape=lT,z.escapeRegExp=fT,z.every=yk,z.find=bk,z.findIndex=s5,z.findKey=kR,z.findLast=Ak,z.findLastIndex=i5,z.findLastKey=RR,z.floor=aO,z.forEach=f5,z.forEachRight=h5,z.forIn=TR,z.forInRight=OR,z.forOwn=NR,z.forOwnRight=LR,z.get=Vv,z.gt=iR,z.gte=oR,z.has=MR,z.hasIn=Gv,z.head=a5,z.identity=us,z.includes=Fk,z.indexOf=AP,z.inRange=oT,z.invoke=KR,z.isArguments=Ac,z.isArray=ht,z.isArrayBuffer=aR,z.isArrayLike=os,z.isArrayLikeObject=Er,z.isBoolean=uR,z.isBuffer=wu,z.isDate=cR,z.isElement=lR,z.isEmpty=fR,z.isEqual=hR,z.isEqualWith=dR,z.isError=qv,z.isFinite=pR,z.isFunction=ta,z.isInteger=E5,z.isLength=j0,z.isMap=b5,z.isMatch=mR,z.isMatchWith=gR,z.isNaN=vR,z.isNative=wR,z.isNil=ER,z.isNull=yR,z.isNumber=A5,z.isObject=cr,z.isObjectLike=hr,z.isPlainObject=Yh,z.isRegExp=jv,z.isSafeInteger=bR,z.isSet=S5,z.isString=K0,z.isSymbol=Bs,z.isTypedArray=ql,z.isUndefined=AR,z.isWeakMap=SR,z.isWeakSet=_R,z.join=FP,z.kebabCase=hT,z.last=Ys,z.lastIndexOf=BP,z.lowerCase=dT,z.lowerFirst=pT,z.lt=CR,z.lte=DR,z.max=uO,z.maxBy=cO,z.mean=lO,z.meanBy=fO,z.min=hO,z.minBy=dO,z.stubArray=Jv,z.stubFalse=Qv,z.stubObject=JT,z.stubString=QT,z.stubTrue=eO,z.multiply=pO,z.nth=IP,z.noConflict=KT,z.noop=Zv,z.now=H0,z.pad=mT,z.padEnd=gT,z.padStart=vT,z.parseInt=wT,z.random=aT,z.reduce=Pk,z.reduceRight=kk,z.repeat=yT,z.replace=ET,z.result=ZR,z.round=mO,z.runInContext=oe,z.sample=Tk,z.size=Lk,z.snakeCase=bT,z.some=Uk,z.sortedIndex=OP,z.sortedIndexBy=NP,z.sortedIndexOf=LP,z.sortedLastIndex=UP,z.sortedLastIndexBy=HP,z.sortedLastIndexOf=MP,z.startCase=ST,z.startsWith=_T,z.subtract=gO,z.sum=vO,z.sumBy=wO,z.template=CT,z.times=tO,z.toFinite=ra,z.toInteger=yt,z.toLength=C5,z.toLower=DT,z.toNumber=Xs,z.toSafeInteger=FR,z.toString=Gt,z.toUpper=FT,z.trim=BT,z.trimEnd=IT,z.trimStart=xT,z.truncate=$T,z.unescape=PT,z.uniqueId=nO,z.upperCase=kT,z.upperFirst=zv,z.each=f5,z.eachRight=h5,z.first=a5,Xv(z,(function(){var c={};return ro(z,function(f,b){Nt.call(z.prototype,b)||(c[b]=f)}),c})(),{chain:!1}),z.VERSION=t,U(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){z[c].placeholder=z}),U(["drop","take"],function(c,f){Bt.prototype[c]=function(b){b=b===e?1:Tr(yt(b),0);var k=this.__filtered__&&!f?new Bt(this):this.clone();return k.__filtered__?k.__takeCount__=yn(b,k.__takeCount__):k.__views__.push({size:yn(b,X),type:c+(k.__dir__<0?"Right":"")}),k},Bt.prototype[c+"Right"]=function(b){return this.reverse()[c](b).reverse()}}),U(["filter","map","takeWhile"],function(c,f){var b=f+1,k=b==O||b==N;Bt.prototype[c]=function(j){var W=this.clone();return W.__iteratees__.push({iteratee:st(j,3),type:b}),W.__filtered__=W.__filtered__||k,W}}),U(["head","last"],function(c,f){var b="take"+(f?"Right":"");Bt.prototype[c]=function(){return this[b](1).value()[0]}}),U(["initial","tail"],function(c,f){var b="drop"+(f?"":"Right");Bt.prototype[c]=function(){return this.__filtered__?new Bt(this):this[b](1)}}),Bt.prototype.compact=function(){return this.filter(us)},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 jh(b,c,f)})}),Bt.prototype.reject=function(c){return this.filter(q0(st(c)))},Bt.prototype.slice=function(c,f){c=yt(c);var b=this;return b.__filtered__&&(c>0||f<0)?new Bt(b):(c<0?b=b.takeRight(-c):c&&(b=b.drop(c)),f!==e&&(f=yt(f),b=f<0?b.dropRight(-f):b.take(f-c)),b)},Bt.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},Bt.prototype.toArray=function(){return this.take(X)},ro(Bt.prototype,function(c,f){var b=/^(?:filter|find|map|reject)|While$/.test(f),k=/^(?:head|last)$/.test(f),j=z[k?"take"+(f=="last"?"Right":""):f],W=k||/^find/.test(f);j&&(z.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(z,Qi([Ft],re));return k&&Ne?$t[0]:$t};Ce&&b&&typeof _e=="function"&&_e.length!=1&&(ue=Ce=!1);var Ne=this.__chain__,Ge=!!this.__actions__.length,it=W&&!Ne,Et=ue&&!Ge;if(!W&&Ce){J=Et?J:new Bt(this);var nt=c.apply(J,re);return nt.__actions__.push({func:L0,args:[Be],thisArg:e}),new Gs(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);z.prototype[c]=function(){var j=arguments;if(k&&!this.__chain__){var W=this.value();return f.apply(ht(W)?W:[],j)}return this[b](function(J){return f.apply(ht(J)?J:[],j)})}}),ro(Bt.prototype,function(c,f){var b=z[f];if(b){var k=b.name+"";Nt.call(Nl,k)||(Nl[k]=[]),Nl[k].push({name:f,func:b})}}),Nl[$0(e,y).name]=[{name:"wrapper",func:e}],Bt.prototype.clone=kx,Bt.prototype.reverse=Rx,Bt.prototype.value=Tx,z.prototype.at=lk,z.prototype.chain=fk,z.prototype.commit=hk,z.prototype.next=dk,z.prototype.plant=mk,z.prototype.reverse=gk,z.prototype.toJSON=z.prototype.valueOf=z.prototype.value=vk,z.prototype.first=z.prototype.head,mc&&(z.prototype[mc]=pk),z}),wi=Rh();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ir._=wi,define(function(){return wi})):Ko?((Ko.exports=wi)._=wi,bh._=wi):Ir._=wi}).call(Zf)});var h2=be(($ye,n7)=>{"use strict";var Pye=B(x()),LJ=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])},gS=class e extends Error{constructor(t,r,n){super(t),LJ(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(`
`)}};n7.exports=gS});var hi=be((kye,s7)=>{"use strict";var Rye=B(x()),UJ={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}};s7.exports=UJ});var ic=be((Tye,o7)=>{"use strict";var Oye=B(x()),HJ=hi(),i7={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=HJ.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=i7.findRule(e,o.name);return s?i(s):void 0},literal(o){return o.value!==""},class:r,any:r});return i(t)}};o7.exports=i7});var vS=be((Nye,a7)=>{"use strict";var Lye=B(x()),MJ={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};a7.exports=MJ});var wS=be((Uye,u7)=>{"use strict";var Hye=B(x()),qJ=hi(),jJ=ic(),KJ=h2(),Np=1,Al=0,Lp=-1;function d2(e){function t(s){return s.match=Al}function r(s){return o(s.expression),s.match=Np}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===Np&&++l,p===Lp&&++h}return l===u?Np:a?h===u?Lp:Al:h>0?Lp:Al}let o=qJ.build({rule(s){let a,u=0;if(typeof s.match>"u"){s.match=Al;do if(a=s.match,s.match=o(s.expression),++u>6)throw new KJ("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=jJ.findRule(e,s.name);return s.match=o(a)},literal(s){let a=s.value.length===0?Np:Al;return s.match=a},class(s){let a=s.parts.length===0?Lp:Al;return s.match=a},any:t});o(e)}d2.ALWAYS_MATCH=Np;d2.SOMETIMES_MATCH=Al;d2.NEVER_MATCH=Lp;u7.exports=d2});var l7=be((Mye,c7)=>{"use strict";var qye=B(x()),VJ=ic(),Ue=vS(),GJ=hi(),{ALWAYS_MATCH:ah,SOMETIMES_MATCH:yS,NEVER_MATCH:ES}=wS();function zJ(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===ah?C:E===ES?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=GJ.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===ES?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===ah?S:h(S,F.length>1?m(yS,[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!==ES?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,VJ.indexOfRule(e,E.name)]},literal(E){if(E.value.length>0){let _=E.match|0,F=_===yS||_===ah&&!E.ignoreCase?o(E.ignoreCase?E.value.toLowerCase():E.value):null,H=_!==ah?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=_===yS?s(E):null,F=_!==ah?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=_!==ah?a({type:"any"}):null;return m(_,[Ue.MATCH_ANY],[Ue.ACCEPT_N,1],[Ue.FAIL,C])}});w(e)}c7.exports=zJ});var h7=be((jye,f7)=>{"use strict";var Kye=B(x()),bS=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+").")}};f7.exports=bS});var AS=be((Vye,d7)=>{"use strict";var Gye=B(x());d7.exports="2.0.1"});var p7=be(p2=>{"use strict";var Wye=B(x());function eu(e){return e.charCodeAt(0).toString(16).toUpperCase()}p2.hex=eu;function WJ(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"+eu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+eu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+eu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+eu(t))}p2.stringEscape=WJ;function YJ(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"+eu(t)).replace(/[\x10-\x1F\x7F-\xFF]/g,t=>"\\x"+eu(t)).replace(/[\u0100-\u0FFF]/g,t=>"\\u0"+eu(t)).replace(/[\u1000-\uFFFF]/g,t=>"\\u"+eu(t))}p2.regexpClassEscape=YJ});var v7=be(g7=>{var Xye=B(x()),m7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");g7.encode=function(e){if(0<=e&&e<m7.length)return m7[e];throw new TypeError("Must be between 0 and 63: "+e)}});var b7=be(E7=>{var Jye=B(x()),XJ=v7(),w7=5,y7=1<<w7,ZJ=y7-1,JJ=y7;function QJ(e){return e<0?(-e<<1)+1:(e<<1)+0}E7.encode=function(t){let r="",n,i=QJ(t);do n=i&ZJ,i>>>=w7,i>0&&(n|=JJ),r+=XJ.encode(n);while(i>0);return r}});var g2=be(ac=>{var eEe=B(x());function eQ(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=eQ;var S7=(function(){return!("__proto__"in Object.create(null))})();function _7(e){return e}function tQ(e){return C7(e)?"$"+e:e}ac.toSetString=S7?_7:tQ;function rQ(e){return C7(e)?e.slice(1):e}ac.fromSetString=S7?_7:rQ;function C7(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 A7(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function nQ(e,t){let r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=A7(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:A7(e.name,t.name)}ac.compareByGeneratedPositionsInflated=nQ;var SS="http:",Up=`${SS}//host`;function D7(e){return t=>{let r=Hp(t),n=_S(t),i=new URL(t,n);e(i);let o=i.toString();return r==="absolute"?o:r==="scheme-relative"?o.slice(SS.length):r==="path-absolute"?o.slice(Up.length):CS(n,o)}}function oc(e,t){return new URL(e,t).toString()}function sQ(e,t){let r=0;do{let n=e+r++;if(t.indexOf(n)===-1)return n}while(!0)}function _S(e){let t=e.split("..").length-1,r=sQ("p",e),n=`${Up}/`;for(let i=0;i<t;i++)n+=`${r}/`;return n}var iQ=/^[A-Za-z0-9\+\-\.]+:/;function Hp(e){return e[0]==="/"?e[1]==="/"?"scheme-relative":"path-absolute":iQ.test(e)?"absolute":"path-relative"}function CS(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 oQ=D7(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),m2=D7(e=>{});ac.normalize=m2;function aQ(e,t){let r=Hp(t),n=Hp(e);if(e=oQ(e),r==="absolute")return oc(t,void 0);if(n==="absolute")return oc(t,e);if(r==="scheme-relative")return m2(t);if(n==="scheme-relative")return oc(t,oc(e,Up)).slice(SS.length);if(r==="path-absolute")return m2(t);if(n==="path-absolute")return oc(t,oc(e,Up)).slice(Up.length);let i=_S(t+e),o=oc(t,oc(e,i));return CS(i,o)}ac.join=aQ;function uQ(e,t){let r=cQ(e,t);return typeof r=="string"?r:m2(t)}ac.relative=uQ;function cQ(e,t){if(Hp(e)!==Hp(t))return null;let n=_S(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:CS(i,o)}});var B7=be(F7=>{var rEe=B(x()),DS=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()}};F7.ArraySet=DS});var $7=be(x7=>{var sEe=B(x()),I7=g2();function lQ(e,t){let r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,o=t.generatedColumn;return n>r||n==r&&o>=i||I7.compareByGeneratedPositionsInflated(e,t)<=0}var FS=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(t,r){this._array.forEach(t,r)}add(t){lQ(this._last,t)?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))}toArray(){return this._sorted||(this._array.sort(I7.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};x7.MappingList=FS});var BS=be(P7=>{var oEe=B(x()),Mp=b7(),$r=g2(),v2=B7().ArraySet,fQ=$7().MappingList,w2=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 v2,this._names=new v2,this._mappings=new fQ,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 v2:this._sources,a=new v2;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+=Mp.encode(l.generatedColumn-t),t=l.generatedColumn,l.source!=null&&(m=this._sources.indexOf(l.source),u+=Mp.encode(m-s),s=m,u+=Mp.encode(l.originalLine-1-i),i=l.originalLine-1,u+=Mp.encode(l.originalColumn-n),n=l.originalColumn,l.name!=null&&(h=this._names.indexOf(l.name),u+=Mp.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())}};w2.prototype._version=3;P7.SourceMapGenerator=w2});var R7=be(k7=>{var uEe=B(x()),hQ=BS().SourceMapGenerator,y2=g2(),dQ=/(\r?\n)/,pQ=10,uh="$$$isSourceNode$$$",IS=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[uh]=!0,i!=null&&this.add(i)}static fromStringWithSourceMap(t,r,n){let i=new e,o=t.split(dQ),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=y2.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?y2.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[uh]||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[uh]||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[uh]?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[uh]?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[y2.toSetString(t)]=r}walkSourceContents(t){for(let n=0,i=this.children.length;n<i;n++)this.children[n][uh]&&this.children[n].walkSourceContents(t);let r=Object.keys(this.sourceContents);for(let n=0,i=r.length;n<i;n++)t(y2.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 hQ(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)===pQ?(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}}};k7.SourceNode=IS});var T7=be(xS=>{var lEe=B(x());xS.SourceMapGenerator=BS().SourceMapGenerator;xS.SourceNode=R7().SourceNode});var U7=be((fEe,L7)=>{"use strict";var hEe=B(x()),mQ=ic(),jt=vS(),gQ=h7(),vQ=AS(),{stringEscape:qs,regexpClassEscape:$S}=p7(),{SourceNode:di}=T7();function N7(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 O7(e,t,r,n,i){return r?new di(null,null,r.source,[e,N7(t,r,i),new di(r.end.line,r.end.column-1,r.source,n)]):new di(null,null,null,[e,t,n])}function wQ(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)?$S(C[0])+"-"+$S(C[1]):$S(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 O7(`
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 gQ(g.name,"s","var");function E(C){let F=0,H=C.length,K=[],S;function I(R,O){let T=O+3,N=C[F+T-2],P=C[F+T-1],M,Y;w.checkedIf(F,()=>{F+=T,M=E(C.slice(F,F+N)),F+=N},P>0?()=>{Y=E(C.slice(F,F+P)),F+=P}:null),K.push("if ("+R+") {"),K.push(...M.map(r)),P>0&&(K.push("} else {"),K.push(...Y.map(r))),K.push("}")}function q(R){let T=C[F+2-1],N;w.checkedLoop(F,()=>{F+=2,N=E(C.slice(F,F+T)),F+=T}),K.push("while ("+R+") {"),K.push(...N.map(r)),K.push("}")}function L(){let O=C[F+4-1],T=s(C[F+1])+"("+C.slice(F+4,F+4+O).map(N=>w.index(N)).join(", ")+")";w.pop(C[F+2]),K.push(w.push(T)),F+=4+O}for(;F<H;)switch(C[F]){case jt.PUSH_EMPTY_STRING:K.push(w.push("''")),F++;break;case jt.PUSH_CURR_POS:K.push(w.push("peg$currPos")),F++;break;case jt.PUSH_UNDEFINED:K.push(w.push("undefined")),F++;break;case jt.PUSH_NULL:K.push(w.push("null")),F++;break;case jt.PUSH_FAILED:K.push(w.push("peg$FAILED")),F++;break;case jt.PUSH_EMPTY_ARRAY:K.push(w.push("[]")),F++;break;case jt.POP:w.pop(),F++;break;case jt.POP_CURR_POS:K.push("peg$currPos = "+w.pop()+";"),F++;break;case jt.POP_N:w.pop(C[F+1]),F+=2;break;case jt.NIP:S=w.pop(),w.pop(),K.push(w.push(S)),F++;break;case jt.APPEND:S=w.pop(),K.push(w.top()+".push("+S+");"),F++;break;case jt.WRAP:K.push(w.push("["+w.pop(C[F+1]).join(", ")+"]")),F+=2;break;case jt.TEXT:K.push(w.push("input.substring("+w.pop()+", peg$currPos)")),F++;break;case jt.PLUCK:{let O=C[F+3-1],T=3+O;S=C.slice(F+3,F+T),S=O===1?w.index(S[0]):`[ ${S.map(N=>w.index(N)).join(", ")} ]`,w.pop(C[F+1]),K.push(w.push(S)),F+=T;break}case jt.IF:I(w.top(),0);break;case jt.IF_ERROR:I(w.top()+" === peg$FAILED",0);break;case jt.IF_NOT_ERROR:I(w.top()+" !== peg$FAILED",0);break;case jt.WHILE_NOT_ERROR:q(w.top()+" !== peg$FAILED");break;case jt.MATCH_ANY:I("input.length > peg$currPos",0);break;case jt.MATCH_STRING:I(e.literals[C[F+1]].length>1?"input.substr(peg$currPos, "+e.literals[C[F+1]].length+") === "+n(C[F+1]):"input.charCodeAt(peg$currPos) === "+e.literals[C[F+1]].charCodeAt(0),1);break;case jt.MATCH_STRING_IC:I("input.substr(peg$currPos, "+e.literals[C[F+1]].length+").toLowerCase() === "+n(C[F+1]),1);break;case jt.MATCH_CHAR_CLASS:I(i(C[F+1])+".test(input.charAt(peg$currPos))",1);break;case jt.ACCEPT_N:K.push(w.push(C[F+1]>1?"input.substr(peg$currPos, "+C[F+1]+")":"input.charAt(peg$currPos)")),K.push(C[F+1]>1?"peg$currPos += "+C[F+1]+";":"peg$currPos++;"),F+=2;break;case jt.ACCEPT_STRING:K.push(w.push(n(C[F+1]))),K.push(e.literals[C[F+1]].length>1?"peg$currPos += "+e.literals[C[F+1]].length+";":"peg$currPos++;"),F+=2;break;case jt.FAIL:K.push(w.push("peg$FAILED")),K.push("if (peg$silentFails === 0) { peg$fail("+o(C[F+1])+"); }"),F+=2;break;case jt.LOAD_SAVED_POS:K.push("peg$savedPos = "+w.index(C[F+1])+";"),F+=2;break;case jt.UPDATE_SAVED_POS:K.push("peg$savedPos = peg$currPos;"),F++;break;case jt.CALL:L();break;case jt.RULE:K.push(w.push(a(e.rules[C[F+1]].name)+"()")),F+=2;break;case jt.SILENT_FAILS_ON:K.push("peg$silentFails++;"),F++;break;case jt.SILENT_FAILS_OFF:K.push("peg$silentFails--;"),F++;break;default:throw new Error("Invalid opcode: "+C[F]+".")}return K}let _=E(g.bytecode);return y.push(O7(" 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)+'"',mQ.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?N7(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 ${vQ}.`,"//","// 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(q=>t.dependencies[q]),H="["+F.map(q=>'"'+qs(q)+'"').join(", ")+"]",K=F.map(q=>'require("'+qs(q)+'")').join(", "),S=C.join(", "),I=y();return I.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+H+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+K+");"),t.exportVar!==null&&I.push(" } else {"," root."+t.exportVar+" = factory();"),I.push(" }","})(this, function("+S+") {",' "use strict";',"",g,"",r("return "+w()+";"),"});"),I}}[t.format]();return new di(null,null,t.grammarSource,_.map(C=>C instanceof di?C:C+`
`))}e.code=v(d())}L7.exports=wQ});var M7=be((dEe,H7)=>{"use strict";var pEe=B(x()),yQ=ic(),EQ=hi();function bQ(e,t,r){function n(s){return s.type==="rule"&&s.expression.type==="rule_ref"}function i(s,a,u){EQ.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:yQ.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)})}H7.exports=bQ});var j7=be((mEe,q7)=>{"use strict";var gEe=B(x()),AQ=hi();function SQ(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=AQ.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)}q7.exports=SQ});var V7=be((vEe,K7)=>{"use strict";var wEe=B(x()),_Q=hi();function CQ(e,t,r){let n={};_Q.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)}K7.exports=CQ});var W7=be((yEe,z7)=>{"use strict";var EEe=B(x()),G7=ic(),DQ=hi();function FQ(e,t,r){let n=[],i=[],o=DQ.build({rule(s){n.push(s.name),o(s.expression),n.pop()},sequence(s){s.elements.every(a=>(o(a),!G7.alwaysConsumesOnSuccess(e,a)))},rule_ref(s){i.push(s);let a=G7.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)}z7.exports=FQ});var Z7=be((bEe,X7)=>{"use strict";var AEe=B(x()),Y7=ic(),BQ=hi();function IQ(e,t,r){BQ.build({zero_or_more(i){Y7.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){Y7.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)}X7.exports=IQ});var Q7=be((SEe,J7)=>{"use strict";var _Ee=B(x()),xQ=ic(),$Q=hi();function PQ(e,t,r){$Q.build({rule_ref(i){xQ.findRule(e,i.name)||r.error(`Rule "${i.name}" is not defined`,i.location)}})(e)}J7.exports=PQ});var tx=be((CEe,ex)=>{"use strict";var DEe=B(x()),kQ=hi();function RQ(e,t,r){let n=kQ.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)}ex.exports=RQ});var nx=be((FEe,rx)=>{"use strict";var BEe=B(x()),TQ=h2(),PS=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(){}},kS=class{constructor(t){this._callbacks=new PS(t),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...t){++this.errors,this._firstError===null&&(this._firstError=new TQ(...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}};rx.exports=kS});var sx=be((exports,module)=>{"use strict";var IEe=B(x()),generateBytecode=l7(),generateJS=U7(),inferenceMatchResult=wS(),removeProxyRules=M7(),reportDuplicateLabels=j7(),reportDuplicateRules=V7(),reportInfiniteRecursion=W7(),reportInfiniteRepetition=Z7(),reportUndefinedRules=Q7(),reportIncorrectPlucking=tx(),Session=nx(),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 ox=be((xEe,ix)=>{"use strict";var $Ee=B(x()),OQ={$:"text","&":"simple_and","!":"simple_not"},NQ={"?":"optional","*":"zero_or_more","+":"one_or_more"},LQ={"&":"semantic_and","!":"semantic_not"};function UQ(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}UQ(uc,Error);function RS(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=RS("",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+" | "+RS("",i.column-1," ")+RS("",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 HQ(e,t){t=t!==void 0?t:{};var r={},n=t.grammarSource,i={Grammar:c0},o=c0,s="{",a="}",u="=",l="/",h="@",m=":",p="$",d="&",v="!",g="?",y="*",w="+",E="(",_=")",C=" ",F="\v",H="\f",K=" ",S="\xA0",I="\uFEFF",q=`
`,L=`\r
`,R="\r",O="\u2028",T="\u2029",N="/*",P="*/",M="//",Y="_",V="\\",X="\u200C",te="\u200D",ae="i",me='"',he="'",De="[",Pe="^",Ie="]",se="-",pe="0",Fe="b",Te="f",Ve="n",Oe="r",pt="t",Qe="v",ct="x",mn="u",gr=".",vr=";",lt=/^[\n\r\u2028\u2029]/,Pr=/^[0-9]/,es=/^[0-9a-f]/i,mi=/^[{}]/,Dt=/^[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137-\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148-\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C-\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA-\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9-\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC-\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF-\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F-\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0-\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB-\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE-\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0561-\u0587\u13F8-\u13FD\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6-\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FC7\u1FD0-\u1FD3\u1FD6-\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6-\u1FF7\u210A\u210E-\u210F\u2113\u212F\u2134\u2139\u213C-\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65-\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73-\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3-\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7B5\uA7B7\uA7FA\uAB30-\uAB5A\uAB60-\uAB65\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]/,Ze=/^[\u02B0-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0374\u037A\u0559\u0640\u06E5-\u06E6\u07F4-\u07F5\u07FA\u081A\u0824\u0828\u0971\u0E46\u0EC6\u10FC\u17D7\u1843\u1AA7\u1C78-\u1C7D\u1D2C-\u1D6A\u1D78\u1D9B-\u1DBF\u2071\u207F\u2090-\u209C\u2C7C-\u2C7D\u2D6F\u2E2F\u3005\u3031-\u3035\u303B\u309D-\u309E\u30FC-\u30FE\uA015\uA4F8-\uA4FD\uA60C\uA67F\uA69C-\uA69D\uA717-\uA71F\uA770\uA788\uA7F8-\uA7F9\uA9CF\uA9E6\uAA70\uAADD\uAAF3-\uAAF4\uAB5C-\uAB5F\uFF70\uFF9E-\uFF9F]/,Re=/^[\xAA\xBA\u01BB\u01C0-\u01C3\u0294\u05D0-\u05EA\u05F0-\u05F2\u0620-\u063F\u0641-\u064A\u066E-\u066F\u0671-\u06D3\u06D5\u06EE-\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u0800-\u0815\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0972-\u0980\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0-\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0-\u0CE1\u0CF1-\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065-\u1066\u106E-\u1070\u1075-\u1081\u108E\u10D0-\u10FA\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17DC\u1820-\u1842\u1844-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE-\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C77\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5-\u1CF6\u2135-\u2138\u2D30-\u2D67\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3006\u303C\u3041-\u3096\u309F\u30A1-\u30FA\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA014\uA016-\uA48C\uA4D0-\uA4F7\uA500-\uA60B\uA610-\uA61F\uA62A-\uA62B\uA66E\uA6A0-\uA6E5\uA78F\uA7F7\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9E0-\uA9E4\uA9E7-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA6F\uAA71-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADC\uAAE0-\uAAEA\uAAF2\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF66-\uFF6F\uFF71-\uFF9D\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,or=/^[\u01C5\u01C8\u01CB\u01F2\u1F88-\u1F8F\u1F98-\u1F9F\u1FA8-\u1FAF\u1FBC\u1FCC\u1FFC]/,Tn=/^[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178-\u0179\u017B\u017D\u0181-\u0182\u0184\u0186-\u0187\u0189-\u018B\u018E-\u0191\u0193-\u0194\u0196-\u0198\u019C-\u019D\u019F-\u01A0\u01A2\u01A4\u01A6-\u01A7\u01A9\u01AC\u01AE-\u01AF\u01B1-\u01B3\u01B5\u01B7-\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A-\u023B\u023D-\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E-\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9-\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0-\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E-\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D-\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0-\uA7B4\uA7B6\uFF21-\uFF3A]/,mt=/^[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0982-\u0983\u09BE-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u09D7\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0B02-\u0B03\u0B3E\u0B40\u0B47-\u0B48\u0B4B-\u0B4C\u0B57\u0BBE-\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD7\u0C01-\u0C03\u0C41-\u0C44\u0C82-\u0C83\u0CBE\u0CC0-\u0CC4\u0CC7-\u0CC8\u0CCA-\u0CCB\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D57\u0D82-\u0D83\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DF2-\u0DF3\u0F3E-\u0F3F\u0F7F\u102B-\u102C\u1031\u1038\u103B-\u103C\u1056-\u1057\u1062-\u1064\u1067-\u106D\u1083-\u1084\u1087-\u108C\u108F\u109A-\u109C\u17B6\u17BE-\u17C5\u17C7-\u17C8\u1923-\u1926\u1929-\u192B\u1930-\u1931\u1933-\u1938\u1A19-\u1A1A\u1A55\u1A57\u1A61\u1A63-\u1A64\u1A6D-\u1A72\u1B04\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B82\u1BA1\u1BA6-\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1C24-\u1C2B\u1C34-\u1C35\u1CE1\u1CF2-\u1CF3\u302E-\u302F\uA823-\uA824\uA827\uA880-\uA881\uA8B4-\uA8C3\uA952-\uA953\uA983\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BD-\uA9C0\uAA2F-\uAA30\uAA33-\uAA34\uAA4D\uAA7B\uAA7D\uAAEB\uAAEE-\uAAEF\uAAF5\uABE3-\uABE4\uABE6-\uABE7\uABE9-\uABEA\uABEC]/,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]/,ru=/^[_\u203F-\u2040\u2054\uFE33-\uFE34\uFE4D-\uFE4F\uFF3F]/,Ut=/^[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/,gn=rt("{",!1),Yi=rt("}",!1),Sl=rt("=",!1),nu=rt("/",!1),lh=rt("@",!1),su=rt(":",!1),Xi=rt("$",!1),Kt=rt("&",!1),js=rt("!",!1),_l=rt("?",!1),fh=rt("*",!1),lc=rt("+",!1),iu=rt("(",!1),hh=rt(")",!1),Cl=Bl(),fc=vi("whitespace"),dh=rt(" ",!1),ie=rt("\v",!1),we=rt("\f",!1),je=rt(" ",!1),Me=rt("\xA0",!1),et=rt("\uFEFF",!1),gt=Vr([`
`,"\r","\u2028","\u2029"],!1,!1),wt=vi("end of line"),kr=rt(`
`,!1),ar=rt(`\r
`,!1),Ks=rt("\r",!1),Zi=rt("\u2028",!1),Nn=rt("\u2029",!1),ts=vi("comment"),Fr=rt("/*",!1),Ln=rt("*/",!1),ou=rt("//",!1),au=vi("identifier"),ph=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),rs=rt("'",!1),Cs=vi("character class"),Vs=rt("[",!1),gi=rt("^",!1),Ji=rt("]",!1),Dl=rt("-",!1),jp=rt("0",!1),mh=rt("b",!1),C2=rt("f",!1),Kp=rt("n",!1),Fl=rt("r",!1),Vp=rt("t",!1),D2=rt("v",!1),gh=rt("x",!1),vh=rt("u",!1),wh=Vr([["0","9"]],!1,!1),F2=Vr([["0","9"],["a","f"]],!1,!0),Gp=rt(".",!1),yh=vi("code block"),uu=Vr(["{","}"],!1,!1),cu=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),zp=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),Wp=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),B2=Vr(["\u01C5","\u01C8","\u01CB","\u01F2",["\u1F88","\u1F8F"],["\u1F98","\u1F9F"],["\u1FA8","\u1FAF"],"\u1FBC","\u1FCC","\u1FFC"],!1,!1),Yp=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),Xp=Vr(["\u0903","\u093B",["\u093E","\u0940"],["\u0949","\u094C"],["\u094E","\u094F"],["\u0982","\u0983"],["\u09BE","\u09C0"],["\u09C7","\u09C8"],["\u09CB","\u09CC"],"\u09D7","\u0A03",["\u0A3E","\u0A40"],"\u0A83",["\u0ABE","\u0AC0"],"\u0AC9",["\u0ACB","\u0ACC"],["\u0B02","\u0B03"],"\u0B3E","\u0B40",["\u0B47","\u0B48"],["\u0B4B","\u0B4C"],"\u0B57",["\u0BBE","\u0BBF"],["\u0BC1","\u0BC2"],["\u0BC6","\u0BC8"],["\u0BCA","\u0BCC"],"\u0BD7",["\u0C01","\u0C03"],["\u0C41","\u0C44"],["\u0C82","\u0C83"],"\u0CBE",["\u0CC0","\u0CC4"],["\u0CC7","\u0CC8"],["\u0CCA","\u0CCB"],["\u0CD5","\u0CD6"],["\u0D02","\u0D03"],["\u0D3E","\u0D40"],["\u0D46","\u0D48"],["\u0D4A","\u0D4C"],"\u0D57",["\u0D82","\u0D83"],["\u0DCF","\u0DD1"],["\u0DD8","\u0DDF"],["\u0DF2","\u0DF3"],["\u0F3E","\u0F3F"],"\u0F7F",["\u102B","\u102C"],"\u1031","\u1038",["\u103B","\u103C"],["\u1056","\u1057"],["\u1062","\u1064"],["\u1067","\u106D"],["\u1083","\u1084"],["\u1087","\u108C"],"\u108F",["\u109A","\u109C"],"\u17B6",["\u17BE","\u17C5"],["\u17C7","\u17C8"],["\u1923","\u1926"],["\u1929","\u192B"],["\u1930","\u1931"],["\u1933","\u1938"],["\u1A19","\u1A1A"],"\u1A55","\u1A57","\u1A61",["\u1A63","\u1A64"],["\u1A6D","\u1A72"],"\u1B04","\u1B35","\u1B3B",["\u1B3D","\u1B41"],["\u1B43","\u1B44"],"\u1B82","\u1BA1",["\u1BA6","\u1BA7"],"\u1BAA","\u1BE7",["\u1BEA","\u1BEC"],"\u1BEE",["\u1BF2","\u1BF3"],["\u1C24","\u1C2B"],["\u1C34","\u1C35"],"\u1CE1",["\u1CF2","\u1CF3"],["\u302E","\u302F"],["\uA823","\uA824"],"\uA827",["\uA880","\uA881"],["\uA8B4","\uA8C3"],["\uA952","\uA953"],"\uA983",["\uA9B4","\uA9B5"],["\uA9BA","\uA9BB"],["\uA9BD","\uA9C0"],["\uAA2F","\uAA30"],["\uAA33","\uAA34"],"\uAA4D","\uAA7B","\uAA7D","\uAAEB",["\uAAEE","\uAAEF"],"\uAAF5",["\uABE3","\uABE4"],["\uABE6","\uABE7"],["\uABE9","\uABEA"],"\uABEC"],!1,!1),Zp=Vr([["\u0300","\u036F"],["\u0483","\u0487"],["\u0591","\u05BD"],"\u05BF",["\u05C1","\u05C2"],["\u05C4","\u05C5"],"\u05C7",["\u0610","\u061A"],["\u064B","\u065F"],"\u0670",["\u06D6","\u06DC"],["\u06DF","\u06E4"],["\u06E7","\u06E8"],["\u06EA","\u06ED"],"\u0711",["\u0730","\u074A"],["\u07A6","\u07B0"],["\u07EB","\u07F3"],["\u0816","\u0819"],["\u081B","\u0823"],["\u0825","\u0827"],["\u0829","\u082D"],["\u0859","\u085B"],["\u08E3","\u0902"],"\u093A","\u093C",["\u0941","\u0948"],"\u094D",["\u0951","\u0957"],["\u0962","\u0963"],"\u0981","\u09BC",["\u09C1","\u09C4"],"\u09CD",["\u09E2","\u09E3"],["\u0A01","\u0A02"],"\u0A3C",["\u0A41","\u0A42"],["\u0A47","\u0A48"],["\u0A4B","\u0A4D"],"\u0A51",["\u0A70","\u0A71"],"\u0A75",["\u0A81","\u0A82"],"\u0ABC",["\u0AC1","\u0AC5"],["\u0AC7","\u0AC8"],"\u0ACD",["\u0AE2","\u0AE3"],"\u0B01","\u0B3C","\u0B3F",["\u0B41","\u0B44"],"\u0B4D","\u0B56",["\u0B62","\u0B63"],"\u0B82","\u0BC0","\u0BCD","\u0C00",["\u0C3E","\u0C40"],["\u0C46","\u0C48"],["\u0C4A","\u0C4D"],["\u0C55","\u0C56"],["\u0C62","\u0C63"],"\u0C81","\u0CBC","\u0CBF","\u0CC6",["\u0CCC","\u0CCD"],["\u0CE2","\u0CE3"],"\u0D01",["\u0D41","\u0D44"],"\u0D4D",["\u0D62","\u0D63"],"\u0DCA",["\u0DD2","\u0DD4"],"\u0DD6","\u0E31",["\u0E34","\u0E3A"],["\u0E47","\u0E4E"],"\u0EB1",["\u0EB4","\u0EB9"],["\u0EBB","\u0EBC"],["\u0EC8","\u0ECD"],["\u0F18","\u0F19"],"\u0F35","\u0F37","\u0F39",["\u0F71","\u0F7E"],["\u0F80","\u0F84"],["\u0F86","\u0F87"],["\u0F8D","\u0F97"],["\u0F99","\u0FBC"],"\u0FC6",["\u102D","\u1030"],["\u1032","\u1037"],["\u1039","\u103A"],["\u103D","\u103E"],["\u1058","\u1059"],["\u105E","\u1060"],["\u1071","\u1074"],"\u1082",["\u1085","\u1086"],"\u108D","\u109D",["\u135D","\u135F"],["\u1712","\u1714"],["\u1732","\u1734"],["\u1752","\u1753"],["\u1772","\u1773"],["\u17B4","\u17B5"],["\u17B7","\u17BD"],"\u17C6",["\u17C9","\u17D3"],"\u17DD",["\u180B","\u180D"],"\u18A9",["\u1920","\u1922"],["\u1927","\u1928"],"\u1932",["\u1939","\u193B"],["\u1A17","\u1A18"],"\u1A1B","\u1A56",["\u1A58","\u1A5E"],"\u1A60","\u1A62",["\u1A65","\u1A6C"],["\u1A73","\u1A7C"],"\u1A7F",["\u1AB0","\u1ABD"],["\u1B00","\u1B03"],"\u1B34",["\u1B36","\u1B3A"],"\u1B3C","\u1B42",["\u1B6B","\u1B73"],["\u1B80","\u1B81"],["\u1BA2","\u1BA5"],["\u1BA8","\u1BA9"],["\u1BAB","\u1BAD"],"\u1BE6",["\u1BE8","\u1BE9"],"\u1BED",["\u1BEF","\u1BF1"],["\u1C2C","\u1C33"],["\u1C36","\u1C37"],["\u1CD0","\u1CD2"],["\u1CD4","\u1CE0"],["\u1CE2","\u1CE8"],"\u1CED","\u1CF4",["\u1CF8","\u1CF9"],["\u1DC0","\u1DF5"],["\u1DFC","\u1DFF"],["\u20D0","\u20DC"],"\u20E1",["\u20E5","\u20F0"],["\u2CEF","\u2CF1"],"\u2D7F",["\u2DE0","\u2DFF"],["\u302A","\u302D"],["\u3099","\u309A"],"\uA66F",["\uA674","\uA67D"],["\uA69E","\uA69F"],["\uA6F0","\uA6F1"],"\uA802","\uA806","\uA80B",["\uA825","\uA826"],"\uA8C4",["\uA8E0","\uA8F1"],["\uA926","\uA92D"],["\uA947","\uA951"],["\uA980","\uA982"],"\uA9B3",["\uA9B6","\uA9B9"],"\uA9BC","\uA9E5",["\uAA29","\uAA2E"],["\uAA31","\uAA32"],["\uAA35","\uAA36"],"\uAA43","\uAA4C","\uAA7C","\uAAB0",["\uAAB2","\uAAB4"],["\uAAB7","\uAAB8"],["\uAABE","\uAABF"],"\uAAC1",["\uAAEC","\uAAED"],"\uAAF6","\uABE5","\uABE8","\uABED","\uFB1E",["\uFE00","\uFE0F"],["\uFE20","\uFE2F"]],!1,!1),Jp=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),I2=Vr([["\u16EE","\u16F0"],["\u2160","\u2182"],["\u2185","\u2188"],"\u3007",["\u3021","\u3029"],["\u3038","\u303A"],["\uA6E6","\uA6EF"]],!1,!1),x2=Vr(["_",["\u203F","\u2040"],"\u2054",["\uFE33","\uFE34"],["\uFE4D","\uFE4F"],"\uFF3F"],!1,!1),$2=Vr([" ","\xA0","\u1680",["\u2000","\u200A"],"\u202F","\u205F","\u3000"],!1,!1),Qp=rt(";",!1),P2=function(D,G,ee){return{type:"grammar",topLevelInitializer:D,initializer:G,rules:ee,location:tr()}},k2=function(D){return{type:"top_level_initializer",code:D[0],codeLocation:D[1],location:tr()}},R2=function(D){return{type:"initializer",code:D[0],codeLocation:D[1],location:tr()}},T2=function(D,G,ee){return{type:"rule",name:D[0],nameLocation:D[1],expression:G!==null?{type:"named",name:G,expression:ee,location:tr()}:ee,location:tr()}},Eh=function(D,G){return G.length>0?{type:"choice",alternatives:[D].concat(G),location:tr()}:D},O2=function(D,G){return G!==null?{type:"action",expression:D,code:G[0],codeLocation:G[1],location:tr()}:D},N2=function(D,G){return G.length>0||D.type==="labeled"&&D.pick?{type:"sequence",elements:[D].concat(G),location:tr()}:D},L2=function(D,G,ee){return ee.type.startsWith("semantic_")&&Sh('"@" cannot be used on a semantic predicate',D),{type:"labeled",label:G!==null?G[0]:null,labelLocation:G!==null?G[1]:D,pick:!0,expression:ee,location:tr()}},U2=function(D,G){return{type:"labeled",label:D[0],labelLocation:D[1],expression:G,location:tr()}},H2=function(){return tr()},er=function(D){return Yo.indexOf(D[0])>=0&&Sh(`Label can't be a reserved word "${D[0]}"`,D[1]),D},Zt=function(D,G){return{type:OQ[D],expression:G,location:tr()}},M2=function(D,G){return{type:NQ[G],expression:D,location:tr()}},q2=function(D){return D.type==="labeled"||D.type==="sequence"?{type:"group",expression:D,location:tr()}:D},j2=function(D){return{type:"rule_ref",name:D[0],location:tr()}},K2=function(D,G){return{type:LQ[D],code:G[0],codeLocation:G[1],location:tr()}},V2=function(D,G){return[D+G.join(""),tr()]},G2=function(D,G){return{type:"literal",value:D,ignoreCase:G!==null,location:tr()}},e0=function(D){return D.join("")},z2=function(D){return D.join("")},Ir=function(D,G,ee){return{type:"class",parts:G.filter(Z=>Z!==""),inverted:D!==null,ignoreCase:ee!==null,location:tr()}},bh=function(D,G){return D.charCodeAt(0)>G.charCodeAt(0)&&Sh("Invalid character range: "+Qi()+"."),[D,G]},Ko=function(){return""},t0=function(){return"\0"},Ah=function(){return"\b"},ns=function(){return"\f"},r0=function(){return`
`},n0=function(){return"\r"},s0=function(){return" "},i0=function(){return"\v"},o0=function(D){return String.fromCharCode(parseInt(D,16))},a0=function(D){return String.fromCharCode(parseInt(D,16))},Un=function(){return{type:"any",location:tr()}},W2=function(D){return[D,tr()]},U=0,ft=0,hc=[{line:1,column:1}],Rr=0,lu=[],ce=0,Wt;if("startRule"in t){if(!(t.startRule in i))throw new Error(`Can't start parsing from rule "`+t.startRule+'".');o=i[t.startRule]}function Qi(){return e.substring(ft,U)}function u0(){return ft}function JS(){return{source:n,start:ft,end:U}}function tr(){return hu(ft,U)}function QS(D,G){throw G=G!==void 0?G:hu(ft,U),Dh([vi(D)],e.substring(ft,U),G)}function Sh(D,G){throw G=G!==void 0?G:hu(ft,U),Ch(D,G)}function rt(D,G){return{type:"literal",text:D,ignoreCase:G}}function Vr(D,G,ee){return{type:"class",parts:D,inverted:G,ignoreCase:ee}}function Bl(){return{type:"any"}}function fu(){return{type:"end"}}function vi(D){return{type:"other",description:D}}function _h(D){var G=hc[D],ee;if(G)return G;for(ee=D-1;!hc[ee];)ee--;for(G=hc[ee],G={line:G.line,column:G.column};ee<D;)e.charCodeAt(ee)===10?(G.line++,G.column=1):G.column++,ee++;return hc[D]=G,G}function hu(D,G){var ee=_h(D),Z=_h(G);return{source:n,start:{offset:D,line:ee.line,column:ee.column},end:{offset:G,line:Z.line,column:Z.column}}}function Ae(D){U<Rr||(U>Rr&&(Rr=U,lu=[]),lu.push(D))}function Ch(D,G){return new uc(D,null,null,G)}function Dh(D,G,ee){return new uc(uc.buildMessage(D,G),D,G,ee)}function c0(){var D,G,ee,Z,fe,ge,Mt,yr;if(D=U,G=Yt(),ee=U,Z=Fh(),Z!==r?(fe=Yt(),ee=Z):(U=ee,ee=r),ee===r&&(ee=null),Z=U,fe=Bh(),fe!==r?(ge=Yt(),Z=fe):(U=Z,Z=r),Z===r&&(Z=null),fe=[],ge=U,Mt=l0(),Mt!==r?(yr=Yt(),ge=Mt):(U=ge,ge=r),ge!==r)for(;ge!==r;)fe.push(ge),ge=U,Mt=l0(),Mt!==r?(yr=Yt(),ge=Mt):(U=ge,ge=r);else fe=r;return fe!==r?(ft=D,D=P2(ee,Z,fe)):(U=D,D=r),D}function Fh(){var D,G,ee,Z,fe;return D=U,e.charCodeAt(U)===123?(G=s,U++):(G=r,ce===0&&Ae(gn)),G!==r?(ee=Wo(),ee!==r?(e.charCodeAt(U)===125?(Z=a,U++):(Z=r,ce===0&&Ae(Yi)),Z!==r?(fe=Tl(),fe!==r?(ft=D,D=k2(ee)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function Bh(){var D,G,ee;return D=U,G=Wo(),G!==r?(ee=Tl(),ee!==r?(ft=D,D=R2(G)):(U=D,D=r)):(U=D,D=r),D}function l0(){var D,G,ee,Z,fe,ge,Mt,yr;return D=U,G=Hn(),G!==r?(ee=Yt(),Z=U,fe=Rh(),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(Sl)),fe!==r?(ge=Yt(),Mt=Ih(),Mt!==r?(yr=Tl(),yr!==r?(ft=D,D=T2(G,Z,Mt)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function Ih(){var D,G,ee,Z,fe,ge,Mt,yr;if(D=U,G=Qr(),G!==r){for(ee=[],Z=U,fe=Yt(),e.charCodeAt(U)===47?(ge=l,U++):(ge=r,ce===0&&Ae(nu)),ge!==r?(Mt=Yt(),yr=Qr(),yr!==r?Z=yr:(U=Z,Z=r)):(U=Z,Z=r);Z!==r;)ee.push(Z),Z=U,fe=Yt(),e.charCodeAt(U)===47?(ge=l,U++):(ge=r,ce===0&&Ae(nu)),ge!==r?(Mt=Yt(),yr=Qr(),yr!==r?Z=yr:(U=Z,Z=r)):(U=Z,Z=r);ft=D,D=Eh(G,ee)}else U=D,D=r;return D}function Qr(){var D,G,ee,Z,fe;return D=U,G=xh(),G!==r?(ee=U,Z=Yt(),fe=Wo(),fe!==r?ee=fe:(U=ee,ee=r),ee===r&&(ee=null),ft=D,D=O2(G,ee)):(U=D,D=r),D}function xh(){var D,G,ee,Z,fe,ge;if(D=U,G=Vo(),G!==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=N2(G,ee)}else U=D,D=r;return D}function Vo(){var D,G,ee,Z;return D=U,G=f0(),G!==r?(ee=$h(),ee===r&&(ee=null),Z=Ph(),Z!==r?(ft=D,D=L2(G,ee,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=U,G=$h(),G!==r?(ee=Yt(),Z=Ph(),Z!==r?(ft=D,D=U2(G,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=Ph())),D}function f0(){var D,G;return D=U,e.charCodeAt(U)===64?(G=h,U++):(G=r,ce===0&&Ae(lh)),G!==r&&(ft=D,G=H2()),D=G,D}function $h(){var D,G,ee,Z;return D=U,G=Hn(),G!==r?(ee=Yt(),e.charCodeAt(U)===58?(Z=m,U++):(Z=r,ce===0&&Ae(su)),Z!==r?(ft=D,D=er(G)):(U=D,D=r)):(U=D,D=r),D}function Ph(){var D,G,ee,Z;return D=U,G=Y2(),G!==r?(ee=Yt(),Z=h0(),Z!==r?(ft=D,D=Zt(G,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=h0()),D}function Y2(){var D;return e.charCodeAt(U)===36?(D=p,U++):(D=r,ce===0&&Ae(Xi)),D===r&&(e.charCodeAt(U)===38?(D=d,U++):(D=r,ce===0&&Ae(Kt)),D===r&&(e.charCodeAt(U)===33?(D=v,U++):(D=r,ce===0&&Ae(js)))),D}function h0(){var D,G,ee,Z;return D=U,G=d0(),G!==r?(ee=Yt(),Z=X2(),Z!==r?(ft=D,D=M2(G,Z)):(U=D,D=r)):(U=D,D=r),D===r&&(D=d0()),D}function X2(){var D;return e.charCodeAt(U)===63?(D=g,U++):(D=r,ce===0&&Ae(_l)),D===r&&(e.charCodeAt(U)===42?(D=y,U++):(D=r,ce===0&&Ae(fh)),D===r&&(e.charCodeAt(U)===43?(D=w,U++):(D=r,ce===0&&Ae(lc)))),D}function d0(){var D,G,ee,Z,fe,ge;return D=rv(),D===r&&(D=ye(),D===r&&(D=Il(),D===r&&(D=du(),D===r&&(D=Z2(),D===r&&(D=U,e.charCodeAt(U)===40?(G=E,U++):(G=r,ce===0&&Ae(iu)),G!==r?(ee=Yt(),Z=Ih(),Z!==r?(fe=Yt(),e.charCodeAt(U)===41?(ge=_,U++):(ge=r,ce===0&&Ae(hh)),ge!==r?(ft=D,D=q2(Z)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r)))))),D}function du(){var D,G,ee,Z,fe,ge,Mt,yr;return D=U,G=Hn(),G!==r?(ee=U,ce++,Z=U,fe=Yt(),ge=U,Mt=Rh(),Mt!==r?(yr=Yt(),Mt=[Mt,yr],ge=Mt):(U=ge,ge=r),ge===r&&(ge=null),e.charCodeAt(U)===61?(Mt=u,U++):(Mt=r,ce===0&&Ae(Sl)),Mt!==r?(fe=[fe,ge,Mt],Z=fe):(U=Z,Z=r),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(ft=D,D=j2(G)):(U=D,D=r)):(U=D,D=r),D}function Z2(){var D,G,ee,Z;return D=U,G=J2(),G!==r?(ee=Yt(),Z=Wo(),Z!==r?(ft=D,D=K2(G,Z)):(U=D,D=r)):(U=D,D=r),D}function J2(){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(js))),D}function Gr(){var D;return e.length>U?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Cl)),D}function dc(){var D,G;return ce++,e.charCodeAt(U)===9?(D=C,U++):(D=r,ce===0&&Ae(dh)),D===r&&(e.charCodeAt(U)===11?(D=F,U++):(D=r,ce===0&&Ae(ie)),D===r&&(e.charCodeAt(U)===12?(D=H,U++):(D=r,ce===0&&Ae(we)),D===r&&(e.charCodeAt(U)===32?(D=K,U++):(D=r,ce===0&&Ae(je)),D===r&&(e.charCodeAt(U)===160?(D=S,U++):(D=r,ce===0&&Ae(Me)),D===r&&(e.charCodeAt(U)===65279?(D=I,U++):(D=r,ce===0&&Ae(et)),D===r&&(D=E0())))))),ce--,D===r&&(G=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 Go(){var D,G;return ce++,e.charCodeAt(U)===10?(D=q,U++):(D=r,ce===0&&Ae(kr)),D===r&&(e.substr(U,2)===L?(D=L,U+=2):(D=r,ce===0&&Ae(ar)),D===r&&(e.charCodeAt(U)===13?(D=R,U++):(D=r,ce===0&&Ae(Ks)),D===r&&(e.charCodeAt(U)===8232?(D=O,U++):(D=r,ce===0&&Ae(Zi)),D===r&&(e.charCodeAt(U)===8233?(D=T,U++):(D=r,ce===0&&Ae(Nn)))))),ce--,D===r&&(G=r,ce===0&&Ae(wt)),D}function p0(){var D,G;return ce++,D=Q2(),D===r&&(D=zo()),ce--,D===r&&(G=r,ce===0&&Ae(ts)),D}function Q2(){var D,G,ee,Z,fe,ge;if(D=U,e.substr(U,2)===N?(G=N,U+=2):(G=r,ce===0&&Ae(Fr)),G!==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=Gr(),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=Gr(),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?(G=[G,ee,Z],D=G):(U=D,D=r)}else U=D,D=r;return D}function m0(){var D,G,ee,Z,fe,ge;if(D=U,e.substr(U,2)===N?(G=N,U+=2):(G=r,ce===0&&Ae(Fr)),G!==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=Gr(),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=Gr(),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?(G=[G,ee,Z],D=G):(U=D,D=r)}else U=D,D=r;return D}function zo(){var D,G,ee,Z,fe,ge;if(D=U,e.substr(U,2)===M?(G=M,U+=2):(G=r,ce===0&&Ae(ou)),G!==r){for(ee=[],Z=U,fe=U,ce++,ge=en(),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=Gr(),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=Gr(),ge!==r?(fe=[fe,ge],Z=fe):(U=Z,Z=r)):(U=Z,Z=r);G=[G,ee],D=G}else U=D,D=r;return D}function Hn(){var D,G,ee,Z;if(ce++,D=U,G=kh(),G!==r){for(ee=[],Z=g0();Z!==r;)ee.push(Z),Z=g0();ft=D,D=V2(G,ee)}else U=D,D=r;return ce--,D===r&&(G=r,ce===0&&Ae(au)),D}function kh(){var D,G,ee;return D=ev(),D===r&&(e.charCodeAt(U)===36?(D=p,U++):(D=r,ce===0&&Ae(Xi)),D===r&&(e.charCodeAt(U)===95?(D=Y,U++):(D=r,ce===0&&Ae(ph)),D===r&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=r,ce===0&&Ae(vn)),G!==r?(ee=pc(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r)))),D}function g0(){var D;return D=kh(),D===r&&(D=tv(),D===r&&(D=Pl(),D===r&&(D=kl(),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 ev(){var D;return D=ov(),D===r&&(D=w0(),D===r&&(D=iv(),D===r&&(D=xl(),D===r&&(D=sv(),D===r&&(D=y0()))))),D}function tv(){var D;return D=eo(),D===r&&(D=$l()),D}function rv(){var D,G,ee;return ce++,D=U,G=Rh(),G!==r?(e.charCodeAt(U)===105?(ee=ae,U++):(ee=r,ce===0&&Ae(ur)),ee===r&&(ee=null),ft=D,D=G2(G,ee)):(U=D,D=r),ce--,D===r&&(G=r,ce===0&&Ae(ut)),D}function Rh(){var D,G,ee,Z;if(ce++,D=U,e.charCodeAt(U)===34?(G=me,U++):(G=r,ce===0&&Ae(nr)),G!==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=e0(ee)):(U=D,D=r)}else U=D,D=r;if(D===r)if(D=U,e.charCodeAt(U)===39?(G=he,U++):(G=r,ce===0&&Ae(rs)),G!==r){for(ee=[],Z=oe();Z!==r;)ee.push(Z),Z=oe();e.charCodeAt(U)===39?(Z=he,U++):(Z=r,ce===0&&Ae(rs)),Z!==r?(ft=D,D=z2(ee)):(U=D,D=r)}else U=D,D=r;return ce--,D===r&&(G=r,ce===0&&Ae(wn)),D}function wi(){var D,G,ee,Z;return D=U,G=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=Gr(),Z!==r?(ee=[ee,Z],G=ee):(U=G,G=r)):(U=G,G=r),G!==r?D=e.substring(D,U):D=G,D===r&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=r,ce===0&&Ae(vn)),G!==r?(ee=xt(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r),D===r&&(D=ot())),D}function oe(){var D,G,ee,Z;return D=U,G=U,ee=U,ce++,e.charCodeAt(U)===39?(Z=he,U++):(Z=r,ce===0&&Ae(rs)),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=Gr(),Z!==r?(ee=[ee,Z],G=ee):(U=G,G=r)):(U=G,G=r),G!==r?D=e.substring(D,U):D=G,D===r&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=r,ce===0&&Ae(vn)),G!==r?(ee=xt(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r),D===r&&(D=ot())),D}function ye(){var D,G,ee,Z,fe,ge;if(ce++,D=U,e.charCodeAt(U)===91?(G=De,U++):(G=r,ce===0&&Ae(Vs)),G!==r){for(e.charCodeAt(U)===94?(ee=Pe,U++):(ee=r,ce===0&&Ae(gi)),ee===r&&(ee=null),Z=[],fe=de(),fe===r&&(fe=He());fe!==r;)Z.push(fe),fe=de(),fe===r&&(fe=He());e.charCodeAt(U)===93?(fe=Ie,U++):(fe=r,ce===0&&Ae(Ji)),fe!==r?(e.charCodeAt(U)===105?(ge=ae,U++):(ge=r,ce===0&&Ae(ur)),ge===r&&(ge=null),ft=D,D=Ir(ee,Z,ge)):(U=D,D=r)}else U=D,D=r;return ce--,D===r&&(G=r,ce===0&&Ae(Cs)),D}function de(){var D,G,ee,Z;return D=U,G=He(),G!==r?(e.charCodeAt(U)===45?(ee=se,U++):(ee=r,ce===0&&Ae(Dl)),ee!==r?(Z=He(),Z!==r?(ft=D,D=bh(G,Z)):(U=D,D=r)):(U=D,D=r)):(U=D,D=r),D}function He(){var D,G,ee,Z;return D=U,G=U,ee=U,ce++,e.charCodeAt(U)===93?(Z=Ie,U++):(Z=r,ce===0&&Ae(Ji)),Z===r&&(e.charCodeAt(U)===92?(Z=V,U++):(Z=r,ce===0&&Ae(vn)),Z===r&&(Z=en())),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(Z=Gr(),Z!==r?(ee=[ee,Z],G=ee):(U=G,G=r)):(U=G,G=r),G!==r?D=e.substring(D,U):D=G,D===r&&(D=U,e.charCodeAt(U)===92?(G=V,U++):(G=r,ce===0&&Ae(vn)),G!==r?(ee=xt(),ee!==r?D=ee:(U=D,D=r)):(U=D,D=r),D===r&&(D=ot())),D}function ot(){var D,G,ee;return D=U,e.charCodeAt(U)===92?(G=V,U++):(G=r,ce===0&&Ae(vn)),G!==r?(ee=Go(),ee!==r?(ft=D,D=Ko()):(U=D,D=r)):(U=D,D=r),D}function xt(){var D,G,ee,Z;return D=wr(),D===r&&(D=U,e.charCodeAt(U)===48?(G=pe,U++):(G=r,ce===0&&Ae(jp)),G!==r?(ee=U,ce++,Z=v0(),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(ft=D,D=t0()):(U=D,D=r)):(U=D,D=r),D===r&&(D=ss(),D===r&&(D=pc()))),D}function wr(){var D;return D=Vt(),D===r&&(D=Th()),D}function Vt(){var D,G;return e.charCodeAt(U)===39?(D=he,U++):(D=r,ce===0&&Ae(rs)),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?(G=Fe,U++):(G=r,ce===0&&Ae(mh)),G!==r&&(ft=D,G=Ah()),D=G,D===r&&(D=U,e.charCodeAt(U)===102?(G=Te,U++):(G=r,ce===0&&Ae(C2)),G!==r&&(ft=D,G=ns()),D=G,D===r&&(D=U,e.charCodeAt(U)===110?(G=Ve,U++):(G=r,ce===0&&Ae(Kp)),G!==r&&(ft=D,G=r0()),D=G,D===r&&(D=U,e.charCodeAt(U)===114?(G=Oe,U++):(G=r,ce===0&&Ae(Fl)),G!==r&&(ft=D,G=n0()),D=G,D===r&&(D=U,e.charCodeAt(U)===116?(G=pt,U++):(G=r,ce===0&&Ae(Vp)),G!==r&&(ft=D,G=s0()),D=G,D===r&&(D=U,e.charCodeAt(U)===118?(G=Qe,U++):(G=r,ce===0&&Ae(D2)),G!==r&&(ft=D,G=i0()),D=G)))))))),D}function Th(){var D,G,ee,Z;return D=U,G=U,ee=U,ce++,Z=nv(),Z===r&&(Z=en()),ce--,Z===r?ee=void 0:(U=ee,ee=r),ee!==r?(Z=Gr(),Z!==r?(ee=[ee,Z],G=ee):(U=G,G=r)):(U=G,G=r),G!==r?D=e.substring(D,U):D=G,D}function nv(){var D;return D=Vt(),D===r&&(D=v0(),D===r&&(e.charCodeAt(U)===120?(D=ct,U++):(D=r,ce===0&&Ae(gh)),D===r&&(e.charCodeAt(U)===117?(D=mn,U++):(D=r,ce===0&&Ae(vh))))),D}function ss(){var D,G,ee,Z,fe,ge;return D=U,e.charCodeAt(U)===120?(G=ct,U++):(G=r,ce===0&&Ae(gh)),G!==r?(ee=U,Z=U,fe=Ds(),fe!==r?(ge=Ds(),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=o0(ee)):(U=D,D=r)):(U=D,D=r),D}function pc(){var D,G,ee,Z,fe,ge,Mt,yr;return D=U,e.charCodeAt(U)===117?(G=mn,U++):(G=r,ce===0&&Ae(vh)),G!==r?(ee=U,Z=U,fe=Ds(),fe!==r?(ge=Ds(),ge!==r?(Mt=Ds(),Mt!==r?(yr=Ds(),yr!==r?(fe=[fe,ge,Mt,yr],Z=fe):(U=Z,Z=r)):(U=Z,Z=r)):(U=Z,Z=r)):(U=Z,Z=r),Z!==r?ee=e.substring(ee,U):ee=Z,ee!==r?(ft=D,D=a0(ee)):(U=D,D=r)):(U=D,D=r),D}function v0(){var D;return Pr.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(wh)),D}function Ds(){var D;return es.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(F2)),D}function Il(){var D,G;return D=U,e.charCodeAt(U)===46?(G=gr,U++):(G=r,ce===0&&Ae(Gp)),G!==r&&(ft=D,G=Un()),D=G,D}function Wo(){var D,G,ee,Z;return ce++,D=U,e.charCodeAt(U)===123?(G=s,U++):(G=r,ce===0&&Ae(gn)),G!==r?(ee=Nt(),e.charCodeAt(U)===125?(Z=a,U++):(Z=r,ce===0&&Ae(Yi)),Z!==r?D=ee:(U=D,D=r)):(U=D,D=r),ce--,D===r&&(G=r,ce===0&&Ae(yh)),D}function Nt(){var D,G;return D=U,G=Oh(),ft=D,G=W2(G),D=G,D}function Oh(){var D,G,ee,Z,fe,ge;if(D=U,G=[],ee=[],Z=U,fe=U,ce++,mi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=r,ce===0&&Ae(uu)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=Gr(),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(uu)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=Gr(),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=Oh(),e.charCodeAt(U)===125?(ge=a,U++):(ge=r,ce===0&&Ae(Yi)),ge!==r?(Z=[Z,fe,ge],ee=Z):(U=ee,ee=r)):(U=ee,ee=r));ee!==r;){if(G.push(ee),ee=[],Z=U,fe=U,ce++,mi.test(e.charAt(U))?(ge=e.charAt(U),U++):(ge=r,ce===0&&Ae(uu)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=Gr(),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(uu)),ce--,ge===r?fe=void 0:(U=fe,fe=r),fe!==r?(ge=Gr(),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=Oh(),e.charCodeAt(U)===125?(ge=a,U++):(ge=r,ce===0&&Ae(Yi)),ge!==r?(Z=[Z,fe,ge],ee=Z):(U=ee,ee=r)):(U=ee,ee=r))}return D=e.substring(D,U),D}function w0(){var D;return Dt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(cu)),D}function xl(){var D;return Ze.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(zp)),D}function sv(){var D;return Re.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Wp)),D}function iv(){var D;return or.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(B2)),D}function ov(){var D;return Tn.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Yp)),D}function $l(){var D;return mt.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Xp)),D}function eo(){var D;return cc.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Zp)),D}function Pl(){var D;return On.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(Jp)),D}function y0(){var D;return Se.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(I2)),D}function kl(){var D;return ru.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae(x2)),D}function E0(){var D;return Ut.test(e.charAt(U))?(D=e.charAt(U),U++):(D=r,ce===0&&Ae($2)),D}function Yt(){var D,G;for(D=[],G=dc(),G===r&&(G=Go(),G===r&&(G=p0()));G!==r;)D.push(G),G=dc(),G===r&&(G=Go(),G===r&&(G=p0()));return D}function Rl(){var D,G;for(D=[],G=dc(),G===r&&(G=m0());G!==r;)D.push(G),G=dc(),G===r&&(G=m0());return D}function Tl(){var D,G,ee,Z;return D=U,G=Yt(),e.charCodeAt(U)===59?(ee=vr,U++):(ee=r,ce===0&&Ae(Qp)),ee!==r?(G=[G,ee],D=G):(U=D,D=r),D===r&&(D=U,G=Rl(),ee=zo(),ee===r&&(ee=null),Z=Go(),Z!==r?(G=[G,ee,Z],D=G):(U=D,D=r),D===r&&(D=U,G=Yt(),ee=mc(),ee!==r?(G=[G,ee],D=G):(U=D,D=r))),D}function mc(){var D,G;return D=U,ce++,e.length>U?(G=e.charAt(U),U++):(G=r,ce===0&&Ae(Cl)),ce--,G===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(fu()),Dh(lu,Rr<e.length?e.charAt(Rr):null,Rr<e.length?hu(Rr,Rr+1):hu(Rr,Rr))}ix.exports={SyntaxError:uc,parse:HQ}});var E2=be((PEe,ax)=>{"use strict";var kEe=B(x()),MQ=h2(),qQ=sx(),jQ=ox(),KQ=AS(),VQ=["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"],qp={VERSION:KQ,RESERVED_WORDS:VQ,GrammarError:MQ,parser:jQ,compiler:qQ,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:qp.parser,passes:r(qp.compiler.passes),reservedWords:qp.RESERVED_WORDS.slice()};return n.forEach(o=>{o.use(i,t)}),qp.compiler.compile(i.parser.parse(e,{grammarSource:t.grammarSource,reservedWords:i.reservedWords}),i.passes,t)}};ax.exports=qp});var KS=be((qS,jS)=>{var zEe=B(x());(function(e,t){typeof qS=="object"&&typeof jS<"u"?jS.exports=t():typeof define=="function"&&define.amd?define(t):e.JSON5=t()})(qS,(function(){"use strict";function e(ie,we){return we={exports:{}},ie(we,we.exports),we.exports}var t=e(function(ie){var we=ie.exports=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")();typeof __g=="number"&&(__g=we)}),r=e(function(ie){var we=ie.exports={version:"2.6.5"};typeof __e=="number"&&(__e=we)}),n=r.version,i=function(ie){return typeof ie=="object"?ie!==null:typeof ie=="function"},o=function(ie){if(!i(ie))throw TypeError(ie+" is not an object!");return ie},s=function(ie){try{return!!ie()}catch{return!0}},a=!s(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7}),u=t.document,l=i(u)&&i(u.createElement),h=function(ie){return l?u.createElement(ie):{}},m=!a&&!s(function(){return Object.defineProperty(h("div"),"a",{get:function(){return 7}}).a!=7}),p=function(ie,we){if(!i(ie))return ie;var je,Me;if(we&&typeof(je=ie.toString)=="function"&&!i(Me=je.call(ie))||typeof(je=ie.valueOf)=="function"&&!i(Me=je.call(ie))||!we&&typeof(je=ie.toString)=="function"&&!i(Me=je.call(ie)))return Me;throw TypeError("Can't convert object to primitive value")},d=Object.defineProperty,v=a?Object.defineProperty:function(we,je,Me){if(o(we),je=p(je,!0),o(Me),m)try{return d(we,je,Me)}catch{}if("get"in Me||"set"in Me)throw TypeError("Accessors not supported!");return"value"in Me&&(we[je]=Me.value),we},g={f:v},y=function(ie,we){return{enumerable:!(ie&1),configurable:!(ie&2),writable:!(ie&4),value:we}},w=a?function(ie,we,je){return g.f(ie,we,y(1,je))}:function(ie,we,je){return ie[we]=je,ie},E={}.hasOwnProperty,_=function(ie,we){return E.call(ie,we)},C=0,F=Math.random(),H=function(ie){return"Symbol(".concat(ie===void 0?"":ie,")_",(++C+F).toString(36))},K=!1,S=e(function(ie){var we="__core-js_shared__",je=t[we]||(t[we]={});(ie.exports=function(Me,et){return je[Me]||(je[Me]=et!==void 0?et:{})})("versions",[]).push({version:r.version,mode:K?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),I=S("native-function-to-string",Function.toString),q=e(function(ie){var we=H("src"),je="toString",Me=(""+I).split(je);r.inspectSource=function(et){return I.call(et)},(ie.exports=function(et,gt,wt,kr){var ar=typeof wt=="function";ar&&(_(wt,"name")||w(wt,"name",gt)),et[gt]!==wt&&(ar&&(_(wt,we)||w(wt,we,et[gt]?""+et[gt]:Me.join(String(gt)))),et===t?et[gt]=wt:kr?et[gt]?et[gt]=wt:w(et,gt,wt):(delete et[gt],w(et,gt,wt)))})(Function.prototype,je,function(){return typeof this=="function"&&this[we]||I.call(this)})}),L=function(ie){if(typeof ie!="function")throw TypeError(ie+" is not a function!");return ie},R=function(ie,we,je){if(L(ie),we===void 0)return ie;switch(je){case 1:return function(Me){return ie.call(we,Me)};case 2:return function(Me,et){return ie.call(we,Me,et)};case 3:return function(Me,et,gt){return ie.call(we,Me,et,gt)}}return function(){return ie.apply(we,arguments)}},O="prototype",T=function(ie,we,je){var Me=ie&T.F,et=ie&T.G,gt=ie&T.S,wt=ie&T.P,kr=ie&T.B,ar=et?t:gt?t[we]||(t[we]={}):(t[we]||{})[O],Ks=et?r:r[we]||(r[we]={}),Zi=Ks[O]||(Ks[O]={}),Nn,ts,Fr,Ln;et&&(je=we);for(Nn in je)ts=!Me&&ar&&ar[Nn]!==void 0,Fr=(ts?ar:je)[Nn],Ln=kr&&ts?R(Fr,t):wt&&typeof Fr=="function"?R(Function.call,Fr):Fr,ar&&q(ar,Nn,Fr,ie&T.U),Ks[Nn]!=Fr&&w(Ks,Nn,Ln),wt&&Zi[Nn]!=Fr&&(Zi[Nn]=Fr)};t.core=r,T.F=1,T.G=2,T.S=4,T.P=8,T.B=16,T.W=32,T.U=64,T.R=128;var N=T,P=Math.ceil,M=Math.floor,Y=function(ie){return isNaN(ie=+ie)?0:(ie>0?M:P)(ie)},V=function(ie){if(ie==null)throw TypeError("Can't call method on "+ie);return ie},X=function(ie){return function(we,je){var Me=String(V(we)),et=Y(je),gt=Me.length,wt,kr;return et<0||et>=gt?ie?"":void 0:(wt=Me.charCodeAt(et),wt<55296||wt>56319||et+1===gt||(kr=Me.charCodeAt(et+1))<56320||kr>57343?ie?Me.charAt(et):wt:ie?Me.slice(et,et+2):(wt-55296<<10)+(kr-56320)+65536)}},te=X(!1);N(N.P,"String",{codePointAt:function(we){return te(this,we)}});var ae=r.String.codePointAt,me=Math.max,he=Math.min,De=function(ie,we){return ie=Y(ie),ie<0?me(ie+we,0):he(ie,we)},Pe=String.fromCharCode,Ie=String.fromCodePoint;N(N.S+N.F*(!!Ie&&Ie.length!=1),"String",{fromCodePoint:function(we){for(var je=arguments,Me=[],et=arguments.length,gt=0,wt;et>gt;){if(wt=+je[gt++],De(wt,1114111)!==wt)throw RangeError(wt+" is not a valid code point");Me.push(wt<65536?Pe(wt):Pe(((wt-=65536)>>10)+55296,wt%1024+56320))}return Me.join("")}});var se=r.String.fromCodePoint,pe=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Fe=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Te=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Ve={Space_Separator:pe,ID_Start:Fe,ID_Continue:Te},Oe={isSpaceSeparator:function(we){return typeof we=="string"&&Ve.Space_Separator.test(we)},isIdStartChar:function(we){return typeof we=="string"&&(we>="a"&&we<="z"||we>="A"&&we<="Z"||we==="$"||we==="_"||Ve.ID_Start.test(we))},isIdContinueChar:function(we){return typeof we=="string"&&(we>="a"&&we<="z"||we>="A"&&we<="Z"||we>="0"&&we<="9"||we==="$"||we==="_"||we==="\u200C"||we==="\u200D"||Ve.ID_Continue.test(we))},isDigit:function(we){return typeof we=="string"&&/[0-9]/.test(we)},isHexDigit:function(we){return typeof we=="string"&&/[0-9A-Fa-f]/.test(we)}},pt,Qe,ct,mn,gr,vr,lt,Pr,es,mi=function(we,je){pt=String(we),Qe="start",ct=[],mn=0,gr=1,vr=0,lt=void 0,Pr=void 0,es=void 0;do lt=cc(),lh[Qe]();while(lt.type!=="eof");return typeof je=="function"?Dt({"":es},"",je):es};function Dt(ie,we,je){var Me=ie[we];if(Me!=null&&typeof Me=="object")if(Array.isArray(Me))for(var et=0;et<Me.length;et++){var gt=String(et),wt=Dt(Me,gt,je);wt===void 0?delete Me[gt]:Object.defineProperty(Me,gt,{value:wt,writable:!0,enumerable:!0,configurable:!0})}else for(var kr in Me){var ar=Dt(Me,kr,je);ar===void 0?delete Me[kr]:Object.defineProperty(Me,kr,{value:ar,writable:!0,enumerable:!0,configurable:!0})}return je.call(ie,we,Me)}var Ze,Re,or,Tn,mt;function cc(){for(Ze="default",Re="",or=!1,Tn=1;;){mt=On();var ie=ru[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 ru={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 ru[Qe]()},comment:function(){switch(mt){case"*":Se(),Ze="multiLineComment";return;case"/":Se(),Ze="singleLineComment";return}throw Kt(Se())},multiLineComment:function(){switch(mt){case"*":Se(),Ze="multiLineCommentAsterisk";return;case void 0:throw Kt(Se())}Se()},multiLineCommentAsterisk:function(){switch(mt){case"*":Se();return;case"/":Se(),Ze="default";return;case void 0:throw Kt(Se())}Se(),Ze="multiLineComment"},singleLineComment:function(){switch(mt){case`
`:case"\r":case"\u2028":case"\u2029":Se(),Ze="default";return;case void 0:return Se(),Ut("eof")}Se()},value:function(){switch(mt){case"{":case"[":return Ut("punctuator",Se());case"n":return Se(),gn("ull"),Ut("null",null);case"t":return Se(),gn("rue"),Ut("boolean",!0);case"f":return Se(),gn("alse"),Ut("boolean",!1);case"-":case"+":Se()==="-"&&(Tn=-1),Ze="sign";return;case".":Re=Se(),Ze="decimalPointLeading";return;case"0":Re=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Re=Se(),Ze="decimalInteger";return;case"I":return Se(),gn("nfinity"),Ut("numeric",1/0);case"N":return Se(),gn("aN"),Ut("numeric",NaN);case'"':case"'":or=Se()==='"',Re="",Ze="string";return}throw Kt(Se())},identifierNameStartEscape:function(){if(mt!=="u")throw Kt(Se());Se();var we=nu();switch(we){case"$":case"_":break;default:if(!Oe.isIdStartChar(we))throw _l();break}Re+=we,Ze="identifierName"},identifierName:function(){switch(mt){case"$":case"_":case"\u200C":case"\u200D":Re+=Se();return;case"\\":Se(),Ze="identifierNameEscape";return}if(Oe.isIdContinueChar(mt)){Re+=Se();return}return Ut("identifier",Re)},identifierNameEscape:function(){if(mt!=="u")throw Kt(Se());Se();var we=nu();switch(we){case"$":case"_":case"\u200C":case"\u200D":break;default:if(!Oe.isIdContinueChar(we))throw _l();break}Re+=we,Ze="identifierName"},sign:function(){switch(mt){case".":Re=Se(),Ze="decimalPointLeading";return;case"0":Re=Se(),Ze="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Re=Se(),Ze="decimalInteger";return;case"I":return Se(),gn("nfinity"),Ut("numeric",Tn*(1/0));case"N":return Se(),gn("aN"),Ut("numeric",NaN)}throw Kt(Se())},zero:function(){switch(mt){case".":Re+=Se(),Ze="decimalPoint";return;case"e":case"E":Re+=Se(),Ze="decimalExponent";return;case"x":case"X":Re+=Se(),Ze="hexadecimal";return}return Ut("numeric",Tn*0)},decimalInteger:function(){switch(mt){case".":Re+=Se(),Ze="decimalPoint";return;case"e":case"E":Re+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},decimalPointLeading:function(){if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalFraction";return}throw Kt(Se())},decimalPoint:function(){switch(mt){case"e":case"E":Re+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalFraction";return}return Ut("numeric",Tn*Number(Re))},decimalFraction:function(){switch(mt){case"e":case"E":Re+=Se(),Ze="decimalExponent";return}if(Oe.isDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},decimalExponent:function(){switch(mt){case"+":case"-":Re+=Se(),Ze="decimalExponentSign";return}if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalExponentInteger";return}throw Kt(Se())},decimalExponentSign:function(){if(Oe.isDigit(mt)){Re+=Se(),Ze="decimalExponentInteger";return}throw Kt(Se())},decimalExponentInteger:function(){if(Oe.isDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},hexadecimal:function(){if(Oe.isHexDigit(mt)){Re+=Se(),Ze="hexadecimalInteger";return}throw Kt(Se())},hexadecimalInteger:function(){if(Oe.isHexDigit(mt)){Re+=Se();return}return Ut("numeric",Tn*Number(Re))},string:function(){switch(mt){case"\\":Se(),Re+=Yi();return;case'"':if(or)return Se(),Ut("string",Re);Re+=Se();return;case"'":if(!or)return Se(),Ut("string",Re);Re+=Se();return;case`
`:case"\r":throw Kt(Se());case"\u2028":case"\u2029":fh(mt);break;case void 0:throw Kt(Se())}Re+=Se()},start:function(){switch(mt){case"{":case"[":return Ut("punctuator",Se())}Ze="value"},beforePropertyName:function(){switch(mt){case"$":case"_":Re=Se(),Ze="identifierName";return;case"\\":Se(),Ze="identifierNameStartEscape";return;case"}":return Ut("punctuator",Se());case'"':case"'":or=Se()==='"',Ze="string";return}if(Oe.isIdStartChar(mt)){Re+=Se(),Ze="identifierName";return}throw Kt(Se())},afterPropertyName:function(){if(mt===":")return Ut("punctuator",Se());throw Kt(Se())},beforePropertyValue:function(){Ze="value"},afterPropertyValue:function(){switch(mt){case",":case"}":return Ut("punctuator",Se())}throw Kt(Se())},beforeArrayValue:function(){if(mt==="]")return Ut("punctuator",Se());Ze="value"},afterArrayValue:function(){switch(mt){case",":case"]":return Ut("punctuator",Se())}throw Kt(Se())},end:function(){throw Kt(Se())}};function Ut(ie,we){return{type:ie,value:we,line:gr,column:vr}}function gn(ie){for(var we=0,je=ie;we<je.length;we+=1){var Me=je[we],et=On();if(et!==Me)throw Kt(Se());Se()}}function Yi(){var ie=On();switch(ie){case"b":return Se(),"\b";case"f":return Se(),"\f";case"n":return Se(),`
`;case"r":return Se(),"\r";case"t":return Se()," ";case"v":return Se(),"\v";case"0":if(Se(),Oe.isDigit(On()))throw Kt(Se());return"\0";case"x":return Se(),Sl();case"u":return Se(),nu();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 Sl(){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 nu(){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 lh={start:function(){if(lt.type==="eof")throw js();su()},beforePropertyName:function(){switch(lt.type){case"identifier":case"string":Pr=lt.value,Qe="afterPropertyName";return;case"punctuator":Xi();return;case"eof":throw js()}},afterPropertyName:function(){if(lt.type==="eof")throw js();Qe="beforePropertyValue"},beforePropertyValue:function(){if(lt.type==="eof")throw js();su()},beforeArrayValue:function(){if(lt.type==="eof")throw js();if(lt.type==="punctuator"&&lt.value==="]"){Xi();return}su()},afterPropertyValue:function(){if(lt.type==="eof")throw js();switch(lt.value){case",":Qe="beforePropertyName";return;case"}":Xi()}},afterArrayValue:function(){if(lt.type==="eof")throw js();switch(lt.value){case",":Qe="beforeArrayValue";return;case"]":Xi()}},end:function(){}};function su(){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(es===void 0)es=ie;else{var we=ct[ct.length-1];Array.isArray(we)?we.push(ie):Object.defineProperty(we,Pr,{value:ie,writable:!0,enumerable:!0,configurable:!0})}if(ie!==null&&typeof ie=="object")ct.push(ie),Array.isArray(ie)?Qe="beforeArrayValue":Qe="beforePropertyName";else{var je=ct[ct.length-1];je==null?Qe="end":Array.isArray(je)?Qe="afterArrayValue":Qe="afterPropertyValue"}}function Xi(){ct.pop();var ie=ct[ct.length-1];ie==null?Qe="end":Array.isArray(ie)?Qe="afterArrayValue":Qe="afterPropertyValue"}function Kt(ie){return iu(ie===void 0?"JSON5: invalid end of input at "+gr+":"+vr:"JSON5: invalid character '"+lc(ie)+"' at "+gr+":"+vr)}function js(){return iu("JSON5: invalid end of input at "+gr+":"+vr)}function _l(){return vr-=5,iu("JSON5: invalid identifier character at "+gr+":"+vr)}function fh(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 iu(ie){var we=new SyntaxError(ie);return we.lineNumber=gr,we.columnNumber=vr,we}var hh=function(we,je,Me){var et=[],gt="",wt,kr,ar="",Ks;if(je!=null&&typeof je=="object"&&!Array.isArray(je)&&(Me=je.space,Ks=je.quote,je=je.replacer),typeof je=="function")kr=je;else if(Array.isArray(je)){wt=[];for(var Zi=0,Nn=je;Zi<Nn.length;Zi+=1){var ts=Nn[Zi],Fr=void 0;typeof ts=="string"?Fr=ts:(typeof ts=="number"||ts instanceof String||ts instanceof Number)&&(Fr=String(ts)),Fr!==void 0&&wt.indexOf(Fr)<0&&wt.push(Fr)}}return Me instanceof Number?Me=Number(Me):Me instanceof String&&(Me=String(Me)),typeof Me=="number"?Me>0&&(Me=Math.min(10,Math.floor(Me)),ar=" ".substr(0,Me)):typeof Me=="string"&&(ar=Me.substr(0,10)),Ln("",{"":we});function Ln(Ht,Br){var ut=Br[Ht];switch(ut!=null&&(typeof ut.toJSON5=="function"?ut=ut.toJSON5(Ht):typeof ut.toJSON=="function"&&(ut=ut.toJSON(Ht))),kr&&(ut=kr.call(Br,Ht,ut)),ut instanceof Number?ut=Number(ut):ut instanceof String?ut=String(ut):ut instanceof Boolean&&(ut=ut.valueOf()),ut){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof ut=="string")return ou(ut,!1);if(typeof ut=="number")return String(ut);if(typeof ut=="object")return Array.isArray(ut)?vn(ut):au(ut)}function ou(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 rs=nr.charCodeAt(0).toString(16);ur+="\\x"+("00"+rs).substring(rs.length);continue}ur+=nr}var Cs=Ks||Object.keys(Br).reduce(function(Vs,gi){return Br[Vs]<Br[gi]?Vs:gi});return ur=ur.replace(new RegExp(Cs,"g"),ut[Cs]),Cs+ur+Cs}function au(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 rs=nr[wn],Cs=Ln(rs,Ht);if(Cs!==void 0){var Vs=ph(rs)+":";ar!==""&&(Vs+=" "),Vs+=Cs,ur.push(Vs)}}var gi;if(ur.length===0)gi="{}";else{var Ji;if(ar==="")Ji=ur.join(","),gi="{"+Ji+"}";else{var Dl=`,
`+gt;Ji=ur.join(Dl),gi=`{
`+gt+Ji+`,
`+Br+"}"}}return et.pop(),gt=Br,gi}function ph(Ht){if(Ht.length===0)return ou(Ht,!0);var Br=String.fromCodePoint(Ht.codePointAt(0));if(!Oe.isIdStartChar(Br))return ou(Ht,!0);for(var ut=Br.length;ut<Ht.length;ut++)if(!Oe.isIdContinueChar(String.fromCodePoint(Ht.codePointAt(ut))))return ou(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 rs=ut.join(",");nr="["+rs+"]"}else{var Cs=`,
`+gt,Vs=ut.join(Cs);nr=`[
`+gt+Vs+`,
`+Br+"]"}return et.pop(),gt=Br,nr}},Cl={parse:mi,stringify:hh},fc=Cl,dh=fc;return dh}))});var Obe=B(x());var xbe=B(x());var Kne=B(x(),1),__="3.7.8",TU=__,zl=typeof Buffer=="function",y_=typeof TextDecoder=="function"?new TextDecoder:void 0,E_=typeof TextEncoder=="function"?new TextEncoder:void 0,OU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Qh=Array.prototype.slice.call(OU),s1=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(Qh),NU=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,rn=String.fromCharCode.bind(String),b_=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),C_=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),D_=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),F_=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+=Qh[t>>18&63]+Qh[t>>12&63]+Qh[t>>6&63]+Qh[t&63]}return s?o.slice(0,s-3)+"===".substring(s):o},Kw=typeof btoa=="function"?e=>btoa(e):zl?e=>Buffer.from(e,"binary").toString("base64"):F_,qw=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 Kw(r.join(""))},i1=(e,t=!1)=>t?C_(qw(e)):qw(e),LU=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)}},UU=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,B_=e=>e.replace(UU,LU),A_=zl?e=>Buffer.from(e,"utf8").toString("base64"):E_?e=>qw(E_.encode(e)):e=>Kw(B_(e)),Gl=(e,t=!1)=>t?C_(A_(e)):A_(e),S_=e=>Gl(e,!0),HU=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,MU=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))}},I_=e=>e.replace(HU,MU),x_=e=>{if(e=e.replace(/\s+/g,""),!NU.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=s1[e.charAt(o++)]<<18|s1[e.charAt(o++)]<<12|(r=s1[e.charAt(o++)])<<6|(n=s1[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("")},Vw=typeof atob=="function"?e=>atob(D_(e)):zl?e=>Buffer.from(e,"base64").toString("binary"):x_,$_=zl?e=>b_(Buffer.from(e,"base64")):e=>b_(Vw(e).split("").map(t=>t.charCodeAt(0))),P_=e=>$_(k_(e)),qU=zl?e=>Buffer.from(e,"base64").toString("utf8"):y_?e=>y_.decode($_(e)):e=>I_(Vw(e)),k_=e=>D_(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),jw=e=>qU(k_(e)),jU=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)},R_=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),T_=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,R_(r));e("fromBase64",function(){return jw(this)}),e("toBase64",function(t){return Gl(this,t)}),e("toBase64URI",function(){return Gl(this,!0)}),e("toBase64URL",function(){return Gl(this,!0)}),e("toUint8Array",function(){return P_(this)})},O_=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,R_(r));e("toBase64",function(t){return i1(this,t)}),e("toBase64URI",function(){return i1(this,!0)}),e("toBase64URL",function(){return i1(this,!0)})},KU=()=>{T_(),O_()},bt={version:__,VERSION:TU,atob:Vw,atobPolyfill:x_,btoa:Kw,btoaPolyfill:F_,fromBase64:jw,toBase64:Gl,encode:Gl,encodeURI:S_,encodeURL:S_,utob:B_,btou:I_,decode:jw,isValid:jU,fromUint8Array:i1,toUint8Array:P_,extendString:T_,extendUint8Array:O_,extendBuiltins:KU};var A2=B(aa());var rse=B(x()),vy=B(BC());function mj(e){let t=vy.default.pemtohex(e);return vy.default.KJUR.crypto.Util.hashHex(t,"sha256").match(/.{2}/g).join(":").toUpperCase()}var IC={generateFingerprint:mj};var sfe=B(x());var efe=B(x(),1);var Nle=B(x(),1);var Qce=B(x(),1);var fse=B(x(),1);var sse=B(x(),1),S1=Symbol.for("yaml.alias"),_1=Symbol.for("yaml.document"),Fi=Symbol.for("yaml.map"),wy=Symbol.for("yaml.pair"),Ps=Symbol.for("yaml.scalar"),da=Symbol.for("yaml.seq"),Vn=Symbol.for("yaml.node.type"),ms=e=>!!e&&typeof e=="object"&&e[Vn]===S1,Bi=e=>!!e&&typeof e=="object"&&e[Vn]===_1,Ii=e=>!!e&&typeof e=="object"&&e[Vn]===Fi,It=e=>!!e&&typeof e=="object"&&e[Vn]===wy,dt=e=>!!e&&typeof e=="object"&&e[Vn]===Ps,ks=e=>!!e&&typeof e=="object"&&e[Vn]===da;function qt(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 S1:case Fi:case Ps:case da:return!0}return!1}var C1=e=>(dt(e)||qt(e))&&!!e.anchor;var ase=B(x(),1);var gs=Symbol("break visit"),xC=Symbol("skip children"),uo=Symbol("remove node");function vs(e,t){let r=$C(t);Bi(e)?of(null,e.contents,r,Object.freeze([e]))===uo&&(e.contents=null):of(null,e,r,Object.freeze([]))}vs.BREAK=gs;vs.SKIP=xC;vs.REMOVE=uo;function of(e,t,r,n){let i=PC(e,t,r,n);if(kt(i)||It(i))return kC(e,n,i),of(e,i,r,n);if(typeof i!="symbol"){if(qt(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=of(o,t.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===gs)return gs;s===uo&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){n=Object.freeze(n.concat(t));let o=of("key",t.key,r,n);if(o===gs)return gs;o===uo&&(t.key=null);let s=of("value",t.value,r,n);if(s===gs)return gs;s===uo&&(t.value=null)}}return i}async function D1(e,t){let r=$C(t);Bi(e)?await af(null,e.contents,r,Object.freeze([e]))===uo&&(e.contents=null):await af(null,e,r,Object.freeze([]))}D1.BREAK=gs;D1.SKIP=xC;D1.REMOVE=uo;async function af(e,t,r,n){let i=await PC(e,t,r,n);if(kt(i)||It(i))return kC(e,n,i),af(e,i,r,n);if(typeof i!="symbol"){if(qt(t)){n=Object.freeze(n.concat(t));for(let o=0;o<t.items.length;++o){let s=await af(o,t.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===gs)return gs;s===uo&&(t.items.splice(o,1),o-=1)}}}else if(It(t)){n=Object.freeze(n.concat(t));let o=await af("key",t.key,r,n);if(o===gs)return gs;o===uo&&(t.key=null);let s=await af("value",t.value,r,n);if(s===gs)return gs;s===uo&&(t.value=null)}}return i}function $C(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 PC(e,t,r,n){if(typeof r=="function")return r(e,t,n);if(Ii(t))return r.Map?.(e,t,n);if(ks(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(ms(t))return r.Alias?.(e,t,n)}function kC(e,t,r){let n=t[t.length-1];if(qt(n))n.items[e]=r;else if(It(n))e==="key"?n.key=r:n.value=r;else if(Bi(n))n.contents=r;else{let i=ms(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var gj={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},vj=e=>e.replace(/[!,[\]{}]/g,t=>gj[t]),co=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let n=t.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,s]=n;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,s),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),s)}let[,n,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(i)}catch(s){return r(String(s)),null}return n==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,n]of Object.entries(this.tags))if(t.startsWith(n))return r+vj(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={};vs(t.contents,(s,a)=>{kt(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of n)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||i.some(a=>a.startsWith(s)))&&r.push(`%TAG ${o} ${s}`);return r.join(`
`)}};co.defaultYaml={explicit:!1,version:"1.2"};co.defaultTags={"!!":"tag:yaml.org,2002:"};var _ue=B(x(),1);var Pse=B(x(),1);var mse=B(x(),1);function F1(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 yy(e){let t=new Set;return vs(e,{Value(r,n){n.anchor&&t.add(n.anchor)}}),t}function Ey(e,t){for(let r=1;;++r){let n=`${e}${r}`;if(!t.has(n))return n}}function RC(e,t){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=yy(e));let s=Ey(t,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(dt(s.node)||qt(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}var Cse=B(x(),1);var vse=B(x(),1);function _u(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=_u(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=_u(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=_u(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=_u(e,n,i,o);s===void 0?delete n[i]:s!==o&&(n[i]=s)}return e.call(t,r,n)}var Ese=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||!C1(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 Cu=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"?_u(o,{"":a},"",a):a}};var pa=class extends Cu{constructor(t){super(S1),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=[],vs(t,{Node:(o,s)=>{(ms(s)||C1(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=B1(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(F1(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 B1(e,t,r){if(ms(t)){let n=t.resolve(e),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(qt(t)){let n=0;for(let i of t.items){let o=B1(e,i,r);o>n&&(n=o)}return n}else if(It(t)){let n=B1(e,t.key,r),i=B1(e,t.value,r);return Math.max(n,i)}return 1}var zse=B(x(),1);var qse=B(x(),1);var Nse=B(x(),1);var I1=e=>!e||typeof e!="function"&&typeof e!="object",Ke=class extends Cu{constructor(t){super(Ps),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 wj="tag:yaml.org,2002:";function yj(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=wj+t.slice(2));let l=yj(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 ud(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 cf=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,uf=class extends Cu{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(cf(t))this.add(r);else{let[n,...i]=t,o=this.get(n,!0);if(qt(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,ud(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(t){let[r,...n]=t;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(qt(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(t,r){let[n,...i]=t,o=this.get(n,!0);return i.length===0?!r&&dt(o)?o.value:o:qt(o)?o.getIn(i,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!It(r))return!1;let n=r.value;return n==null||t&&dt(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(t){let[r,...n]=t;if(n.length===0)return this.has(r);let i=this.get(r,!0);return qt(i)?i.hasIn(n):!1}setIn(t,r){let[n,...i]=t;if(i.length===0)this.set(n,r);else{let o=this.get(n,!0);if(qt(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,ud(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};var Pie=B(x(),1);var die=B(x(),1);var aie=B(x(),1);var Yse=B(x(),1),TC=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Qs(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var lo=(e,t,r)=>e.endsWith(`
`)?Qs(r,t):r.includes(`
`)?`
`+Qs(r,t):(e.endsWith(" ")?"":" ")+r;var tie=B(x(),1);var Zse=B(x(),1),by="flow",x1="block",cd="quoted";function ld(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===x1&&(g=OC(e,g,t.length),g!==-1&&(m=g+u));for(let _;_=e[g+=1];){if(r===cd&&_==="\\"){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===x1&&(g=OC(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===cd){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===cd&&h[C]&&(E+=`${e[C]}\\`),E+=`
${t}${e.slice(C+1,F)}`)}return E}function OC(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 P1=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),k1=e=>/^(%|---|\.\.\.)/m.test(e);function Ej(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 fd(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(k1(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:ld(s,o,cd,P1(t,!1))}function Ay(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return fd(e,t);let r=t.indent||(k1(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
${r}`)+"'";return t.implicitKey?n:ld(n,r,by,P1(t,!1))}function lf(e,t){let{singleQuote:r}=t.options,n;if(r===!1)n=fd;else{let i=e.includes('"'),o=e.includes("'");i&&!o?n=Ay:o&&!i?n=fd:n=r?Ay:fd}return n(e,t)}var Sy;try{Sy=new RegExp(`(^|(?<!
))
+(?!
|$)`,"g")}catch{Sy=/\n+(?!\n|$)/g}function $1({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 lf(r,n);let l=n.indent||(n.forceBlockIndent||k1(r)?" ":""),h=s==="literal"?!0:s==="folded"||t===Ke.BLOCK_FOLDED?!1:t===Ke.BLOCK_LITERAL?!0:!Ej(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(Sy,`$&${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=P1(n,!0);s!=="folded"&&t!==Ke.BLOCK_FOLDED&&(K.onOverflow=()=>{H=!0});let S=ld(`${E}${F}${d}`,l,x1,K);if(!H)return`>${C}
${l}${S}`}return r=r.replace(/\n+/g,`$&${l}`),`|${C}
${l}${E}${r}${d}`}function bj(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 lf(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||h||!o.includes(`
`)?lf(o,t):$1(e,t,r,n);if(!a&&!h&&i!==Ke.PLAIN&&o.includes(`
`))return $1(e,t,r,n);if(k1(o)){if(u==="")return t.forceBlockIndent=!0,$1(e,t,r,n);if(a&&u===l)return lf(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 lf(o,t)}return a?m:ld(m,u,by,P1(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?lf(s.value,t):$1(s,t,r,n);case Ke.QUOTE_DOUBLE:return fd(s.value,t);case Ke.QUOTE_SINGLE:return Ay(s.value,t);case Ke.PLAIN:return bj(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 R1(e,t){let r=Object.assign({blockQuote:!0,commentString:TC,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 Aj(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 Sj(e,t,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(dt(e)||qt(e))&&e.anchor;o&&F1(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(ms(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=Aj(t.doc.schema.tags,o));let s=Sj(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 NC({key:e,value:t},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:u,options:{commentString:l,indentSeq:h,simpleKeys:m}}=r,p=kt(e)&&e.comment||null;if(m){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(qt(e)||!kt(e)&&typeof e=="object"){let K="With simple keys, collection cannot be used as a key value";throw new Error(K)}}let d=!m&&(!e||p&&t==null&&!r.inFlow||qt(e)||(dt(e)?e.type===Ke.BLOCK_FOLDED||e.type===Ke.BLOCK_LITERAL:typeof e=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!d&&(m||!o),indent:a+u});let v=!1,g=!1,y=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+=lo(y,r.indent,l(p)):g&&i&&i(),y;v&&(p=null),d?(p&&(y+=lo(y,r.indent,l(p))),y=`? ${y}
${a}:`):(y=`${y}:`,p&&(y+=lo(y,r.indent,l(p))));let w,E,_;kt(t)?(w=!!t.spaceBefore,E=t.commentBefore,_=t.comment):(w=!1,E=null,_=null,t&&typeof t=="object"&&(t=s.createNode(t))),r.implicitKey=!1,!d&&!p&&dt(t)&&(r.indentAtStart=y.length+1),g=!1,!h&&u.length>=2&&!r.inFlow&&!d&&ks(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+=`
${Qs(K,r.indent)}`}F===""&&!r.inFlow?H===`
`&&_&&(H=`
`):H+=`
${r.indent}`}else if(!d&&qt(t)){let K=F[0],S=F.indexOf(`
`),I=S!==-1,q=r.inFlow??t.flow??t.items.length===0;if(I||!q){let L=!1;if(I&&(K==="&"||K==="!")){let R=F.indexOf(" ");K==="&"&&R!==-1&&R<S&&F[R+1]==="!"&&(R=F.indexOf(" ",R+1)),(R===-1||S<R)&&(L=!0)}L||(H=`
${r.indent}`)}}else(F===""||F[0]===`
`)&&(H="");return y+=H+F,r.inFlow?C&&n&&n():_&&!C?y+=lo(y,r.indent,l(_)):g&&i&&i(),y}var Die=B(x(),1);var mie=B(x(),1);function T1(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var yie=B(x(),1);var O1="<<",xi={identify:e=>e===O1||typeof e=="symbol"&&e.description===O1,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ke(Symbol(O1)),{addToJSMap:Cy}),stringify:()=>O1},LC=(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 Cy(e,t,r){let n=UC(e,r);if(ks(n))for(let i of n.items)_y(e,t,i);else if(Array.isArray(n))for(let i of n)_y(e,t,i);else _y(e,t,n)}function _y(e,t,r){let n=UC(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 UC(e,t){return e&&ms(t)?t.resolve(e.doc,e):t}function N1(e,t,{key:r,value:n}){if(kt(r)&&r.addToJSMap)r.addToJSMap(e,t,n);else if(LC(e,r))Cy(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=_j(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 _j(e,t,r){if(t===null)return"";if(typeof t!="object")return String(t);if(kt(e)&&r?.doc){let n=R1(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)+'..."'),T1(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 ff(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:wy}),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 N1(r,n,this)}toString(t,r,n){return t?.doc?NC(this,t,r,n):JSON.stringify(this)}};var oue=B(x(),1);var Yie=B(x(),1);var Vie=B(x(),1);var Nie=B(x(),1);function U1(e,t,r){return(t.inFlow??e.flow?Dj:Cj)(e,t,r)}function Cj({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(""),L1(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(""),L1(r,p,E.commentBefore,m))}m=!1;let w=ga(g,h,()=>y=null,()=>m=!0);y&&(w+=lo(w,o,l(y))),m&&y&&(m=!1),p.push(n+w)}let d;if(p.length===0)d=i.start+i.end;else{d=p[0];for(let v=1;v<p.length;++v){let g=p[v];d+=g?`
${u}${g}`:`
`}}return e?(d+=`
`+Qs(l(e),u),a&&a()):m&&s&&s(),d}function Dj({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(""),L1(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(""),L1(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+=lo(w,n,a(y))),m.push(w),h=m.length}let{start:p,end:d}=r;if(m.length===0)return p+d;if(!l){let v=m.reduce((g,y)=>g+y.length+2,2);l=t.options.lineWidth>0&&v>t.options.lineWidth}if(l){let v=p;for(let g of m)v+=g?`
${o}${i}${g}`:`
`;return`${v}
${i}${d}`}else return`${p}${s}${m.join(" ")}${s}${d}`}function L1({indent:e,options:{commentString:t}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Qs(t(n),e);r.push(o.trimStart())}}function Du(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 uf{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(ff(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=Du(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);dt(i.value)&&I1(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=Du(this.items,t);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(t,r){let i=Du(this.items,t)?.value;return(!r&&dt(i)?i.value:i)??void 0}has(t){return!!Du(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)N1(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})),U1(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 aoe=B(x(),1);var noe=B(x(),1);var Sn=class extends uf{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=H1(t);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(t,r){let n=H1(t);if(typeof n!="number")return;let i=this.items[n];return!r&&dt(i)?i.value:i}has(t){let r=H1(t);return typeof r=="number"&&r<this.items.length}set(t,r){let n=H1(t);if(typeof n!="number")throw new Error(`Expected a valid index, not ${t}.`);let i=this.items[n];dt(i)&&I1(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?U1(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 H1(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 ks(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,r)=>Sn.from(e,t,r)};var loe=B(x(),1);var Fu={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 Qae=B(x(),1);var doe=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 goe=B(x(),1);var hd={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&&hd.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 Aoe=B(x(),1);var woe=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 M1={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},q1={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)}},j1={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 Coe=B(x(),1);var K1=e=>typeof e=="bigint"||Number.isInteger(e),Dy=(e,t,r,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),r);function HC(e,t,r){let{value:n}=e;return K1(n)&&n>=0?r+n.toString(t):_n(e)}var V1={identify:e=>K1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,r)=>Dy(e,2,8,r),stringify:e=>HC(e,8,"0o")},G1={identify:K1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,r)=>Dy(e,0,10,r),stringify:_n},z1={identify:e=>K1(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,r)=>Dy(e,2,16,r),stringify:e=>HC(e,16,"0x")};var Roe=B(x(),1);var MC=[$i,Pi,Fu,Ic,hd,V1,G1,z1,M1,q1,j1];var Uoe=B(x(),1);function qC(e){return typeof e=="bigint"||Number.isInteger(e)}var W1=({value:e})=>JSON.stringify(e),Fj=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:W1},{identify:e=>e==null,createNode:()=>new Ke(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:W1},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:W1},{identify:qC,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})=>qC(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:W1}],Bj={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},jC=[$i,Pi].concat(Fj,Bj);var joe=B(x(),1);var dd={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 rae=B(x(),1);var Yoe=B(x(),1);function Fy(e,t){if(ks(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 By(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(ff(a,u,r))}return i}var pd={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Fy,createNode:By};var hf=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=By(t,r,n),o=new this;return o.items=i.items,o}};hf.tag="tag:yaml.org,2002:omap";var md={collection:"seq",identify:e=>e instanceof Map,nodeClass:hf,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let r=Fy(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 hf,r)},createNode:(e,t,r)=>hf.from(e,t,r)};var Tae=B(x(),1);var iae=B(x(),1);function KC({value:e,source:t},r){return t&&(e?Iy:xy).test.test(t)?t:e?r.options.trueStr:r.options.falseStr}var Iy={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:KC},xy={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:KC};var cae=B(x(),1);var VC={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},GC={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)}},zC={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 hae=B(x(),1);var gd=e=>typeof e=="bigint"||Number.isInteger(e);function Y1(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 $y(e,t,r){let{value:n}=e;if(gd(n)){let i=n.toString(t);return n<0?"-"+r+i.substr(1):r+i}return _n(e)}var WC={identify:gd,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,r)=>Y1(e,2,2,r),stringify:e=>$y(e,2,"0b")},YC={identify:gd,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,r)=>Y1(e,1,8,r),stringify:e=>$y(e,8,"0")},XC={identify:gd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,r)=>Y1(e,0,10,r),stringify:_n},ZC={identify:gd,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,r)=>Y1(e,2,16,r),stringify:e=>$y(e,16,"0x")};var vae=B(x(),1);var df=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),Du(this.items,r.key)||this.items.push(r)}get(t,r){let n=Du(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=Du(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(ff(s,null,n));return o}};df.tag="tag:yaml.org,2002:set";var vd={collection:"map",identify:e=>e instanceof Set,nodeClass:df,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,r)=>df.from(e,t,r),resolve(e,t){if(Ii(e)){if(e.hasAllNullValues(!0))return Object.assign(new df,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};var Eae=B(x(),1);function Py(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 JC(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 X1={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})=>Py(e,r),stringify:JC},Z1={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Py(e,!1),stringify:JC},pf={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(pf.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=Py(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 ky=[$i,Pi,Fu,Ic,Iy,xy,WC,YC,XC,ZC,VC,GC,zC,dd,xi,md,pd,vd,X1,Z1,pf];var QC=new Map([["core",MC],["failsafe",[$i,Pi,Fu]],["json",jC],["yaml11",ky],["yaml-1.1",ky]]),e8={binary:dd,bool:hd,float:j1,floatExp:q1,floatNaN:M1,floatTime:Z1,int:G1,intHex:z1,intOct:V1,intTime:X1,map:$i,merge:xi,null:Ic,omap:md,pairs:pd,seq:Pi,set:vd,timestamp:pf},t8={"tag:yaml.org,2002:binary":dd,"tag:yaml.org,2002:merge":xi,"tag:yaml.org,2002:omap":md,"tag:yaml.org,2002:pairs":pd,"tag:yaml.org,2002:set":vd,"tag:yaml.org,2002:timestamp":pf};function J1(e,t,r){let n=QC.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(QC.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"?e8[s]:s;if(!a){let u=JSON.stringify(s),l=Object.keys(e8).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 Ij=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,wd=class e{constructor({compat:t,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?J1(t,"compat"):t?J1(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?t8:{},this.tags=J1(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Fi,{value:$i}),Object.defineProperty(this,Ps,{value:Fu}),Object.defineProperty(this,da,{value:Pi}),this.sortMapEntries=typeof s=="function"?s:s===!0?Ij:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};var fue=B(x(),1);function r8(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=R1(e,t),{commentString:o}=i.options;if(e.commentBefore){r.length!==1&&r.unshift("");let u=o(e.commentBefore);r.unshift(Qs(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(Qs(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+=lo(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(Qs(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(Qs(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:_1});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:s}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new co({version:s}),this.setSchema(s,n),this.contents=t===void 0?null:this.createNode(t,i,n)}clone(){let t=Object.create(e.prototype,{[Vn]:{value:_1}});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){mf(this.contents)&&this.contents.add(t)}addIn(t,r){mf(this.contents)&&this.contents.addIn(t,r)}createAlias(t,r){if(!t.anchor){let n=yy(this);t.anchor=!r||n.has(r)?Ey(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}=RC(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&&qt(g)&&(g.flow=!0),p(),g}createPair(t,r,n={}){let i=this.createNode(t,null,n),o=this.createNode(r,null,n);return new dr(i,o)}delete(t){return mf(this.contents)?this.contents.delete(t):!1}deleteIn(t){return cf(t)?this.contents==null?!1:(this.contents=null,!0):mf(this.contents)?this.contents.deleteIn(t):!1}get(t,r){return qt(this.contents)?this.contents.get(t,r):void 0}getIn(t,r){return cf(t)?!r&&dt(this.contents)?this.contents.value:this.contents:qt(this.contents)?this.contents.getIn(t,r):void 0}has(t){return qt(this.contents)?this.contents.has(t):!1}hasIn(t){return cf(t)?this.contents!==void 0:qt(this.contents)?this.contents.hasIn(t):!1}set(t,r){this.contents==null?this.contents=ud(this.schema,[t],r):mf(this.contents)&&this.contents.set(t,r)}setIn(t,r){cf(t)?this.contents=r:this.contents==null?this.contents=ud(this.schema,Array.from(t),r):mf(this.contents)&&this.contents.setIn(t,r)}setSchema(t,r={}){typeof t=="number"&&(t=String(t));let n;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new co({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new co({version:t}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new wd(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"?_u(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 r8(this,t)}};function mf(e){if(qt(e))return!0;throw new Error("Expected a YAML collection as document contents")}var Due=B(x(),1),yd=class extends Error{constructor(t,r,n,i){super(),this.name=t,this.code=n,this.message=i,this.pos=r}},ki=class extends yd{constructor(t,r,n){super("YAMLParseError",t,r,n)}},Ed=class extends yd{constructor(t,r,n){super("YAMLWarning",t,r,n)}},Ry=(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 Vce=B(x(),1);var Uce=B(x(),1);var gce=B(x(),1);var Kue=B(x(),1);var Bue=B(x(),1);function fo(e,{flow:t,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let u=!1,l=a,h=a,m="",p="",d=!1,v=!1,g=null,y=null,w=null,E=null,_=null,C=null,F=null;for(let S of e)switch(v&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&o(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),v=!1),g&&(l&&S.type!=="comment"&&S.type!=="newline"&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),S.type){case"space":!t&&(r!=="doc-start"||n?.type!=="flow-collection")&&S.source.includes(" ")&&(g=S),h=!0;break;case"comment":{h||o(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let I=S.source.substring(1)||" ";m?m+=p+I:m=I,p="",l=!1;break}case"newline":l?m?m+=S.source:(!C||r!=="seq-item-ind")&&(u=!0):p+=S.source,l=!0,d=!0,(y||w)&&(E=S),h=!0;break;case"anchor":y&&o(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&o(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=S,F??(F=S.offset),l=!1,h=!1,v=!0;break;case"tag":{w&&o(S,"MULTIPLE_TAGS","A node can have at most one tag"),w=S,F??(F=S.offset),l=!1,h=!1,v=!0;break}case r:(y||w)&&o(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),C&&o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${t??"collection"}`),C=S,l=r==="seq-item-ind"||r==="explicit-key-ind",h=!1;break;case"comma":if(t){_&&o(S,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),_=S,l=!1,h=!1;break}default:o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),l=!1,h=!1}let H=e[e.length-1],K=H?H.offset+H.source.length:i;return v&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g&&(l&&g.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:_,found:C,spaceBefore:u,comment:m,hasNewline:d,anchor:y,tag:w,newlineAfterProp:E,end:K,start:F??K}}var xue=B(x(),1);function Bu(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(Bu(t.key)||Bu(t.value))return!0}return!1;default:return!0}}var kue=B(x(),1);function bd(e,t,r){if(t?.type==="flow-collection"){let n=t.end[0];n.indent===e&&(n.source==="]"||n.source==="}")&&Bu(t)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}var Oue=B(x(),1);function Q1(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 n8="All mapping items must start at the same column";function s8({composeNode:e,composeEmptyNode:t},r,n,i,o){let s=o?.nodeClass??Sr,a=new s(r.schema);r.atRoot&&(r.atRoot=!1);let u=n.offset,l=null;for(let h of n.items){let{start:m,key:p,sep:d,value:v}=h,g=fo(m,{indicator:"explicit-key-ind",next:p??d?.[0],offset:u,onError:i,parentIndent:n.indent,startOnNewline:!0}),y=!g.found;if(y){if(p&&(p.type==="block-seq"?i(u,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==n.indent&&i(u,"BAD_INDENT",n8)),!g.anchor&&!g.tag&&!d){l=g.end,g.comment&&(a.comment?a.comment+=`
`+g.comment:a.comment=g.comment);continue}(g.newlineAfterProp||Bu(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",n8);r.atKey=!0;let w=g.end,E=p?e(r,p,g,i):t(r,w,m,null,g,i);r.schema.compat&&bd(n.indent,p,i),r.atKey=!1,Q1(r,a.items,E)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let _=fo(d??[],{indicator:"map-value-ind",next:v,offset:E.range[2],onError:i,parentIndent:n.indent,startOnNewline:!p||p.type==="block-scalar"});if(u=_.end,_.found){y&&(v?.type==="block-map"&&!_.hasNewline&&i(u,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&g.start<_.found.offset-1024&&i(E.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=v?e(r,v,_,i):t(r,u,d,null,_,i);r.schema.compat&&bd(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 Yue=B(x(),1);function i8({composeNode:e,composeEmptyNode:t},r,n,i,o){let s=o?.nodeClass??Sn,a=new s(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let u=n.offset,l=null;for(let{start:h,value:m}of n.items){let p=fo(h,{indicator:"seq-item-ind",next:m,offset:u,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||m)m?.type==="block-seq"?i(p.end,"BAD_INDENT","All sequence items must start at the same column"):i(u,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(a.comment=p.comment);continue}let d=m?e(r,m,p,i):t(r,p.end,h,null,p,i);r.schema.compat&&bd(n.indent,m,i),u=d.range[2],a.items.push(d)}return a.range=[n.offset,u,l??u],a}var ace=B(x(),1);var Zue=B(x(),1);function ho(e,t,r,n){let i="";if(e){let o=!1,s="";for(let a of e){let{source:u,type:l}=a;switch(l){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let h=u.substring(1)||" ";i?i+=s+h:i=h,s="";break}case"newline":i&&(s+=u),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=u.length}}return{comment:i,offset:t}}var Ty="Block collections are not allowed within flow collections",Oy=e=>e&&(e.type==="block-map"||e.type==="block-seq");function o8({composeNode:e,composeEmptyNode:t},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",u=o?.nodeClass??(s?Sr:Sn),l=new u(r.schema);l.flow=!0;let h=r.atRoot;h&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let m=n.offset+n.start.source.length;for(let y=0;y<n.items.length;++y){let w=n.items[y],{start:E,key:_,sep:C,value:F}=w,H=fo(E,{flow:a,indicator:"explicit-key-ind",next:_??C?.[0],offset:m,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!H.found){if(!H.anchor&&!H.tag&&!C&&!F){y===0&&H.comma?i(H.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<n.items.length-1&&i(H.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),H.comment&&(l.comment?l.comment+=`
`+H.comment:l.comment=H.comment),m=H.end;continue}!s&&r.options.strict&&Bu(_)&&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],Oy(F)&&i(K.range,"BLOCK_IN_FLOW",Ty)}else{r.atKey=!0;let K=H.end,S=_?e(r,_,H,i):t(r,K,E,null,H,i);Oy(_)&&i(S.range,"BLOCK_IN_FLOW",Ty),r.atKey=!1;let I=fo(C??[],{flow:a,indicator:"map-value-ind",next:F,offset:S.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(I.found){if(!s&&!H.found&&r.options.strict){if(C)for(let R of C){if(R===I.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}H.start<I.found.offset-1024&&i(I.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else F&&("source"in F&&F.source?.[0]===":"?i(F,"MISSING_CHAR",`Missing space after : in ${a}`):i(I.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let q=F?e(r,F,I,i):I.found?t(r,I.end,C,null,I,i):null;q?Oy(F)&&i(q.range,"BLOCK_IN_FLOW",Ty):I.comment&&(S.comment?S.comment+=`
`+I.comment:S.comment=I.comment);let L=new dr(S,q);if(r.options.keepSourceTokens&&(L.srcToken=w),s){let R=l;Q1(r,R.items,S)&&i(K,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(L)}else{let R=new Sr(r.schema);R.flow=!0,R.items.push(L);let O=(q??S).range;R.range=[S.range[0],O[1],O[2]],l.items.push(R)}m=q?q.range[2]:I.end}}let p=s?"}":"]",[d,...v]=n.end,g=m;if(d?.source===p)g=d.offset+d.source.length;else{let y=a[0].toUpperCase()+a.substring(1),w=h?`${y} must end with a ${p}`:`${y} in block collection must be sufficiently indented and end with a ${p}`;i(m,h?"MISSING_CHAR":"BAD_INDENT",w),d&&d.source.length!==1&&v.unshift(d)}if(v.length>0){let y=ho(v,g,r.options.strict,i);y.comment&&(l.comment?l.comment+=`
`+y.comment:l.comment=y.comment),l.range=[n.offset,g,y.offset]}else l.range=[n.offset,g,g];return l}function Ny(e,t,r,n,i,o){let s=r.type==="block-map"?s8(e,t,r,n,o):r.type==="block-seq"?i8(e,t,r,n,o):o8(e,t,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function a8(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 Ny(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),Ny(e,t,r,i,s)}let l=Ny(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 Ice=B(x(),1);var yce=B(x(),1);function Ly(e,t,r){let n=t.offset,i=xj(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?$j(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 xj({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 $j(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 Sce=B(x(),1);function Uy(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=Pj(o,l);break;case"single-quoted-scalar":a=Ke.QUOTE_SINGLE,u=kj(o,l);break;case"double-quoted-scalar":a=Ke.QUOTE_DOUBLE,u=Rj(o,l);break;default:return r(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let h=n+o.length,m=ho(s,h,t,r);return{value:u,type:a,comment:m.comment,range:[n,h,m.offset]}}function Pj(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}`),u8(e)}function kj(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),u8(e.slice(1,-1)).replace(/''/g,"'")}function u8(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 Rj(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}=Tj(e,n);r+=o,n=s}else if(i==="\\"){let o=e[++n],s=Oj[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+=Nj(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 Tj(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 Oj={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Nj(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 Hy(e,t,r,n){let{value:i,type:o,comment:s,range:a}=t.type==="block-scalar"?Ly(e,t,n):Uy(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[Ps]:u?l=Lj(e.schema,i,u,r,n):t.type==="scalar"?l=Uj(e,i,t,n):l=e.schema[Ps];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 Lj(e,t,r,n,i){if(r==="!")return e[Ps];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[Ps])}function Uj({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[Ps];if(r.compat){let a=r.compat.find(u=>u.default&&u.test?.test(n))??r[Ps];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 $ce=B(x(),1);function c8(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 Hj={composeNode:My,composeEmptyNode:em};function My(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=Mj(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=Hy(e,t,u,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=a8(Hj,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=em(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 em(e,t,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:u},l){let h={type:"scalar",offset:c8(t,r,n),indent:-1,source:""},m=Hy(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 Mj({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=ho(n,s,e.strict,i);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}function l8(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=fo(n,{indicator:"doc-start",next:i??o?.[0],offset:r,onError:s,parentIndent:0,startOnNewline:!0});h.found&&(u.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!h.hasNewline&&s(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),u.contents=i?My(l,i,h,s):em(l,h.end,n,null,h,s);let m=u.contents.range[2],p=ho(o,m,!1,s);return p.comment&&(u.comment=p.comment),u.range=[r,m,p.offset],u}function Ad(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 f8(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 Sd=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Ad(r);o?this.warnings.push(new Ed(s,n,i)):this.errors.push(new ki(s,n,i))},this.directives=new co({version:t.version||"1.2"}),this.options=t}decorate(t,r){let{comment:n,afterEmptyLine:i}=f8(this.prelude);if(n){let o=t.contents;if(r)t.comment=t.comment?`${t.comment}
${n}`:n;else if(i||t.directives.docStart||!o)t.commentBefore=n;else if(qt(o)&&!o.flow&&o.items.length>0){let s=o.items[0];It(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n}
${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n}
${s}`:n}}if(r){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:f8(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=Ad(t);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let r=l8(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(Ad(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(Ad(t),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=ho(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new ki(Ad(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 ple=B(x(),1);var ile=B(x(),1);var ale=B(x(),1);var cle=B(x(),1),qy=Symbol("break visit"),qj=Symbol("skip children"),h8=Symbol("remove item");function xc(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),d8(Object.freeze([]),e,t)}xc.BREAK=qy;xc.SKIP=qj;xc.REMOVE=h8;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 d8(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=d8(Object.freeze(e.concat([[i,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===qy)return qy;a===h8&&(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 jy="\uFEFF",Ky="",Vy="",tm="";function p8(e){switch(e){case jy:return"byte-order-mark";case Ky:return"doc-mode";case Vy:return"flow-error-end";case tm: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 Ele=B(x(),1);function Ri(e){switch(e){case void 0:case" ":case`
`:case"\r":case" ":return!0;default:return!1}}var m8=new Set("0123456789ABCDEFabcdef"),Kj=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),rm=new Set(",[]{}"),Vj=new Set(` ,[]{}
\r `),Gy=e=>!e||Vj.has(e),_d=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,r=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let t=this.pos,r=this.buffer[t];for(;r===" "||r===" ";)r=this.buffer[++t];return!r||r==="#"||r===`
`?!0:r==="\r"?this.buffer[t+1]===`
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let r=this.buffer[t];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+t];if(r==="\r"){let i=this.buffer[n+t+1];if(i===`
`||!i&&!this.atEnd)return t+n+1}return r===`
`||n>=this.indentNext||!r&&!this.atEnd?t+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(t,3);if((n==="---"||n==="...")&&Ri(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===jy&&(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 Ky,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&Ri(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ri(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ri(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(t[r]){case"#":yield*this.pushCount(t.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Gy),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,r,n=-1;do t=yield*this.pushNewline(),t>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(t+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&Ri(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Vy,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(Gy),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||Ri(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),r=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),i=n.indexOf(`
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=n.indexOf(`
`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let r=this.buffer[++t];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Ri(r)||r==="#")}*parseBlockScalar(){let t=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case`
`:t=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(t+1);if(o===-1)break;t=this.buffer.indexOf(`
`,o)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
`;)n=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let o=t-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
`&&o>=this.pos&&o+1+r>a)t=o;else break}while(!0);return yield tm,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let o=this.buffer[n+1];if(Ri(o)||t&&rm.has(o))break;r=n}else if(Ri(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===`
`?(n+=1,i=`
`,o=this.buffer[n+1]):r=n),o==="#"||t&&rm.has(o))break;if(i===`
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(t&&rm.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield tm,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(Gy),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Ri(n)||r&&rm.has(n)){r?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,r=this.buffer[t];for(;!Ri(r)&&r!==">";)r=this.buffer[++t];return yield*this.pushToIndex(r===">"?t+1:t,!1)}else{let t=this.pos+1,r=this.buffer[t];for(;r;)if(Kj.has(r))r=this.buffer[++t];else if(r==="%"&&m8.has(this.buffer[t+1])&&m8.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 Ale=B(x(),1),Cd=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 Dle=B(x(),1);function Iu(e,t){for(let r=0;r<e.length;++r)if(e[r].type===t)return!0;return!1}function g8(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 w8(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 nm(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 gf(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 sm(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 v8(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Iu(t.start,"explicit-key-ind")&&!Iu(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,w8(t.value)?t.value.end?sm(t.value.end,t.sep):t.value.end=t.sep:sm(t.start,t.sep),delete t.sep)}var Dd=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 _d,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=p8(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"&&v8(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&&g8(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":{g8(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=nm(this.peek(2)),n=gf(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)){sm(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(Iu(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(w8(r.key)&&!Iu(r.sep,"newline")){let s=gf(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(Iu(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=gf(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]}):Iu(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&&!Iu(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)){sm(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||Iu(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=nm(n),o=gf(i);v8(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=nm(t),n=gf(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=nm(t),n=gf(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 Tle=B(x(),1);function Gj(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Cd||null,prettyErrors:t}}function Fd(e,t={}){let{lineCounter:r,prettyErrors:n}=Gj(t),i=new Dd(r?.addNewLine),o=new Sd(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(Ry(e,r)),s.warnings.forEach(Ry(e,r))),s}function zy(e,t,r){let n;typeof t=="function"?n=t:r===void 0&&t&&typeof t=="object"&&(r=t);let i=Fd(e,r);if(!i)return null;if(i.warnings.forEach(o=>T1(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 Wy(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 Wj={logLevel:"error",merge:!0};function E8(e,t,...r){try{return e(t,...r)}catch{return e(S8(e(t.replace(/!<str>\s*/g,"__SubStoreJSYAMLString__"),...r)).replace(/__SubStoreJSYAMLString__/g,""),...r)}}function im(e){return JSON.parse(JSON.stringify(e))}function Yj(e){return{...Wj,...e||{}}}function Xj(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 b8(e,t){return zy(e,Yj(t))}function A8(e,t){return Wy(e,Xj(t))}function vf(e,...t){return E8(b8,im(e),...t)}function Zj(e,...t){return E8(b8,im(e),...t)}function y8(e,...t){return A8(im(e),...t)}function S8(e,...t){return A8(im(e),...t)}var Rs={safeLoad:vf,load:Zj,safeDump:y8,dump:S8,parse:vf,stringify:y8};var i2e=B(x());var ofe=B(x());var pr="settings",om="subs",Yy="collections",$c="files",am="modules",Bd="artifacts",_8="rules";var Pc="#sub-store-cached-resource",kc="#sub-store-cached-headers-resource",Rc="#sub-store-cached-script-resource",Xy="#sub-store-logs";var Efe=B(x());var cfe=B(x());var D8=1e4,Jj=1e3,k8=["log","info","warn","error","debug"],F8="unknown",R8=/^Sub-Store\s+--\s+v\d+(?:\.\d+){0,3}$/,B8=/^\u2505{8,}$/,Qj=/^\[sub-store\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/,T8=/^\[[^\]\r\n]+\]\s+(?:LOG|INFO|WARN|ERROR|DEBUG):\s*/i,eK=/^\[([^\]\r\n]+)\]\s*/,tK=[/^(?:.+\sParser|Rule parser \[.+\]) is activated!?$/,/^Pre-processor \[.+\] activated!?$/,/^Fallback Base64 Pre-processor error: decoded line does not start with protocol$/,/^\[CORS\] allowed origins: .+$/],I8=!1,Zy=!1,um=null,x8=0;function rK(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?$8(n):n} ${o}`,...s]}return[r.length?$8(n):n,...r]}function $8(e){return`${e}`.replace(/%/g,"%%")}function nK(e,t=0){let r=P8(t,0,D8);return P8(e,r,D8)}function sK(e){return Array.from(e||[]).map(pK).join(" ")}function iK(e){try{let t=e.read(Xy);if(!t)return[];let r=typeof t=="string"?JSON.parse(t):t;return Array.isArray(r)?r.filter(mK):[]}catch{return[]}}function oK(e,t){e.write(JSON.stringify(Array.isArray(t)?t:[]),Xy)}function aK(e,t,r){try{let n=uK(e);if(n===0)return;let i=sK(r);if(lK(i))return;let o=iK(e),s=N8(t);o.push({id:gK(),time:Date.now(),level:s,message:cK(i,s)}),oK(e,o.slice(-n))}catch{}}function O8(e){I8||typeof console>"u"||(I8=!0,k8.forEach(t=>{let r=console[t];typeof r=="function"&&(console[t]=function(...n){if(r.apply(console,rK(n,{isNode:e.env.isNode})),!Zy)try{Zy=!0,aK(e,t,n)}finally{Zy=!1}})}))}function uK(e){let t=Date.now();if(um!==null&&t<x8)return um;let r=e.read(pr)||{};return um=nK(r.logsMaxCount),x8=t+Jj,um}function P8(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 N8(e){return k8.includes(e)?e:"log"}function cK(e,t){let r=`${e||""}`;if(T8.test(r))return r;let n=N8(t).toUpperCase(),i=r.match(eK);if(i){let o=i[1].trim()||F8,s=r.slice(i[0].length).trimStart();return`[${o}] ${n}: ${s}`}return`[${F8}] ${n}: ${r}`}function lK(e){let t=fK(e);return t.length===1?R8.test(t[0])||dK(t[0]):hK(t)}function fK(e){let t=`${e||""}`.split(/\r?\n/).map(n=>n.trim()).filter(Boolean);if(t.length===0)return t;let r=t[0].replace(T8,"").trim();return r!==t[0]&&(r?t[0]=r:t.shift()),t}function hK(e){return e.length<3||!B8.test(e[0])||!B8.test(e[e.length-1])?!1:e.slice(1,-1).some(t=>R8.test(t))}function dK(e){let t=e.replace(Qj,"");return tK.some(r=>r.test(t))}function pK(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 mK(e){return e&&typeof e=="object"&&typeof e.id=="string"&&typeof e.time=="number"&&typeof e.level=="string"&&typeof e.message=="string"}function gK(){return`${Date.now()}-${Math.random().toString(36).slice(2,10)}`}var mfe=B(x());var hfe=B(x());function po(e){if(ei().isNode)try{return e()}catch{return}}function mo(){return po(()=>yu("fs"))}var xu=typeof $task<"u",vo=typeof $loon<"u",wa=typeof Egern<"u",$u=typeof $httpClient<"u"&&!vo&&!wa,go=eval('typeof process !== "undefined"'),L8=typeof $environment<"u"&&$environment["stash-version"],U8=typeof $rocket<"u",vK=typeof $native<"u",Pu=typeof $Plugins<"u",wK=vo&&typeof $loon=="object"&&$loon!==null&&$loon.isSubsCheckPro===!0;function cm(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}function yK(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 EK(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 lm=class{constructor(name="untitled",debug=!1){if(this.name=name,this.debug=debug,this.http=wo(),this.env=ei(),go){let dotenv=eval('require("dotenv")');dotenv.config()}this.node=go?{fs:mo()}:null,this.initCache(),O8(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(xu&&(this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}")),(vo||$u||wa)&&(this.cache=JSON.parse($persistentStore.read(this.name)||"{}")),Pu&&(this.cache=JSON.parse($Plugins.SubStoreCache.get(this.name)||"{}")),go){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".",rootPath=`${basePath}/root.json`,backupRootPath=`${basePath}/root_${Date.now()}.json`;if(this.log(`Root path: ${rootPath}`),this.node.fs.existsSync(rootPath))try{this.root=JSON.parse(this.node.fs.readFileSync(`${rootPath}`))}catch(e){this.node.fs.copyFileSync(rootPath,backupRootPath),this.error(`Failed to parse ${rootPath}: ${e.message}. Backup created at ${backupRootPath}`)}cm(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")),!cm(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"}),!cm(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}`)}}cm(this.cache)||(this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"w"}),this.cache={})}}persistCache(){let data=JSON.stringify(this.cache,null,2);if(xu&&$prefs.setValueForKey(data,this.name),(vo||$u||wa)&&$persistentStore.write(data,this.name),Pu&&$Plugins.SubStoreCache.set(this.name,data),go){let basePath=eval("process.env.SUB_STORE_DATA_BASE_PATH")||".";this.node.fs.writeFileSync(`${basePath}/${this.name}.json`,data,{flag:"w"},e=>console.log(e)),this.node.fs.writeFileSync(`${basePath}/root.json`,JSON.stringify(this.root,null,2),{flag:"w"},e=>console.log(e))}}write(e,t){if(this.log(`SET ${t}`),t.indexOf("#")!==-1){if(t=t.substr(1),$u||vo||wa)return $persistentStore.write(e,t);if(xu)return $prefs.setValueForKey(e,t);if(go&&(this.root[t]=e),Pu)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),$u||vo||wa)return $persistentStore.read(e);if(xu)return $prefs.valueForKey(e);if(go)return this.root[e];if(Pu)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),$u||vo||wa)return $persistentStore.write(null,e);if(xu)return $prefs.removeValueForKey(e);if(go&&delete this.root[e],Pu)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(xu&&$notify(title,subtitle,content,options),($u||wa)&&$notification.post(title,subtitle,content+`${mediaURL?`
\u591A\u5A92\u4F53:`+mediaURL:""}`,{url:openURL}),vo){let e={};openURL&&(e.openUrl=openURL),mediaURL&&(e.mediaUrl=mediaURL),JSON.stringify(e)==="{}"?$notification.post(title,subtitle,content):$notification.post(title,subtitle,content,e)}if(go){let content_=content+(openURL?`
\u70B9\u51FB\u8DF3\u8F6C: ${openURL}`:"")+(mediaURL?`
\u591A\u5A92\u4F53: ${mediaURL}`:"");console.log(`[Notify] ${title}
${subtitle}
${content_}
`);let push=eval("process.env.SUB_STORE_PUSH_SERVICE");if(push)if(/^https?:\/\//.test(push)){let e=push.replace("[\u63A8\u9001\u6807\u9898]",encodeURIComponent(title||"Sub-Store")).replace("[\u63A8\u9001\u5185\u5BB9]",encodeURIComponent([subtitle,content_].map(r=>r).join(`
`)));wo().get({url:e}).then(r=>{console.log(`[Push Service] URL: ${e}
RES: ${r.statusCode} ${r.body}`)}).catch(r=>{console.log(`[Push Service] URL: ${e}
ERROR: ${r}`)})}else eval('import("shoutrrr-ts")').then(({send:e})=>e(push,`${title}
${subtitle}
${content_}`,{transport:bK(wo())}).then(()=>console.log("[Push Service] RES: sent"),t=>console.log(`[Push Service] ERROR: ${t.message}`))).catch(()=>console.log("[Push Service] ERROR: notification delivery failed"))}Pu&&$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={}){xu||vo||$u||Pu||wa?$done(e):go&&typeof $context<"u"&&($context.headers=e.headers,$context.statusCode=e.statusCode,$context.body=e.body)}};function ei(){return{isQX:xu,isLoon:vo,isSurge:$u,isNode:go,isStash:L8,isShadowRocket:U8,isEgern:wa,isLanceX:vK,isGUIforCores:Pu,isSubsCheckPro:wK}}function bK(e){return async(t,r={})=>{let n=r.body;if(n!=null&&typeof n!="string"&&!(n instanceof Uint8Array)&&!(n instanceof ArrayBuffer))throw new Error("unsupported notification request body");let i=Object.fromEntries(new Headers(r.headers).entries()),o=await e.request({url:t,method:r.method||"GET",headers:i,body:n instanceof ArrayBuffer?new Uint8Array(n):n,encoding:null,timeout:8e3});return new Response([204,205,304].includes(o.statusCode)?null:o.body,{status:o.statusCode})}}function wo(defaultOptions={baseURL:""}){let{isQX,isLoon,isSurge,isNode,isGUIforCores,isEgern}=ei(),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=EK(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(yK(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||L8||U8)&&(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 Afe=B(x()),H8=0;function Ur(e){return SK(AK(_K(e)))}function AK(e){return DK(FK(CK(e),e.length*8))}function SK(e){for(var t=H8?"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 _K(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 CK(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 DK(e){for(var t="",r=0;r<e.length*32;r+=8)t+=String.fromCharCode(e[r>>5]>>>r%32&255);return t}function FK(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=ku(r,a),n=ku(n,u),i=ku(i,l),o=ku(o,h)}return Array(r,n,i,o)}function fm(e,t,r,n,i,o){return ku(BK(ku(ku(t,e),ku(n,o)),i),r)}function Cn(e,t,r,n,i,o,s){return fm(t&r|~t&n,e,t,i,o,s)}function Dn(e,t,r,n,i,o,s){return fm(t&n|r&~n,e,t,i,o,s)}function Fn(e,t,r,n,i,o,s){return fm(t^r^n,e,t,i,o,s)}function Bn(e,t,r,n,i,o,s){return fm(r^(t|~n),e,t,i,o,s)}function ku(e,t){var r=(e&65535)+(t&65535),n=(e>>16)+(t>>16)+(r>>16);return n<<16|r&65535}function BK(e,t){return e<<t|e>>>32-t}var qfe=B(x()),Em=B(X8()),xV=/^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/,$V=/^(([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 xV.test(e)}function Xt(e){return $V.test(e)}function Z8(e){return/^((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4}))$/.test(e)}function qe(e){return typeof e=="string"&&e.trim().length>0}function vt(e,t){return qe(e)?e:t}function wf(e){return typeof e<"u"&&e!==null}function ya(e,t){return wf(e)?e:t}function Ea(e){return e?/^.+?\s*?=\s*?.+?\s*?,.+?/.test(e)?{"policy-descriptor":e}:{policy:e}:{}}function PV(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function xd(e){let t=e.split(/,|\//),r=t[Math.floor(Math.random()*t.length)];if(r.includes("-")){let[n,i]=r.split("-").map(Number);return PV(n,i)}else return Number(r)}function J8(e){return Number.isSafeInteger(e)?String(e):BigInt(e).toString()}function bm(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 ze(e){return e!==null&&typeof e=="object"&&[null,Object.prototype].includes(Object.getPrototypeOf(e))}var Jfe=B(x());var Wfe=B(x()),Vfe=B(eD());var kV=new lm("sub-store"),Q=kV;var oE=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=iE(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=iE(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=iE(n)??TV();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function iE(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function TV(){let t=(Q.read(pr)||{})?.resourceCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:36e5}var Hr=new oE;var rhe=B(x());var uE=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=aE(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=aE(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=aE(n)??NV();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function aE(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function NV(){let t=(Q.read(pr)||{})?.headersCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:6e4}var $d=new uE;var mhe=B(x());var ohe=B(x());var tD=10,LV="backendRequestConcurrency",rD=0,UV="backendRequestConcurrencyWaitTime",Pd=0,fE=[];function HV(e){return new Promise(t=>setTimeout(t,e))}function MV(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return tD;let t=Number(e);return!Number.isInteger(t)||t<1?tD:t}function qV(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return rD;let t=Number(e);return!Number.isInteger(t)||t<0?rD:t}function cE(){let e=Q.read(pr)||{};return MV(e[LV])}function lE(){let e=Q.read(pr)||{};return qV(e[UV])}function jV(e,t){return`active=${Pd}, pending=${fE.length}, limit=${e}, waitTime=${t}ms`}function Am(e,t,r,n){Q.log(`[Backend Request Concurrency] ${e}: ${t} (${jV(r,n)})`)}function KV(){let e=fE.shift();e&&e()}async function VV(e){let t=cE(),r=lE();for(;Pd>=t;)Am("queued",e,t,r),await new Promise(n=>{fE.push(n)}),t=cE(),r=lE();Pd+=1,Am("acquired",e,t,r),r>0&&(Am("waiting before request",e,t,r),await HV(r))}function GV(e){Pd=Math.max(0,Pd-1),Am("released",e,cE(),lE()),KV()}async function yf(e,t="request"){await VV(t);try{return await e()}finally{GV(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 Sm(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}=ei(),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=$d.get(id),flowInfo;if(!$arguments?.noCache&&cached)Q.info(`\u4F7F\u7528\u7F13\u5B58\u7684\u6D41\u91CF\u4FE1\u606F: ${url}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),flowInfo=cached;else{let e=wo();if(flowUrl){let t;try{Q.info(`\u4F7F\u7528 GET \u65B9\u6CD5\u4ECE\u54CD\u5E94\u4F53\u83B7\u53D6\u6D41\u91CF\u4FE1\u606F: ${flowUrl}, ${customHeaders?JSON.stringify(customHeaders):`User-Agent: ${userAgent||""}`}, Insecure: ${!!insecure}, Proxy: ${proxy}`);let{headers:r,body:n,statusCode:i}=await yf(()=>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=Ef(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=Ef(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 yf(()=>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 yf(()=>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&&$d.set(id,flowInfo,$arguments?.headersCacheTtl?$arguments?.headersCacheTtl*1e3:void 0)}return flowInfo}function Ef(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 kd(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}:kd(e/1024,r[++n])}function _m(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=kd(Math.abs(n));i.value=n<0?"-"+i.value:i.value;let o=kd(e.total);throw new Error(`\u6D41\u91CF\u5DF2\u7528\u5B8C: ${i.value} ${i.unit} / ${o.value} ${o.unit}`)}}}function nD(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 sD(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 vhe=B(x());function ni(e,t,r="name"){return e.find(n=>n[r]===t)}var Lge=B(x());var yhe=B(x());var bhe=B(x()),hE=class{constructor(t,r,n){this.code=t,this.message=r,this.details=n}};var ba=class extends hE{constructor(t,r,n){super(t,r,n),this.type="RequestInvalidError"}};var Fhe=B(x());var pE=new Map,dE=new Set,mE;function gE(e){return e?.cron==null?"":`${e.cron}`.trim()}function iD(e){return gE(e).length>0}function zV(e){let t=e?.displayName??e?.["display-name"];return t==null?"":`${t}`.trim()}function oD(e){if(!e||typeof e!="object")return`${e}`;let t=e.name==null?"":`${e.name}`,r=zV(e);return!r||r===t?t:`${t} (${r})`}function WV(e){return!iD(e)}function YV(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 XV(e){if(!e||typeof e!="object")return e;let t=gE(e);return t?(YV(t),e.cron=t,e):(delete e.cron,e)}function ZV(){pE.forEach(e=>e.stop()),pE.clear()}async function JV(e,t,r){if(dE.has(e)){Q.info(`[ARTIFACT CRON] ${t} ${r} skipped: previous run is still running`);return}dE.add(e);try{Q.info(`[ARTIFACT CRON] ${t} ${r} started`),await mE(e),Q.info(`[ARTIFACT CRON] ${t} ${r} finished`)}catch(n){Q.error(`[ARTIFACT CRON] ${t} ${r} error: ${n.message??n}`)}finally{dE.delete(e)}}function QV(artifact){let cron=gE(artifact),name=artifact.name,logName=oD(artifact),{CronJob}=eval('require("cron")');try{let e=new CronJob(cron,async function(){await JV(name,logName,cron)},null,!0);pE.set(name,e),Q.info(`[ARTIFACT CRON] ${logName} ${cron} scheduled`)}catch(e){Q.error(`[ARTIFACT CRON] ${logName} ${cron} schedule error: ${e.message??e}`)}}function aD(){if(!Q.env.isNode||!mE)return;ZV();let e=Q.read(Bd);(Array.isArray(e)?e:[]).filter(r=>r.sync&&r.source).filter(iD).forEach(QV)}function Che(e){Q.env.isNode&&(mE=e,aD())}var Hhe=B(x());var Ihe=B(x());function eG(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function tG(){return{name:"Clash Provider",test:n=>/^payload:/gm.exec(n).index>=0,parse:n=>n.replace("payload:","").replace(/^\s*-\s*/gm,"")}}var uD=[eG(),tG()];var Phe=B(x());function rG(){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 cD(){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 nG(){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))),cD().func(r))}}function sG(){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 Rs.dump(i)}}}var lD={QX:rG(),Surge:cD(),Loon:nG(),Clash:sG()};var Rhe=B(x()),iG=[[/^(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 oG(){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 iG)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 fD=[oG()];var Aa=(function(){function e(n){for(let i of uD)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 fD){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=lD[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 nge=B(x());var Khe=B(x());var Zhe=B(x());var vE="https://api.github.com";function hD(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 aG(e,t=vE){return(String(e??"").trim()||t).replace(/\/+$/,"")}function uG({githubApiUrl:e,githubProxy:t}={}){let r=aG(e),n=r!==vE,i=String(t||"").trim().replace(/\/+$/,"");return n?r:`${i?`${i}/`:""}${vE}`}function Yhe(e={}){return!!e?.gistToken}var bf=class{constructor({token,key,syncPlatform}){let{isStash,isLoon,isShadowRocket,isQX}=ei(),{defaultProxy,githubApiTimeout,githubProxy,githubApiUrl}=Q.read(pr)||{},githubApiRequestTimeout=githubApiTimeout||1e4,githubGistBaseURL=uG({githubApiUrl,githubProxy}),proxy=defaultProxy;Q.env.isNode&&(proxy=proxy||eval("process.env.SUB_STORE_BACKEND_DEFAULT_PROXY")),syncPlatform==="gitlab"?(this.headers={"PRIVATE-TOKEN":`${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=wo({baseURL:"https://gitlab.com/api/v4",headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ea(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(hD(e)):e}})):(this.headers={Authorization:`token ${token}`,"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36"},this.http=wo({baseURL:githubGistBaseURL,headers:{...this.headers,...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},...proxy?{proxy}:{},...isLoon&&proxy?{node:proxy}:{},...isQX&&proxy?{opts:{policy:proxy}}:{},...proxy?Ea(proxy):{},timeout:githubApiRequestTimeout,events:{onResponse:e=>/^[45]/.test(String(e.statusCode))?Promise.reject(hD(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 ide=B(x());var Lme=B(x());var kme=B(x(),1);var lde=B(x(),1);var ade=B(x(),1);function wE(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=wE(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 _a(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 Af(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 Cm(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 Dm(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Gn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Sf(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 cG=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function lG(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function fG(e){for(let t=0;t<e.length;t++)e[t]=lG(e[t]);return e}var yE=cG?e=>e:fG,mD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",hG=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Fm(e){if(nn(e),mD)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=hG[e[r]];return t}var Sa={_0:48,_9:57,A:65,F:70,a:97,f:102};function pD(e){if(e>=Sa._0&&e<=Sa._9)return e-Sa._0;if(e>=Sa.A&&e<=Sa.F)return e-(Sa.A-10);if(e>=Sa.a&&e<=Sa.f)return e-(Sa.a-10)}function Rd(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(mD)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=pD(e.charCodeAt(o)),a=pD(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 dG(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function EE(e,t=""){return typeof e=="string"?dG(e):nn(e,void 0,t)}function bE(...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 Bm(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 AE(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 Ru(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 SE=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Im=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if(_a(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),Gn(i)}update(t){return Af(this),this.iHash.update(t),this}digestInto(t){Af(this),Cm(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=s,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},So=(()=>{let e=((t,r,n)=>new Im(t,r).update(n).digest());return e.create=(t,r)=>new Im(t,r),e})();var pde=B(x(),1);function Td(e,t,r){return _a(e),r===void 0&&(r=new Uint8Array(e.outputLen)),So(e,r,t)}var _E=Uint8Array.of(0),gD=Uint8Array.of();function CE(e,t,r,n=32){_a(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=gD:nn(r,void 0,"info");let s=new Uint8Array(o*i),a=So.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)_E[0]=h+1,u.update(h===0?gD:l).update(r).update(_E).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),Gn(l,_E),s.slice(0,n)}var Tu=(e,t,r,n,i)=>CE(e,Td(e,t,r),n,i);var _de=B(x(),1);var vde=B(x(),1);function vD(e,t,r){return e&t^~e&r}function wD(e,t,r){return e&t^e&r^t&r}var Od=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=Sf(this.buffer)}update(t){Af(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=Sf(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){Af(this),Cm(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,Gn(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=Sf(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()}},Ca=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 wde=B(x(),1),xm=BigInt(4294967295),yD=BigInt(32);function pG(e,t=!1){return t?{h:Number(e&xm),l:Number(e>>yD&xm)}:{h:Number(e>>yD&xm)|0,l:Number(e&xm)|0}}function ED(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}=pG(e[o],t);[n[o],i[o]]=[s,a]}return[n,i]}var DE=(e,t,r)=>e>>>r,FE=(e,t,r)=>e<<32-r|t>>>r,Hc=(e,t,r)=>e>>>r|t<<32-r,Mc=(e,t,r)=>e<<32-r|t>>>r,Nd=(e,t,r)=>e<<64-r|t>>>r-32,Ld=(e,t,r)=>e>>>r-32|t<<64-r;function _o(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var bD=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),AD=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,SD=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),_D=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,CD=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),DD=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;var gG=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]),Ou=new Uint32Array(64),BE=class extends Od{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)Ou[m]=t.getUint32(r,!1);for(let m=16;m<64;m++){let p=Ou[m-15],d=Ou[m-2],v=Oi(p,7)^Oi(p,18)^p>>>3,g=Oi(d,17)^Oi(d,19)^d>>>10;Ou[m]=g+Ou[m-7]+v+Ou[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+vD(a,u,l)+gG[m]+Ou[m]|0,g=(Oi(n,2)^Oi(n,13)^Oi(n,22))+wD(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(){Gn(Ou)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Gn(this.buffer)}},IE=class extends BE{A=Ca[0]|0;B=Ca[1]|0;C=Ca[2]|0;D=Ca[3]|0;E=Ca[4]|0;F=Ca[5]|0;G=Ca[6]|0;H=Ca[7]|0;constructor(){super(32)}};var FD=ED(["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))),vG=FD[0],wG=FD[1],Nu=new Uint32Array(80),Lu=new Uint32Array(80),xE=class extends Od{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)Nu[_]=t.getUint32(r),Lu[_]=t.getUint32(r+=4);for(let _=16;_<80;_++){let C=Nu[_-15]|0,F=Lu[_-15]|0,H=Hc(C,F,1)^Hc(C,F,8)^DE(C,F,7),K=Mc(C,F,1)^Mc(C,F,8)^FE(C,F,7),S=Nu[_-2]|0,I=Lu[_-2]|0,q=Hc(S,I,19)^Nd(S,I,61)^DE(S,I,6),L=Mc(S,I,19)^Ld(S,I,61)^FE(S,I,6),R=SD(K,L,Lu[_-7],Lu[_-16]),O=_D(R,H,q,Nu[_-7],Nu[_-16]);Nu[_]=O|0,Lu[_]=R|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:h,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let _=0;_<80;_++){let C=Hc(m,p,14)^Hc(m,p,18)^Nd(m,p,41),F=Mc(m,p,14)^Mc(m,p,18)^Ld(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=CD(E,F,K,wG[_],Lu[_]),I=DD(S,w,C,H,vG[_],Nu[_]),q=S|0,L=Hc(n,i,28)^Nd(n,i,34)^Nd(n,i,39),R=Mc(n,i,28)^Ld(n,i,34)^Ld(n,i,39),O=n&o^n&a^o&a,T=i&s^i&u^s&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=_o(l|0,h|0,I|0,q|0),l=a|0,h=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let N=bD(q,R,T);n=AD(N,I,L,O),i=N|0}({h:n,l:i}=_o(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=_o(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=_o(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=_o(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=_o(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=_o(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=_o(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=_o(this.Hh|0,this.Hl|0,w|0,E|0),this.set(n,i,o,s,a,u,l,h,m,p,d,v,g,y,w,E)}roundClean(){Gn(Nu,Lu)}destroy(){this.destroyed=!0,Gn(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},$E=class extends xE{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=AE(()=>new IE,SE(1));var $m=AE(()=>new $E,SE(3));var eme=B(x(),1);var Dde=B(x(),1);function TE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function yG(e){if(!TE(e))throw new TypeError("Uint8Array expected")}function $D(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 EG(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function qc(e,t){if(typeof t!="string")throw new TypeError(`${e}: string expected`);return!0}function OE(e){if(typeof e!="number")throw new TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function PE(e){if(!Array.isArray(e))throw new TypeError("array expected")}function km(e,t){if(!$D(!0,t))throw new TypeError(`${e}: array of strings expected`)}function PD(e,t){if(!$D(!1,t))throw new TypeError(`${e}: array of numbers expected`)}function NE(...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 LE(e){let t=typeof e=="string"?e.split(""):e,r=t.length;km("alphabet",t);let n=new Map(t.map((i,o)=>[i,o]));return{encode:i=>(PE(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=>(PE(i),i.map(o=>{qc("alphabet.decode",o);let s=n.get(o);if(s===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return s}))}}function UE(e=""){return qc("join",e),{encode:t=>(km("join.decode",t),t.join(e)),decode:t=>(qc("join.decode",t),t.split(e))}}function bG(e,t="="){return OE(e),qc("padding",t),{encode(r){for(km("padding.encode",r);r.length*e%8;)r.push(t);return r},decode(r){km("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 kD=(e,t)=>t===0?e:kD(t,e%t),Rm=(e,t)=>e+(t-kD(e,t)),Pm=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function kE(e,t,r,n){if(PE(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(Rm(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${Rm(t,r)}`);let i=0,o=0,s=Pm[t],a=Pm[r]-1,u=[];for(let l of e){if(OE(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=Pm[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 HE(e,t=!1){if(OE(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(Rm(8,e)>32||Rm(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:r=>{if(!TE(r))throw new TypeError("radix2.encode input should be Uint8Array");return kE(Array.from(r),8,e,!t)},decode:r=>(PD("radix2.decode",r),Uint8Array.from(kE(r,e,8,t)))}}function BD(e){return EG(e),function(...t){try{return e.apply(null,t)}catch{}}}var AG=typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function",SG=/[\t\n\f\r ]/,_G=(e,t)=>{qc("base64",e);let r=t?"base64url":"base64";if(e.length>0&&SG.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},ME=Object.freeze(AG?{encode(e){return yG(e),e.toBase64()},decode(e){return _G(e,!1)}}:NE(HE(6),LE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),bG(6),UE(""))),$n=Object.freeze(NE(HE(6),LE("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),UE("")));var RE=NE(LE("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),UE("")),ID=[996825010,642813549,513874426,1027748829,705979059];function Ud(e){let t=e>>25,r=(e&33554431)<<5;for(let n=0;n<ID.length;n++)(t>>n&1)===1&&(r^=ID[n]);return r}function xD(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=Ud(i)^s>>5}i=Ud(i);for(let o=0;o<n;o++)i=Ud(i)^e.charCodeAt(o)&31;for(let o of t)i=Ud(i)^o;for(let o=0;o<6;o++)i=Ud(i);return i^=r,RE.encode(kE([i%Pm[30]],30,5,!1))}function CG(e){let t=e==="bech32"?1:734539939,r=HE(5),n=r.decode,i=r.encode,o=BD(n);function s(m,p,d=90){qc("bech32.encode prefix",m),TE(p)&&(p=Array.from(p)),PD("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=xD(y,p,t);return`${y}1${RE.encode(p)}${w}`}function a(m,p=90){qc("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=RE.decode(w).slice(0,-6),_=xD(y,E,t);if(!w.endsWith(_))throw new Error(`Invalid checksum in ${m}: expected "${_}"`);return{prefix:y,words:E}}let u=BD(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 si=Object.freeze(CG("bech32"));var Tde=B(x(),1);var xde=B(x(),1);function FG(e,t,r,n){_a(e);let i=Bm({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=EE(t,"password"),l=EE(r,"salt"),h=new Uint8Array(s),m=So.create(e,u),p=m._cloneInto().update(l);return{c:o,dkLen:s,asyncTick:a,DK:h,PRF:m,PRFSalt:p}}function BG(e,t,r,n,i){return e.destroy(),t.destroy(),n&&n.destroy(),Gn(i),r}function qE(e,t,r,n){let{c:i,dkLen:o,DK:s,PRF:a,PRFSalt:u}=FG(e,t,r,n),l,h=new Uint8Array(4),m=Sf(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 BG(a,u,s,l,p)}function RD(e,t,r,n,i,o){let s=e[t++]^r[n++],a=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],h=e[t++]^r[n++],m=e[t++]^r[n++],p=e[t++]^r[n++],d=e[t++]^r[n++],v=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],w=e[t++]^r[n++],E=e[t++]^r[n++],_=e[t++]^r[n++],C=e[t++]^r[n++],F=e[t++]^r[n++],H=s,K=a,S=u,I=l,q=h,L=m,R=p,O=d,T=v,N=g,P=y,M=w,Y=E,V=_,X=C,te=F;for(let ae=0;ae<8;ae+=2)q^=Tt(H+Y|0,7),T^=Tt(q+H|0,9),Y^=Tt(T+q|0,13),H^=Tt(Y+T|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+R|0,7),S^=Tt(X+P|0,9),R^=Tt(S+X|0,13),P^=Tt(R+S|0,18),I^=Tt(te+M|0,7),O^=Tt(I+te|0,9),M^=Tt(O+I|0,13),te^=Tt(M+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),R^=Tt(L+q|0,7),O^=Tt(R+L|0,9),q^=Tt(O+R|0,13),L^=Tt(q+O|0,18),M^=Tt(P+N|0,7),T^=Tt(M+P|0,9),N^=Tt(T+M|0,13),P^=Tt(N+T|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+q|0,i[o++]=m+L|0,i[o++]=p+R|0,i[o++]=d+O|0,i[o++]=v+T|0,i[o++]=g+N|0,i[o++]=y+P|0,i[o++]=w+M|0,i[o++]=E+Y|0,i[o++]=_+V|0,i[o++]=C+X|0,i[o++]=F+te|0}function jE(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)RD(r,s,e,t,r,o),a>0&&(s+=16),RD(r,o,e,t+=16,r,s)}function IG(e,t,r){let n=Bm({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=qE(Dr,e,t,{c:1,dkLen:m*s}),y=Dm(g),w=Dm(new Uint8Array(m*i)),E=Dm(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 xG(e,t,r,n,i){let o=qE(Dr,e,r,{c:1,dkLen:t});return Gn(r,n,i),o}function KE(e,t,r){let{N:n,r:i,p:o,dkLen:s,blockSize32:a,V:u,B32:l,B:h,tmp:m,blockMixCb:p}=IG(e,t,r);yE(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++)jE(u,y,u,y+=a,i),p();jE(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];jE(m,0,l,v,i),p()}}return yE(l),xG(e,s,h,u,m)}var tpe=B(x(),1);var Mde=B(x(),1);var Nde=B(x(),1);function $G(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Tm(e){if(typeof e!="boolean")throw new TypeError(`boolean expected, not ${e}`)}function _f(e){if(typeof e!="number")throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError("positive integer expected, got "+e)}function Mr(e,t,r=""){let n=$G(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 VE(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 TD(e,t,r=!1){Mr(e,void 0,"output");let n=t.outputLen;if(e.length<n)throw new RangeError("digestInto() expects output buffer of length at least "+n);if(r&&!Cf(e))throw new Error("invalid output, must be aligned")}function Co(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Ni(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function PG(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var jc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,kG=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;var RG=e=>{for(let t=0;t<e.length;t++)e[t]=kG(e[t]);return e},Da=jc?e=>e:RG;function OD(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function ND(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 LD(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 UD=(e,t)=>{function r(n,...i){if(Mr(n,void 0,"key"),e.nonceLength!==void 0){let h=i[0];Mr(h,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let o=e.tagLength;o&&i[1]!==void 0&&Mr(i[1],void 0,"AAD");let s=t(n,...i),a=(h,m)=>{if(m!==void 0){if(h!==2)throw new Error("cipher output not supported");Mr(m,void 0,"output")}},u=!1;return{encrypt(h,m){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,Mr(h),a(s.encrypt.length,m),s.encrypt(h,m)},decrypt(h,m){if(Mr(h),o&&h.length<o)throw new Error('"ciphertext" expected length bigger than tagLength='+o);return a(s.decrypt.length,m),s.decrypt(h,m)}}}return Object.assign(r,e),r};function Hd(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(Mr(t,void 0,"output"),t.length!==e)throw new Error('"output" expected Uint8Array of length '+e+", got: "+t.length);if(r&&!Cf(t))throw new Error("invalid output, must be aligned");return t}function HD(e,t,r){_f(e),_f(t),Tm(r);let n=new Uint8Array(16),i=PG(n);return i.setBigUint64(0,BigInt(t),r),i.setBigUint64(8,BigInt(e),r),n}function Cf(e){return e.byteOffset%4===0}function Df(e){return Uint8Array.from(Mr(e))}var qD=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),TG=Da(Co(qD("expand 16-byte k"))),OG=Da(Co(qD("expand 32-byte k")));function Ot(e,t){return e<<t|e>>>32-t}var Md=64,NG=16,GE=2**32-1,MD=Uint32Array.of();function LG(e,t,r,n,i,o,s,a){let u=i.length,l=new Uint8Array(Md),h=Co(l),m=jc&&Cf(i)&&Cf(o),p=m?Co(i):MD,d=m?Co(o):MD;if(!jc){for(let v=0;v<u;s++){if(e(t,r,n,h,s,a),Da(h),s>=GE)throw new Error("arx: counter overflow");let g=Math.min(Md,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>=GE)throw new Error("arx: counter overflow");let g=Math.min(Md,u-v);if(m&&g===Md){let y=v/4;if(v%4!==0)throw new Error("arx: invalid block position");for(let w=0,E;w<NG;w++)E=y+w,d[E]=p[E]^h[w];v+=Md;continue}for(let y=0,w;y<g;y++)w=v+y,o[w]=i[w]^l[y];v+=g}}function jD(e,t){let{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:o,rounds:s}=OD({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return _f(i),_f(s),Tm(o),Tm(r),(a,u,l,h,m=0)=>{Mr(a,void 0,"key"),Mr(u,void 0,"nonce"),Mr(l,void 0,"data");let p=l.length;if(h=Hd(p,h,!1),_f(m),m<0||m>=GE)throw new Error("arx: counter overflow");let d=[],v=a.length,g,y;if(v===32)d.push(g=Df(a)),y=OG;else if(v===16&&r)g=new Uint8Array(32),g.set(a),g.set(a,16),y=TG,d.push(g);else throw Mr(a,32,"arx key"),new Error("invalid key size");(!jc||!Cf(u))&&d.push(u=Df(u));let w=Co(g);if(n){if(u.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let C=u.subarray(0,16);if(jc)n(y,w,Co(C),w);else{let F=Da(Uint32Array.from(y));n(F,w,Co(C),w),Ni(F),Da(w)}u=u.subarray(16)}else jc||Da(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 _=Da(Co(u));try{return LG(e,y,w,_,l,h,m,s),h}finally{Ni(...d)}}}var Wde=B(x(),1);function on(e,t){return e[t++]&255|(e[t++]&255)<<8}var zE=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=Df(Mr(t,32,"key"));let r=on(t,0),n=on(t,2),i=on(t,4),o=on(t,6),s=on(t,8),a=on(t,10),u=on(t,12),l=on(t,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|u<<5)&8065,this.r[8]=(u>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let h=0;h<8;h++)this.pad[h]=on(t,16+2*h)}process(t,r,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],u=s[1],l=s[2],h=s[3],m=s[4],p=s[5],d=s[6],v=s[7],g=s[8],y=s[9],w=on(t,r+0),E=on(t,r+2),_=on(t,r+4),C=on(t,r+6),F=on(t,r+8),H=on(t,r+10),K=on(t,r+12),S=on(t,r+14),I=o[0]+(w&8191),q=o[1]+((w>>>13|E<<3)&8191),L=o[2]+((E>>>10|_<<6)&8191),R=o[3]+((_>>>7|C<<9)&8191),O=o[4]+((C>>>4|F<<12)&8191),T=o[5]+(F>>>1&8191),N=o[6]+((F>>>14|H<<2)&8191),P=o[7]+((H>>>11|K<<5)&8191),M=o[8]+((K>>>8|S<<8)&8191),Y=o[9]+(S>>>5|i),V=0,X=V+I*a+q*(5*y)+L*(5*g)+R*(5*v)+O*(5*d);V=X>>>13,X&=8191,X+=T*(5*p)+N*(5*m)+P*(5*h)+M*(5*l)+Y*(5*u),V+=X>>>13,X&=8191;let te=V+I*u+q*a+L*(5*y)+R*(5*g)+O*(5*v);V=te>>>13,te&=8191,te+=T*(5*d)+N*(5*p)+P*(5*m)+M*(5*h)+Y*(5*l),V+=te>>>13,te&=8191;let ae=V+I*l+q*u+L*a+R*(5*y)+O*(5*g);V=ae>>>13,ae&=8191,ae+=T*(5*v)+N*(5*d)+P*(5*p)+M*(5*m)+Y*(5*h),V+=ae>>>13,ae&=8191;let me=V+I*h+q*l+L*u+R*a+O*(5*y);V=me>>>13,me&=8191,me+=T*(5*g)+N*(5*v)+P*(5*d)+M*(5*p)+Y*(5*m),V+=me>>>13,me&=8191;let he=V+I*m+q*h+L*l+R*u+O*a;V=he>>>13,he&=8191,he+=T*(5*y)+N*(5*g)+P*(5*v)+M*(5*d)+Y*(5*p),V+=he>>>13,he&=8191;let De=V+I*p+q*m+L*h+R*l+O*u;V=De>>>13,De&=8191,De+=T*a+N*(5*y)+P*(5*g)+M*(5*v)+Y*(5*d),V+=De>>>13,De&=8191;let Pe=V+I*d+q*p+L*m+R*h+O*l;V=Pe>>>13,Pe&=8191,Pe+=T*u+N*a+P*(5*y)+M*(5*g)+Y*(5*v),V+=Pe>>>13,Pe&=8191;let Ie=V+I*v+q*d+L*p+R*m+O*h;V=Ie>>>13,Ie&=8191,Ie+=T*l+N*u+P*a+M*(5*y)+Y*(5*g),V+=Ie>>>13,Ie&=8191;let se=V+I*g+q*v+L*d+R*p+O*m;V=se>>>13,se&=8191,se+=T*h+N*l+P*u+M*a+Y*(5*y),V+=se>>>13,se&=8191;let pe=V+I*y+q*g+L*v+R*d+O*p;V=pe>>>13,pe&=8191,pe+=T*m+N*h+P*l+M*u+Y*a,V+=pe>>>13,pe&=8191,V=(V<<2)+V|0,V=V+X|0,X=V&8191,V=V>>>13,te+=V,o[0]=X,o[1]=te,o[2]=ae,o[3]=me,o[4]=he,o[5]=De,o[6]=Pe,o[7]=Ie,o[8]=se,o[9]=pe}finalize(){let{h:t,pad:r}=this,n=new Uint16Array(10),i=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=i,i=t[a]>>>13,t[a]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,n[0]=t[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=t[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)t[a]=t[a]&o|n[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let s=t[0]+r[0];t[0]=s&65535;for(let a=1;a<8;a++)s=(t[a]+r[a]|0)+(s>>>16)|0,t[a]=s&65535;Ni(n)}update(t){VE(this),Mr(t),t=Df(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){VE(this),TD(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}},KD=LD(32,e=>new zE(e));function UG(e,t,r,n,i,o=20){let s=e[0],a=e[1],u=e[2],l=e[3],h=t[0],m=t[1],p=t[2],d=t[3],v=t[4],g=t[5],y=t[6],w=t[7],E=i,_=r[0],C=r[1],F=r[2],H=s,K=a,S=u,I=l,q=h,L=m,R=p,O=d,T=v,N=g,P=y,M=w,Y=E,V=_,X=C,te=F;for(let me=0;me<o;me+=2)H=H+q|0,Y=Ot(Y^H,16),T=T+Y|0,q=Ot(q^T,12),H=H+q|0,Y=Ot(Y^H,8),T=T+Y|0,q=Ot(q^T,7),K=K+L|0,V=Ot(V^K,16),N=N+V|0,L=Ot(L^N,12),K=K+L|0,V=Ot(V^K,8),N=N+V|0,L=Ot(L^N,7),S=S+R|0,X=Ot(X^S,16),P=P+X|0,R=Ot(R^P,12),S=S+R|0,X=Ot(X^S,8),P=P+X|0,R=Ot(R^P,7),I=I+O|0,te=Ot(te^I,16),M=M+te|0,O=Ot(O^M,12),I=I+O|0,te=Ot(te^I,8),M=M+te|0,O=Ot(O^M,7),H=H+L|0,te=Ot(te^H,16),P=P+te|0,L=Ot(L^P,12),H=H+L|0,te=Ot(te^H,8),P=P+te|0,L=Ot(L^P,7),K=K+R|0,Y=Ot(Y^K,16),M=M+Y|0,R=Ot(R^M,12),K=K+R|0,Y=Ot(Y^K,8),M=M+Y|0,R=Ot(R^M,7),S=S+O|0,V=Ot(V^S,16),T=T+V|0,O=Ot(O^T,12),S=S+O|0,V=Ot(V^S,8),T=T+V|0,O=Ot(O^T,7),I=I+q|0,X=Ot(X^I,16),N=N+X|0,q=Ot(q^N,12),I=I+q|0,X=Ot(X^I,8),N=N+X|0,q=Ot(q^N,7);let ae=0;n[ae++]=s+H|0,n[ae++]=a+K|0,n[ae++]=u+S|0,n[ae++]=l+I|0,n[ae++]=h+q|0,n[ae++]=m+L|0,n[ae++]=p+R|0,n[ae++]=d+O|0,n[ae++]=v+T|0,n[ae++]=g+N|0,n[ae++]=y+P|0,n[ae++]=w+M|0,n[ae++]=E+Y|0,n[ae++]=_+V|0,n[ae++]=C+X|0,n[ae++]=F+te|0}var HG=jD(UG,{counterRight:!1,counterLength:4,allowShortKeys:!1});var MG=new Uint8Array(16),VD=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(MG.subarray(r))},qG=new Uint8Array(32);function GD(e,t,r,n,i){i!==void 0&&Mr(i,void 0,"AAD");let o=e(t,r,qG),s=HD(n.length,i?i.length:0,!0),a=KD.create(o);i&&VD(a,i),VD(a,n),a.update(s);let u=a.digest();return Ni(o,s),u}var jG=e=>(t,r,n)=>({encrypt(o,s){let a=o.length;s=Hd(a+16,s,!1),s.set(o);let u=s.subarray(0,-16);e(t,r,u,u,1);let l=GD(e,t,r,u,n);return s.set(l,a),Ni(l),s},decrypt(o,s){s=Hd(o.length-16,s,!1);let a=o.subarray(0,-16),u=o.subarray(-16),l=GD(e,t,r,a,n);if(!ND(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}}),ii=UD({blockSize:64,nonceLength:12,tagLength:16},jG(HG));var U0e=B(x(),1);var ope=B(x(),1);var npe=B(x(),1);function Ff(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=Ff(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 oi(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 Ba(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 Om(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 Nm(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ys(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Lm(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Li(e,t){return e<<32-t|e>>>t}var KG=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function VG(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function GG(e){for(let t=0;t<e.length;t++)e[t]=VG(e[t]);return e}var WE=KG?e=>e:GG,WD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",zG=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kc(e){if(Je(e),WD)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=zG[e[r]];return t}var Fa={_0:48,_9:57,A:65,F:70,a:97,f:102};function zD(e){if(e>=Fa._0&&e<=Fa._9)return e-Fa._0;if(e>=Fa.A&&e<=Fa.F)return e-(Fa.A-10);if(e>=Fa.a&&e<=Fa.f)return e-(Fa.a-10)}function Vc(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(WD)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=zD(e.charCodeAt(o)),a=zD(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 Bf(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 Uu(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 Hu=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var XE=BigInt(0),YE=BigInt(1);function qd(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new Error(r+"expected boolean, got type="+typeof e)}return e}function YD(e){if(typeof e=="bigint"){if(!Um(e))throw new Error("positive bigint expected, got "+e)}else Zr(e);return e}function jd(e){let t=YD(e).toString(16);return t.length&1?"0"+t:t}function XD(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?XE:BigInt("0x"+e)}function Mu(e){return XD(Kc(e))}function qu(e){return XD(Kc(Hm(Je(e)).reverse()))}function If(e,t){Zr(t),e=YD(e);let r=Vc(e.toString(16).padStart(t*2,"0"));if(r.length!==t)throw new Error("number too large");return r}function Kd(e,t){return If(e,t).reverse()}function Hm(e){return Uint8Array.from(e)}function ju(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 Um=e=>typeof e=="bigint"&&XE<=e;function WG(e,t,r){return Um(e)&&Um(t)&&Um(r)&&t<=e&&e<r}function Vd(e,t,r,n){if(!WG(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function ZE(e){let t;for(t=0;e>XE;e>>=YE,t+=1);return t}var Gd=e=>(YE<<BigInt(e))-YE;function ZD(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 Gc(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 JE(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 ppe=B(x(),1);var lpe=B(x(),1);var Wn=BigInt(0),Pn=BigInt(1),zc=BigInt(2),eF=BigInt(3),tF=BigInt(4),rF=BigInt(5),YG=BigInt(7),nF=BigInt(8),XG=BigInt(9),sF=BigInt(16);function zn(e,t){let r=e%t;return r>=Wn?r:t+r}function ai(e,t,r){let n=e;for(;t-- >Wn;)n*=n,n%=r;return n}function JD(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=zn(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 zn(i,t)}function eb(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function iF(e,t){let r=(e.ORDER+Pn)/tF,n=e.pow(t,r);return eb(e,n,t),n}function ZG(e,t){let r=(e.ORDER-rF)/nF,n=e.mul(t,zc),i=e.pow(n,r),o=e.mul(t,i),s=e.mul(e.mul(o,zc),i),a=e.mul(o,e.sub(s,e.ONE));return eb(e,a,t),a}function JG(e){let t=Mm(e),r=oF(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+YG)/sF;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 eb(a,y,u),y}}function oF(e){if(e<eF)throw new Error("sqrt is not defined for small field");let t=e-Pn,r=0;for(;t%zc===Wn;)t/=zc,r++;let n=zc,i=Mm(e);for(;QD(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return iF;let o=i.pow(n,t),s=(t+Pn)/zc;return function(u,l){if(u.is0(l))return l;if(QD(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 QG(e){return e%tF===eF?iF:e%nF===rF?ZG:e%sF===XG?JG(e):oF(e)}var ez=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tb(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=ez.reduce((n,i)=>(n[i]="function",n),t);return Gc(e,r),e}function tz(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 zd(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 QD(e,t){let r=(e.ORDER-Pn)/zc,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 rz(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 QE=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}=rz(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 zn(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 zn(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return zn(t*t,this.ORDER)}add(t,r){return zn(t+r,this.ORDER)}sub(t,r){return zn(t-r,this.ORDER)}mul(t,r){return zn(t*r,this.ORDER)}pow(t,r){return tz(this,t,r)}div(t,r){return zn(t*JD(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 JD(t,this.ORDER)}sqrt(t){return this._sqrt||(this._sqrt=QG(this.ORDER)),this._sqrt(this,t)}toBytes(t){return this.isLE?Kd(t,this.BYTES):If(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):Mu(t);if(a&&(u=zn(u,s)),!r&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return zd(this,t)}cmov(t,r,n){return n?r:t}};function Mm(e,t={}){return new QE(e,t)}function aF(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 rb(e){let t=aF(e);return t+Math.ceil(t/2)}function uF(e,t,r=!1){Je(e);let n=e.length,i=aF(t),o=rb(t);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?qu(e):Mu(e),a=zn(s,t-Pn)+Pn;return r?Kd(a,i):If(a,i)}var xf=BigInt(0),Wc=BigInt(1);function Wd(e,t){let r=t.negate();return e?r:t}function ob(e,t){let r=zd(e.Fp,t.map(n=>n.Z));return t.map((n,i)=>e.fromAffine(n.toAffine(r[i])))}function hF(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function nb(e,t){hF(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e,o=Gd(e),s=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function cF(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 sb=new WeakMap,dF=new WeakMap;function ib(e){return dF.get(e)||1}function lF(e){if(e!==xf)throw new Error("invalid wNAF")}var qm=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>xf;)r&Wc&&(n=n.add(i)),i=i.double(),r>>=Wc;return n}precomputeWindow(t,r){let{windows:n,windowSize:i}=nb(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=nb(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=cF(n,a,s);n=u,h?o=o.add(Wd(p,r[d])):i=i.add(Wd(m,r[l]))}return lF(n),{p:i,f:o}}wNAFUnsafe(t,r,n,i=this.ZERO){let o=nb(t,this.bits);for(let s=0;s<o.windows&&n!==xf;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=cF(n,s,o);if(n=a,!l){let m=r[u];i=i.add(h?m.negate():m)}}return lF(n),i}getPrecomputes(t,r,n){let i=sb.get(r);return i||(i=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(i=n(i)),sb.set(r,i))),i}cached(t,r,n){let i=ib(t);return this.wNAF(i,this.getPrecomputes(i,t,n),r)}unsafe(t,r,n,i){let o=ib(t);return o===1?this._unsafeLadder(t,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,i)}createCache(t,r){hF(r,this.bits),dF.set(t,r),sb.delete(t)}hasCache(t){return ib(t)!==1}};function pF(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>xf||n>xf;)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 fF(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return tb(t),t}else return Mm(e,{isLE:r})}function mF(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>xf))throw new Error(`CURVE.${u} must be positive bigint`)}let i=fF(t.p,r.Fp,n),o=fF(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 jm(e,t){return function(n){let i=e(n);return{secretKey:i,publicKey:t(i)}}}var ype=B(x(),1);var Yd=BigInt(0),$f=BigInt(1),Km=BigInt(2);function nz(e){return Gc(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}function gF(e){let t=nz(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||Uu,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?Km**BigInt(254):Km**BigInt(447),v=a?BigInt(8)*Km**BigInt(251)-$f:BigInt(4)*Km**BigInt(445)-$f,g=d+v+$f,y=T=>zn(T,r),w=E(m);function E(T){return Kd(y(T),h)}function _(T){let N=Hm(Je(T,h,"uCoordinate"));return a&&(N[31]&=127),y(qu(N))}function C(T){return qu(i(Hm(Je(T,h,"scalar"))))}function F(T,N){let P=q(_(N),C(T));if(P===Yd)throw new Error("invalid private or public key received");return E(P)}function H(T){return F(T,w)}let K=H,S=F;function I(T,N,P){let M=y(T*(N-P));return N=y(N-M),P=y(P+M),{x_2:N,x_3:P}}function q(T,N){Vd("u",T,Yd,r),Vd("scalar",N,d,g);let P=N,M=T,Y=$f,V=Yd,X=T,te=$f,ae=Yd;for(let he=BigInt(l-1);he>=Yd;he--){let De=P>>he&$f;ae^=De,{x_2:Y,x_3:X}=I(ae,Y,X),{x_2:V,x_3:te}=I(ae,V,te),ae=De;let Pe=Y+V,Ie=y(Pe*Pe),se=Y-V,pe=y(se*se),Fe=Ie-pe,Te=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Te*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(M*y(ct*ct)),Y=y(Ie*pe),V=y(Fe*(Ie+y(p*Fe)))}({x_2:Y,x_3:X}=I(ae,Y,X)),{x_2:V,x_3:te}=I(ae,V,te);let me=o(V);return y(Y*me)}let L={secretKey:h,publicKey:h,seed:h},R=(T=u(h))=>(Je(T,L.seed,"seed"),T),O={randomSecretKey:R};return Object.freeze({keygen:jm(R,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var Ipe=B(x(),1);var Ape=B(x(),1);var Vm=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(t,r){if(oi(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),ys(i)}update(t){return Ba(this),this.iHash.update(t),this}digestInto(t){Ba(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()}},Pf=(e,t,r)=>new Vm(e,t).update(r).digest();Pf.create=(e,t)=>new Vm(e,t);var vF=(e,t)=>(e+(e>=0?t:-t)/wF)/t;function sz(e,t,r){let[[n,i],[o,s]]=t,a=vF(s*e,r),u=vF(-i*e,r),l=e-a*n-u*o,h=-a*i-u*s,m=l<Ia,p=h<Ia;m&&(l=-l),p&&(h=-h);let d=Gd(Math.ceil(ZE(r)/2))+kf;if(l<Ia||l>=d||h<Ia||h>=d)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:m,k1:l,k2neg:p,k2:h}}function ub(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ab(e,t){let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return qd(r.lowS,"lowS"),qd(r.prehash,"prehash"),r.format!==void 0&&ub(r.format),r}var cb=class extends Error{constructor(t=""){super(t)}},Ku={Err:cb,_tlv:{encode:(e,t)=>{let{Err:r}=Ku;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=jd(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?jd(i.length/2|128):"";return jd(e)+o+i+t},decode(e,t){let{Err:r}=Ku,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}=Ku;if(e<Ia)throw new t("integer: negative integers are not allowed");let r=jd(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}=Ku;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 Mu(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=Ku,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}=Ku,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s)),o=n+i;return t.encode(48,o)}},Ia=BigInt(0),kf=BigInt(1),wF=BigInt(2),Gm=BigInt(3),iz=BigInt(4);function lb(e,t={}){let r=mF("weierstrass",e,t),{Fp:n,Fn:i}=r,o=r.CURVE,{h:s,n:a}=o;Gc(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=EF(n,i);function h(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(R,O,T){let{x:N,y:P}=O.toAffine(),M=n.toBytes(N);if(qd(T,"isCompressed"),T){h();let Y=!n.isOdd(P);return xr(yF(Y),M)}else return xr(Uint8Array.of(4),M,n.toBytes(P))}function p(R){Je(R,void 0,"Point");let{publicKey:O,publicKeyUncompressed:T}=l,N=R.length,P=R[0],M=R.subarray(1);if(N===O&&(P===2||P===3)){let Y=n.fromBytes(M);if(!n.isValid(Y))throw new Error("bad point: is not on curve, wrong x");let V=g(Y),X;try{X=n.sqrt(V)}catch(me){let he=me instanceof Error?": "+me.message:"";throw new Error("bad point: is not on curve, sqrt error"+he)}h();let te=n.isOdd(X);return(P&1)===1!==te&&(X=n.neg(X)),{x:Y,y:X}}else if(N===T&&P===4){let Y=n.BYTES,V=n.fromBytes(M.subarray(0,Y)),X=n.fromBytes(M.subarray(Y,Y*2));if(!y(V,X))throw new Error("bad point: is not on curve");return{x:V,y:X}}else throw new Error(`bad point: got length ${N}, expected compressed=${O} or uncompressed=${T}`)}let d=t.toBytes||m,v=t.fromBytes||p;function g(R){let O=n.sqr(R),T=n.mul(O,R);return n.add(n.add(T,n.mul(R,o.a)),o.b)}function y(R,O){let T=n.sqr(O),N=g(R);return n.eql(T,N)}if(!y(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let w=n.mul(n.pow(o.a,Gm),iz),E=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(w,E)))throw new Error("bad curve params: a or b");function _(R,O,T=!1){if(!n.isValid(O)||T&&n.is0(O))throw new Error(`bad point coordinate ${R}`);return O}function C(R){if(!(R instanceof I))throw new Error("Weierstrass Point expected")}function F(R){if(!u||!u.basises)throw new Error("no endo");return sz(R,u.basises,i.ORDER)}let H=JE((R,O)=>{let{X:T,Y:N,Z:P}=R;if(n.eql(P,n.ONE))return{x:T,y:N};let M=R.is0();O==null&&(O=M?n.ONE:n.inv(P));let Y=n.mul(T,O),V=n.mul(N,O),X=n.mul(P,O);if(M)return{x:n.ZERO,y:n.ZERO};if(!n.eql(X,n.ONE))throw new Error("invZ was invalid");return{x:Y,y:V}}),K=JE(R=>{if(R.is0()){if(t.allowInfinityPoint&&!n.is0(R.Y))return;throw new Error("bad point: ZERO")}let{x:O,y:T}=R.toAffine();if(!n.isValid(O)||!n.isValid(T))throw new Error("bad point: x or y not field elements");if(!y(O,T))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function S(R,O,T,N,P){return T=new I(n.mul(T.X,R),T.Y,T.Z),O=Wd(N,O),T=Wd(P,T),O.add(T)}class I{static BASE=new I(o.Gx,o.Gy,n.ONE);static ZERO=new I(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(O,T,N){this.X=_("x",O),this.Y=_("y",T,!0),this.Z=_("z",N),Object.freeze(this)}static CURVE(){return o}static fromAffine(O){let{x:T,y:N}=O||{};if(!O||!n.isValid(T)||!n.isValid(N))throw new Error("invalid affine point");if(O instanceof I)throw new Error("projective point not allowed");return n.is0(T)&&n.is0(N)?I.ZERO:new I(T,N,n.ONE)}static fromBytes(O){let T=I.fromAffine(v(Je(O,void 0,"point")));return T.assertValidity(),T}static fromHex(O){return I.fromBytes(Vc(O))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(O=8,T=!0){return L.createCache(this,O),T||this.multiply(Gm),this}assertValidity(){K(this)}hasEvenY(){let{y:O}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(O)}equals(O){C(O);let{X:T,Y:N,Z:P}=this,{X:M,Y,Z:V}=O,X=n.eql(n.mul(T,V),n.mul(M,P)),te=n.eql(n.mul(N,V),n.mul(Y,P));return X&&te}negate(){return new I(this.X,n.neg(this.Y),this.Z)}double(){let{a:O,b:T}=o,N=n.mul(T,Gm),{X:P,Y:M,Z:Y}=this,V=n.ZERO,X=n.ZERO,te=n.ZERO,ae=n.mul(P,P),me=n.mul(M,M),he=n.mul(Y,Y),De=n.mul(P,M);return De=n.add(De,De),te=n.mul(P,Y),te=n.add(te,te),V=n.mul(O,te),X=n.mul(N,he),X=n.add(V,X),V=n.sub(me,X),X=n.add(me,X),X=n.mul(V,X),V=n.mul(De,V),te=n.mul(N,te),he=n.mul(O,he),De=n.sub(ae,he),De=n.mul(O,De),De=n.add(De,te),te=n.add(ae,ae),ae=n.add(te,ae),ae=n.add(ae,he),ae=n.mul(ae,De),X=n.add(X,ae),he=n.mul(M,Y),he=n.add(he,he),ae=n.mul(he,De),V=n.sub(V,ae),te=n.mul(he,me),te=n.add(te,te),te=n.add(te,te),new I(V,X,te)}add(O){C(O);let{X:T,Y:N,Z:P}=this,{X:M,Y,Z:V}=O,X=n.ZERO,te=n.ZERO,ae=n.ZERO,me=o.a,he=n.mul(o.b,Gm),De=n.mul(T,M),Pe=n.mul(N,Y),Ie=n.mul(P,V),se=n.add(T,N),pe=n.add(M,Y);se=n.mul(se,pe),pe=n.add(De,Pe),se=n.sub(se,pe),pe=n.add(T,P);let Fe=n.add(M,V);return pe=n.mul(pe,Fe),Fe=n.add(De,Ie),pe=n.sub(pe,Fe),Fe=n.add(N,P),X=n.add(Y,V),Fe=n.mul(Fe,X),X=n.add(Pe,Ie),Fe=n.sub(Fe,X),ae=n.mul(me,pe),X=n.mul(he,Ie),ae=n.add(X,ae),X=n.sub(Pe,ae),ae=n.add(Pe,ae),te=n.mul(X,ae),Pe=n.add(De,De),Pe=n.add(Pe,De),Ie=n.mul(me,Ie),pe=n.mul(he,pe),Pe=n.add(Pe,Ie),Ie=n.sub(De,Ie),Ie=n.mul(me,Ie),pe=n.add(pe,Ie),De=n.mul(Pe,pe),te=n.add(te,De),De=n.mul(Fe,pe),X=n.mul(se,X),X=n.sub(X,De),De=n.mul(se,Pe),ae=n.mul(Fe,ae),ae=n.add(ae,De),new I(X,te,ae)}subtract(O){return this.add(O.negate())}is0(){return this.equals(I.ZERO)}multiply(O){let{endo:T}=t;if(!i.isValidNot0(O))throw new Error("invalid scalar: out of range");let N,P,M=Y=>L.cached(this,Y,V=>ob(I,V));if(T){let{k1neg:Y,k1:V,k2neg:X,k2:te}=F(O),{p:ae,f:me}=M(V),{p:he,f:De}=M(te);P=me.add(De),N=S(T.beta,ae,he,Y,X)}else{let{p:Y,f:V}=M(O);N=Y,P=V}return ob(I,[N,P])[0]}multiplyUnsafe(O){let{endo:T}=t,N=this;if(!i.isValid(O))throw new Error("invalid scalar: out of range");if(O===Ia||N.is0())return I.ZERO;if(O===kf)return N;if(L.hasCache(this))return this.multiply(O);if(T){let{k1neg:P,k1:M,k2neg:Y,k2:V}=F(O),{p1:X,p2:te}=pF(I,N,M,V);return S(T.beta,X,te,P,Y)}else return L.unsafe(N,O)}toAffine(O){return H(this,O)}isTorsionFree(){let{isTorsionFree:O}=t;return s===kf?!0:O?O(I,this):L.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:O}=t;return s===kf?this:O?O(I,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(O=!0){return qd(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 q=i.BITS,L=new qm(I,t.endo?Math.ceil(q/2):q);return I.BASE.precompute(8),I}function yF(e){return Uint8Array.of(e?2:3)}function EF(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function oz(e,t={}){let{Fn:r}=e,n=t.randomBytes||Uu,i=Object.assign(EF(e.Fp,r),{seed:rb(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 uF(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(!Ff(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=jm(a,u);return Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function fb(e,t,r={}){oi(t),Gc(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes||Uu,i=r.hmac||((T,N)=>Pf(t,T,N)),{Fp:o,Fn:s}=e,{ORDER:a,BITS:u}=s,{keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d}=oz(e,r),v={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},g=a*wF<o.ORDER;function y(T){let N=a>>kf;return T>N}function w(T,N){if(!s.isValidNot0(N))throw new Error(`invalid signature ${T}: out of range 1..Point.Fn.ORDER`);return N}function E(){if(g)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function _(T,N){ub(N);let P=d.signature,M=N==="compact"?P:N==="recovered"?P+1:void 0;return Je(T,M)}class C{r;s;recovery;constructor(N,P,M){if(this.r=w("r",N),this.s=w("s",P),M!=null){if(E(),![0,1,2,3].includes(M))throw new Error("invalid recovery id");this.recovery=M}Object.freeze(this)}static fromBytes(N,P=v.format){_(N,P);let M;if(P==="der"){let{r:te,s:ae}=Ku.toSig(Je(N));return new C(te,ae)}P==="recovered"&&(M=N[0],P="compact",N=N.subarray(1));let Y=d.signature/2,V=N.subarray(0,Y),X=N.subarray(Y,Y*2);return new C(s.fromBytes(V),s.fromBytes(X),M)}static fromHex(N,P){return this.fromBytes(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:M}=this,Y=this.assertRecovery(),V=Y===2||Y===3?P+a:P;if(!o.isValid(V))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let X=o.toBytes(V),te=e.fromBytes(xr(yF((Y&1)===0),X)),ae=s.inv(V),me=H(Je(N,void 0,"msgHash")),he=s.create(-me*ae),De=s.create(M*ae),Pe=e.BASE.multiplyUnsafe(he).add(te.multiplyUnsafe(De));if(Pe.is0())throw new Error("invalid recovery: point at infinify");return Pe.assertValidity(),Pe}hasHighS(){return y(this.s)}toBytes(N=v.format){if(ub(N),N==="der")return Vc(Ku.hexFromSig(this));let{r:P,s:M}=this,Y=s.toBytes(P),V=s.toBytes(M);return N==="recovered"?(E(),xr(Uint8Array.of(this.assertRecovery()),Y,V)):xr(Y,V)}toHex(N){return Kc(this.toBytes(N))}}let F=r.bits2int||function(N){if(N.length>8192)throw new Error("input is too large");let P=Mu(N),M=N.length*8-u;return M>0?P>>BigInt(M):P},H=r.bits2int_modN||function(N){return s.create(F(N))},K=Gd(u);function S(T){return Vd("num < 2^"+u,T,Ia,K),s.toBytes(T)}function I(T,N){return Je(T,void 0,"message"),N?Je(t(T),void 0,"prehashed message"):T}function q(T,N,P){let{lowS:M,prehash:Y,extraEntropy:V}=ab(P,v);T=I(T,Y);let X=H(T),te=s.fromBytes(N);if(!s.isValidNot0(te))throw new Error("invalid private key");let ae=[S(te),S(X)];if(V!=null&&V!==!1){let Pe=V===!0?n(d.secretKey):V;ae.push(Je(Pe,void 0,"extraEntropy"))}let me=xr(...ae),he=X;function De(Pe){let Ie=F(Pe);if(!s.isValidNot0(Ie))return;let se=s.inv(Ie),pe=e.BASE.multiply(Ie).toAffine(),Fe=s.create(pe.x);if(Fe===Ia)return;let Te=s.create(se*s.create(he+Fe*te));if(Te===Ia)return;let Ve=(pe.x===Fe?0:2)|Number(pe.y&kf),Oe=Te;return M&&y(Te)&&(Oe=s.neg(Te),Ve^=1),new C(Fe,Oe,g?void 0:Ve)}return{seed:me,k2sig:De}}function L(T,N,P={}){let{seed:M,k2sig:Y}=q(T,N,P);return ZD(t.outputLen,s.BYTES,i)(M,Y).toBytes(P.format)}function R(T,N,P,M={}){let{lowS:Y,prehash:V,format:X}=ab(M,v);if(P=Je(P,void 0,"publicKey"),N=I(N,V),!Ff(T)){let te=T instanceof C?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}_(T,X);try{let te=C.fromBytes(T,X),ae=e.fromBytes(P);if(Y&&te.hasHighS())return!1;let{r:me,s:he}=te,De=H(N),Pe=s.inv(he),Ie=s.create(De*Pe),se=s.create(me*Pe),pe=e.BASE.multiplyUnsafe(Ie).add(ae.multiplyUnsafe(se));return pe.is0()?!1:s.create(pe.x)===me}catch{return!1}}function O(T,N,P={}){let{prehash:M}=ab(P,v);return N=I(N,M),C.fromBytes(T,"recovered").recoverPublicKey(N).toBytes()}return Object.freeze({keygen:l,getPublicKey:h,getSharedSecret:m,utils:p,lengths:d,Point:e,sign:L,verify:R,recoverPublicKey:O,Signature:C,hash:t})}var Gpe=B(x(),1);var Upe=B(x(),1);var Ppe=B(x(),1);function bF(e,t,r){return e&t^~e&r}function AF(e,t,r){return e&t^e&r^t&r}var Xd=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=Lm(this.buffer)}update(t){Ba(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=Lm(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){Ba(this),Om(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,ys(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=Lm(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()}},xa=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 kpe=B(x(),1),zm=BigInt(4294967295),SF=BigInt(32);function az(e,t=!1){return t?{h:Number(e&zm),l:Number(e>>SF&zm)}:{h:Number(e>>SF&zm)|0,l:Number(e&zm)|0}}function Wm(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}=az(e[o],t);[n[o],i[o]]=[s,a]}return[n,i]}var hb=(e,t,r)=>e>>>r,db=(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,Zd=(e,t,r)=>e<<64-r|t>>>r-32,Jd=(e,t,r)=>e>>>r-32|t<<64-r;var _F=(e,t,r)=>e<<r|t>>>32-r,CF=(e,t,r)=>t<<r|e>>>32-r,DF=(e,t,r)=>t<<r-32|e>>>64-r,FF=(e,t,r)=>e<<r-32|t>>>64-r;function Do(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}var BF=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),IF=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,xF=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),$F=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,PF=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),kF=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;var cz=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]),Vu=new Uint32Array(64),pb=class extends Xd{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)Vu[m]=t.getUint32(r,!1);for(let m=16;m<64;m++){let p=Vu[m-15],d=Vu[m-2],v=Li(p,7)^Li(p,18)^p>>>3,g=Li(d,17)^Li(d,19)^d>>>10;Vu[m]=g+Vu[m-7]+v+Vu[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+bF(a,u,l)+cz[m]+Vu[m]|0,g=(Li(n,2)^Li(n,13)^Li(n,22))+AF(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(){ys(Vu)}destroy(){this.set(0,0,0,0,0,0,0,0),ys(this.buffer)}},mb=class extends pb{A=xa[0]|0;B=xa[1]|0;C=xa[2]|0;D=xa[3]|0;E=xa[4]|0;F=xa[5]|0;G=xa[6]|0;H=xa[7]|0;constructor(){super(32)}};var RF=Wm(["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))),lz=RF[0],fz=RF[1],Gu=new Uint32Array(80),zu=new Uint32Array(80),gb=class extends Xd{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)Gu[_]=t.getUint32(r),zu[_]=t.getUint32(r+=4);for(let _=16;_<80;_++){let C=Gu[_-15]|0,F=zu[_-15]|0,H=Yc(C,F,1)^Yc(C,F,8)^hb(C,F,7),K=Xc(C,F,1)^Xc(C,F,8)^db(C,F,7),S=Gu[_-2]|0,I=zu[_-2]|0,q=Yc(S,I,19)^Zd(S,I,61)^hb(S,I,6),L=Xc(S,I,19)^Jd(S,I,61)^db(S,I,6),R=xF(K,L,zu[_-7],zu[_-16]),O=$F(R,H,q,Gu[_-7],Gu[_-16]);Gu[_]=O|0,zu[_]=R|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:h,Eh:m,El:p,Fh:d,Fl:v,Gh:g,Gl:y,Hh:w,Hl:E}=this;for(let _=0;_<80;_++){let C=Yc(m,p,14)^Yc(m,p,18)^Zd(m,p,41),F=Xc(m,p,14)^Xc(m,p,18)^Jd(m,p,41),H=m&d^~m&g,K=p&v^~p&y,S=PF(E,F,K,fz[_],zu[_]),I=kF(S,w,C,H,lz[_],Gu[_]),q=S|0,L=Yc(n,i,28)^Zd(n,i,34)^Zd(n,i,39),R=Xc(n,i,28)^Jd(n,i,34)^Jd(n,i,39),O=n&o^n&a^o&a,T=i&s^i&u^s&u;w=g|0,E=y|0,g=d|0,y=v|0,d=m|0,v=p|0,{h:m,l:p}=Do(l|0,h|0,I|0,q|0),l=a|0,h=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let N=BF(q,R,T);n=IF(N,I,L,O),i=N|0}({h:n,l:i}=Do(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Do(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=Do(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:h}=Do(this.Dh|0,this.Dl|0,l|0,h|0),{h:m,l:p}=Do(this.Eh|0,this.El|0,m|0,p|0),{h:d,l:v}=Do(this.Fh|0,this.Fl|0,d|0,v|0),{h:g,l:y}=Do(this.Gh|0,this.Gl|0,g|0,y|0),{h:w,l:E}=Do(this.Hh|0,this.Hl|0,w|0,E|0),this.set(n,i,o,s,a,u,l,h,m,p,d,v,g,y,w,E)}roundClean(){ys(Gu,zu)}destroy(){ys(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var vb=class extends gb{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 Ym=Bf(()=>new mb,Hu(1));var TF=Bf(()=>new vb,Hu(2));var hz=BigInt(1),OF=BigInt(2),dz=BigInt(3),pz=BigInt(5),Kpe=BigInt(8),NF=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");function mz(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=NF,a=e*e%o*e%o,u=ai(a,OF,o)*a%o,l=ai(u,hz,o)*e%o,h=ai(l,pz,o)*l%o,m=ai(h,t,o)*h%o,p=ai(m,r,o)*m%o,d=ai(p,n,o)*p%o,v=ai(d,i,o)*d%o,g=ai(v,i,o)*d%o,y=ai(g,t,o)*h%o;return{pow_p_5_8:ai(y,OF,o)*e%o,b2:a}}function gz(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var LF=(()=>{let e=NF;return gF({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=mz(t);return zn(ai(r,dz,e)*n,e)},adjustScalarBytes:gz})})();var Jpe=B(x(),1);var vz={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},wz={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")};var yz=lb(vz),wb=fb(yz,Ym);var Ez=lb(wz),UF=fb(Ez,TF);var r0e=B(x(),1);function MF(e,t,r){return oi(e),r===void 0&&(r=new Uint8Array(e.outputLen)),Pf(e,r,t)}var yb=Uint8Array.of(0),HF=Uint8Array.of();function qF(e,t,r,n=32){oi(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=HF:Je(r,void 0,"info");let s=new Uint8Array(o*i),a=Pf.create(e,t),u=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let h=0;h<o;h++)yb[0]=h+1,u.update(h===0?HF:l).update(r).update(yb).digestInto(l),s.set(l,i*h),a._cloneInto(u);return a.destroy(),u.destroy(),ys(l,yb),s.slice(0,n)}var o0e=B(x(),1);var bz=BigInt(0),Qd=BigInt(1),Az=BigInt(2),Sz=BigInt(7),_z=BigInt(256),Cz=BigInt(113),VF=[],GF=[],zF=[];for(let e=0,t=Qd,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],VF.push(2*(5*n+r)),GF.push((e+1)*(e+2)/2%64);let i=bz;for(let o=0;o<7;o++)t=(t<<Qd^(t>>Sz)*Cz)%_z,t&Az&&(i^=Qd<<(Qd<<BigInt(o))-Qd);zF.push(i)}var WF=Wm(zF,!0),Dz=WF[0],Fz=WF[1],jF=(e,t,r)=>r>32?DF(e,t,r):_F(e,t,r),KF=(e,t,r)=>r>32?FF(e,t,r):CF(e,t,r);function Bz(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=jF(l,h,1)^r[a],p=KF(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=GF[s],u=jF(i,o,a),l=KF(i,o,a),h=VF[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]^=Dz[n],e[1]^=Fz[n]}ys(r)}var Xm=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=Nm(this.state)}clone(){return this._cloneInto()}keccak(){WE(this.state32),Bz(this.state32,this.rounds),WE(this.state32),this.posOut=0,this.pos=0}update(t){Ba(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){Ba(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(Om(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,ys(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}},YF=(e,t,r,n={})=>Bf(()=>new Xm(t,e,r),n);var Zc=YF(6,136,32,Hu(8));var XF=YF(6,72,64,Hu(10));var ZF=(e,t,r,n={})=>Bf((i={})=>new Xm(t,e,i.dkLen===void 0?r:i.dkLen,!0),n),JF=ZF(31,168,16,Hu(11)),Fo=ZF(31,136,32,Hu(12));var C0e=B(x(),1);var w0e=B(x(),1);var u0e=B(x(),1);function Eb(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function eB(e){return Eb(e),(e&e-1)===0&&e!==0}function bb(e,t){Eb(e);let r=0;for(let n=0;n<t;n++,e>>>=1)r=r<<1|e&1;return r}function tB(e){return Eb(e),31-Math.clz32(e)}function QF(e){let t=e.length;if(t<2||!eB(t))throw new Error("n must be a power of 2 and greater than 1. Got "+t);let r=tB(t);for(let n=0;n<t;n++){let i=bb(n,r);if(n<i){let o=e[n];e[n]=e[i],e[i]=o}}return e}var Ab=(e,t)=>{let{N:r,roots:n,dit:i,invertButterflies:o=!1,skipStages:s=0,brp:a=!0}=t,u=tB(r);if(!eB(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&&QF(h);for(let m=0,p=1;m<u-s;m++){let d=i?m+1+s:u-m,v=1<<d,g=v>>1,y=r>>d;for(let w=0;w<r;w+=v)for(let E=0,_=p++;E<g;E++){let C=o?i?r-_:_:E*y,F=w+E,H=w+E+g,K=n[C],S=h[H],I=h[F];if(l){let q=e.mul(S,K);h[F]=e.add(I,q),h[H]=e.sub(I,q)}else o?(h[F]=e.add(S,I),h[H]=e.mul(e.sub(S,I),K)):(h[F]=e.add(I,S),h[H]=e.mul(e.sub(I,S),K))}}return!i&&a&&QF(h),h}};var h0e=B(x(),1);var Bo=Uu;function Zm(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 rB(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 Jm(e,t){let r=t*e.bytesLen;return{bytesLen:r,encode:n=>{if(n.length!==t)throw new Error(`vecCoder.encode: wrong length=${n.length}. Expected: ${t}`);let i=new Uint8Array(r);for(let o=0,s=0;o<n.length;o++){let a=e.encode(n[o]);i.set(a,s),a.fill(0),s+=a.length}return i},decode:n=>{Je(n,r);let i=[];for(let o=0;o<n.length;o+=e.bytesLen)i.push(e.decode(n.subarray(o,o+e.bytesLen)));return i}}}function qr(...e){for(let t of e)if(Array.isArray(t))for(let r of t)r.fill(0);else t.fill(0)}function Sb(e){return(1<<e)-1}var l0e=Uint8Array.of();var nB=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=bb(_,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=Ab(p,{dit:!1,...d}),g=Ab(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=Sb(E),F=E*(r/8);return{bytesLen:F,encode:H=>{let K=new Uint8Array(F);for(let S=0,I=0,q=0,L=0;S<H.length;S++)for(I|=(_.encode(H[S])&C)<<q,q+=E;q>=8;q-=8,I>>=8)K[L++]=I&Sb(q);return K},decode:H=>{let K=t(r);for(let S=0,I=0,q=0,L=0;S<H.length;S++)for(I|=H[S]<<q,q+=8;q>=E;q-=E,I>>=E)K[L++]=_.decode(I&C);return K}}}}},Iz=e=>(t,r)=>{r||(r=e.blockLen);let n=new Uint8Array(t.length+2);n.set(t);let i=t.length,o=new Uint8Array(r),s=e.create({}),a=0,u=0;return{stats:()=>({calls:a,xofs:u}),get:(l,h)=>(n[i+0]=l,n[i+1]=h,s.destroy(),s=e.create({}).update(n),a++,()=>(u++,s.xofInto(o))),clean:()=>{s.destroy(),qr(o,n)}}},sB=Iz(JF);var kn=256,$a=3329,xz=3303,$z=17,{mod:rp,nttZetas:Pz,NTT:Qc,bitsCoder:kz}=nB({N:kn,Q:$a,F:xz,ROOT_OF_UNITY:$z,newPoly:e=>new Uint16Array(e),brvBits:7,isKyber:!0}),_b={512:{N:kn,Q:$a,K:2,ETA1:3,ETA2:2,du:10,dv:4,RBGstrength:128},768:{N:kn,Q:$a,K:3,ETA1:2,ETA2:2,du:10,dv:4,RBGstrength:192},1024:{N:kn,Q:$a,K:4,ETA1:2,ETA2:2,du:11,dv:5,RBGstrength:256}},Rz=e=>{if(e>=12)return{encode:r=>r,decode:r=>r};let t=2**(e-1);return{encode:r=>((r<<e)+$a/2)/$a,decode:r=>r*$a+t>>>e}},ep=e=>kz(e,Rz(e));function el(e,t){for(let r=0;r<kn;r++)e[r]=rp(e[r]+t[r])}function Tz(e,t){for(let r=0;r<kn;r++)e[r]=rp(e[r]-t[r])}function Oz(e,t,r,n,i){let o=rp(t*n*i+e*r),s=rp(e*n+t*r);return{c0:o,c1:s}}function Qm(e,t){for(let r=0;r<kn/2;r++){let n=Pz[64+(r>>1)];r&1&&(n=-n);let{c0:i,c1:o}=Oz(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 iB(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<$a&&(t[r++]=o),r<kn&&s<$a&&(t[r++]=s)}}return t}function tp(e,t,r,n){let i=e(n*kn/4,t,r),o=new Uint16Array(kn),s=Nm(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++]=rp(m-h),h=0,a=0)}if(a)throw new Error(`sampleCBD: leftover bits: ${a}`);return o}var Nz=e=>{let{K:t,PRF:r,XOF:n,HASH512:i,ETA1:o,ETA2:s,du:a,dv:u}=e,l=ep(1),h=ep(u),m=ep(a),p=Jc("publicKey",Jm(ep(12),t),32),d=Jm(ep(12),t),v=Jc("ciphertext",Jm(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(tp(r,C,I,o)));let K=n(_);for(let I=0;I<t;I++){let q=Qc.encode(tp(r,C,t+I,o));for(let L=0;L<t;L++){let R=iB(K.get(L,I));el(q,Qm(R,F[L]))}H.push(q)}K.clean();let S={publicKey:p.encode([H,_]),secretKey:d.encode(F)};return qr(_,C,F,H,w,E),S},encrypt:(y,w,E)=>{let[_,C]=p.decode(y),F=[];for(let L=0;L<t;L++)F.push(Qc.encode(tp(r,E,L,o)));let H=n(C),K=new Uint16Array(kn),S=[];for(let L=0;L<t;L++){let R=tp(r,E,t+L,s),O=new Uint16Array(kn);for(let T=0;T<t;T++){let N=iB(H.get(L,T));el(O,Qm(N,F[T]))}el(R,Qc.decode(O)),S.push(R),el(K,Qm(_[L],F[L])),qr(O)}H.clean();let I=tp(r,E,2*t,s);el(I,Qc.decode(K));let q=l.decode(w);return el(q,I),qr(_,F,K,I),v.encode([S,q])},decrypt:(y,w)=>{let[E,_]=v.decode(y),C=d.decode(w),F=new Uint16Array(kn);for(let H=0;H<t;H++)el(F,Qm(C[H],Qc.encode(E[H])));return Tz(_,Qc.decode(F)),qr(F,C,E),l.encode(_)}}};function Cb(e){let t=Nz(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=Bo(l))=>{Je(h,l,"seed");let{publicKey:m,secretKey:p}=t.keygen(h.subarray(0,32)),d=r(m),v=a.encode([p,m,d,h.subarray(32)]);return qr(p,d),{publicKey:m,secretKey:v}},getPublicKey:h=>{let[m,p,d,v]=a.decode(h);return Uint8Array.from(p)},encapsulate:(h,m=Bo(u))=>{Je(h,s.publicKey,"publicKey"),Je(m,u,"message");let p=h.subarray(0,384*e.K),d=o.encode(o.decode(rB(p)));if(!Zm(d,p))throw qr(d),new Error("ML-KEM.encapsulate: wrong publicKey modulus");qr(d);let v=n.create().update(m).update(r(h)).digest(),g=t.encrypt(h,m,v.subarray(32,64));return qr(v.subarray(32)),{cipherText:g,sharedSecret:v.subarray(0,32)}},decapsulate:(h,m)=>{Je(m,a.bytesLen,"secretKey"),Je(h,s.cipherText,"cipherText");let p=a.bytesLen-96,d=p+32,v=r(m.subarray(p/2,d));if(!Zm(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=Zm(h,H),S=i.create({dkLen:32}).update(E).update(h).digest();return qr(_,H,K?S:F),K?F:S}}}function Lz(e,t,r){return Fo.create({dkLen:e}).update(t).update(new Uint8Array([r])).digest()}var Db={HASH256:Zc,HASH512:XF,KDF:Fo,XOF:sB,PRF:Lz},S0e=Cb({...Db,..._b[512]}),np=Cb({...Db,..._b[768]}),oB=Cb({...Db,..._b[1024]});function Uz(e,t=!1){let r=e.lengths,n=e.keygen;if(t){let o=e.Point.Fn;if(!o)throw new Error("No Point.Fn");n=(s=Bo(r.seed))=>{Je(s,r.seed,"seed");let a=o.isLE?qu(s):Mu(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 Fb(e,t=!1){let r=Uz(e,t);if(!e.getSharedSecret)throw new Error("wrong curve");return{lengths:{...r.lengths,msg:r.lengths.seed,cipherText:r.lengths.publicKey},keygen:r.keygen,getPublicKey:r.getPublicKey,encapsulate(n,i=Bo(e.lengths.seed)){let o=this.keygen(i).secretKey,s=this.decapsulate(n,o),a=e.getPublicKey(o);return qr(o),{sharedSecret:s,cipherText:a}},decapsulate(n,i){let o=e.getSharedSecret(i,n);return e.lengths.publicKeyHasPrefix?o.subarray(1):o}}}function sp(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 Bb(e){return(t,r)=>e(t,{dkLen:r})}function Hz(e,t,...r){let n=sp(r,"seed"),i=sp(r,"publicKey");e===void 0&&(e=n.bytesLen),Zr(e);function o(s){Je(s,e);let a=n.decode(t(s,n.bytesLen)),u=r.map((m,p)=>m.keygen(a[p])),l=u.map(m=>m.secretKey),h=u.map(m=>m.publicKey);return{secretKey:l,publicKey:h}}return{info:{lengths:{seed:e,publicKey:i.bytesLen,secretKey:e}},getPublicKey(s){return this.keygen(s).publicKey},keygen(s=Bo(e)){let{publicKey:a,secretKey:u}=o(s),l=i.encode(a);return qr(a),qr(u),{secretKey:s,publicKey:l}},expandDecapsulationKey:o,realSeedLen:e}}function eg(e,t,r,n,...i){let o=Hz(e,r,...i),s=sp(i,"cipherText"),a=sp(i,"publicKey"),u=sp(i,"msg");return t===void 0&&(t=u.bytesLen),Zr(t),{lengths:{...o.info.lengths,msg:t,msgRand:u.bytesLen,cipherText:s.bytesLen},getPublicKey:o.getPublicKey,keygen:o.keygen,encapsulate(l,h=Bo(u.bytesLen)){let m=a.decode(l),p=u.decode(h),d=i.map((w,E)=>w.encapsulate(m[E],p[E])),v=d.map(w=>w.sharedSecret),g=d.map(w=>w.cipherText),y={sharedSecret:n(m,g,v),cipherText:s.encode(g)};return qr(v,g),y},decapsulate(l,h){let m=s.decode(l),{publicKey:p,secretKey:d}=o.expandDecapsulationKey(h),v=i.map((g,y)=>g.decapsulate(m[y],d[y]));return n(p,m,v)}}}function aB(e,t,r,n,i){return oi(n),oi(i),eg(32,32,Bb(n),(o,s,a)=>i(xr(a[0],a[1],s[1],o[1],ju(e))),t,r)}var T0e=aB("QSF-KEM(ML-KEM-768,P-256)-XOF(SHAKE256)-KDF(SHA3-256)",np,Fb(wb,!0),Fo,Zc),O0e=aB("QSF-KEM(ML-KEM-1024,P-384)-XOF(SHAKE256)-KDF(SHA3-256)",oB,Fb(UF,!0),Fo,Zc);function Mz(e,t,r,n,i){return oi(n),oi(i),eg(32,32,Bb(n),(o,s,a)=>{let u=xr(a[0],a[1],s[0],o[0],s[1],o[1],ju(e)),l=32,h=xr(ju("hybrid_prk"),u),m=MF(i,h),p=xr(If(l,2),ju("shared_secret"),ju("")),d=qF(i,m,p,l);return qr(m,p,h,u),d},t,r)}var uB=Fb(LF),N0e=Mz("KitchenSink-KEM(ML-KEM-768,X25519)-XOF(SHAKE256)-KDF(HKDF-SHA-256)",np,uB,Fo,Ym),qz=eg(32,32,Bb(Fo),(e,t,r)=>Zc(xr(r[0],r[1],t[1],e[1],ju("\\.//^\\"))),np,uB);function jz(e,t,r,n){let i=e.Point.Fn;if(!i)throw new Error("no Point.Fn");function o(s){let a;for(let h=0,m=t;;h=m,m+=t){if(m>s.length)throw new Error("rejection sampling failed");if(a=i.fromBytes(s.subarray(h,m),!0),i.isValidNot0(a))break}let u=i.toBytes(i.create(a)),l=e.getPublicKey(u,!1);return{secretKey:u,publicKey:l}}return{lengths:{secretKey:t,publicKey:r,seed:n,msg:n,cipherText:r},keygen(s=Bo(n)){return Je(s,n,"seed"),o(s)},getPublicKey(s){return e.getPublicKey(s,!1)},encapsulate(s,a=Bo(n)){Je(a,n,"rand");let{secretKey:u}=o(a),l=this.decapsulate(s,u),h=e.getPublicKey(u,!1);return qr(u),{sharedSecret:l,cipherText:h}},decapsulate(s,a){return e.getSharedSecret(a,s).subarray(1)}}}function Kz(e,t,r,n){let{secretKey:i,publicKeyUncompressed:o}=r.lengths;if(!i||!o)throw new Error("wrong curve");let s=jz(r,i,o,n),a=64,u=a+n;return eg(32,32,l=>{Je(l,32);let h=Fo(l,{dkLen:u}),m=h.subarray(0,a),p=h.subarray(a,u);return xr(m,p)},(l,h,m)=>Zc(xr(m[0],m[1],h[1],l[1],ju(e))),t,s)}var Vz=Kz("MLKEM768-P256",np,wb,128);var tg=qz,cB=Vz;var h1e=B(x(),1);var q0e=B(x(),1);var Qt=(e,t,r)=>nn(e,t,r),xb=Cr,Rf=Fm,un=(...e)=>bE(...e),Tf=e=>Rd(e),Of=wE,Nf=e=>Ru(e),ng=BigInt(0),Ib=BigInt(1);function Pa(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new TypeError(r+"expected boolean, got type="+typeof e)}return e}function sg(e){if(typeof e=="bigint"){if(!rg(e))throw new RangeError("positive bigint expected, got "+e)}else xb(e);return e}function Io(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw new RangeError(r+"expected safe integer, got "+e)}}function ip(e){let t=sg(e).toString(16);return t.length&1?"0"+t:t}function lB(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?ng:BigInt("0x"+e)}function tl(e){return lB(Fm(e))}function Ui(e){return lB(Fm(Wu(nn(e)).reverse()))}function ig(e,t){if(Cr(t),t===0)throw new RangeError("zero length");e=sg(e);let r=e.toString(16);if(r.length>t*2)throw new RangeError("number too large");return Rd(r.padStart(t*2,"0"))}function op(e,t){return ig(e,t).reverse()}function fB(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 Wu(e){return Uint8Array.from(Qt(e))}function og(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 rg=e=>typeof e=="bigint"&&ng<=e;function Gz(e,t,r){return rg(e)&&rg(t)&&rg(r)&&t<=e&&e<r}function ka(e,t,r,n){if(!Gz(t,r,n))throw new RangeError("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function Lf(e){if(e<ng)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>ng;e>>=Ib,t+=1);return t}var ap=e=>(Ib<<BigInt(e))-Ib;function hB(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 ui(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 $b=()=>{throw new Error("not implemented")};var Y0e=B(x(),1);var V0e=B(x(),1);var cn=BigInt(0),mr=BigInt(1),rl=BigInt(2),gB=BigInt(3),vB=BigInt(4),wB=BigInt(5),zz=BigInt(7),yB=BigInt(8),Wz=BigInt(9),EB=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 ci(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 dB(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 Pb(e,t,r){let n=e;if(!n.eql(n.sqr(t),r))throw new Error("Cannot find square root")}function bB(e,t){let r=e,n=(r.ORDER+mr)/vB,i=r.pow(t,n);return Pb(r,i,t),i}function Yz(e,t){let r=e,n=(r.ORDER-wB)/yB,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 Pb(r,u,t),u}function Xz(e){let t=ug(e),r=AB(e),n=r(t,t.neg(t.ONE)),i=r(t,n),o=r(t,t.neg(n)),s=(e+zz)/EB;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 Pb(l,w,u),w})}function AB(e){if(e<gB)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=ug(e);for(;pB(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return bB;let o=i.pow(n,t),s=(t+mr)/rl;return function(u,l){let h=u;if(h.is0(l))return l;if(pB(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 Zz(e){return e%vB===gB?bB:e%yB===wB?Yz:e%EB===Wz?Xz(e):AB(e)}var Ra=(e,t)=>(ir(e,t)&mr)===mr,Jz=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function kb(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=Jz.reduce((n,i)=>(n[i]="function",n),t);if(ui(e,r),Io(e.BYTES,"BYTES"),Io(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=mr)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function Qz(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 up(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 pB(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 eW(e,t){if(t!==void 0&&xb(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=Lf(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 mB=new WeakMap,ag=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}=eW(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 Qz(this,t,r)}div(t,r){return ir(t*dB(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 dB(t,this.ORDER)}sqrt(t){let r=mB.get(this);return r||mB.set(this,r=Zz(this.ORDER)),r(this,t)}toBytes(t){return this.isLE?op(t,this.BYTES):ig(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 up(this,t)}cmov(t,r,n){return Pa(n,"condition"),n?r:t}};Object.freeze(ag.prototype);function ug(e,t={}){return new ag(e,t)}function SB(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=Lf(e-mr);return Math.ceil(t/8)}function Rb(e){let t=SB(e);return t+Math.ceil(t/2)}function _B(e,t,r=!1){Qt(e);let n=e.length,i=SB(t),o=Math.max(Rb(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?op(a,i):ig(a,i)}var Uf=BigInt(0),nl=BigInt(1);function cp(e,t){let r=t.negate();return e?r:t}function sl(e,t){let r=up(e.Fp,t.map(n=>n.Z));return t.map((n,i)=>e.fromAffine(n.toAffine(r[i])))}function BB(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Tb(e,t){BB(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e,o=ap(e),s=BigInt(e);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function CB(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 Ob=new WeakMap,IB=new WeakMap;function Nb(e){return IB.get(e)||1}function DB(e){if(e!==Uf)throw new Error("invalid wNAF")}var Hf=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>Uf;)r&nl&&(n=n.add(i)),i=i.double(),r>>=nl;return n}precomputeWindow(t,r){let{windows:n,windowSize:i}=Tb(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=Tb(t,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:l,isZero:h,isNeg:m,isNegF:p,offsetF:d}=CB(n,a,s);n=u,h?o=o.add(cp(p,r[d])):i=i.add(cp(m,r[l]))}return DB(n),{p:i,f:o}}wNAFUnsafe(t,r,n,i=this.ZERO){let o=Tb(t,this.bits);for(let s=0;s<o.windows&&n!==Uf;s++){let{nextN:a,offset:u,isZero:l,isNeg:h}=CB(n,s,o);if(n=a,!l){let m=r[u];i=i.add(h?m.negate():m)}}return DB(n),i}getPrecomputes(t,r,n){let i=Ob.get(r);return i||(i=this.precomputeWindow(r,t),t!==1&&(typeof n=="function"&&(i=n(i)),Ob.set(r,i))),i}cached(t,r,n){let i=Nb(t);return this.wNAF(i,this.getPrecomputes(i,t,n),r)}unsafe(t,r,n,i){let o=Nb(t);return o===1?this._unsafeLadder(t,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,t,n),r,i)}createCache(t,r){BB(r,this.bits),IB.set(t,r),Ob.delete(t)}hasCache(t){return Nb(t)!==1}};function xB(e,t,r,n){let i=t,o=e.ZERO,s=e.ZERO;for(;r>Uf||n>Uf;)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 FB(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return kb(t),t}else return ug(e,{isLE:r})}function cg(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>Uf))throw new Error(`CURVE.${u} must be positive bigint`)}let i=FB(t.p,r.Fp,n),o=FB(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 lp(e,t){return function(n){let i=e(n);return{secretKey:i,publicKey:t(i)}}}var J0e=B(x(),1);function fp(e,t){if(Io(e),Io(t),t<0||t>4)throw new Error("invalid I2OSP length: "+t);if(e<0||e>2**(8*t)-1)throw new Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=e&255,e>>>=8;return new Uint8Array(r)}function tW(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 rW(e){if(!Of(e)&&typeof e!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof e=="string"?og(e):e;if(t.length===0)throw new Error("DST must be non-empty");return t}function Lb(e,t,r,n){Qt(e),Io(r),t=rW(t),t.length>255&&(t=n(un(og("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,fp(t.length,1)),u=new Uint8Array(o),l=fp(r,2),h=new Array(s),m=n(un(u,e,l,fp(0,1),a));h[0]=n(un(m,fp(1,1),a));for(let d=1;d<s;d++){let v=[tW(m,h[d-1]),fp(d+1,1),a];h[d]=n(un(...v))}return un(...h).slice(0,r)}var $B="HashToScalar-";var o1e=B(x(),1);var PB=(e,t)=>(e+(e>=0?t:-t)/kB)/t;function nW(e,t,r){ka("scalar",e,xo,r);let[[n,i],[o,s]]=t,a=PB(s*e,r),u=PB(-i*e,r),l=e-a*n-u*o,h=-a*i-u*s,m=l<xo,p=h<xo;m&&(l=-l),p&&(h=-h);let d=ap(Math.ceil(Lf(r)/2))+Yu;if(l<xo||l>=d||h<xo||h>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:l,k2neg:p,k2:h}}function Hb(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Ub(e,t){ui(e);let r={};for(let n of Object.keys(t))r[n]=e[n]===void 0?t[n]:e[n];return Pa(r.lowS,"lowS"),Pa(r.prehash,"prehash"),r.format!==void 0&&Hb(r.format),r}var Mb=class extends Error{constructor(t=""){super(t)}},Hi={Err:Mb,_tlv:{encode:(e,t)=>{let{Err:r}=Hi;if(Io(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=ip(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?ip(i.length/2|128):"";return ip(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(sg(e),e<xo)throw new t("integer: negative integers are not allowed");let r=ip(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 xo=BigInt(0),Yu=BigInt(1),kB=BigInt(2),lg=BigInt(3),sW=BigInt(4);function RB(e,t={}){let r=cg("weierstrass",e,t),n=r.Fp,i=r.Fn,o=r.CURVE,{h:s,n:a}=o;ui(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=OB(n,i);function m(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function p(L,R,O){if(l&&R.is0())return Uint8Array.of(0);let{x:T,y:N}=R.toAffine(),P=n.toBytes(T);if(Pa(O,"isCompressed"),O){m();let M=!n.isOdd(N);return un(TB(M),P)}else return un(Uint8Array.of(4),P,n.toBytes(N))}function d(L){Qt(L,void 0,"Point");let{publicKey:R,publicKeyUncompressed:O}=h,T=L.length,N=L[0],P=L.subarray(1);if(l&&T===1&&N===0)return{x:n.ZERO,y:n.ZERO};if(T===R&&(N===2||N===3)){let M=n.fromBytes(P);if(!n.isValid(M))throw new Error("bad point: is not on curve, wrong x");let Y=y(M),V;try{V=n.sqrt(Y)}catch(ae){let me=ae instanceof Error?": "+ae.message:"";throw new Error("bad point: is not on curve, sqrt error"+me)}m();let X=n.isOdd(V);return(N&1)===1!==X&&(V=n.neg(V)),{x:M,y:V}}else if(T===O&&N===4){let M=n.BYTES,Y=n.fromBytes(P.subarray(0,M)),V=n.fromBytes(P.subarray(M,M*2));if(!w(Y,V))throw new Error("bad point: is not on curve");return{x:Y,y:V}}else throw new Error(`bad point: got length ${T}, expected compressed=${R} or uncompressed=${O}`)}let v=t.toBytes===void 0?p:t.toBytes,g=t.fromBytes===void 0?d:t.fromBytes;function y(L){let R=n.sqr(L),O=n.mul(R,L);return n.add(n.add(O,n.mul(L,o.a)),o.b)}function w(L,R){let O=n.sqr(R),T=y(L);return n.eql(O,T)}if(!w(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let E=n.mul(n.pow(o.a,lg),sW),_=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(E,_)))throw new Error("bad curve params: a or b");function C(L,R,O=!1){if(!n.isValid(R)||O&&n.is0(R))throw new Error(`bad point coordinate ${L}`);return R}function F(L){if(!(L instanceof S))throw new Error("Weierstrass Point expected")}function H(L){if(!u||!u.basises)throw new Error("no endo");return nW(L,u.basises,i.ORDER)}function K(L,R,O,T,N){return O=new S(n.mul(O.X,L),O.Y,O.Z),R=cp(T,R),O=cp(N,O),R.add(O)}class S{static BASE=new S(o.Gx,o.Gy,n.ONE);static ZERO=new S(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(R,O,T){this.X=C("x",R),this.Y=C("y",O,!0),this.Z=C("z",T),Object.freeze(this)}static CURVE(){return o}static fromAffine(R){let{x:O,y:T}=R||{};if(!R||!n.isValid(O)||!n.isValid(T))throw new Error("invalid affine point");if(R instanceof S)throw new Error("projective point not allowed");return n.is0(O)&&n.is0(T)?S.ZERO:new S(O,T,n.ONE)}static fromBytes(R){let O=S.fromAffine(g(Qt(R,void 0,"point")));return O.assertValidity(),O}static fromHex(R){return S.fromBytes(Tf(R))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(R=8,O=!0){return q.createCache(this,R),O||this.multiply(lg),this}assertValidity(){let R=this;if(R.is0()){if(t.allowInfinityPoint&&n.is0(R.X)&&n.eql(R.Y,n.ONE)&&n.is0(R.Z))return;throw new Error("bad point: ZERO")}let{x:O,y:T}=R.toAffine();if(!n.isValid(O)||!n.isValid(T))throw new Error("bad point: x or y not field elements");if(!w(O,T))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:R}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(R)}equals(R){F(R);let{X:O,Y:T,Z:N}=this,{X:P,Y:M,Z:Y}=R,V=n.eql(n.mul(O,Y),n.mul(P,N)),X=n.eql(n.mul(T,Y),n.mul(M,N));return V&&X}negate(){return new S(this.X,n.neg(this.Y),this.Z)}double(){let{a:R,b:O}=o,T=n.mul(O,lg),{X:N,Y:P,Z:M}=this,Y=n.ZERO,V=n.ZERO,X=n.ZERO,te=n.mul(N,N),ae=n.mul(P,P),me=n.mul(M,M),he=n.mul(N,P);return he=n.add(he,he),X=n.mul(N,M),X=n.add(X,X),Y=n.mul(R,X),V=n.mul(T,me),V=n.add(Y,V),Y=n.sub(ae,V),V=n.add(ae,V),V=n.mul(Y,V),Y=n.mul(he,Y),X=n.mul(T,X),me=n.mul(R,me),he=n.sub(te,me),he=n.mul(R,he),he=n.add(he,X),X=n.add(te,te),te=n.add(X,te),te=n.add(te,me),te=n.mul(te,he),V=n.add(V,te),me=n.mul(P,M),me=n.add(me,me),te=n.mul(me,he),Y=n.sub(Y,te),X=n.mul(me,ae),X=n.add(X,X),X=n.add(X,X),new S(Y,V,X)}add(R){F(R);let{X:O,Y:T,Z:N}=this,{X:P,Y:M,Z:Y}=R,V=n.ZERO,X=n.ZERO,te=n.ZERO,ae=o.a,me=n.mul(o.b,lg),he=n.mul(O,P),De=n.mul(T,M),Pe=n.mul(N,Y),Ie=n.add(O,T),se=n.add(P,M);Ie=n.mul(Ie,se),se=n.add(he,De),Ie=n.sub(Ie,se),se=n.add(O,N);let pe=n.add(P,Y);return se=n.mul(se,pe),pe=n.add(he,Pe),se=n.sub(se,pe),pe=n.add(T,N),V=n.add(M,Y),pe=n.mul(pe,V),V=n.add(De,Pe),pe=n.sub(pe,V),te=n.mul(ae,se),V=n.mul(me,Pe),te=n.add(V,te),V=n.sub(De,te),te=n.add(De,te),X=n.mul(V,te),De=n.add(he,he),De=n.add(De,he),Pe=n.mul(ae,Pe),se=n.mul(me,se),De=n.add(De,Pe),Pe=n.sub(he,Pe),Pe=n.mul(ae,Pe),se=n.add(se,Pe),he=n.mul(De,se),X=n.add(X,he),he=n.mul(pe,se),V=n.mul(Ie,V),V=n.sub(V,he),he=n.mul(Ie,De),te=n.mul(pe,te),te=n.add(te,he),new S(V,X,te)}subtract(R){return F(R),this.add(R.negate())}is0(){return this.equals(S.ZERO)}multiply(R){let{endo:O}=t;if(!i.isValidNot0(R))throw new RangeError("invalid scalar: out of range");let T,N,P=M=>q.cached(this,M,Y=>sl(S,Y));if(O){let{k1neg:M,k1:Y,k2neg:V,k2:X}=H(R),{p:te,f:ae}=P(Y),{p:me,f:he}=P(X);N=ae.add(he),T=K(O.beta,te,me,M,V)}else{let{p:M,f:Y}=P(R);T=M,N=Y}return sl(S,[T,N])[0]}multiplyUnsafe(R){let{endo:O}=t,T=this,N=R;if(!i.isValid(N))throw new RangeError("invalid scalar: out of range");if(N===xo||T.is0())return S.ZERO;if(N===Yu)return T;if(q.hasCache(this))return this.multiply(N);if(O){let{k1neg:P,k1:M,k2neg:Y,k2:V}=H(N),{p1:X,p2:te}=xB(S,T,M,V);return K(O.beta,X,te,P,Y)}else return q.unsafe(T,N)}toAffine(R){let O=this,T=R,{X:N,Y:P,Z:M}=O;if(n.eql(M,n.ONE))return{x:N,y:P};let Y=O.is0();T==null&&(T=Y?n.ONE:n.inv(M));let V=n.mul(N,T),X=n.mul(P,T),te=n.mul(M,T);if(Y)return{x:n.ZERO,y:n.ZERO};if(!n.eql(te,n.ONE))throw new Error("invZ was invalid");return{x:V,y:X}}isTorsionFree(){let{isTorsionFree:R}=t;return s===Yu?!0:R?R(S,this):q.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:R}=t;return s===Yu?this:R?R(S,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===Yu?this.is0():this.clearCofactor().is0()}toBytes(R=!0){return Pa(R,"isCompressed"),this.assertValidity(),v(S,this,R)}toHex(R=!0){return Rf(this.toBytes(R))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let I=i.BITS,q=new Hf(S,t.endo?Math.ceil(I/2):I);return I>=8&&S.BASE.precompute(8),Object.freeze(S.prototype),Object.freeze(S),S}function TB(e){return Uint8Array.of(e?2:3)}function OB(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function iW(e,t={}){let{Fn:r}=e,n=t.randomBytes===void 0?Nf:t.randomBytes,i=Object.assign(OB(e.Fp,r),{seed:Math.max(Rb(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,_B(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(!Of(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=lp(a,u);return Object.freeze(m),Object.freeze(i),Object.freeze({getPublicKey:u,getSharedSecret:h,keygen:p,Point:e,utils:m,lengths:i})}function NB(e,t,r={}){let n=t;_a(n),ui(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let i=r.randomBytes===void 0?Nf:r.randomBytes,o=r.hmac===void 0?(N,P)=>So(n,N,P):r.hmac,{Fp:s,Fn:a}=e,{ORDER:u,BITS:l}=a,{keygen:h,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v}=iW(e,r),g={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},y=u*kB+Yu<s.ORDER;function w(N){let P=u>>Yu;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){Hb(P);let M=v.signature,Y=P==="compact"?M:P==="recovered"?M+1:void 0;return Qt(N,Y)}class F{r;s;recovery;constructor(P,M,Y){if(this.r=E("r",P),this.s=E("s",M),Y!=null){if(_(),![0,1,2,3].includes(Y))throw new Error("invalid recovery id");this.recovery=Y}Object.freeze(this)}static fromBytes(P,M=g.format){C(P,M);let Y;if(M==="der"){let{r:ae,s:me}=Hi.toSig(Qt(P));return new F(ae,me)}M==="recovered"&&(Y=P[0],M="compact",P=P.subarray(1));let V=v.signature/2,X=P.subarray(0,V),te=P.subarray(V,V*2);return new F(a.fromBytes(X),a.fromBytes(te),Y)}static fromHex(P,M){return this.fromBytes(Tf(P),M)}assertRecovery(){let{recovery:P}=this;if(P==null)throw new Error("invalid recovery id: must be present");return P}addRecoveryBit(P){return new F(this.r,this.s,P)}recoverPublicKey(P){let{r:M,s:Y}=this,V=this.assertRecovery(),X=V===2||V===3?M+u:M;if(!s.isValid(X))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let te=s.toBytes(X),ae=e.fromBytes(un(TB((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(Hb(P),P==="der")return Tf(Hi.hexFromSig(this));let{r:M,s:Y}=this,V=a.toBytes(M),X=a.toBytes(Y);return P==="recovered"?(_(),un(Uint8Array.of(this.assertRecovery()),V,X)):un(V,X)}toHex(P){return Rf(this.toBytes(P))}}Object.freeze(F.prototype),Object.freeze(F);let H=r.bits2int===void 0?function(P){if(P.length>8192)throw new Error("input is too large");let M=tl(P),Y=P.length*8-l;return Y>0?M>>BigInt(Y):M}:r.bits2int,K=r.bits2int_modN===void 0?function(P){return a.create(H(P))}:r.bits2int_modN,S=ap(l);function I(N){return ka("num < 2^"+l,N,xo,S),a.toBytes(N)}function q(N,P){return Qt(N,void 0,"message"),P?Qt(n(N),void 0,"prehashed message"):N}function L(N,P,M){let{lowS:Y,prehash:V,extraEntropy:X}=Ub(M,g);N=q(N,V);let te=K(N),ae=a.fromBytes(P);if(!a.isValidNot0(ae))throw new Error("invalid private key");let me=[I(ae),I(te)];if(X!=null&&X!==!1){let Ie=X===!0?i(v.secretKey):X;me.push(Qt(Ie,void 0,"extraEntropy"))}let he=un(...me),De=te;function Pe(Ie){let se=H(Ie);if(!a.isValidNot0(se))return;let pe=a.inv(se),Fe=e.BASE.multiply(se).toAffine(),Te=a.create(Fe.x);if(Te===xo)return;let Ve=a.create(pe*a.create(De+Te*ae));if(Ve===xo)return;let Oe=(Fe.x===Te?0:2)|Number(Fe.y&Yu),pt=Ve;return Y&&w(Ve)&&(pt=a.neg(Ve),Oe^=1),new F(Te,pt,y?void 0:Oe)}return{seed:he,k2sig:Pe}}function R(N,P,M={}){let{seed:Y,k2sig:V}=L(N,P,M);return hB(n.outputLen,a.BYTES,o)(Y,V).toBytes(M.format)}function O(N,P,M,Y={}){let{lowS:V,prehash:X,format:te}=Ub(Y,g);if(M=Qt(M,void 0,"publicKey"),P=q(P,X),!Of(N)){let ae=N instanceof F?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+ae)}C(N,te);try{let ae=F.fromBytes(N,te),me=e.fromBytes(M);if(V&&ae.hasHighS())return!1;let{r:he,s:De}=ae,Pe=K(P),Ie=a.inv(De),se=a.create(Pe*Ie),pe=a.create(he*Ie),Fe=e.BASE.multiplyUnsafe(se).add(me.multiplyUnsafe(pe));return Fe.is0()?!1:a.create(Fe.x)===he}catch{return!1}}function T(N,P,M={}){let{prehash:Y}=Ub(M,g);return P=q(P,Y),F.fromBytes(N,"recovered").recoverPublicKey(P).toBytes()}return Object.freeze({keygen:h,getPublicKey:m,getSharedSecret:p,utils:d,lengths:v,Point:e,sign:R,verify:O,recoverPublicKey:T,Signature:F,hash:n})}var oW={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")};var aW=RB(oW),Mf=NB(aW,Dr);var T1e=B(x(),1);var k1e=B(x(),1);var g1e=B(x(),1);var Xu=BigInt(0),Es=BigInt(1),qb=BigInt(2),uW=BigInt(8);function cW(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 LB(e,t={}){let r=t,n=cg("edwards",e,r,r.FpFnLE),{Fp:i,Fn:o}=n,s=n.CURVE,{h:a}=s;ui(r,{},{uvRatio:"function"});let u=qb<<BigInt(o.BYTES*8)-Es,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:Xu}}}:r.uvRatio;if(!cW(i,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function m(g,y,w=!1){let E=w?Es:Xu;return ka("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,Es,l(s.Gx*s.Gy));static ZERO=new d(Xu,Es,Es,Xu);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,Es,l(w*E))}static fromBytes(y,w=!1){let E=i.BYTES,{a:_,d:C}=s;y=Wu(Qt(y,E,"point")),Pa(w,"zip215");let F=Wu(y),H=y[E-1];F[E-1]=H&-129;let K=Ui(F),S=w?u:i.ORDER;ka("point.y",K,Xu,S);let I=l(K*K),q=l(I-Es),L=l(C*I-_),{isValid:R,value:O}=h(q,L);if(!R)throw new Error("bad point: invalid y coordinate");let T=(O&Es)===Es,N=(H&128)!==0;if(!w&&O===Xu&&N)throw new Error("bad point: x=0 and x_0=1");return N!==T&&(O=l(-O)),d.fromAffine({x:O,y:K})}static fromHex(y,w=!1){return d.fromBytes(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(qb),this}assertValidity(){let y=this,{a:w,d:E}=s;if(y.is0())throw new Error("bad point: ZERO");let{X:_,Y:C,Z:F,T:H}=y,K=l(_*_),S=l(C*C),I=l(F*F),q=l(I*I),L=l(K*w),R=l(I*l(L+S)),O=l(q+l(E*l(K*S)));if(R!==O)throw new Error("bad point: equation left != right (1)");let T=l(_*C),N=l(F*H);if(T!==N)throw new Error("bad point: equation left != right (2)")}equals(y){p(y);let{X:w,Y:E,Z:_}=this,{X:C,Y:F,Z:H}=y,K=l(w*H),S=l(C*_),I=l(E*H),q=l(F*_);return K===S&&I===q}is0(){return this.equals(d.ZERO)}negate(){return new d(l(-this.X),this.Y,this.Z,l(-this.T))}double(){let{a:y}=s,{X:w,Y:E,Z:_}=this,C=l(w*w),F=l(E*E),H=l(qb*l(_*_)),K=l(y*C),S=w+E,I=l(l(S*S)-C-F),q=K+F,L=q-H,R=K-F,O=l(I*L),T=l(q*R),N=l(I*R),P=l(L*q);return new d(O,T,P,N)}add(y){p(y);let{a:w,d:E}=s,{X:_,Y:C,Z:F,T:H}=this,{X:K,Y:S,Z:I,T:q}=y,L=l(_*K),R=l(C*S),O=l(H*E*q),T=l(F*I),N=l((_+C)*(K+S)-L-R),P=T-O,M=T+O,Y=l(R-w*L),V=l(N*P),X=l(M*Y),te=l(N*Y),ae=l(P*M);return new d(V,X,ae,te)}subtract(y){return p(y),this.add(y.negate())}multiply(y){if(!o.isValidNot0(y))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:w,f:E}=v.cached(this,y,_=>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===Xu?d.ZERO:this.is0()||y===Es?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?uW:i.inv(F));let K=l(_*E),S=l(C*E),I=i.mul(F,E);if(H)return{x:Xu,y:Es};if(I!==Es)throw new Error("invZ was invalid");return{x:K,y:S}}clearCofactor(){return a===Es?this:this.multiplyUnsafe(a)}toBytes(){let{x:y,y:w}=this.toAffine(),E=i.toBytes(w);return E[E.length-1]|=y&Es?128:0,E}toHex(){return Rf(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let v=new Hf(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var fg=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(t){this.ep=t}static fromBytes(t){$b()}static fromHex(t){$b()}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 Rf(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 b1e=B(x(),1);var hp=BigInt(0),qf=BigInt(1),hg=BigInt(2);function lW(e){return ui(e,{P:"bigint",type:"string",adjustScalarBytes:"function",powPminus2:"function"},{randomBytes:"function"}),Object.freeze({...e})}function UB(e){let t=lW(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?Nf:s,l=a?255:448,h=a?32:56,m=BigInt(a?9:5),p=BigInt(a?121665:39081),d=a?hg**BigInt(254):hg**BigInt(447),v=a?BigInt(8)*hg**BigInt(251)-qf:BigInt(4)*hg**BigInt(445)-qf,g=d+v+qf,y=T=>ir(T,r),w=E(m);function E(T){return op(y(T),h)}function _(T){let N=Wu(Qt(T,h,"uCoordinate"));return a&&(N[31]&=127),y(Ui(N))}function C(T){return Ui(i(Wu(Qt(T,h,"scalar"))))}function F(T,N){let P=q(_(N),C(T));if(P===hp)throw new Error("invalid private or public key received");return E(P)}function H(T){return F(T,w)}let K=H,S=F;function I(T,N,P){let M=y(T*(N-P));return N=y(N-M),P=y(P+M),{x_2:N,x_3:P}}function q(T,N){ka("u",T,hp,r),ka("scalar",N,d,g);let P=N,M=T,Y=qf,V=hp,X=T,te=qf,ae=hp;for(let he=BigInt(l-1);he>=hp;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,Te=X+te,Ve=X-te,Oe=y(Ve*Pe),pt=y(Te*se),Qe=Oe+pt,ct=Oe-pt;X=y(Qe*Qe),te=y(M*y(ct*ct)),Y=y(Ie*pe),V=y(Fe*(Ie+y(p*Fe)))}({x_2:Y,x_3:X}=I(ae,Y,X)),{x_2:V,x_3:te}=I(ae,V,te);let me=o(V);return y(Y*me)}let L={secretKey:h,publicKey:h,seed:h},R=T=>(T=T===void 0?u(h):T,Qt(T,L.seed,"seed"),T),O={randomSecretKey:R};return Object.freeze(L),Object.freeze(O),Object.freeze({keygen:lp(R,K),getSharedSecret:S,getPublicKey:K,scalarMult:F,scalarMultBase:H,utils:O,GuBytes:w.slice(),lengths:L})}var fW=BigInt(0),Ta=BigInt(1),HB=BigInt(2),hW=BigInt(3),dW=BigInt(5),pW=BigInt(8),ol=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Gb={p:ol,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:pW,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function jB(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=ol,a=e*e%o*e%o,u=ci(a,HB,o)*a%o,l=ci(u,Ta,o)*e%o,h=ci(l,dW,o)*l%o,m=ci(h,t,o)*h%o,p=ci(m,r,o)*m%o,d=ci(p,n,o)*p%o,v=ci(d,i,o)*d%o,g=ci(v,i,o)*d%o,y=ci(g,t,o)*h%o;return{pow_p_5_8:ci(y,HB,o)*e%o,b2:a}}function mW(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var jb=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function zb(e,t){let r=ol,n=ir(t*t*t,r),i=ir(n*n*t,r),o=jB(e*i).pow_p_5_8,s=ir(e*n*o,r),a=ir(t*s*s,r),u=s,l=ir(s*jb,r),h=a===e,m=a===ir(-e,r),p=a===ir(-e*jb,r);return h&&(s=u),(m||p)&&(s=l),Ra(s,r)&&(s=ir(-s,r)),{isValid:h||m,value:s}}var il=LB(Gb,{uvRatio:zb}),Zu=il.Fp,KB=il.Fn;var dg=(()=>{let e=ol;return UB({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=jB(t);return ir(ci(r,hW,e)*n,e)},adjustScalarBytes:mW})})();var Kb=jb,gW=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),vW=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),wW=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),yW=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),MB=e=>zb(Ta,e),EW=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Vb=e=>Zu.create(Ui(e)&EW);function qB(e){let{d:t}=Gb,r=ol,n=w=>Zu.create(w),i=n(Kb*e*e),o=n((i+Ta)*wW),s=BigInt(-1),a=n((s-t*i)*n(i+t)),{isValid:u,value:l}=zb(o,a),h=n(l*e);Ra(h,r)||(h=n(-h)),u||(l=h),u||(s=i);let m=n(s*(i-Ta)*yW-a),p=l*l,d=n((l+l)*a),v=n(m*gW),g=n(Ta-p),y=n(Ta+p);return new il(n(d*y),n(g*v),n(v*y),n(d*g))}var Ju=class e extends fg{static BASE=new e(il.BASE);static ZERO=new e(il.ZERO);static Fp=Zu;static Fn=KB;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}=Gb,i=ol,o=C=>Zu.create(C),s=Vb(t);if(!fB(Zu.toBytes(s),t)||Ra(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}=MB(o(p*m)),g=o(v*l),y=o(v*g*p),w=o((s+s)*g);Ra(w,i)&&(w=o(-w));let E=o(u*y),_=o(w*E);if(!d||Ra(_,i)||E===fW)throw new Error("invalid ristretto255 encoding 2");return new e(new il(w,E,Ta,_))}static fromHex(t){return e.fromBytes(Rd(t))}toBytes(){let{X:t,Y:r,Z:n,T:i}=this.ep,o=ol,s=y=>Zu.create(y),a=s(s(n+r)*s(n-r)),u=s(t*r),l=s(u*u),{value:h}=MB(s(a*l)),m=s(h*a),p=s(h*u),d=s(m*p*i),v;if(Ra(i*d,o)){let y=s(r*Kb),w=s(t*Kb);t=y,r=w,v=s(m*vW)}else v=p;Ra(t*d,o)&&(r=s(-r));let g=s((n-r)*v);return Ra(g,o)&&(g=s(-g)),Zu.toBytes(g)}equals(t){this.assertSame(t);let{X:r,Y:n}=this.ep,{X:i,Y:o}=t.ep,s=l=>Zu.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(Ju.BASE);Object.freeze(Ju.ZERO);Object.freeze(Ju.prototype);Object.freeze(Ju);var bW=Object.freeze({Point:Ju,hashToCurve(e,t){let r=t?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":t.DST,n=Lb(e,r,64,$m);return bW.deriveToCurve(n)},hashToScalar(e,t={DST:$B}){let r=Lb(e,t.DST,64,$m);return KB.create(Ui(r))},deriveToCurve(e){nn(e,64);let t=Vb(e.subarray(0,32)),r=qB(t),n=Vb(e.subarray(32,64)),i=qB(n);return new Ju(r.add(i))}});var VB=!1,AW=!1;async function GB(e,t){if(AW)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 pg(e,t){return await GB(async()=>{let r=Wb(e)?e:await _W(e),n=await crypto.subtle.importKey("raw",t,{name:"X25519"},VB,[]);return new Uint8Array(await crypto.subtle.deriveBits({name:"X25519",public:n},r,256))},()=>{if(Wb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return dg.scalarMult(e,t)})}async function dp(e){return await GB(async()=>pg(e,dg.GuBytes),()=>{if(Wb(e))throw new Error("CryptoKey provided but X25519 WebCrypto is not supported");return dg.scalarMultBase(e)})}var SW=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]);async function _W(e){if(e.length!==32)throw new Error("X25519 private key must be 32 bytes");let t=new Uint8Array([...SW,...e]);return crypto.subtle.importKey("pkcs8",t,{name:"X25519"},VB,["deriveBits"])}function Wb(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var M1e=B(x(),1);var N1e=B(x(),1);var mg=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),DW(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 DW(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 jf(e,...t){return e.pipeThrough(new TransformStream({start(r){for(let n of t)r.enqueue(n)}}))}function gg(e){return new ReadableStream({start(t){t.enqueue(e),t.close()}})}async function Yb(e){if(!(e instanceof ReadableStream))throw new Error("readAll expects a ReadableStream<Uint8Array>");return new Uint8Array(await new Response(e).arrayBuffer())}async function zB(e){if(!(e instanceof ReadableStream))throw new Error("readAllString expects a ReadableStream<Uint8Array>");return await new Response(e).text()}async function WB(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=jf(e,o.subarray(t));return{data:s,rest:a}}var Mi=class{args;body;constructor(t,r){this.args=t,this.body=r}};async function FW(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 Mi(r,i)}}async function YB(e){let t=new mg(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 FW(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:jf(e,a)}}}function Xb(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 XB(e,t){return al([Xb(e),new TextEncoder().encode(" "+$n.encode(t)+`
`)])}async function Cg(e){let t;if(JB(e))t=e;else if(e.startsWith("AGE-SECRET-KEY-PQ-1")){let n=si.decodeToBytes(e);if(n.prefix.toUpperCase()!=="AGE-SECRET-KEY-PQ-"||n.bytes.length!==32)throw Error("invalid identity");let i=tg.getPublicKey(n.bytes);return si.encode("age1pq",si.toWords(i),!1)}else{let n=si.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 dp(t);return si.encodeFromBytes("age",r)}var wg=class{recipient;constructor(t){let r=si.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}=tg.encapsulate(this.recipient),i=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:o,nonce:s}=Dg(ZB,n,i),a=ii(o,s).encrypt(t);return[new Mi(["mlkem768x25519",$n.encode(r)],a)]}},yg=class{identity;constructor(t){let r=si.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=tg.decapsulate(n,this.identity),o=new TextEncoder().encode("age-encryption.org/mlkem768x25519"),{key:s,nonce:a}=Dg(ZB,i,o);try{return ii(s,a).decrypt(r.body)}catch{continue}}return null}},ZB=25722,BW=80,Zb=16;function Dg(e,t,r){let n=IW(e),i=vg(n,void 0,"psk_id_hash",new Uint8Array(0)),o=vg(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=vg(n,t,"secret",new Uint8Array(0)),u=Jb(n,a,"key",s,32),l=Jb(n,a,"base_nonce",s,12);return{key:u,nonce:l}}function IW(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 vg(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),Td(Dr,i,t)}function Jb(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),CE(Dr,t,o,i)}function xW(e){e.length!==Mf.lengths.publicKeyUncompressed&&(e=Mf.Point.fromBytes(e).toBytes(!1));let t=Mf.utils.randomSecretKey(),r=Mf.getPublicKey(t,!1),n=Mf.getSharedSecret(t,e,!0).subarray(1),i=new Uint8Array(r.length+e.length);i.set(r,0),i.set(e,r.length);let o=new Uint8Array(5);o.set(new TextEncoder().encode("KEM"),0),o[3]=Zb>>8,o[4]=Zb&255;let s=vg(o,void 0,"eae_prk",n),a=Jb(o,s,"shared_secret",i,32);return{encapsulatedKey:r,sharedSecret:a}}var Eg=class{recipient;constructor(t){let r=si.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}=xW(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),Td(Dr,h,i).subarray(0,4)})(),{key:s,nonce:a}=Dg(Zb,n,i),u=ii(s,a).encrypt(t);return[new Mi(["p256tag",$n.encode(o),$n.encode(r)],u)]}},bg=class{recipient;constructor(t){let r=si.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}=cB.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),Td(Dr,h,i).subarray(0,4)})(),{key:s,nonce:a}=Dg(BW,n,i),u=ii(s,a).encrypt(t);return[new Mi(["mlkem768p256tag",$n.encode(o),$n.encode(r)],u)]}},Ag=class{recipient;constructor(t){let r=si.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=Ru(32),n=await dp(r),i=await pg(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 Mi(["X25519",$n.encode(n)],Qb(t,a))]}},pp=class{identity;recipient;constructor(t){if(JB(t)){this.identity=t,this.recipient=dp(t);return}let r=si.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=dp(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 pg(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=eA(r.body,u);if(l!==null)return l}return null}},Sg=class{passphrase;logN;constructor(t,r){this.passphrase=t,this.logN=r}wrapFileKey(t){let r=Ru(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=KE(this.passphrase,i,{N:2**this.logN,r:8,p:1,dkLen:32});return[new Mi(["scrypt",$n.encode(r),this.logN.toString()],Qb(t,o))]}},_g=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=KE(this.passphrase,s,{N:2**i,r:8,p:1,dkLen:32}),u=eA(r.body,a);if(u!==null)return u}return null}};function Qb(e,t){let r=new Uint8Array(12);return ii(t,r).encrypt(e)}function eA(e,t){if(e.length!==32)throw Error("invalid stanza");let r=new Uint8Array(12);try{return ii(t,r).decrypt(e)}catch{return null}}function JB(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var nme=B(x(),1);var ul=16,rA=64*1024,tA=rA+ul;function QB(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(tA),o=0;return new TransformStream({transform(s,a){for(;s.length>0;){if(o===i.length){let l=ii(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=ii(e,t).decrypt(i.subarray(0,o));if(!n&&a.length===0)throw new Error("final chunk is empty");s.enqueue(a)}})}function eI(e){if(e<ul)throw Error("ciphertext is too small");if(e===ul)return 0;let t=Math.floor(e/tA),r=e%tA;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 tI(e){let t=new Uint8Array(12),r=()=>{for(let o=t.length-2;o>=0&&(t[o]++,t[o]===0);o--);},n=new Uint8Array(rA),i=0;return new TransformStream({transform(o,s){for(;o.length>0;){if(i===n.length){let u=ii(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=ii(e,t).encrypt(n.subarray(0,i));o.enqueue(s)}})}function rI(e){let t=Math.max(1,Math.ceil(e/rA));return e+ul*t}var mp={};_O(mp,{decode:()=>PW,encode:()=>$W});var ome=B(x(),1);function $W(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(ME.encode(e.subarray(r,n))+`
`)}return t.push(`-----END AGE ENCRYPTED FILE-----
`),t.join("")}function PW(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 ME.decode(t.join(""))}var Eme=B(x(),1);var ame=B(x(),1);var gp=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 wg(t));else if(t.startsWith("age1tag1"))this.recipients.push(new Eg(t));else if(t.startsWith("age1tagpq1"))this.recipients.push(new bg(t));else if(t.startsWith("age1"))this.recipients.push(new Ag(t));else throw new Error("unrecognized recipient type");else this.recipients.push(t)}async encrypt(t){let r=Ru(16),n=[],i=this.recipients;this.passphrase!==null&&(i=[new Sg(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=So(Dr,s,Xb(n)),u=XB(n,a),l=Ru(16),h=new TextEncoder().encode("payload"),m=Tu(Dr,r,l,h,32),p=tI(m);return t instanceof ReadableStream?Object.assign(jf(t.pipeThrough(p),u,l),{size:d=>rI(d)+u.length+l.length}):(typeof t=="string"&&(t=new TextEncoder().encode(t)),await Yb(jf(gg(t).pipeThrough(p),u,l)))}},Fg=class{identities=[];addPassphrase(t){this.identities.push(new _g(t))}addIdentity(t){if(LW(t))this.identities.push(new pp(t));else if(typeof t=="string")if(t.startsWith("AGE-SECRET-KEY-1"))this.identities.push(new pp(t));else if(t.startsWith("AGE-SECRET-KEY-PQ-1"))this.identities.push(new yg(t));else throw new Error("unrecognized identity type");else this.identities.push(t)}async decrypt(t,r){let n=t instanceof ReadableStream?t:gg(t),{fileKey:i,headerSize:o,rest:s}=await this.decryptHeaderInternal(n),{data:a,rest:u}=await WB(s,16),l=new TextEncoder().encode("payload"),h=Tu(Dr,i,a,l,32),m=QB(h),p=u.pipeThrough(m),d=Object.assign(p,{size:v=>eI(v-o-a.length)});return t instanceof ReadableStream?d:r==="text"?await zB(p):await Yb(p)}async decryptHeader(t){return(await this.decryptHeaderInternal(gg(t))).fileKey}async decryptHeaderInternal(t){let r=await YB(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=So(Dr,o,r.headerNoMAC);if(!NW(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 NW(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 LW(e){return typeof CryptoKey<"u"&&e instanceof CryptoKey}var HW="-----BEGIN AGE ENCRYPTED FILE-----";var Kf="age-secret-key",Ome=Object.freeze({X25519:"x25519",HYBRID:"mlkem768-x25519"}),MW=["TextEncoder","TextDecoder","ReadableStream","TransformStream","Response","Uint8Array"],qW=/\bAGE-SECRET-KEY(?:-PQ)?-1[023456789ACDEFGHJKLMNPQRSTUVWXYZ]+\b/g,nA="__subStoreAgeX25519Fallback";function sA(e){return String(e??"").trim()}function jW(e){return e.startsWith("age1")&&!e.startsWith("age1pq1")&&!e.startsWith("age1tag1")&&!e.startsWith("age1tagpq1")}function KW(e){return e.startsWith("age1pq1")}function VW(e){return e.startsWith("AGE-SECRET-KEY-1")}function GW(e){return e.startsWith("AGE-SECRET-KEY-PQ-1")}function nI(){return new ba("INVALID_AGE_PUBLIC_KEY","age-public-key \u4EC5\u652F\u6301 X25519(age1...) \u6216 MLKEM768-X25519(age1pq1...) \u516C\u94A5")}function sI(){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 iA(e=globalThis){let t=MW.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 Bg(){return typeof DOMException<"u"?new DOMException("X25519 WebCrypto is not available","NotSupportedError"):new ReferenceError("X25519 WebCrypto is not available")}function zW(){let e={importKey(){throw Bg()},deriveBits(){throw Bg()}};return e[nA]=!0,e}function WW(e){return typeof e=="string"?e:e?.name}function iI(e){return String(WW(e)||"").toUpperCase()==="X25519"}function YW(e){let t=String(e?.message||e||"");return/x25519|algorithm|not\s+supported|unsupported|unrecognized|unknown/i.test(t)}function oI(e){return e instanceof TypeError||e instanceof ReferenceError||e?.name==="TypeError"||e?.name==="ReferenceError"||e?.name==="NotSupportedError"||e?.name==="Error"&&YW(e)||typeof DOMException<"u"&&e instanceof DOMException&&e.name==="NotSupportedError"}function XW(e){let t=Object.create(e);return Object.defineProperty(t,nA,{configurable:!0,value:!0}),Object.defineProperty(t,"importKey",{configurable:!0,value:async(...r)=>{try{return await e.importKey.apply(e,r)}catch(n){throw iI(r[2])&&oI(n)?Bg():n}}}),Object.defineProperty(t,"deriveBits",{configurable:!0,value:async(...r)=>{try{return await e.deriveBits.apply(e,r)}catch(n){throw iI(r[0])&&oI(n)?Bg():n}}}),t}function aI(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?.[nA])){if(!r||typeof r.importKey!="function"||typeof r.deriveBits!="function"){aI(e,t,zW());return}typeof process>"u"&&aI(e,t,XW(r))}}function uI(e){let t=sA(e);if(!t||!jW(t)&&!KW(t))throw nI();try{new gp().addRecipient(t)}catch{throw nI()}return t}async function cI(e){let t=sA(e);if(!t||!VW(t)&&!GW(t))throw sI();try{await Cg(t)}catch{throw sI()}return t}async function lI(e){iA();let t=await cI(e),r=await Cg(t);return uI(r)}async function oA(e,t){iA();let r=uI(t),n=new gp;n.addRecipient(r);let i=await n.encrypt(e??"");return mp.encode(i)}function aA(e){return sA(e).startsWith(HW)}async function Vf(e,t){let r=e??"",n=typeof r=="string"?r:new TextDecoder().decode(r);if(!aA(n))return r;iA();let i=await cI(t),o=new Fg;o.addIdentity(i);try{let s=mp.decode(n);return await o.decrypt(s,"text")}catch(s){throw new Error(`age \u89E3\u5BC6\u5931\u8D25: ${s?.message??s}`)}}function uA(e){return String(e??"").replace(qW,t=>`${t.startsWith("AGE-SECRET-KEY-PQ-1")?"AGE-SECRET-KEY-PQ-1":"AGE-SECRET-KEY-1"}...${t.slice(-6)}`)}function Qu(e){return uA(String(e??"").replace(/([?#&]age-secret-key=)[^&#\s]+/gi,"$1***"))}var tge=["Sub-Store placeholder","This file keeps the Gist alive when all sync configuration files are deleted."].join(`
`);var oge=B(x());var rY=new Set(["enabled","fallbackNotify"]),nY=new Set(["fallbackNotify","fallbackQuiet"]);function Ig(e){return e===!0?"quiet":e===!1||e==null||e===""?"disabled":e}function xg(...e){for(let t of e)if(t!=null&&t!=="")return Ig(t);return"disabled"}function $g(e){return rY.has(Ig(e))}function Gf(e){return nY.has(Ig(e))}function vp({mode:e,message:t,notify:r}){let n=Ig(e);if(n==="disabled"||Gf(n))throw new Error(t);$g(n)&&r?.(t)}function Pg({mode:e,notify:t,error:r}){$g(e)&&t?.(r)}function cA({platform:e="JSON",produceType:t,produceOpts:r={}}){return t==="raw"?JSON.stringify([]):Rt.produce([],e,t,r)}var hge=B(x());var fI={merge:!0,logLevel:"error"};function hI(e){return typeof e=="string"&&e.includes("short-id")}function kg(e){if(!hI(e))return e;try{let t=Fd(e,fI);return dI(e,t)}catch{return e}}function dI(e,t,r){let n=new Map,i=new Map;vs(t,{Node(p,d){ms(d)?i.set(d.range[0],n.get(d.source)):d.anchor&&n.set(d.anchor,d)}});let o=p=>ms(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;vs(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)vs(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(ks(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?vf(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 sY(){return{name:"HTML",test:n=>/^<!DOCTYPE html>/.test(n),parse:()=>""}}function iY(){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 oY(){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 aY(){let e="Clash Pre-processor",t=function(i,o){if(o&&!/proxies/.test(i))return!1;let s,a;if(hI(i))try{s=Fd(i,fI),s.errors.length===0&&(a=s.toJS())}catch{s=void 0}if(a===void 0&&(a=vf(i)),o&&!Array.isArray(a.proxies)&&!Array.isArray(a["proxy-groups"]))return!1;if(s){let u=dI(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:vf(s.normalized);return(o?`proxies:
`:"")+(Array.isArray(a)?a:[]).map(u=>`${o?" - ":""}${JSON.stringify(u)}
`).join("")}}}function uY(){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 cY(){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 Rg=[sY(),aY(),iY(),uY(),cY(),oY()];var gge=B(x());var wge=B(x()),lA="mihomoConfig",lY="mihomoProfile",fY=[lA,lY];function cl(e){let t=typeof e=="string"?e:e?.type;return fY.includes(t)}function pI(e){return!e||!cl(e)||e.type===lA?e:{...e,type:lA}}var hY=["localFirst","remoteFirst"],dY=["local","remote"],pY=["collection","local","none","remote","subscription"];function wp(e){return Object.keys(e).map(Qu).join(", ")}function mI(e){return hY.includes(e)}function mY(e){return cl(e)?vI(e):e?.source}function vI(e){return pY.includes(e?.sourceType)?e.sourceType:"collection"}function Tg(e){return(Array.isArray(e)?e:[e]).flat()}function wI(e){return Tg(e).filter(t=>t!=null&&t!=="").join(`
`)}function gY(e,t){return t!=null&&t!==""?t:e.ignoreFailedRemoteFile}async function gI({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 Yn(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 ${Qu(p)} \u53D1\u751F\u9519\u8BEF: ${d}`),""}})),m=gY(e,s);if(Object.keys(u).length>0)if(m)m==="enabled"&&Q.notify(a,`\u274C ${e.name}`,`\u8FDC\u7A0B\u6587\u4EF6 ${wp(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);else throw new Error(`\u6587\u4EF6 ${e.name} \u7684\u8FDC\u7A0B\u6587\u4EF6 ${wp(u)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`);return h}async function yI(e,{url:t,ua:r,content:n,mergeSources:i,ignoreFailedRemoteFile:o,proxy:s,noCache:a,noFlow:u,notifyTitle:l}={}){if(n&&!mI(i))return n;if(t){let m=await gI({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(mY(e)==="local"&&!mI(e.mergeSources))return e.content;let h=await gI({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 vY(e,t={}){let r={},n=vI(e);if(n==="none")return Rt.yaml.safeDump(r);if(dY.includes(n)){let i=await yI(e,t);if(e?.mode!=="proxy")return wI(i);let o=Tg(i).map(s=>Rt.parse(s)).flat();if(o.length===0)throw new Error(`\u6587\u4EF6 ${e.name} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);r.proxies=Rt.produce(o,"mihomo","internal",{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy})}else r.proxies=await Oa({type:n,name:e?.sourceName,platform:"mihomo",produceType:"internal",produceOpts:{"delete-underscore-fields":!0,"include-unsupported-proxy":e?.includeUnsupportedProxy},noFlow:t.noFlow});return Rt.yaml.safeDump(r)}async function Oa({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(om);if(C=ni(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=xg(a,C.ignoreFailedRemoteSub),H=w||C.noFlow,K=[];try{let S;if(o&&!["localFirst","remoteFirst"].includes(s))S=o,K=o;else if(n){let R={},O=await Promise.all(n.split(/[\r\n]+/).map(T=>T.trim()).filter(T=>T.length).map(async T=>{try{return await Yn(T,i||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return R[T]=N,Q.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Qu(T)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(T=>T.result??T),K=O.map(T=>T.raw??T),Object.keys(R).length>0){let T=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${wp(R)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;vp({mode:F,message:T,notify:()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,T)}})}s==="localFirst"?(S.unshift(o),K.unshift(o)):s==="remoteFirst"&&(S.push(o),K.push(o))}else if(C.source==="local"&&!["localFirst","remoteFirst"].includes(C.mergeSources))S=C.content,K=C.content;else{let R={},O=await Promise.all(C.url.split(/[\r\n]+/).map(T=>T.trim()).filter(T=>T.length).map(async T=>{try{return await Yn(T,i||C.ua,void 0,g||C.proxy,void 0,d,y||C.noCache,!0,{returnRaw:!0,noFlow:H})}catch(N){return R[T]=N,Q.error(`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Qu(T)} \u53D1\u751F\u9519\u8BEF: ${N}`),""}}));if(S=O.map(T=>T.result??T),K=O.map(T=>T.raw??T),Object.keys(R).length>0){let T=`\u8BA2\u9605 ${C.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${wp(R)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;vp({mode:F,message:T,notify:()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,T)}})}C.mergeSources==="localFirst"?(S.unshift(C.content),K.unshift(C.content)):C.mergeSources==="remoteFirst"&&(S.push(C.content),K.push(C.content))}if(l==="raw"){let R=JSON.stringify((Array.isArray(S)?S:[S]).flat());return _?{result:R,raw:Array.isArray(K)?K:[K]}:R}let I=(Array.isArray(S)?S:[S]).map(R=>Rt.parse(R)).flat();if(I.forEach(R=>{R._subName=C.name,R._subDisplayName=C.displayName}),I=await Rt.process(I,C.process||[],r,{[C.name]:C},v,K,{noFlow:H}),I.length===0)throw new Error(`\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let q={};for(let R of I){if(q[R.name]){Q.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${R.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}q[R.name]=!0}let L=Rt.produce(I,r,l,h);return _?{result:L,raw:Array.isArray(K)?K:[K]}:L}catch(S){if(!Gf(F))throw S;Pg({mode:F,error:S,notify:q=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${C.name}`,`\u{1F914} \u539F\u56E0\uFF1A${q.message??q}`)}}),Q.error(`\u8BA2\u9605 ${C.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${S.message??S}`);let I=cA({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(om),F=Q.read(Yy),H=ni(F,t);if(!H)throw new Error(`\u627E\u4E0D\u5230\u7EC4\u5408\u8BA2\u9605 ${t}`);let K=[...H.subscriptions],S=H.subscriptionTags;Array.isArray(S)&&S.length>0&&C.forEach(R=>{Array.isArray(R.tag)&&R.tag.length>0&&!K.includes(R.name)&&R.tag.some(O=>S.includes(O))&&K.push(R.name)});let I=xg(a,H.ignoreFailedRemoteSub),q=w||H.noFlow,L={};try{let R={},O={},T=0;if(await Promise.all(K.map(async Y=>{let V=ni(C,Y),X=xg(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 Yn(pe,ae,void 0,g||V.proxy||H.proxy,void 0,void 0,y||V.noCache,!0,{returnRaw:!0,noFlow:q||V.noFlow})}catch(Fe){return Ie[pe]=Fe,Q.error(`\u8BA2\u9605 ${V.name} \u7684\u8FDC\u7A0B\u8BA2\u9605 ${Qu(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 ${wp(Ie)} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`;vp({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=>Rt.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 Rt.process(De,V.process||[],r,{[V.name]:V,_collection:H,$options:v},void 0,Pe,{noFlow:q||V.noFlow}),R[Y]=De,L[Y]=Pe,T++,Q.info(`\u2705 \u5B50\u8BA2\u9605\uFF1A${V.name}\u52A0\u8F7D\u6210\u529F\uFF0C\u8FDB\u5EA6--${100*(T/K.length).toFixed(1)}% `)}catch(me){if(T++,Gf(X)){Pg({mode:X,error:me,notify:he=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u8BA2\u9605\u5931\u8D25",`\u274C ${V.name}`,`\u{1F914} \u539F\u56E0\uFF1A${he.message??he}`)}}),Q.error(`\u8BA2\u9605 ${V.name} \u5728\u7EC4\u5408\u8BA2\u9605\u5904\u7406\u4E2D\u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${me.message??me}`),R[Y]=[],L[Y]=[];return}O[Y]=me,L[Y]=void 0,Q.error(`\u274C \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u4E2D\u7684\u5B50\u8BA2\u9605: ${V.name}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${me}\uFF01\u8FDB\u5EA6--${100*(T/K.length).toFixed(1)}%`)}})),Object.keys(O).length>0){let Y=`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u7684\u5B50\u8BA2\u9605 ${Object.keys(O).join(", ")} \u53D1\u751F\u9519\u8BEF, \u8BF7\u67E5\u770B\u65E5\u5FD7`,V=()=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,Y)};Object.keys(R).length>0&&Gf(I)?(Object.keys(O).forEach(te=>{L[te]=[]}),$g(I)&&V()):vp({mode:I,message:Y,notify:V})}let N=Array.prototype.concat.apply([],K.map(Y=>R[Y]||[]));if(N.forEach(Y=>{Y._collectionName=H.name,Y._collectionDisplayName=H.displayName}),N=await Rt.process(N,H.process||[],r,{_collection:H},v,L,{noFlow:q}),N.length===0)throw new Error(`\u7EC4\u5408\u8BA2\u9605 ${t} \u4E2D\u4E0D\u542B\u6709\u6548\u8282\u70B9`);let P={};for(let Y of N){if(P[Y.name]){Q.notify("\u{1F30D} Sub-Store",`\u26A0\uFE0F \u7EC4\u5408\u8BA2\u9605 ${t} \u5305\u542B\u91CD\u590D\u8282\u70B9 ${Y.name}\uFF01`,"\u8BF7\u4ED4\u7EC6\u68C0\u6D4B\u914D\u7F6E\uFF01",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"});break}P[Y.name]=!0}let M=Rt.produce(N,r,l,h);return _?{result:M,raw:L}:M}catch(R){if(!Gf(I))throw R;Pg({mode:I,error:R,notify:T=>{Q.notify("\u{1F30D} Sub-Store \u5904\u7406\u7EC4\u5408\u8BA2\u9605\u5931\u8D25",`\u274C ${H.name}`,`\u{1F914} \u539F\u56E0\uFF1A${T.message??T}`)}}),Q.error(`\u7EC4\u5408\u8BA2\u9605 ${H.name} \u542F\u7528\u515C\u5E95\u540E\u8FD4\u56DE\u7A7A\u7ED3\u679C: ${R.message??R}`);let O=cA({platform:r,produceType:l,produceOpts:h});return _?{result:O,raw:L}:O}}else if(e==="rule"){let C=Q.read(_8),F=ni(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 Yn(S),q=Aa.parse(I);H=H.concat(q)}catch(I){Q.error(`\u5904\u7406\u5206\u6D41\u8BA2\u9605\u4E2D\u7684URL: ${S}\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A${I}! \u8BE5\u8BA2\u9605\u5DF2\u88AB\u8DF3\u8FC7\u3002`)}}return H=await Aa.process(H,[{type:"Remove Duplicate Filter"}]),Aa.produce(H,r)}else if(e==="file"){let C=Q.read($c),F=pI(p||ni(C,t));if(!F)throw new Error(`\u627E\u4E0D\u5230\u6587\u4EF6 ${t}`);let H="";if(cl(F)?H=await vY(F,{url:n,ua:i,content:o,mergeSources:s,ignoreFailedRemoteFile:u,proxy:g,noCache:y,noFlow:w}):H=await yI(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=wI(K),I=Array.isArray(F.process)&&F.process.length>0?await Rt.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=kg(I?.$content??""),(E?I:I?.$content)??""}}var Mge=B(x());function fA(){return po(()=>yu("stream/promises"))}var EI=Rg.find(e=>e.name==="Clash Pre-processor"),hA=new Map;function wY(e=""){let t=`${e}`.trim();return t?new RegExp(t,"i"):null}function yY(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=wY(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 EY(e){return Qu(e)}async function zf(e,{ageSecretKey:t,preprocess:r,url:n}){let i=t?await Vf(e,t):e,o=i;if(r)try{let s=EI.test(i);s&&(i=EI.parse(i,!0,s))}catch(s){Q.error(`Clash Pre-processor error: ${s}`)}if(r)try{let s=Rt.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 yp(e,t){return t?{result:e.result,raw:e.raw}:e.result}function dA(e,t){return t?{result:e,raw:e}:e}async function Yn(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?.[Kf]||options?.ageSecretKey:void 0,returnRaw=options&&typeof options=="object"&&options.returnRaw,ageSecretKey=explicitAgeSecretKey||$arguments?.[Kf],{isNode,isStash,isLoon,isShadowRocket,isQX}=ei(),{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=yY(url,githubProxy,githubProxyRegex);let safeUrl=EY(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`),yp(await zf(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 Yn(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`),Yn(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 yp(await zf(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"?am:$c,n=ni(Q.read(r),t);if(!n)throw new Error(`\u627E\u4E0D\u5230 ${e}: ${t}`);return dA(e==="module"?n.content:await Oa({type:"file",name:t,noFlow:options?.noFlow}),returnRaw)}catch(t){throw Q.error(`Error when loading ${e}: ${url.split("#")[0]}.
Reason: ${t}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${e}: ${url}`)}}else if(url?.startsWith("/"))try{let e=mo();return dA(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&&hA.has(id))return yp(await zf(await hA.get(id),{ageSecretKey,preprocess,url:safeUrl}),returnRaw);let http=wo({headers:{...customHeaders||{"User-Agent":userAgent},...isStash&&proxy?{"X-Stash-Selected-Proxy":encodeURIComponent(proxy)}:{},...isShadowRocket&&proxy?{"X-Surge-Policy":proxy}:{}},timeout:requestTimeout}),result,rawResult,cached=Hr.get(id);if(!noCache&&!$arguments?.noCache&&cached)Q.info(`\u4F7F\u7528\u7F13\u5B58: ${safeUrl}, ${customHeaders?JSON.stringify(customHeaders):userAgent}`),rawResult=cached,result=await zf(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 yf(()=>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&&$d.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 zf(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}`),yp(await zf(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 _m(Ef(await Sm(url,$arguments.flowUserAgent,void 0,proxy,$arguments.flowUrl,$arguments.flowHeaders))),isNode||hA.set(id,rawResult),yp(result,returnRaw)}async function bI(url,file){let undici=eval("require('undici')"),fs=mo(),{pipeline}=fA(),{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 dve=B(x());var c2e=B(x());var mA=class{constructor(){Q.read(Rc)||Q.write("{}",Rc);try{this.resourceCache=JSON.parse(Q.read(Rc))}catch(t){Q.error(`\u89E3\u6790\u6301\u4E45\u5316\u7F13\u5B58\u4E2D\u7684 ${Rc} \u5931\u8D25, \u91CD\u7F6E\u4E3A {}, \u9519\u8BEF: ${t?.message??t}`),this.resourceCache={},Q.write("{}",Rc)}this._cleanup()}_cleanup(t,r){let n=pA(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),Rc)}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=pA(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=pA(n)??AY();this.resourceCache[t]={time:Date.now()+i,data:r},this._persist()}};function pA(e){let t=Number(e);return isFinite(t)&&t>0?t:null}function AY(){let t=(Q.read(pr)||{})?.scriptCacheTtl;return t&&(t=Number(t),isFinite(t)&&t>0)?t*1e3:1728e5}var gA=new mA;var f2e=B(x());function Og(e,t){return[...Array(e).keys()].map(()=>t)}var m2e=B(x());var vA={"\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 Wf(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(vA))if(vA[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 AI(e){return vA[Wf(e)]?.[0]}function Ep(e){return e.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴‍☠️|🏳️‍🌈/g,"").trim()}var Ng=class{constructor({country,asn}={}){if(Q.env.isNode){let Reader=eval('require("@maxmind/geoip2-node")').Reader,fs=mo(),countryFile=country||eval("process.env.SUB_STORE_MMDB_COUNTRY_PATH"),asnFile=asn||eval("process.env.SUB_STORE_MMDB_ASN_PATH");if(countryFile&&(this.countryReader=Reader.openBuffer(fs.readFileSync(countryFile))),asnFile){if(!fs.existsSync(asnFile))throw new Error("GeoLite2 ASN MMDB does not exist");this.asnReader=Reader.openBuffer(fs.readFileSync(asnFile))}}}geoip(e){return this.countryReader?.country(e)?.country?.isoCode}ipaso(e){return this.asnReader?.asn(e)?.autonomousSystemOrganization}ipasn(e){return this.asnReader?.asn(e)?.autonomousSystemNumber}};var K2e=B(x());var Xf=B(kI());var $2e=B(x());function FA(){return po(()=>yu("dgram"))}var R2e=B(x());function BA(){return po(()=>yu("net"))}var N2e=B(x());function IA(){return po(()=>yu("tls"))}var fl=B(aa());var RI=53,xY=853,Ap=2;function xA({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}]}),Xf.default.encode({type:"query",id:0,flags:Xf.default.RECURSION_DESIRED,questions:[{type:t,name:e}],additionals:n})}function $A(e){return e||8e3}function $Y(e){return e?.replace(/^\[(.*)\]$/,"$1")}function PY(e){return _r(e)||Xt(e)}function kY(e,t=RI){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 RY(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 TY(e,t){try{let r=t?e:`udp://${Xt(e)?`[${e}]`:e}`,n=new URL(r);RY(n,e);let i=$Y(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:kY(n.port,t==="tls"?xY:RI)}}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 OY(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 TY(t,n)}async function PA({url:e,domain:t,type:r="A",timeout:n,edns:i,skipCertVerify:o}){let s=xA({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 Xf.default.decode(fl.Buffer.from(Q.env.isQX?l.bodyBytes:l.body))}async function NY({server:e,domain:t,type:r="A",timeout:n,edns:i}){let o=FA(),s=xA({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"))},$A(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,Xf.default.decode(v))}catch(g){d(g)}}),h.send(s,e.port,e.host,v=>{v&&d(v)})})}async function LY({server:e,domain:t,type:r="A",timeout:n,edns:i,skipCertVerify:o}){let s=e.protocol==="tls"?IA():BA(),a=e.protocol==="tls"?"TLS":"TCP",u=xA({domain:t,type:r,edns:i}),l=fl.Buffer.alloc(Ap);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:PY(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($A(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>=Ap&&(g=v.readUInt16BE(0)),g!=null&&v.length>=g+Ap){let C=v.slice(Ap,g+Ap);E(null,Xf.default.decode(C))}}catch(C){E(C)}})})}async function Hg({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:$A(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=OY(e);if(l.protocol==="doh")return PA({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)?LY({server:l,domain:t,type:r,timeout:n,edns:i,skipCertVerify:o}):NY({server:l,domain:t,type:r,timeout:n,edns:i})}var Jf=B(za());var X2e=B(x());var Mg="2.44.31";var{isNode:TI,isQX:HY,isLoon:MY,isSurge:qY,isStash:jY,isShadowRocket:KY,isLanceX:VY,isEgern:GY,isGUIforCores:zY}=ei(),Lo="Node";TI?Lo="Node":HY?Lo="QX":MY?Lo="Loon":jY?Lo="Stash":KY?Lo="Shadowrocket":GY?Lo="Egern":qY?Lo="Surge":VY?Lo="LanceX":zY&&(Lo="GUI.for.Cores");var hl={},WY={};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),TI){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 qg={backend:Lo,version:Mg,feature:WY,meta:hl};var OA="Response Transformer";function NA(e){return e===OA}function _p(e){return e.startsWith("<")&&e.endsWith(">")?e.slice(1,-1):e}function UI(e,t){let r=typeof t=="string"?JSON.parse(t):t;for(let n in r)if(ze(r[n]))if(n.endsWith("!")){let i=_p(n.slice(0,-1));e[i]=r[n]}else{let i=_p(n);e[i]||Object.assign(e,{[i]:{}}),UI(e[i],r[i])}else if(Array.isArray(r[n]))if(n.startsWith("+")){let i=_p(n.slice(1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...r[n],...e[i]]}else if(n.endsWith("+")){let i=_p(n.slice(0,-1));e[i]||Object.assign(e,{[i]:[]}),e[i]=[...e[i],...r[n]]}else{let i=_p(n);Object.assign(e,{[i]:r[n]})}else Object.assign(e,{[n]:r[n]});return e}function YY({rule:e}){return{name:"Conditional Filter",func:t=>t.map(r=>jg(e,r))}}function jg(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=>jg(r,t));case"OR":return e.child.some(r=>jg(r,t));case"NOT":return!jg(e.child,t);default:throw new Error(`Unknown operator: ${e.operator}`)}}function XY(e){return{name:"Quick Setting Operator",func:i=>{if(t(e.useless)){let a=GI().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 ZY({mode:e,tw:t}){return{name:"Flag Operator",func:r=>r.map(n=>{if(e==="remove")n.name=Ep(n.name);else{let i=Wf(n.name);n.name=Ep(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 JY(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=>Jf.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=>Jf.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=>Jf.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 QY(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 CX(t);default:throw new Error("Unknown sort option: "+e)}}}}function eX(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=>UA(s)),o=new Map;return n.sort((s,a)=>{let u=OI(i,s.name,o),l=OI(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 OI(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 HI(e){return{name:"Regex Rename Operator",func:t=>t.map(r=>{for(let{expr:n,now:i}of e)r.name=r.name.replace(UA(n,"g"),i).trim();return r})}}function tX(e){let t=e.map(r=>({expr:r,now:""}));return{name:"Regex Delete Operator",func:HI(t).func}}function rX(e,t,r,n,i,o){return o.source=n,o.env=qg,{name:"Script Operator",func:async s=>{let a=s;if(cl(a?.$file))try{let u=Rs.safeLoad(e),l;if(a?.$content)try{l=Rs.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=Rt.yaml.safeDump(UI(l||{},u)),a}catch{}return await(async function(){a=Qf("operator",e,r,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=s;return await(async function(){a=Qf("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 MI="Add Proxies From Subscription Operator";function nX(e){if(!e)return{};let t=Rs.safeLoad(e);return ze(t)?t:{}}function sX(e){return Array.isArray(e?.proxies)?e.proxies:[]}function iX({sourceType:e="subscription",sourceName:t,includeUnsupportedProxy:r,position:n="replace"}={},i={}){let o=async s=>{if(!cl(s?.$file))return s;let a=nX(s.$content),u=sX(a),l=await Oa({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=Rt.yaml.safeDump(a),s};return{name:MI,func:o,nodeFunc:o}}function oX(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 aX=10,uX=2,NI=20;function cX(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return aX;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 qI(e){if(typeof e>"u"||e===null||typeof e=="string"&&e.trim()==="")return uX;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 lX(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 fX(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 LA(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 hX(e){return LA(e).join(`
`)}async function dX(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 pX(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 TA(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 mX(e,t,r,n,i,o){if(n==="disabled")return null;let s=TA(e,t,r,i,o),a=s?Hr.get(s):null;return e==="Custom"?KI(a):a}function kA(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 gX(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 jI(e,t){return e&&typeof e=="object"&&Object.defineProperty(e,"_resolverUrl",{value:t,enumerable:!1,configurable:!0}),e}function vX(e,t){return{result:e,resolverUrl:t}}function KI(e){return e&&typeof e=="object"&&!Array.isArray(e)&&Array.isArray(e.result)?jI(e.result,e.resolverUrl):e}function LI(e){return e&&typeof e=="object"?e._resolverUrl:null}var Kg={Custom:async function(e,t,r,n,i,o,s,a,u){let l=LA(o),h=l.join(`
`),m=qI(a),p=Ur(`CUSTOM:${s?"INSECURE:":""}${h}:${e}:${t}`),d=KI(Hr.get(p));if(!r&&d)return d;let v=t==="IPv6"?"AAAA":"A",g=async E=>{let _=await Hg({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 pX(l,m,g);return Hr.set(p,vX(y,w),u),jI(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 Hg({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 Hg({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 VI({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=lX(s,m),d=fX(a),v=["IPv6","IP4P"].includes(t)?"IPv6":"IPv4",g=Kg[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=cX(l),E=e==="Custom"?hX(i):i,_=e==="Custom"?LA(E).length:1,C=e==="Custom"?qI(h):1,F=w*Math.min(C,_),H=e==="Custom"&&(o===!0||o==="enabled");return F>NI&&Q.warn(`\u57DF\u540D\u89E3\u6790\u603B\u5E76\u53D1\u6570\u4E0A\u9650 ${F} \u8D85\u8FC7\u5EFA\u8BAE\u503C ${NI}, \u53EF\u80FD\u5BFC\u81F4\u4EE3\u7406 App TCP \u8FDE\u63A5\u6570\u6FC0\u589E`),Q.info(`Domain Resolver: [${t}] ${e} ${y||""} ${gX(e,E)}${H?" tlsSkipCertVerify=enabled":""} concurrency=${w}${e==="Custom"?` dnsConcurrency=${C}`:""}`),{name:"Resolve Domain Operator",func:async K=>{K.forEach((L,R)=>{!L["_no-resolve"]&&L["no-resolve"]&&(K[R]["_no-resolve"]=L["no-resolve"])});let S={},I=[...new Map(K.filter(L=>!dl(L.server)&&!L["_no-resolve"]).map(L=>{let R=TA(e,L.server,v,E,H);return[R,{id:R,domain:L.server}]})).values()],q=[];return I.forEach(({id:L,domain:R})=>{let O=mX(e,R,v,n,E,H);if(O){S[L]=O;let T=e==="Custom"&&LI(O)||E;Q.info(`Using cached resolved domain: ${R}${kA(e,T)} \u279F ${O}`)}else q.push({id:L,domain:R})}),await dX(q,w,async({id:L,domain:R})=>{try{let O=await g(R,v,n==="disabled",p,y,E,H,C,d);S[L]=O;let T=e==="Custom"&&LI(O)||E;Q.info(`Successfully resolved domain: ${R}${kA(e,T)} \u279F ${O}`)}catch(O){Q.error(`Failed to resolve domain: ${R}${kA(e,E)} with resolver [${e}]: ${O}`)}}),K.forEach(L=>{if(!L["_no-resolve"]){let R=TA(e,L.server,v,E,H);if(R&&S[R]){L._resolved_ips=S[R];let O=Array.isArray(S[R])?S[R][Math.floor(Math.random()*S[R].length)]:S[R];if(v==="IPv6"&&Xt(O)){try{O=new Em.Address6(O).correctForm()}catch(T){Q.error(`Failed to parse IPv6 address: ${O}: ${T}`)}if(/^2001::[^:]+:[^:]+:[^:]+$/.test(O)){L._IP4P=O;let{server:T,port:N}=oX(O);T&&N?(L._domain=L.server,L.server=T,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)}VI.resolver=Kg;function RA(e){var t=/^[\x00-\x7F]+$/;return t.test(e)}function GI(){return{name:"Useless Filter",func:e=>e.map(t=>{if(t.cipher&&!RA(t.cipher))return!1;if(t.password&&!RA(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&&!RA(n)))return!1}return!/网址|流量|时间|应急|过期|Bandwidth|expire/.test(t.name)})}}function wX(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=Wf(o.name),a=t.some(u=>n[u]===s);return r?a:!a})}}function yX({regex:e=[],keep:t=!0}){return{name:"Regex Filter",func:r=>r.map(n=>{let i=e.some(o=>UA(o).test(n.name));return t?i:!i})}}function UA(e,...t){return t=t.join(""),e.startsWith("(?i)")?(e=e.substring(4),new RegExp(e,"i"+t)):new RegExp(e,t)}function EX(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 bX(e,t,r,n,i,o){return o.source=n,o.env=qg,{name:"Script Filter",func:async s=>{let a=Og(s.length,!0);return await(async function(){a=Qf("filter",e,r,i)(s,t,o)})(),a},nodeFunc:async s=>{let a=Og(s.length,!0);return await(async function(){a=Qf("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 AX(e,t,r,n,i,o){return o.source=n,o.env=qg,{name:OA,func:async s=>{let a=s;return await(async function(){a=Qf("transformFunction",e,r,i)(s,o)})(),a},shortcutFunc:async s=>{let a=s;return await(async function(){a=Qf("transformFunction",`async function transformFunction(res = {}, context) {
let $res = res
${e}
return $res
}`,r,i)(s,o)})(),a}}}var Cp={"Useless Filter":GI,"Region Filter":wX,"Regex Filter":yX,"Type Filter":EX,"Script Filter":bX,"Conditional Filter":YY,"Quick Setting Operator":XY,"Flag Operator":ZY,"Sort Operator":QY,"Regex Sort Operator":eX,"Regex Rename Operator":HI,"Regex Delete Operator":tX,"Script Operator":rX,[MI]:iX,[OA]:AX,"Handle Duplicate Operator":JY,"Resolve Domain Operator":VI};async function zI(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 SX(e,t){let r=Og(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 _X(e,t){let r=DX(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 WI(e,t){if(e.name.indexOf("Filter")!==-1)return SX(e,t);if(e.name.indexOf("Operator")!==-1)return _X(e,t)}function CX(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 DX(e){return JSON.parse(JSON.stringify(e))}function Qf(name,script,$arguments,$options){let flowUtils={getFlowField:Uc,getFlowHeaders:Sm,parseFlowHeaders:Ef,flowTransfer:kd,validCheck:_m,getRmainingDays:nD,normalizeFlowHeader:sD};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,Jf.default,$persistentStore,$httpClient,$notification,Rt,Rt.yaml,Rt.Buffer,Rt.Base64.decode,Rt.Base64.encode,Kg,gA,flowUtils,Oa,eval('typeof require !== "undefined"')?yu: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,Jf.default,Rt,Rt.yaml,Rt.Buffer,Rt.Base64.decode,Rt.Base64.encode,Kg,gA,flowUtils,Oa,eval('typeof require !== "undefined"')?yu:void 0)}var xye=B(x());var Lve=B(x()),c9=B(za());var Eve=B(x()),ZI=B(za());var We=class{constructor(t){this.proxy=t,this.output=[]}append(t){if(typeof t>"u")throw new Error("required field is missing");this.output.push(t)}appendIfPresent(t,r){le(this.proxy,r)&&this.append(t)}toString(){return this.output.join("")}};function le(e,t){let r=ZI.default.get(e,t);return typeof r<"u"&&r!==null}function Vg(e){let{network:t,flow:r,encryption:n}=e,i=e["reality-opts"],o=!!(e.tls||i);return t==="ws"&&i?!1:t==="grpc"?o&&!r:r?qe(n)&&n.trim()!=="none"||o&&!["ws","xhttp"].includes(t):!0}function Gg(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 eh(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 Dp(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 JI(e){return!!Dp(e)}function th(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 YI(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 zg(e){if(["vmess","vless","trojan","anytls"].includes(e.type)&&YI(e,"sni")&&["vmess","vless"].includes(e.type)&&(e.tls=!0),e.type==="vless"&&e.network==="xhttp"){let t=e["xhttp-opts"]?.["download-settings"];YI(t,"servername")&&(t.tls=!0)}}function HA(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 QI(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:HA(i,s?32:128)}:null}function XI(e,t){let{addressKey:r,cidrKey:n,family:i,defaultCIDR:o}=t,s=QI(e[r],i);if(!s){(e[r]==null||`${e[r]}`.trim().length===0)&&delete e[n];return}e[r]=s.address;let a=HA(e[n],o);e[n]=a??s.cidr??o}function Fp(e={}){return XI(e,{addressKey:"ip",cidrKey:"ip-cidr",family:"ipv4",defaultCIDR:32}),XI(e,{addressKey:"ipv6",cidrKey:"ipv6-cidr",family:"ipv6",defaultCIDR:128}),e}function As(e={},t="ipv4"){let r=t==="ipv6"?{addressKey:"ipv6",cidrKey:"ipv6-cidr",defaultCIDR:128}:{addressKey:"ip",cidrKey:"ip-cidr",defaultCIDR:32},n=QI(e[r.addressKey],t);if(!n)return;let i=HA(e[r.cidrKey],r.defaultCIDR);return`${n.address}/${i??n.cidr??r.defaultCIDR}`}function Uo(e,t,r={}){return e=e.map(n=>{if(!Object.hasOwn(n,"ecn"))return n;let i={...n};return delete i.ecn,i}),t==="internal"?e:r.prettyYaml||r["pretty-yaml"]?kg(Rs.safeDump({proxies:e},{lineWidth:-1})):`proxies:
`+e.map(n=>" - "+JSON.stringify(n)+`
`).join("")}var Sve=B(x());var pl="_dns",MA="_force-query",qA="_sockopt",e9="https://dns.alidns.com/dns-query";function Wg(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 t9(e){if(!qe(e))return;if(!e.includes("://"))return{type:"config",config:e};let t=e.split("+");if(t.length===1&&qe(t[0]))return{type:"dns",dns:t[0]};if(t.length===2&&qe(t[0])&&qe(t[1]))return{type:"dns",queryServerName:t[0],dns:t[1]}}function jA(e){return t9(e)!=null}function Yg(e){return["none","half","full"].includes(e)}function KA(e){return typeof e=="boolean"?e:typeof e=="number"&&Number.isInteger(e)&&e!==0}function Xg({echConfigList:e,echForceQuery:t,echSockopt:r}={}){let n=t9(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)),Yg(t)&&(i[MA]=t),ze(r)&&(i[qA]=r),i}function VA(e,t,{dnsFieldPath:r="ech-opts._dns",warnDefaultDns:n}={}){let i={};if(ze(e)){if(!KA(e.enable))return i;let o=e["query-server-name"];return qe(e.config)?i.echConfigList=e.config:qe(e[pl])?i.echConfigList=qe(o)?`${o}+${e[pl]}`:e[pl]:qe(o)&&(i.echConfigList=`${o}+${e9}`,n?.({defaultDns:e9,dnsFieldPath:r,queryServerName:o})),i.echConfigList&&Yg(e[MA])&&(i.echForceQuery=e[MA]),i.echConfigList&&ze(e[qA])&&(i.echSockopt=e[qA]),i}return qe(t)&&(i.echConfigList=t),i}function GA(e,t,r){return VA(e,t,r).echConfigList}var Bve=B(x()),n9=B(za());var Cve=B(x());function zA(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 FX(e){return zA(e,{allowZeroUpperBound:!1})}function r9(e){return zA(e,{allowZeroLowerBound:!1,allowZeroUpperBound:!1})}function Ho(e){let t=FX(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function rh(e){let t=r9(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?`${n}`:`${r}-${n}`}function ml(e){let t=r9(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Us(e){let t=zA(e);if(!t)return;let{lowerBound:r,upperBound:n}=t;return r===n?n:`${r}-${n}`}function Zn(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 nh={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 s9(e,t,r){if(!Object.prototype.hasOwnProperty.call(nh,t))return;let n=nh[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=Us(r)??r;break;case"max-each-post-bytes":i=ml(r)??r;break;case"min-posts-interval":i=Ho(r)??r;break;case"xmux-keep-alive":i=Zn(r)??r;break}n9.default.set(e,n,i)}var xve=B(x()),Zg="auto",BX=[Zg,"none","zero","aes-128-gcm","chacha20-poly1305"],IX=[Zg,"aes-128-gcm","chacha20-poly1305","none"],xX=["none","chacha20-poly1305"],$X={"chacha20-ietf-poly1305":"chacha20-poly1305"};function i9(e){return e==null?"":`${e}`.trim().toLowerCase()}function WA(e){return $X[e]||e}function jr(e,t=BX,{acceptAliases:r=!0,fallback:n=Zg}={}){let i=i9(e);if(!i)return n;let o=t.map(i9);if(o.includes(i))return WA(i);let s=WA(i),a=o.map(WA);return r&&a.includes(s)?s:n}function Bp(e){return jr(e,IX)}function o9(e){return jr(e,xX,{fallback:"chacha20-poly1305"})}function a9(e){let t=Bp(e);return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}function u9(e){let t=jr(e,["aes-128-gcm","chacha20-poly1305"]);if(t!==Zg)return t==="chacha20-poly1305"?"chacha20-ietf-poly1305":t}var Jg="Surge",sh=class extends Error{constructor(t){super(t),this.name="SurgeUnsupportedProxyError"}};function Rn(e){return new sh(e)}var PX={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function Mo(e){if(typeof e!="string")return e;let t=e.trim(),r=t[0];return(r==='"'||r==="'")&&t[t.length-1]===r?t.slice(1,-1):t}function Vi(e){return`"${String(Mo(e))}"`}function 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":PX[i]??i,"no-error-alert":r?void 0:t["no-error-alert"],tfo:t.tfo??t["fast-open"],"test-url":t["test-url"],"test-timeout":t["test-timeout"],"test-udp":t["test-udp"],hybrid:t.hybrid,tos:o,"allow-other-interface":n?t["allow-other-interface"]:void 0,interface:n?t.interface??t["interface-name"]:void 0,"dns-follow-interface":n?t["dns-follow-interface"]:void 0,"block-quic":t["block-quic"],ecn:r?void 0:t.ecn,"underlying-proxy":r?void 0:t["underlying-proxy"]};for(let[a,u]of Object.entries(s)){if(u==null)continue;let l=typeof u=="string"&&u.includes(",")?Vi(u):u;e.append(`,${a}=${l}`)}}function YA(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 l9(e){return(Array.isArray(e)?e:Mo(`${e||""}`).split(",")).filter(r=>r!=null).map(r=>String(Mo(r)).trim()).filter(r=>r!=="").join(",")}function f9(e,t){let r=l9(t.alpn);r&&e.append(`,alpn="${r}"`)}function h9(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 kX(e){return l9(e?.["plugin-opts"]?.alpn??e?.alpn)}function Wa(e,t,r=!1){if(t.plugin!=="shadow-tls"||!t["plugin-opts"])return;let n=t["plugin-opts"].password,i=t["plugin-opts"].host,o=t["plugin-opts"].version;if(!n)return;if(e.append(`,shadow-tls-password="${n}"`),i&&e.append(`,shadow-tls-sni=${i}`),o){if(o<2)throw Rn(`shadow-tls version ${o} is not supported`);e.append(`,shadow-tls-version=${o}`)}let s=kX(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=${Vi(t["name-cert-verify"])}`,"name-cert-verify"),t.plugin!=="shadow-tls"&&f9(e,t),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify");let n=le(t,"keystore-client-cert")?t["keystore-client-cert"]:t["client-cert"];(le(t,"keystore-client-cert")||le(t,"client-cert"))&&e.append(`,client-cert=${Vi(n)}`),h9(e,t);let i=ze(t["ech-opts"])?t["ech-opts"]:void 0;if((i?KA(i.enable):qe(t._echConfigList))&&!t["reality-opts"]){let s=Wg(i?i.config:t._echConfigList);if(!s)throw Rn("Surge ECH requires an inline ECHConfigList in base64 or base64url");e.append(`,ech-config=${s}`)}}function RX(e,t){let r=le(t,"keystore-private-key")?t["keystore-private-key"]:t["private-key"];(le(t,"keystore-private-key")||le(t,"private-key"))&&e.append(`,private-key=${Vi(r)}`)}function d9(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 TX(e){return le(e,"obfs-opts.mode")||le(e,"obfs-opts.host")||le(e,"obfs-opts.path")}function OX(e){return Number(e.version)===6&&TX(e)}function ih(){return{produce:(t,r,n={})=>{if(t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"]&&!["vmess","trojan","vless"].includes(t.type))throw Rn(`Platform ${Jg} does not support network ${t.network} with http upgrade`);switch(t.ports&&(t.ports=String(t.ports)),t.type){case"ss":return NX(t);case"trojan":return LX(t);case"vmess":case"vless":return jX(t,n["include-unsupported-proxy"]);case"http":return zX(t);case"h2-connect":return qX(t);case"direct":return WX(t);case"socks5":return YX(t);case"snell":return ZX(t);case"tuic":return JX(t);case"wireguard-surge":return p9(t);case"hysteria2":return eZ(t);case"ssh":return GX(t);case"trusttunnel":return HX(t);case"masque-surge":return MX(t)}if(n["include-unsupported-proxy"]&&t.type==="wireguard")return QX(t);if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw Rn(`Platform ${Jg} does not support proxy type ${t.type} with network or REALITY`);return UX(t)}throw Rn(`Platform ${Jg} does not support proxy type: ${t.type}`)}}}function NX(e){let t=new We(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),e.cipher||(e.cipher="none"),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","none","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw Rn(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password"),le(e,"plugin")){if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else if(!["shadow-tls"].includes(e.plugin))throw Rn(`plugin ${e.plugin} is not supported`)}return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Wa(t,e,!0),fn(t,e),t.toString()}function LX(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),JA(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),Gi(t,e),Wa(t,e),fn(t,e),t.toString()}function UX(e){let t=new We(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 HX(e){let t=new We(e);if(t.append(`${e.name}=trust-tunnel,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),le(e,"client-random-auth-key")){let r=Mo(e["client-random-auth-key"]);if(typeof r!="string"||!/^[0-9a-f]+$/i.test(r))throw new Error("TrustTunnel client-random-auth-key must be a hex string");t.append(`,client-random-auth-key=${r}`)}return XA(t,e),d9(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 MX(e){let t=new We(e);return t.append(`${e.name}=masque,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),YA(t,e),Gi(t,e),fn(t,e),t.toString()}function qX(e){let t=new We(e);return t.append(`${e.name}=h2-connect,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),XA(t,e),d9(e),t.appendIfPresent(`,max-streams=${e["max-streams"]}`,"max-streams"),Gi(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Wa(t,e),fn(t,e),t.toString()}function jX(e,t){let r=e.type==="vless",n=new We(e);if(n.append(`${e.name}=${e.type},${e.server},${e.port}`),n.appendIfPresent(`,username=${e.uuid}`,"uuid"),!r){let i=u9(e.cipher);i&&n.append(`,encrypt-method=${i}`)}if(r)KX(n,e);else{JA(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 Wa(n,e),fn(n,e),n.toString()}function KX(e,t){let r=t.network??"tcp",n=t["reality-opts"],i=t.tls||n;if(!["tcp","raw","none","ws","grpc","xhttp"].includes(r))throw Rn(`VLESS network ${r} is unsupported`);if(t.encryption&&/[,\r\n"']/.test(t.encryption))throw Rn("VLESS encryption contains unsupported characters");if(!Vg(t))throw Rn("Unsupported VLESS transport, TLS or flow combination");if(r==="ws")JA(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"&&VX(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"),f9(e,t),h9(e,t)):(e.appendIfPresent(`,tls=${t.tls}`,"tls"),Gi(e,t,!!i))}function VX(e,t){let r=t["xhttp-opts"];if(r?.["download-settings"])throw Rn("VLESS XHTTP download-settings are unsupported");e.append(",xhttp=true");let n=ze(r?.headers)?Object.entries(r.headers):[],i=r?.host??n.find(([a])=>/^host$/i.test(a))?.[1];for(let[a,u]of Object.entries(nh)){let l=a==="host"?i:c9.default.get(r,u);if(l==null)continue;let h=String(l),m=Mo(h);if(!m&&a!=="session-table")continue;if(/[\r\n]/.test(h)||m.includes('"'))throw Rn(`VLESS xhttp-${a} contains unsupported characters`);let p=!m||/[,'\s]/.test(m)?Vi(m):m;e.append(`,xhttp-${a}=${p}`)}let o=n.filter(([a])=>!/^host$/i.test(a));if(o.some(([a,u])=>/[,="':|\r\n]/.test(a)||/[\r\n]/.test(String(u))))throw Rn("VLESS xhttp-headers contain unsupported characters");let s=ZA(Object.fromEntries(o),"|");s&&e.append(`,xhttp-headers=${Vi(s)}`)}function GX(e){let t=new We(e);return t.append(`${e.name}=ssh,${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),RX(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 zX(e){let t=new We(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),XA(t,e),Gi(t,e,!!e.tls),Wa(t,e),fn(t,e),t.toString()}function WX(e){let t=new We(e);return t.append(`${e.name}=direct`),fn(t,e),t.toString()}function YX(e){let t=new We(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,username="${e.username}"`,"username"),t.appendIfPresent(`,password="${e.password}"`,"password"),Gi(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),Wa(t,e),fn(t,e),t.toString()}function XA(e,t){let r=XX(t.headers);qe(r)&&e.append(`,headers=${Vi(r)}`)}function XX(e){return ZA(e,";")}function ZA(e,t){return!e||typeof e!="object"?"":Object.entries(e).filter(([r,n])=>qe(r)&&n!=null).map(([r,n])=>`${r}:${Vi(n)}`).join(t)}function ZX(e){if(OX(e))return Q.error(`Platform ${Jg} does not support Snell version ${e.version} with obfs`),"";let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk="${e.psk}"`,"psk"),Number(e.version)===6&&t.appendIfPresent(`,mode=${e.mode}`,"mode"),t.appendIfPresent(`,obfs=${e["obfs-opts"]?.mode}`,"obfs-opts.mode"),t.appendIfPresent(`,obfs-host=${e["obfs-opts"]?.host}`,"obfs-opts.host"),t.appendIfPresent(`,obfs-uri=${e["obfs-opts"]?.path}`,"obfs-opts.path"),Wa(t,e),t.appendIfPresent(`,reuse=${e.reuse}`,"reuse"),fn(t,e),t.toString()}function JX(e){let t=new We(e),r=e.type;return(!e.token||e.token.length===0)&&(r="tuic-v5"),t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),t.appendIfPresent(`,token=${e.token}`,"token"),YA(t,e),Gi(t,e),Wa(t,e),fn(t,e),t.toString()}function QX(e){let t=Array.isArray(e.peers)&&e.peers.length>0?e.peers:[e],{ip:r,ipv6:n}=Fp({ip:e["self-ip"]??e.ip??t[0].ip,ipv6:e["self-ip-v6"]??e.ipv6??t[0].ipv6}),i=qe(e["private-key-keystore-name"])?"private-key-keystore-name":"private-key",o=e[i];if(!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=p9({...e,"section-name":a,"underlying-proxy":s==null?e["underlying-proxy"]:void 0}),l=new We(e);l.append(`# > WireGuard Proxy ${e.name}
# ${u}
# > WireGuard Section ${e.name}
[WireGuard ${a}]
${i} = ${o}`),r&&l.append(`
self-ip = ${r}`),n&&l.append(`
self-ip-v6 = ${n}`);let h=e["dns-server"]??e.dns,m=Array.isArray(h)?h.join(", "):h;qe(m)&&l.append(`
dns-server = ${m}`),l.appendIfPresent(`
mtu = ${e.mtu}`,"mtu"),le(e,"prefer-ipv6")?l.append(`
prefer-ipv6 = ${e["prefer-ipv6"]}`):["ipv6-prefer","prefer-v6"].includes(e["ip-version"])&&l.append(`
prefer-ipv6 = true`);let p=e["allow-peer-access"]??e["accept-incoming"];s==null&&p!=null&&l.append(`
allow-peer-access = ${p}`),l.appendIfPresent(`
listen-port = ${s}`,"listen-port");let d=t.length===1?e:{},v=t.length===1&&s==null&&(p==null||/^false$/i.test(`${p}`.trim()))?[r&&"0.0.0.0/0",n&&"::/0"].filter(Boolean).join(","):void 0;for(let g of t){let y=g["allowed-ips"]??d["allowed-ips"],w=Mo(Array.isArray(y)?y.join(","):y)||v;if(!gl(g["public-key"])||!w)throw new Error("Surge WireGuard peers require public-key and allowed-ips");let E=g.endpoint;if(!qe(E)&&qe(g.server)&&gl(g.port)){let H=g.server.trim();E=`${Xt(H)?`[${H}]`:H}:${g.port}`}if(!qe(E)&&s==null)throw new Error("Surge WireGuard peers require endpoint without listen-port");let _=Mo(g["client-id"]??g.reserved);Array.isArray(_)?_=_.join("/"):/^[\da-f]{6}$/i.test(_)&&(_=`0x${_}`);let C={"public-key":g["public-key"],"allowed-ips":Vi(w),endpoint:E,keepalive:g["persistent-keepalive"]??g.keepalive??g["persistent-keepalive-interval"]??e["persistent-keepalive"]??e.keepalive,"client-id":_,"preshared-key":g["preshared-key"]??g["pre-shared-key"]??d["preshared-key"]??d["pre-shared-key"]},F=Object.entries(C).filter(([,H])=>gl(H)).map(([H,K])=>`${H} = ${K}`).join(", ");l.append(`
peer = (${F})`)}return l.toString()}function p9(e){let t=vt(e["section-name"])?.trim();if(!t)throw new Error("Surge WireGuard requires section-name");let r=t.includes(",")?Vi(t):t,n=new We(e);return n.append(`${e.name}=wireguard,section-name=${r}`),fn(n,e),n.toString()}function eZ(e){let t={salamander:"salamander-password",gecko:"gecko-password"}[e.obfs];if(e["obfs-password"]&&!t)throw Rn("only salamander and gecko obfs are supported");let r=new We(e);return r.append(`${e.name}=hysteria2,${e.server},${e.port}`),r.appendIfPresent(`,password="${e.password}"`,"password"),YA(r,e),e["obfs-password"]&&t&&r.append(`,${t}="${e["obfs-password"]}"`),Gi(r,e),Wa(r,e),r.appendIfPresent(`,download-bandwidth=${`${e.down}`.match(/\d+/)?.[0]||0}`,"down"),fn(r,e),r.toString()}function JA(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=ZA(n,"|");qe(i)&&e.append(`,ws-headers=${Vi(i)}`)}}else if(r&&["http"].includes(t.network))Q.info(`Include Unsupported Proxy: network ${t.network} -> tcp`);else{if(["tcp"].includes(t.network)&&t["reality-opts"])throw Rn("reality is unsupported");if(!["tcp"].includes(t.network))throw Rn(`network ${t.network} is unsupported`)}}var rwe=B(x());var Wve=B(x()),w9=B(aa());var Hve=B(x());function QA(e){try{return decodeURIComponent(`${e}`.replace(/\+/g,"%20"))}catch{return e}}function Qg(e){let t=e.indexOf("=");return t===-1?{key:QA(e),value:""}:{key:QA(e.slice(0,t)),value:QA(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 Ss(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=Qg(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=Qg(o);if(s.key===t&&s.value!=="")return s.value}return""}function eS(e,t){let r=vl(e,t),n=li(r);return n==null?{value:"",parsed:null}:{value:r,parsed:n}}function tZ(e,t,r){let n=e.includes("?")?e.endsWith("?")||e.endsWith("&")?"":"&":"?";return`${e}${n}${encodeURIComponent(t)}=${encodeURIComponent(`${r}`)}`}function tS(e,t,r){let n=e==null||e===""?"/":`${e}`,{path:i}=Ss(n,t);return tZ(i,t,r)}function tc(e){let t=e?.path;if(!e)return;let{value:r,parsed:n}=eS(t,"ed");if(e["v2ray-http-upgrade"]){r!==""&&(e.path=Ss(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=Ss(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 rc(e){e&&delete e["_v2ray-http-upgrade-ed"]}var rZ={dual:"dual","v4-only":"ipv4","v6-only":"ipv6","prefer-v4":"ipv4-prefer","prefer-v6":"ipv6-prefer"};function m9(e,t,r){if(!ze(t)||!qe(t[pl]))return;let n=qe(t["query-server-name"])?t["query-server-name"]:"\u8FD9\u91CC\u662F query-server-name";Q.warn(`mihomo \u4E0D\u652F\u6301\u5728 ech-opts \u4E2D\u914D\u7F6E ECH DNS. \u5982\u9700\u8DDF\u8282\u70B9 ECH \u914D\u7F6E\u4E00\u81F4, \u8BF7\u5728 mihomo \u914D\u7F6E\u6587\u4EF6\u91CC\u8BBE\u7F6E dns["nameserver-policy"]["${n}"] = ["${t[pl]}"].`)}function nZ(e,t){t!=="internal"&&(m9(e,e["ech-opts"],"ech-opts"),m9(e,e["xhttp-opts"]?.["download-settings"]?.["ech-opts"],"xhttp-opts.download-settings.ech-opts"))}function Hs(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>{if(!Gg(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(sZ(s)&&s.type==="trusttunnel")return Q.error(`mihomo does not support headers for TrustTunnel proxy ${s.name}. Proxy has been filtered.`),!1;if(th(s,["websocket"])){if(s.type==="snell"&&!iZ(s))return!1;if(g9(s)&&(!["ss","snell","vmess","vless","trojan","anytls"].includes(s.type)||!rS(v9(s),["ss","snell"].includes(s.type)?[1,2,3]:[0,1,2,3])))return!1;if(s.type==="vless"&&s.network==="xhttp"&&g9(s["xhttp-opts"]?.["download-settings"])&&!rS(v9(s["xhttp-opts"]["download-settings"]),[0,1,2,3]))return!1;if(oZ(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(nZ(s,n),zg(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=As(s,"ipv4"),s.ipv6=As(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=JI(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=nS(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="/"),tc(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];rc(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"]=rZ[s["ip-version"]]||s["ip-version"]),s});return Uo(o,n,i)}}}function sZ(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function rS(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 iZ(e){if(!rS(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&&!ze(i))s="obfs-opts must be a mapping";else if(!o.includes(i?.mode??""))s="unsupported obfs-opts.mode";else if(t){let a=w9.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 g9(e){return!!nS(e)}function oZ(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 v9(e){return nS(e)?.version}function nS(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 E9="SurgeMac",b9=ih();function Ip(){return{produce:(t,r,n={})=>{switch(t.type){case"external":return A9(t);default:{if(n.mihomoExternal||t._mihomoExternal)return y9(t,r,n)||"";try{return b9.produce(t,r,n)}catch(i){if(n.useMihomoExternal&&i instanceof sh){let o=y9(t,r,n)||"";if(!o)throw i;return Q.log(`${t.name} is not supported on ${E9}, try to use mihomo(SurgeMac - External Proxy Program) instead`),o}throw i instanceof sh?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 A9(e){let t=new We(e);if(!e.exec||!e["local-port"])throw new Error(`${e.type}: exec and local-port are required`);return t.append(`${e.name}=external,exec="${e.exec}",local-port=${e["local-port"]}`),Array.isArray(e.args)&&e.args.map(r=>{t.append(`,args="${r}"`)}),Array.isArray(e.addresses)&&e.addresses.map(r=>{t.append(`,addresses=${r}`)}),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),fn(t,e),t.toString()}function y9(e,t,r){let n=Hs().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=b9.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:[]};aZ(e.server)?l.addresses.push(e.server):Q.warn(`Platform ${E9}, proxy type ${e.type}: addresses should be an IP address, but got ${e.server}`),u=A9(l)}return r.localPort=i-1,u}}function aZ(e){return _r(e)||Xt(e)}var uwe=B(x());function e2(){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=Bp(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="/"),tc(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];rc(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return Uo(o,n,i)}}}var mwe=B(x());function t2(){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(th(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=Bp(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="/"),tc(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];rc(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return Uo(o,n,i)}}}var Dwe=B(x()),B9=B(aa()),I9=B(za());var wwe=B(x()),sS=B(za());var S9={"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"},_9={"session-id-placement":"session-placement","session-id-key":"session-key"},iS={"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"},uZ={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",...iS,...S9,..._9},xp={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",...S9,"no-grpc-header":"no-grpc-header",..._9,"session-id-table":"session-table","session-id-length":"session-length","seq-placement":"seq-placement","seq-key":"seq-key",...iS,...Object.fromEntries(Object.entries(uZ).map(([e,t])=>[`download-${e}`,`download-settings.${t}`]))};function C9(e){if(e)for(let t of["","download-"]){let r=o=>sS.default.get(e,xp[`${t}${o}`]);for(let o of Object.keys(iS)){let s=r(o);if(s==null)continue;let a=o==="xmux-http-keepalive-secs",u=a?Zn(s):Us(s);if(u==null||a&&u<-1){let l=a?"an integer of at least -1":"a non-negative integer or a valid non-negative integer range";throw new Error(`Loon xhttp-${t}${o} must be ${l}`)}}let n=r("xmux-max-concurrency"),i=r("xmux-max-connections");if(Ho(n)!=null&&Ho(i)!=null){let o=`xhttp-${t}xmux`;throw new Error(`Loon ${o}-max-concurrency and ${o}-max-connections cannot both be positive`)}}}function D9(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(xp,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=Us(r)??r;break;case"port":case"xmux-http-keepalive-secs":r=Zn(r)??r;break;case"alpn":r=[r];break}sS.default.set(e,xp[t],r)}}var $p="Loon",Ms={dual:"dual",ipv4:"v4-only",ipv6:"v6-only","ipv4-prefer":"prefer-v4","ipv6-prefer":"prefer-v6"};function oS(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${$p} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return lZ(t);case"ssr":return fZ(t);case"snell":return hZ(t);case"trojan":return dZ(t);case"vmess":return mZ(t,n["include-unsupported-proxy"]);case"vless":return vZ(t,n["include-unsupported-proxy"]);case"http":return wZ(t);case"socks5":return yZ(t);case"wireguard":return bZ(t);case"tailscale":return EZ(t);case"hysteria2":return SZ(t);case"mieru":return AZ(t)}if(t.type==="anytls"){if(t.network&&!["tcp"].includes(t.network))throw new Error(`Platform ${$p} does not support proxy type ${t.type} with network ${t.network}`);return pZ(t)}throw new Error(`Platform ${$p} 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 nc(e,t){let r=k9(t);r&&e.append(`,tls-profile=${r}`)}function wl(e,t,r=!1){let n=r?P9(t):$9(t);n&&e.append(`,alpn="${n}"`)}function Ya(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 aS(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");C9(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=Zn(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=P9(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:F9(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:k9(n)}}}e.append(",transport=xhttp");for(let[o,s]of[["path",r?.path],["host",F9(r)]])s!=null&&e.append(`,${o}=${Ya(s)}`);for(let[o,s]of Object.entries(xp)){let a=I9.default.get(i,s);a!=null&&e.append(`,xhttp-${o}=${Ya(a)}`)}for(let[o,s]of[["xhttp-header",r?.headers],["xhttp-download-header",n?.headers]])if(ze(s))for(let[a,u]of Object.entries(s))/^host$/i.test(a)||u==null||e.append(`,${o}=${Ya(`${a}: ${u}`,!0)}`)}function F9(e){if(e?.host!=null)return e.host;if(ze(e?.headers))return Object.entries(e.headers).find(([t])=>/^host$/i.test(t))?.[1]}function cZ(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 x9(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}`)}nc(e,t);let o=cZ(t);o&&e.append(`,alpn="${o}"`),e.appendIfPresent(`,udp-port=${t["udp-port"]}`,"udp-port")}function r2(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 $9(e){return(Array.isArray(e.alpn)?e.alpn:`${e.alpn||""}`.split(",")).map(r=>`${r}`.trim()).filter(r=>r!=="").join(",")}function P9(e,t=!1){let r=$9(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 k9(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 lZ(e){let t=new We(e);if(!["rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf","aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`${e.name}=shadowsocks,${e.server},${e.port},${e.cipher},"${e.password}"`),le(e,"plugin")){if(e.plugin==="obfs")t.append(`,obfs-name=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else if(!["shadow-tls"].includes(e.plugin))throw new Error(`plugin ${e.plugin} is not supported`)}x9(t,e),e["udp-over-tcp"]&&(e["udp-over-tcp-version"]===2?e.plugin==="obfs"?Q.error(`Platform ${$p} shadowsocks udp-over-tcp does not support obfs`):t.append(",udp-over-tcp=true"):Q.error(`Platform ${$p} 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=Ms[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function fZ(e){let t=new We(e);t.append(`${e.name}=shadowsocksr,${e.server},${e.port},${e.cipher},"${e.password}"`),t.append(`,protocol=${e.protocol}`),t.appendIfPresent(`,protocol-param=${e["protocol-param"]}`,"protocol-param"),t.appendIfPresent(`,obfs=${e.obfs}`,"obfs"),t.appendIfPresent(`,obfs-param=${e["obfs-param"]}`,"obfs-param"),x9(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=Ms[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function hZ(e){let t=Number(e.version);if(![4,5].includes(t))throw new Error(`Loon does not support Snell version ${e.version??1}`);if(e.psk==null||e.psk==="")throw new Error("Missing Snell PSK");let r=e["obfs-opts"];if(e.plugin||r?.mode&&!["none","http"].includes(r.mode))throw new Error("Loon Snell only supports HTTP obfs");let n=new We(e);n.append(`${e.name}=snell,${e.server},${e.port},${Ya(e.psk,!0)},version=${t}`),r?.mode==="http"&&(n.append(",obfs=http"),r.host!=null&&n.append(`,obfs-host=${Ya(r.host)}`),r.path!=null&&n.append(`,obfs-uri=${Ya(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=Ms[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${o}`,"ip-version"),n.toString()}function dZ(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=new We(e);if(n.append(`${e.name}=trojan,${e.server},${e.port},"${e.password}"`),e.network==="tcp"&&delete e.network,le(e,"network"))if(e.network==="ws")n.append(",transport=ws"),n.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),n.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(r)aS(n,e);else throw new Error(`network ${e.network} is unsupported`);n.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),nc(n,e),wl(n,e,r),t?r2(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=Ms[e["ip-version"]]||e["ip-version"];return n.appendIfPresent(`,ip-mode=${i}`,"ip-version"),n.toString()}function pZ(e){let t=!!e["reality-opts"],r=new We(e);r.append(`${e.name}=anytls,${e.server},${e.port},"${e.password}"`);for(let i of["idle-session-timeout","max-stream-count"])le(e,i)&&Number.isInteger(e[i])&&r.append(`,${i}=${e[i]}`);r.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),nc(r,e),wl(r,e),t?r2(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=Ms[e["ip-version"]]||e["ip-version"];return r.appendIfPresent(`,ip-mode=${n}`,"ip-version"),r.toString()}function mZ(e){let t=!!e["reality-opts"],r=e.network==="xhttp",n=a9(e.cipher),i=new We(e);if(i.append(`${e.name}=vmess,${e.server},${e.port},${n},"${e.uuid}"`),e.network==="tcp"&&delete e.network,le(e,"network"))if(e.network==="ws")i.append(",transport=ws"),i.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),i.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){i.append(",transport=http");let a=e["http-opts"]?.path,u=e["http-opts"]?.headers?.Host;i.appendIfPresent(`,path=${Array.isArray(a)?a[0]:a}`,"http-opts.path"),i.appendIfPresent(`,host=${Array.isArray(u)?u[0]:u}`,"http-opts.headers.Host")}else if(r)aS(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)&&nc(i,e),(e.tls||t||r)&&wl(i,e,r),t?r2(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=Ms[e["ip-version"]]||e["ip-version"];return i.appendIfPresent(`,ip-mode=${s}`,"ip-version"),i.toString()}function gZ(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=${Ya(l)}`),u.length&&e.append(`,encryption-padding=${Ya(u.join("."))}`)}function vZ(e){let t=!!e.flow,r=e["reality-opts"],n=!!vt(r?.["public-key"]),i=e.network==="xhttp",o=(e.network??"tcp")==="tcp",s=n||[!0,"true"].includes(e.tls),a=e.encryption&&e.encryption!=="none";if(r&&!n)throw new Error("Loon VLESS REALITY requires a non-blank public-key");if(t&&!["xtls-rprx-vision","xtls-rprx-vision-udp443"].includes(e.flow))throw new Error(`VLESS flow(${e.flow}) is not supported`);if(t&&!a&&(!o||!s))throw new Error("Loon VLESS Vision without encryption requires TCP with TLS or REALITY");let u=new We(e);if(u.append(`${e.name}=vless,${e.server},${e.port},"${e.uuid}"`),e.network==="tcp"&&delete e.network,le(e,"network"))if(e.network==="ws")u.append(",transport=ws"),u.appendIfPresent(`,path=${e["ws-opts"]?.path}`,"ws-opts.path"),u.appendIfPresent(`,host=${e["ws-opts"]?.headers?.Host}`,"ws-opts.headers.Host");else if(e.network==="http"){u.append(",transport=http");let h=e["http-opts"]?.path,m=e["http-opts"]?.headers?.Host;u.appendIfPresent(`,path=${Array.isArray(h)?h[0]:h}`,"http-opts.path"),u.appendIfPresent(`,host=${Array.isArray(m)?m[0]:m}`,"http-opts.headers.Host")}else if(i)aS(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)&&nc(u,e),(e.tls||n||t||i)&&wl(u,e,i),gZ(u,e.encryption),t&&u.append(`,flow=${e.flow}`),n?r2(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=Ms[e["ip-version"]]||e["ip-version"];return u.appendIfPresent(`,ip-mode=${l}`,"ip-version"),u.toString()}function wZ(e){let t=new We(e),r=e.tls?"https":"http";t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e.tls&&(nc(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=Ms[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${n}`,"ip-version"),t.toString()}function yZ(e){let t=new We(e);t.append(`${e.name}=socks5,${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,"${e.password}"`,"password"),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),t.appendIfPresent(`,sni=${e.sni}`,"sni"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),e.tls&&(nc(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=Ms[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}function EZ(e){let t=new We(e);t.append(`${e.name}=tailscale`);let r=e["exit-node"];r==="auto:any"&&(r="auto"),r===""&&(r="none");let n={"control-url":e["control-url"],"auth-key":e["auth-key"],hostname:e.hostname,"exit-node":r};for(let[s,a]of Object.entries(n)){if(!a)continue;let u=s==="control-url"||s==="auth-key"||/[,\s]/.test(a);t.append(`,${s}=${u?`"${a}"`:a}`)}for(let s of["accept-routes","accept-dns","magic-dns","path-mode","mtu","idle-session-timeout","udp"])t.appendIfPresent(`,${s}=${e[s]}`,s);let i=Ms[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 bZ(e){Array.isArray(e.peers)&&e.peers.length>0&&(e.server=e.peers[0].server,e.port=e.peers[0].port,e.ip=e.peers[0].ip,e.ipv6=e.peers[0].ipv6,e["public-key"]=e.peers[0]["public-key"],e["preshared-key"]=e.peers[0]["pre-shared-key"],e["allowed-ips"]=e.peers[0]["allowed-ips"],e.reserved=e.peers[0].reserved);let t=new We(e);if(t.append(`${e.name}=wireguard`),t.appendIfPresent(`,interface-ip=${e.ip}`,"ip"),t.appendIfPresent(`,interface-ipv6=${e.ipv6}`,"ipv6"),t.appendIfPresent(`,private-key="${e["private-key"]}"`,"private-key"),t.appendIfPresent(`,mtu=${e.mtu}`,"mtu"),e.dns&&Array.isArray(e.dns)){e.dnsv6=e.dns.find(a=>Xt(a));let s=e.dns.find(a=>_r(a));s||(s=e.dns.find(a=>!_r(a)&&!Xt(a))),e.dns=s}t.appendIfPresent(`,dns=${e.dns}`,"dns"),t.appendIfPresent(`,dnsv6=${e.dnsv6}`,"dnsv6"),t.appendIfPresent(`,keepalive=${e["persistent-keepalive"]}`,"persistent-keepalive"),t.appendIfPresent(`,keepalive=${e.keepalive}`,"keepalive");let r=Array.isArray(e["allowed-ips"])?e["allowed-ips"].join(","):e["allowed-ips"],n=Array.isArray(e.reserved)?e.reserved.join(","):e.reserved;n&&(n=`,reserved=[${n}]`);let i=e["preshared-key"]??e["pre-shared-key"];i&&(i=`,preshared-key="${i}"`),t.append(`,peers=[{public-key="${e["public-key"]}",allowed-ips="${r??"0.0.0.0/0,::/0"}",endpoint=${e.server}:${e.port}${n??""}${i??""}}]`);let o=Ms[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 AZ(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||B9.Buffer.byteLength(m,"utf8")>64))throw new Error("Loon Mieru username and password must each be 1-64 UTF-8 bytes");let o=new We(e),s=Xt(t)?`[${t}]`:t,[a,u]=i.map(m=>Ya(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=Ms[e["ip-version"]]||e["ip-version"];return o.appendIfPresent(`,ip-mode=${h}`,"ip-version"),o.toString()}function SZ(e){if(e["obfs-password"]&&e.obfs!="salamander")throw new Error("only salamander obfs is supported");let t=new We(e);t.append(`${e.name}=Hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,"${e.password}"`,"password"),le(e,"ports")&&`${e.ports}`.trim().length>0&&t.append(`,server-ports="${e.ports}"`),le(e,"hop-interval")&&`${e["hop-interval"]}`.trim().length>0&&t.append(`,hop-interval=${e["hop-interval"]}`),t.appendIfPresent(`,tls-name=${e.sni}`,"sni"),t.appendIfPresent(`,tls-cert-sha256=${e["tls-fingerprint"]}`,"tls-fingerprint"),t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),t.appendIfPresent(`,skip-cert-verify=${e["skip-cert-verify"]}`,"skip-cert-verify"),nc(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=Ms[e["ip-version"]]||e["ip-version"];return t.appendIfPresent(`,ip-mode=${r}`,"ip-version"),t.toString()}var Owe=B(x());function _Z(e,{excludeHost:t=!1}={}){if(!ze(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 CZ(e,t){let r=s2(e?.["_v2ray-http-upgrade-ed"]);if(r!=="")return r;let n=s2(Ss(t||"/","ed").value);return n!==""?n:2560}function n2(e,t){return t?.["v2ray-http-upgrade-fast-open"]?tS(e||"/","ed",CZ(t,e)):e}function uS(e,t){let r=t?.["max-early-data"],n=s2(r);if(n==="")return r!=null&&`${r}`!=""?e==null?e:Ss(e,"ed").path:e;let i=t?.["early-data-header-name"];return i&&i!=="Sec-WebSocket-Protocol"?e==null?e:Ss(e,"ed").path:tS(e||"/","ed",n)}function s2(e){return e==null||`${e}`==""||li(e)==null?"":`${e}`}function DZ(e){return Zn(e)}function FZ(e){return Us(e)}function R9({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 i2(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 BZ(e){if(!ze(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=Us(e[i]);s!=null&&(t[o]=typeof s=="number"?`${s}`:s)}let n=DZ(e["h-keep-alive-period"]);return n!=null&&(t.hKeepAlivePeriod=n),Object.keys(t).length>0?t:void 0}function T9(e,t,{excludeHostHeader:r=!0,xmuxTarget:n="root"}={}){if(!ze(e)||!ze(t))return;let i=_Z(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=FZ(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=Ho(t["sc-min-posts-interval-ms"]);a!=null&&(e.scMinPostsIntervalMs=a)}let s=BZ(t["reuse-settings"]);s&&(n==="extra"?e.extra={...ze(e.extra)?e.extra:{},xmux:s}:e.xmux=s)}function IZ(e,t={},r={}){if(!ze(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=Zn(e.port,{allowNegative:!1});s!=null&&(o.port=s);let a=ze(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=VA(e["ech-opts"],void 0,{dnsFieldPath:"xhttp-opts.download-settings.ech-opts._dns",warnDefaultDns:v=>R9({...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=sc(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=i2("xhttp",e)??i2("xhttp",t);p&&(h.host=p);let d=e.mode??t.mode;if(d&&(h.mode=d),T9(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 xZ(e){let t=e["xhttp-opts"]||{},r={};T9(r,t,{excludeHostHeader:!0,xmuxTarget:"root"});let n=IZ(t["download-settings"],t,e);return n&&(r.downloadSettings=n),Object.keys(r).length>0?r:void 0}function sc(e){if(Array.isArray(e))return e.map(sc);if(ze(e)){let t={};for(let[r,n]of Object.entries(e))t[r]=sc(n);return t}return e}function $Z(e,t){return e==null?sc(t):Array.isArray(e)||Array.isArray(t)?sc(e):ze(e)&&ze(t)?O9(e,t):sc(e)}function O9(e,t){let r=ze(e)?sc(e):{};if(!ze(t))return r;for(let[n,i]of Object.entries(t)){if(!Object.prototype.hasOwnProperty.call(r,n)){r[n]=sc(i);continue}r[n]=$Z(r[n],i)}return r}function N9(e){if(typeof e=="string")return e;if(ze(e))return JSON.stringify(e)}function PZ(e){let t=N9(e._extra);if(t!=null)return t;if(e.network!=="xhttp")return e._extra||"";let r=xZ(e),n=O9(r,e._extra_unsupported);return Object.keys(n).length>0?JSON.stringify(n):""}function cS(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=GA(e["ech-opts"],e._echConfigList,{dnsFieldPath:"ech-opts._dns",warnDefaultDns:V=>R9({...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=PZ(e);E&&(w=`&extra=${encodeURIComponent(E)}`);let _="",C=N9(e._finalmask);C&&(_=`&fm=${encodeURIComponent(C)}`);let F="";["xhttp"].includes(e.network)&&e[`${e.network}-opts`]?.mode?F=`&mode=${encodeURIComponent(e[`${e.network}-opts`].mode)}`:e._mode&&(F=`&mode=${encodeURIComponent(e._mode)}`);let H="";e._pqv&&(H=`&pqv=${encodeURIComponent(e._pqv)}`);let K="";e.encryption&&(K=`&encryption=${encodeURIComponent(e.encryption)}`);let S=e.network;e.network==="ws"&&e["ws-opts"]?.["v2ray-http-upgrade"]?S="httpupgrade":e.network==="http"?S="tcp":e.network==="h2"&&(S="http");let I=`&type=${encodeURIComponent(S)}`;if(e.network==="http"&&(I+="&headerType=http"),["grpc"].includes(e.network)){I+=`&mode=${encodeURIComponent(e[`${e.network}-opts`]?.["_grpc-type"]||"gun")}`;let V=e[`${e.network}-opts`]?.["_grpc-authority"];V&&(I+=`&authority=${encodeURIComponent(V)}`)}let q=e[`${e.network}-opts`]||{},L=e.network==="ws"&&q?.["v2ray-http-upgrade"],R=q?.[`${e.network}-service-name`],O=q?.path,T=i2(e.network,q),N=s2(e["ws-opts"]?.["max-early-data"]);Array.isArray(O)&&(O=O[0]),L&&q?.["v2ray-http-upgrade-fast-open"]?O=n2(O,q):e.network==="ws"&&e["ws-opts"]?.["max-early-data"]!=null&&O&&(O=Ss(O,"ed").path),O&&(I+=`&path=${encodeURIComponent(O)}`),T&&(I+=`&host=${encodeURIComponent(Array.isArray(T)?T[0]:T)}`),R&&(I+=`&serviceName=${encodeURIComponent(R)}`),e.network==="http"&&e["http-opts"]?.method&&(I+=`&method=${encodeURIComponent(e["http-opts"].method)}`),e.network==="kcp"&&(e.seed&&(I+=`&seed=${encodeURIComponent(e.seed)}`),e.headerType&&(I+=`&headerType=${encodeURIComponent(e.headerType)}`)),e.network==="ws"&&!L&&N!==""&&(I+=`&ed=${encodeURIComponent(N)}`);let P=e["ws-opts"]?.["early-data-header-name"];P&&(L||e["ws-opts"]?.["max-early-data"]==null||P!=="Sec-WebSocket-Protocol")&&(I+=`&eh=${encodeURIComponent(P)}`);let M="",Y;switch(e["packet-encoding"]!=null?Y=`${e["packet-encoding"]}`.trim().toLowerCase():e.xudp?Y="xudp":e["packet-addr"]?Y="packetaddr":e.udp===!0&&(Y=""),Y){case"":M="&packetEncoding=none";break;case"packetaddr":M="&packetEncoding=packet";break;case"xudp":M="&packetEncoding=xudp";break}return`vless://${e.uuid}@${e.server}:${e.port}?security=${encodeURIComponent(t)}${I}${M}${s}${a}${l}${h}${p}${u}${v}${g}${y}${n}${o}${i}${F}${w}${_}${H}${K}#${encodeURIComponent(e.name)}`}function oh(){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=Dp(se.mux);o+=encodeURIComponent(`v2ray-plugin;obfs=${se.mode};mode=${se.mode}${se.host?";obfs-host="+se.host:""}${se.host?";host="+se.host:""}${se.path?";path="+se.path:""}${se.tls?";tls":""}${se.sni?";sni="+se.sni:""}${se["skip-cert-verify"]?";skip-cert-verify="+se["skip-cert-verify"]:""}${pe!=null?";mux="+pe:""}`);break;case"shadow-tls":o+=encodeURIComponent(`shadow-tls;host=${se.host};password=${se.password};version=${se.version}`);break;default:throw new Error(`Unsupported plugin option: ${r.plugin}`)}}r["udp-over-tcp"]&&(o+="&uot=1"),r.tfo&&(o+="&tfo=1"),o+=`&udp=${r.udp?1:0}`;let s="";if(r.network){let se=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(se="httpupgrade"),s=`&type=${encodeURIComponent(se)}`,["grpc"].includes(r.network)){let Oe=r[`${r.network}-opts`]?.[`${r.network}-service-name`],pt=r[`${r.network}-opts`]?.["_grpc-authority"];Oe&&(s+=`&serviceName=${encodeURIComponent(Oe)}`),pt&&(s+=`&authority=${encodeURIComponent(pt)}`),s+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let pe=r[`${r.network}-opts`]||{},Fe=r.network==="ws"&&pe?.["v2ray-http-upgrade"],Te=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Te)&&(Te=Te[0]),Fe?Te=n2(Te,pe):r.network==="ws"&&(Te=uS(Te,pe)),Te&&(s+=`&path=${encodeURIComponent(Te)}`),Ve&&(s+=`&host=${encodeURIComponent(Array.isArray(Ve)?Ve[0]:Ve)}`)}let a="";r["client-fingerprint"]&&(a=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let u="";r.alpn&&(u=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let l=r["reality-opts"],h="",m="",p="",d=r.tls?"&security=tls":"",v="",g=r._extra&&(l||r.network==="xhttp")?`&extra=${encodeURIComponent(r._extra)}`:"";if(l){d="&security=reality";let se=r["reality-opts"]?.["public-key"];se&&(m=`&pbk=${encodeURIComponent(se)}`);let pe=r["reality-opts"]?.["short-id"];pe&&(h=`&sid=${encodeURIComponent(pe)}`);let Fe=r["reality-opts"]?.["_spider-x"];Fe&&(p=`&spx=${encodeURIComponent(Fe)}`),r._mode&&(v=`&mode=${encodeURIComponent(r._mode)}`)}r.tls&&(o+=`&sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}`),o+=`${s}${u}${a}${d}${h}${m}${p}${v}${g}#${encodeURIComponent(r.name)}`,n+=o.replace(/^&/,"?");break;case"ssr":n=`${r.server}:${r.port}:${r.protocol}:${r.cipher}:${r.obfs}:${bt.encode(r.password)}/`,n+=`?remarks=${bt.encode(r.name)}${r["obfs-param"]?"&obfsparam="+bt.encode(r["obfs-param"]):""}${r["protocol-param"]?"&protoparam="+bt.encode(r["protocol-param"]):""}`,n="ssr://"+bt.encode(n);break;case"vmess":if(r["reality-opts"]||r._finalmask){if(r.aead===!1||r.aead!==!0&&Number(r.alterId||0)!==0)throw new Error("VMess query URI format cannot represent non-AEAD authentication (alterId must be 0)");n=cS({...r,server:Xt(r.server)?`[${r.server}]`:r.server,network:r.network||"tcp",encryption:jr(r.cipher),flow:void 0}).replace(/^vless:\/\//,"vmess://");break}let y="",w=r.network||"tcp";if(r.network==="http"?(w="tcp",y="http"):r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(w="httpupgrade"),n={v:"2",ps:r.name,add:r.server,port:`${r.port}`,id:r.uuid,aid:`${r.alterId||0}`,scy:jr(r.cipher),net:w,type:y,tls:r.tls?"tls":"",alpn:Array.isArray(r.alpn)?r.alpn.join(","):r.alpn,fp:r["client-fingerprint"]},r.tls&&r.sni&&(n.sni=r.sni),r.network){let se=r[`${r.network}-opts`]||{},pe=r.network==="ws"&&se?.["v2ray-http-upgrade"],Fe=se?.path,Te=i2(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=n2(Fe,se):r.network==="ws"&&(Fe=uS(Fe,se)),Fe&&(n.path=Fe),Te&&(n.host=Array.isArray(Te)?r.network==="h2"?Te.join(","):Te[0]:Te))}n="vmess://"+bt.encode(JSON.stringify(n));break;case"vless":n=cS(r);break;case"trojan":let E="";if(r.network){let se=r.network;if(r.network==="ws"&&r["ws-opts"]?.["v2ray-http-upgrade"]&&(se="httpupgrade"),E=`&type=${encodeURIComponent(se)}`,["grpc"].includes(r.network)){let Oe=r[`${r.network}-opts`]?.[`${r.network}-service-name`],pt=r[`${r.network}-opts`]?.["_grpc-authority"];Oe&&(E+=`&serviceName=${encodeURIComponent(Oe)}`),pt&&(E+=`&authority=${encodeURIComponent(pt)}`),E+=`&mode=${encodeURIComponent(r[`${r.network}-opts`]?.["_grpc-type"]||"gun")}`}let pe=r[`${r.network}-opts`]||{},Fe=r.network==="ws"&&pe?.["v2ray-http-upgrade"],Te=pe?.path,Ve=pe?.headers?.Host;Array.isArray(Te)&&(Te=Te[0]),Fe?Te=n2(Te,pe):r.network==="ws"&&(Te=uS(Te,pe)),Te&&(E+=`&path=${encodeURIComponent(Te)}`),Ve&&(E+=`&host=${encodeURIComponent(Array.isArray(Ve)?Ve[0]:Ve)}`)}let _="";r["client-fingerprint"]&&(_=`&fp=${encodeURIComponent(r["client-fingerprint"])}`);let C="";r["tls-fingerprint"]&&(C=`&pcs=${encodeURIComponent(r["tls-fingerprint"])}`);let F="",H=Array.isArray(r._vcn)?r._vcn.join(","):r["name-cert-verify"];(Array.isArray(r._vcn)||H)&&(F=`&vcn=${encodeURIComponent(H)}`);let K="";r.alpn&&(K=`&alpn=${encodeURIComponent(Array.isArray(r.alpn)?r.alpn:r.alpn.join(","))}`);let S=r["reality-opts"],I="",q="",L="",R="",O="",T="";if(S){R="&security=reality";let se=r["reality-opts"]?.["public-key"];se&&(q=`&pbk=${encodeURIComponent(se)}`);let pe=r["reality-opts"]?.["short-id"];pe&&(I=`&sid=${encodeURIComponent(pe)}`);let Fe=r["reality-opts"]?.["_spider-x"];Fe&&(L=`&spx=${encodeURIComponent(Fe)}`),r._extra&&(T=`&extra=${encodeURIComponent(r._extra)}`),r._mode&&(O=`&mode=${encodeURIComponent(r._mode)}`)}n=`trojan://${encodeURIComponent(r.password)}@${r.server}:${r.port}?sni=${encodeURIComponent(r.sni||r.server)}${r["skip-cert-verify"]?"&allowInsecure=1":""}${E}${K}${_}${C}${F}${R}${I}${q}${L}${O}${T}#${encodeURIComponent(r.name)}`;break;case"hysteria2":let N=[];r["hop-interval"]&&N.push(`hop-interval=${r["hop-interval"]}`),r.keepalive&&N.push(`keepalive=${r.keepalive}`),r["skip-cert-verify"]&&N.push("insecure=1"),r.obfs&&(N.push(`obfs=${encodeURIComponent(r.obfs)}`),r["obfs-password"]&&N.push(`obfs-password=${encodeURIComponent(r["obfs-password"])}`)),r.sni&&N.push(`sni=${encodeURIComponent(r.sni)}`),r.ports&&N.push(`mport=${r.ports}`),r["tls-fingerprint"]&&N.push(`pinSHA256=${encodeURIComponent(r["tls-fingerprint"])}`),r.tfo&&N.push("fastopen=1");let P=GA(r["ech-opts"]);P&&N.push(`ech=${encodeURIComponent(P)}`),n=`hysteria2://${encodeURIComponent(r.password)}@${r.server}:${r.port}?${N.join("&")}#${encodeURIComponent(r.name)}`;break;case"hysteria":let M=[];Object.keys(r).forEach(se=>{if(!["name","type","server","port"].includes(se)){let pe=se.replace(/-/,"_");["alpn"].includes(se)?r[se]&&M.push(`${pe}=${encodeURIComponent(Array.isArray(r[se])?r[se][0]:r[se])}`):["skip-cert-verify"].includes(se)?r[se]&&M.push("insecure=1"):["tfo","fast-open"].includes(se)?r[se]&&!M.includes("fastopen=1")&&M.push("fastopen=1"):["ports"].includes(se)?M.push(`mport=${r[se]}`):["auth-str"].includes(se)?M.push(`auth=${r[se]}`):["up"].includes(se)?M.push(`upmbps=${r[se]}`):["down"].includes(se)?M.push(`downmbps=${r[se]}`):["_obfs"].includes(se)?M.push(`obfs=${r[se]}`):["obfs"].includes(se)?M.push(`obfsParam=${r[se]}`):["sni"].includes(se)?M.push(`peer=${r[se]}`):r[se]&&!/^_/i.test(se)&&M.push(`${pe}=${encodeURIComponent(r[se])}`)}}),n=`hysteria://${r.server}:${r.port}?${M.join("&")}#${encodeURIComponent(r.name)}`;break;case"tuic":if(!r.token||r.token.length===0){let se=[];Object.keys(r).forEach(pe=>{if(!["name","type","uuid","password","server","port","tls"].includes(pe)){let Fe=pe.replace(/-/,"_");["alpn"].includes(pe)?r[pe]&&se.push(`${Fe}=${encodeURIComponent(Array.isArray(r[pe])?r[pe][0]:r[pe])}`):["skip-cert-verify"].includes(pe)?r[pe]&&se.push("allow_insecure=1"):["tfo","fast-open"].includes(pe)?r[pe]&&!se.includes("fast_open=1")&&se.push("fast_open=1"):["disable-sni","reduce-rtt"].includes(pe)&&r[pe]?se.push(`${Fe.replace(/-/g,"_")}=1`):["congestion-controller"].includes(pe)?se.push(`congestion_control=${r[pe]}`):r[pe]&&!/^_/i.test(pe)&&se.push(`${Fe.replace(/-/g,"_")}=${encodeURIComponent(r[pe])}`)}}),n=`tuic://${encodeURIComponent(r.uuid)}:${encodeURIComponent(r.password)}@${r.server}:${r.port}?${se.join("&")}#${encodeURIComponent(r.name)}`}break;case"anytls":n=cS({...r,uuid:encodeURIComponent(r.password),network:r.network||"tcp"}).replace("vless","anytls");let Y=[];Object.keys(r).forEach(se=>{if(!["name","type","password","server","port","tls"].includes(se)){let pe=se.replace(/-/,"_");["alpn"].includes(se)?r[se]&&Y.push(`${pe}=${encodeURIComponent(Array.isArray(r[se])?r[se][0]:r[se])}`):["skip-cert-verify"].includes(se)?r[se]&&Y.push("insecure=1"):["udp"].includes(se)?r[se]&&Y.push("udp=1"):r[se]&&!/^_|client-fingerprint/i.test(se)&&["number","string","boolean"].includes(typeof r[se])&&Y.push(`${pe.replace(/-/g,"_")}=${encodeURIComponent(r[se])}`)}});let V=n.split("?"),X=V[0],te={};V.length>1&&V[1].split("#")[0].split("&").forEach(Fe=>{let[Te,Ve]=Fe.split("=");Te&&(te[Te]=Ve)}),Y.forEach(se=>{let[pe,Fe]=se.split("=");pe&&(te[pe]=Fe)});let ae=Object.keys(te).map(se=>`${se}=${te[se]}`).join("&"),me=n.match(/#(.*)$/),he=me?`#${me[1]}`:"";n=`${X}?${ae}${he}`;break;case"mieru":{let se=r["port-range"]||r.port,pe=encodeURIComponent(r.username??""),Fe=encodeURIComponent(r.password??"");if(!r.server||!se||!pe||!Fe)throw new Error("Mieru URI requires a server, port and credentials");let Te=[`port=${encodeURIComponent(se)}`,`protocol=${encodeURIComponent(r.transport||"TCP")}`,`profile=${encodeURIComponent(r.name||r.server)}`];for(let Ve of["multiplexing","handshake-mode","traffic-pattern"])r[Ve]&&Te.push(`${Ve}=${encodeURIComponent(r[Ve])}`);n=`mierus://${pe}:${Fe}@${r.server}?${Te.join("&")}`;break}case"wireguard":let De=[];Object.keys(r).forEach(se=>{["name","type","server","port","ip","ipv6","ip-cidr","ipv6-cidr","private-key"].includes(se)||(["public-key"].includes(se)?De.push(`publickey=${encodeURIComponent(r[se])}`):["udp"].includes(se)?r[se]&&De.push(`${se}=1`):r[se]&&!/^_/i.test(se)&&De.push(`${se}=${encodeURIComponent(r[se])}`))});let Pe=As(r,"ipv4"),Ie=As(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 Mwe=B(x());var kZ=oh();function Pp(){return{type:"ALL",produce:r=>{let n=[];return r.map(i=>{try{n.push(kZ.produce(i))}catch(o){Q.error(`Cannot produce proxy: ${i.name}
Reason: ${o}`)}}),bt.encode(n.join(`
`))}}}var Vwe=B(x()),lS=B(aa());var o2="QX";function RZ(e){return(Array.isArray(e)?e:`${e}`.split(",")).map(r=>`${r}`.trim()).filter(Boolean).map(r=>{let n=lS.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 Xa(e,t){if(le(t,"tls-alpn")){e.append(`,tls-alpn=${t["tls-alpn"]}`);return}let r=le(t,"alpn")&&RZ(t.alpn);r&&e.append(`,tls-alpn=${r}`)}function kp(){let e=(t,r,n={})=>{if(["ws"].includes(t.network)&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${o2} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return TZ(t);case"ssr":return OZ(t);case"trojan":return NZ(t);case"vmess":return LZ(t);case"http":return qZ(t);case"socks5":return jZ(t);case"vless":return UZ(t);case"anytls":return HZ(t);case"hysteria2":return MZ(t);case"mieru":return KZ(t)}throw new Error(`Platform ${o2} 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 ${o2} 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 fS(e){return["http","vmess-http","vemss-http","shadowsocks-http"].includes(e._qx_obfs_http)?e._qx_obfs_http:"http"}function Za(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 TZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t),i=eh(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}`),Jn(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=${fS(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(Jn(e)||e.plugin==="v2ray-plugin"&&e["plugin-opts"]?.tls)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 OZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`shadowsocks=${e.server}:${e.port}`),r(`,method=${e.cipher}`),r(`,password=${e.password}`),r(`,ssr-protocol=${e.protocol}`),n(`,ssr-protocol-param=${e["protocol-param"]}`,"protocol-param"),n(`,obfs=${e.obfs}`,"obfs"),n(`,obfs-host=${e["obfs-param"]}`,"obfs-param"),n(`,fast-open=${e.tfo}`,"tfo"),n(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,server_check_url=${e["test-url"]}`,"test-url"),r(`,tag=${e.name}`),t.toString()}function NZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`trojan=${e.server}:${e.port}`),r(`,password=${e.password}`),le(e,"network")){if(e.network==="ws")Jn(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"&&Jn(e)&&r(",over-tls=true"),Jn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 LZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);r(`vmess=${e.server}:${e.port}`);let i=o9(e.cipher);if(r(`,method=${i}`),r(`,password=${e.uuid}`),Jn(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=${fS(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 Jn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 UZ(e){if(e.encryption&&e.encryption!=="none")throw new Error("VLESS encryption is not supported");let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);if(r(`vless=${e.server}:${e.port}`),r(",method=none"),r(`,password=${e.uuid}`),Jn(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=${fS(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 Jn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 HZ(e){let t=e.network?.trim().toLowerCase();if(t&&t!=="tcp")throw new Error(`Platform ${o2} does not support AnyTLS with transport ${e.network}`);let r=new We(e),n=r.append.bind(r),i=r.appendIfPresent.bind(r);return n(`anytls=${e.server}:${e.port}`),n(`,password=${e.password}`),e.tls=!0,n(",over-tls=true"),i(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 MZ(e){let t=e.obfs||"salamander";if(!["salamander","gecko"].includes(t))throw new Error("QX Hysteria 2 only supports Salamander and Gecko obfuscation");let r=new We(e);r.append(`hysteria2=${e.server}:${e.port}`),r.appendIfPresent(`,password=${e.password}`,"password");let n=String(e.ports||"").trim();n&&r.append(`,port-hopping=${n.replace(/;/g,",")}`);let i=Number(e["hop-interval"]);if(Number.isInteger(i)&&i>=5&&i<=3600&&r.append(`,port-hopping-interval=${i}`),le(e,"obfs-password")){let s=String(e["obfs-password"]);if(lS.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"),Xa(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"),Za(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 qZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`http=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Jn(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Jn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 jZ(e){let t=new We(e),r=t.append.bind(t),n=t.appendIfPresent.bind(t);return r(`socks5=${e.server}:${e.port}`),n(`,username=${e.username}`,"username"),n(`,password=${e.password}`,"password"),Jn(e)&&(e.tls=!0),n(`,over-tls=${e.tls}`,"tls"),Jn(e)&&(n(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 KZ(e){let t=new We(e);return t.append(`mieru=${e.server}:${e.port}`),t.appendIfPresent(`,username=${e.username}`,"username"),t.appendIfPresent(`,password=${e.password}`,"password"),Jn(e)&&(e.tls=!0),t.appendIfPresent(`,over-tls=${e.tls}`,"tls"),Jn(e)&&(t.appendIfPresent(`,tls-pubkey-sha256=${e["tls-pubkey-sha256"]}`,"tls-pubkey-sha256"),Xa(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"),Za(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 Jn(e){return e.tls}var Zwe=B(x());function Rp(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>{if(i["include-unsupported-proxy"])return!0;if(th(s,["websocket","quic","http2","mkcp","grpc"])){if(s.type==="snell"&&![1,2,3,4,5,6].includes(s.version))return!1;if(VZ(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(zg(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=As(s,"ipv4"),s.ipv6=As(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"?eh(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="/"),tc(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];rc(s[`${s.network}-opts`])}return["grpc"].includes(s.network)&&s[`${s.network}-opts`]&&(delete s[`${s.network}-opts`]["_grpc-type"],delete s[`${s.network}-opts`]["_grpc-authority"]),s});return Uo(o,n,i)}}}function VZ(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 rye=B(x()),U9=B(za());var Tp="Surfboard";function yl(e){return e!=null&&`${e}`.trim().length>0}function El(e,t,r=!0){r&&(e.appendIfPresent(`,server-cert-fingerprint-sha256=${t["tls-fingerprint"]}`,"tls-fingerprint"),e.appendIfPresent(`,sni="${t.sni}"`,"sni"),e.appendIfPresent(`,skip-cert-verify=${t["skip-cert-verify"]}`,"skip-cert-verify"))}function a2(){return{produce:t=>{if(t.type!=="vless"&&t.network==="ws"&&t["ws-opts"]?.["v2ray-http-upgrade"])throw new Error(`Platform ${Tp} does not support network ${t.network} with http upgrade`);switch(t.type){case"ss":return XZ(t);case"trojan":return ZZ(t);case"vmess":return JZ(t);case"vless":return QZ(t);case"http":return eJ(t);case"snell":return YZ(t);case"tuic":return GZ(t);case"socks5":return tJ(t);case"hysteria2":return zZ(t);case"wireguard-surge":return rJ(t)}if(t.type==="anytls"){if(t.network&&(!["tcp"].includes(t.network)||["tcp"].includes(t.network)&&t["reality-opts"]))throw new Error(`Platform ${Tp} does not support proxy type ${t.type} with network or REALITY`);return WZ(t)}throw new Error(`Platform ${Tp} does not support proxy type: ${t.type}`)}}}function GZ(e){if(e.token?.length)throw new Error(`Platform ${Tp} does not support proxy type ${e.type} v4`);let t=new We(e);return t.append(`${e.name}=tuic-v5,${e.server},${e.port}`),t.appendIfPresent(`,uuid=${e.uuid}`,"uuid"),t.appendIfPresent(`,password="${e.password}"`,"password"),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"]}`),El(t,e),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.toString()}function zZ(e){if(e.obfs&&e.obfs!=="salamander"||e["obfs-password"]&&e.obfs!=="salamander")throw new Error("Surfboard Hysteria2 only supports salamander obfs");let t=new We(e);return t.append(`${e.name}=hysteria2,${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),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(`,salamander-password="${e["obfs-password"]}"`),El(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 WZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password="${e.password}"`,"password"),El(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 YZ(e){if(le(e,"version")&&![1,2,3,4,5].includes(Number(e.version)))throw new Error(`Platform ${Tp} does not support snell version ${e.version}`);let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,version=${e.version}`,"version"),t.appendIfPresent(`,psk="${e.psk}"`,"psk"),t.appendIfPresent(`,obfs=${e["obfs-opts"]?.mode}`,"obfs-opts.mode"),t.appendIfPresent(`,obfs-host=${e["obfs-opts"]?.host}`,"obfs-opts.host"),t.appendIfPresent(`,obfs-uri=${e["obfs-opts"]?.path}`,"obfs-opts.path"),t.appendIfPresent(`,tfo=${e.tfo}`,"tfo"),e.version>=3&&t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function XZ(e){let t=new We(e);if(t.append(`${e.name}=${e.type},${e.server},${e.port}`),!["aes-128-gcm","aes-192-gcm","aes-256-gcm","chacha20-ietf-poly1305","xchacha20-ietf-poly1305","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(e.cipher))throw new Error(`cipher ${e.cipher} is not supported`);if(t.append(`,encrypt-method=${e.cipher}`),t.appendIfPresent(`,password="${e.password}"`,"password"),le(e,"plugin"))if(e.plugin==="obfs")t.append(`,obfs=${e["plugin-opts"].mode}`),t.appendIfPresent(`,obfs-host=${e["plugin-opts"].host}`,"plugin-opts.host"),t.appendIfPresent(`,obfs-uri=${e["plugin-opts"].path}`,"plugin-opts.path");else throw new Error(`plugin ${e.plugin} is not supported`);return t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function ZZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,password=${e.password}`,"password"),H9(t,e),t.appendIfPresent(`,tls=${e.tls}`,"tls"),El(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 JZ(e){let t=new We(e);return t.append(`${e.name}=${e.type},${e.server},${e.port}`),t.appendIfPresent(`,username=${e.uuid}`,"uuid"),H9(t,e),le(e,"aead")?t.append(`,vmess-aead=${e.aead}`):t.append(`,vmess-aead=${e.alterId===0}`),t.appendIfPresent(`,tls=${e.tls}`,"tls"),El(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function QZ(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(!Vg(e))throw new Error("Unsupported VLESS transport, TLS or flow combination");let t=new We(e);t.append(`${e.name}=vless,${e.server},${e.port}`);let r=(s,a)=>{if(a==null)return;let u=String(a),l=!u||/[,;"'\s\\]/.test(u)?`"${u.replace(/["\\]/g,"\\$&")}"`:u;t.append(`,${s}=${l}`)};r("username",e.uuid);let n=e.network??"tcp";if(n==="ws"){let s=e["ws-opts"];r("ws",!0),s?.["v2ray-http-upgrade"]&&r("ws-http-upgrade",!0),r("ws-path",s?.path),r("ws-headers",L9(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(nh))r(`xhttp-${l}`,l==="host"?u:U9.default.get(s,h));r("xhttp-headers",L9(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 L9(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 eJ(e){let t=new We(e),r=e.tls?"https":"http";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),El(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function tJ(e){let t=new We(e),r=e.tls?"socks5-tls":"socks5";return t.append(`${e.name}=${r},${e.server},${e.port}`),t.appendIfPresent(`,${e.username}`,"username"),t.appendIfPresent(`,${e.password}`,"password"),El(t,e,!!e.tls),t.appendIfPresent(`,udp-relay=${e.udp}`,"udp"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function rJ(e){let t=new We(e);return t.append(`${e.name}=wireguard`),t.appendIfPresent(`,section-name=${e["section-name"]}`,"section-name"),t.appendIfPresent(`,block-quic=${e["block-quic"]}`,"block-quic"),t.toString()}function H9(e,t){if(le(t,"network"))if(t.network==="ws"){if(e.append(",ws=true"),le(t,"ws-opts")&&(e.appendIfPresent(`,ws-path=${t["ws-opts"].path}`,"ws-opts.path"),le(t,"ws-opts.headers"))){let r=t["ws-opts"].headers,n=Object.keys(r).map(i=>{let o=r[i];return["Host"].includes(i)&&(o=`"${o}"`),`${i}:${o}`}).join("|");qe(n)&&e.append(`,ws-headers=${n}`)}}else{if(["tcp"].includes(t.network)&&t["reality-opts"])throw new Error("reality is unsupported");if(!["tcp"].includes(t.network))throw new Error(`network ${t.network} is unsupported`)}}var lye=B(x()),q9=B(aa());var nJ={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=nJ[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})},sJ=e=>{let t=e["control-http-client"];return t==null?!1:typeof t=="string"?t.trim()!=="":ze(t)?Object.values(t).some(r=>r!=null&&r!==""):!0},pn=(e,t)=>{t.detour=e["dialer-proxy"]||e.detour},zi=(e,t)=>{if(["tcp","udp"].includes(e._network)){t.network=e._network;return}e.udp===!1&&(t.network="tcp")},Qn=(e,t)=>{t.tcp_fast_open=!1,e.tfo&&(t.tcp_fast_open=!0),e.tcp_fast_open&&(t.tcp_fast_open=!0),e["tcp-fast-open"]&&(t.tcp_fast_open=!0),t.tcp_fast_open||delete t.tcp_fast_open},Wi=(e,t)=>{!e||!e.enabled||(t.multiplex={enabled:!0},t.multiplex.protocol=e.protocol,e["max-connections"]&&(t.multiplex.max_connections=parseInt(`${e["max-connections"]}`,10)),e["max-streams"]&&(t.multiplex.max_streams=parseInt(`${e["max-streams"]}`,10)),e["min-streams"]&&(t.multiplex.min_streams=parseInt(`${e["min-streams"]}`,10)),e.padding&&(t.multiplex.padding=!0),(e["brutal-opts"]?.up||e["brutal-opts"]?.down)&&(t.multiplex.brutal={enabled:!0},e["brutal-opts"]?.up&&(t.multiplex.brutal.up_mbps=parseInt(`${e["brutal-opts"]?.up}`,10)),e["brutal-opts"]?.down&&(t.multiplex.brutal.down_mbps=parseInt(`${e["brutal-opts"]?.down}`,10))))},dS=(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}=eS(r.path,"ed");n!==""&&(r.path=Ss(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},j9=(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},K9=(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},pS=(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},iJ=(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}-----`]},oJ=["chrome","firefox","edge","safari","360","qq","ios","android","random","randomized"],V9=e=>{let t=`${e||""}`.trim().toLowerCase();if(oJ.includes(t))return t},G9=(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=[q9.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}`)},Ja=(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=V9(e["client-fingerprint"]);r&&(t.tls.utls={...t.tls.utls,enabled:!0,fingerprint:r})}if(e._ech&&ze(e._ech))t.tls.ech=e._ech;else if(e["ech-opts"]&&ze(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=iJ(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?G9(e,t):delete t.tls},aJ=(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),Qn(e,t),pn(e,t),hn(e,t),dn(e,t),t},uJ=(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),Qn(e,t),pn(e,t),Ja(e,t),hn(e,t),dn(e,t),t},cJ=(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),zi(e,t),Qn(e,t),pn(e,t),hn(e,t),dn(e,t),t},lJ=(e={})=>{let t=u2(e),r={tag:e.name,type:"shadowsocks",method:e.cipher,password:e.password,detour:c2(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}),zi(e,r),Wi(e.smux,r),{type:"ss-with-st",ssPart:r,stPart:hS(e,t)}},c2=(e={})=>`${e.name}_shadowtls`,u2=(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}},M9=e=>{if(typeof e=="string")return e.split(",").map(t=>t.trim()).filter(t=>t!=="");if(Array.isArray(e))return e},hS=(e={},t)=>{if(!t)throw new Error("shadow-tls plugin options are missing");let r=V9(e["client-fingerprint"]),n={tag:c2(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=M9(t.alpn)??M9(e.alpn);return i&&(n.tls.alpn=i),G9(e,n),e["fast-open"]===!0&&(n.udp_fragment=!0),Qn(e,n),pn(e,n),hn(e,n),dn(e,n),n},fJ=(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),zi(e,t),Qn(e,t),pn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),e.plugin){let r=[];e.plugin==="obfs"&&(t.plugin="obfs-local",t.plugin_opts="",e["obfs-host"]&&(e["plugin-opts"].host=e["obfs-host"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"mode":r.push(`obfs=${e["plugin-opts"].mode}`);break;case"host":r.push(`obfs-host=${e["plugin-opts"].host}`);break;default:r.push(`${n}=${e["plugin-opts"][n]}`);break}})),e.plugin==="v2ray-plugin"&&(t.plugin="v2ray-plugin",e["ws-host"]&&(e["plugin-opts"].host=e["ws-host"]),e["ws-path"]&&(e["plugin-opts"].path=e["ws-path"]),Object.keys(e["plugin-opts"]).forEach(n=>{switch(n){case"tls":e["plugin-opts"].tls&&r.push("tls");break;case"host":r.push(`host=${e["plugin-opts"].host}`);break;case"path":r.push(`path=${e["plugin-opts"].path}`);break;case"headers":r.push(`headers=${JSON.stringify(e["plugin-opts"].headers)}`);break;case"mux":{let i=Dp(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},hJ=(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),zi(e,t),Qn(e,t),pn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},dJ=e=>{if(e==null)return;let t=`${e}`.trim();return/^\d+$/.test(t)?parseInt(t,10):NaN},pJ=(e={},t=!1)=>{let r=dJ(e.version),n=u2(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),zi(e,s),n?(s.detour=c2(e),delete s.server,delete s.server_port):(e["fast-open"]&&(s.udp_fragment=!0),Qn(e,s),pn(e,s),hn(e,s),dn(e,s)),s},mJ=["","packetaddr","xudp"],gJ=e=>{let t=`${e}`.trim().toLowerCase();if(mJ.includes(t))return t},z9=(e,t)=>{if(e["packet-encoding"]!=null){let r=gJ(e["packet-encoding"]);r!=null&&(t.packet_encoding=r)}else e.xudp?t.packet_encoding="xudp":e["packet-addr"]&&(t.packet_encoding="packetaddr")},vJ=(e,t)=>{z9(e,t),e["global-padding"]!=null&&(t.global_padding=!!e["global-padding"]),e["authenticated-length"]!=null&&(t.authenticated_length=!!e["authenticated-length"])},wJ=(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 vJ(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.network==="ws"&&dS(e,t),e.network==="h2"&&K9(e,t),e.network==="http"&&j9(e,t),e.network==="grpc"&&pS(e,t),zi(e,t),Qn(e,t),pn(e,t),Ja(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},yJ=(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 z9(e,t),e["fast-open"]&&(t.udp_fragment=!0),e.flow!=null&&(t.flow=e.flow),e.network==="ws"&&dS(e,t),e.network==="h2"&&K9(e,t),e.network==="http"&&j9(e,t),e.network==="grpc"&&pS(e,t),zi(e,t),Qn(e,t),pn(e,t),Wi(e.smux,t),Ja(e,t),hn(e,t),dn(e,t),t},EJ=(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"&&pS(e,t),e.network==="ws"&&dS(e,t),zi(e,t),Qn(e,t),pn(e,t),Ja(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},bJ=(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),Qn(e,t),pn(e,t),Ja(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t.tls?.insecure&&(Q.info("Platform sing-box: insecure is not supported on naive outbound"),delete t.tls.insecure),t},AJ=(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)),zi(e,t),Ja(e,t),pn(e,t),Qn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},SJ=(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"]),zi(e,t),Ja(e,t),Qn(e,t),pn(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},_J=(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`),zi(e,t),Qn(e,t),pn(e,t),Ja(e,t),Wi(e.smux,t),hn(e,t),dn(e,t),t},CJ=(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),Ja(e,r),hn(e,r),dn(e,r),r},DJ=(e={})=>{let t=sJ(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)),ze(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},FJ=(e={})=>{let t=["ipv4","ipv6"].map(o=>As(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 Qn(e,i),pn(e,i),Wi(e.smux,i),hn(e,i),dn(e,i),delete i.server,delete i.server_port,delete i.pre_shared_key,delete i.peer_public_key,delete i.reserved,i};function l2(){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(Hs().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=u2(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=hS(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(aJ(u));break;case"http":o.push(uJ(u));break;case"socks5":if(u.tls)throw new Error(`Platform sing-box does not support proxy type: ${u.type} with tls`);o.push(cJ(u));break;case"ss":if(u.plugin==="shadow-tls"){let{ssPart:v,stPart:g}=lJ(u);o.push(v),o.push(g)}else o.push(fJ(u));break;case"ssr":if(i["include-unsupported-proxy"])o.push(hJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type}`);break;case"snell":{o.push(pJ(u,i["include-unsupported-proxy"]));let v=u2(u);v&&o.push(hS(u,v));break}case"vmess":if(!u.network||["tcp","ws","grpc","h2","http"].includes(u.network))o.push(wJ(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(yJ(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(EJ(u));else throw new Error(`Platform sing-box does not support proxy type: ${u.type} with flow ${u.flow}`);break;case"naive":o.push(bJ(u));break;case"hysteria":o.push(AJ(u));break;case"hysteria2":o.push(SJ(u,i["include-unsupported-proxy"]));break;case"tuic":if(!u.token||u.token.length===0)o.push(_J(u));else throw new Error("Platform sing-box does not support proxy type: TUIC v4");break;case"wireguard":o.push(FJ(u));break;case"anytls":o.push(CJ(u,i["include-unsupported-proxy"]));break;case"tailscale":o.push(DJ(u));break;default:throw new Error(`Platform sing-box does not support proxy type: ${u.type}`)}if(d){let v=o[l];v.detour=c2(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 mye=B(x());var BJ={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 f2(){return{type:"ALL",produce:(r,n,i={})=>{let o=r.filter(s=>!["http","https","socks5","ss","ssr","trojan","hysteria2","vless","vmess","tuic","wireguard","anytls","ssh","snell"].includes(s.type)||s.type==="ss"&&(s.plugin==="obfs"&&!["http","tls"].includes(s["plugin-opts"]?.mode)||!["chacha20-ietf-poly1305","chacha20-poly1305","aes-256-gcm","aes-128-gcm","none","tbale","rc4","rc4-md5","aes-128-cfb","aes-192-cfb","aes-256-cfb","aes-128-ctr","aes-192-ctr","aes-256-ctr","bf-cfb","camellia-128-cfb","camellia-192-cfb","camellia-256-cfb","cast5-cfb","des-cfb","idea-cfb","rc2-cfb","seed-cfb","salsa20","chacha20","chacha20-ietf","2022-blake3-aes-128-gcm","2022-blake3-aes-256-gcm"].includes(s.cipher))||s.type==="vmess"&&(!["h2","http","ws","tcp","grpc"].includes(s.network)&&s.network||!Z9(s))||s.type==="trojan"&&!["http","ws","tcp"].includes(s.network)&&s.network||s.type==="vless"&&(!["h2","http","ws","tcp","grpc"].includes(s.network)&&s.network||!Z9(s)||typeof s.flow<"u"&&!["xtls-rprx-vision",""].includes(s.flow))||s.type==="tuic"&&s.token&&s.token.length!==0||s.type==="snell"&&J9(s.version)===null||s.type==="ssr"&&!PJ(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,...W9(s)?{headers:s.headers}:{},tfo:fi(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(s)}:{}};else if(s.type==="https")s={type:"https",name:s.name,server:s.server,port:s.port,username:s.username,password:s.password,...W9(s)?{headers:s.headers}:{},tfo:fi(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(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:Qa(s),...s.tls?{sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(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:Qa(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:e7(s.cipher),server:s.server,port:s.port,password:s.password,protocol:Op(s.protocol),protocol_param:s["protocol-param"],obfs:Op(s.obfs),obfs_param:s["obfs-param"],tfo:fi(s),udp_relay:Qa(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:Qa(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:Qa(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(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:Qa(s),sni:s.sni,skip_tls_verify:s["skip-cert-verify"],reality:bl(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:Q9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=X9(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:Qa(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:Q9(s["h2-opts"]),sni:s.sni,skip_tls_verify:s["skip-cert-verify"]}}:s.network==="grpc"?s.transport=X9(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:bl(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:Qa(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:As(s,"ipv4"),local_ipv6:As(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=J9(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:Qa(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=TJ(u);if(m&&(OJ(u,s)&&(s.fingerprint_sha256=m),NJ(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=BJ[u["ip-version"]]||u["ip-version"]),delete s.subName,delete s.collectionName,delete s.id,delete s.resolved,delete s["no-resolve"],s.transport){for(let p in s.transport)p!=="grpc"&&(Object.keys(s.transport[p]).length===0||Object.values(s.transport[p]).every(d=>d==null))&&delete s.transport[p];Object.keys(s.transport).length===0&&delete s.transport}if(n!=="internal")for(let p in s)(s[p]==null||/^_/i.test(p))&&delete s[p];return{[s.type]:{...s,type:void 0,prev_hop:h}}}catch(u){return Q.error(`Cannot produce proxy: ${s.name}
Reason: ${u}`),null}}).filter(Boolean);return Uo(o,n,i)}}}function W9(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function fi(e){return!!(e.tfo??e["fast-open"])}function Qa(e){return e.udp??e.udp_relay}function Y9(e){if(e!=null&&!(typeof e=="string"&&e.length===0))return e}function bl(e){let t=e?.["reality-opts"];if(!t)return;let r={},n=Y9(t["public-key"]),i=Y9(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 X9(e){return{grpc:{service_name:e["grpc-opts"]?.["grpc-service-name"],sni:e.sni,reality:bl(e),skip_tls_verify:e["skip-cert-verify"]}}}function Z9(e){if(e.network!=="grpc")return!0;let t=e["grpc-opts"]?.["_grpc-type"];return t==null?!0:`${t}`.trim().toLowerCase()==="gun"}function J9(e){if(e==null)return;let t=`${e}`.trim();return/^[1-5]$/.test(t)?parseInt(t,10):null}var IJ=["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"],xJ=["origin","auth_sha1_v4","auth_aes128_md5","auth_aes128_sha1","auth_chain_a","auth_chain_b"],$J=["plain","http_simple","http_post","random_head","tls1.2_ticket_auth","tls1.2_ticket_fastauth"];function Op(e){if(e==null)return;let t=`${e}`.trim().toLowerCase();return t.length>0?t:void 0}function e7(e){let t=Op(e);return t==="plain"?"none":t}function PJ(e){if(!IJ.includes(e7(e.cipher)))return!1;let t=Op(e.protocol);if(t!=null&&!xJ.includes(t))return!1;let r=Op(e.obfs);return r==null||$J.includes(r)}function kJ(e,...t){for(let r of t){let n=mS(e?.[r]);if(n)return n}}function RJ(e){return mS(e?.host)||kJ(e?.headers,"host","Host")}function Q9(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=mS(i);o!=null&&(t[n]=o)}let r=RJ(e);return r&&(t.Host=r),Object.keys(t).length>0?t:void 0}function mS(e){if(Array.isArray(e))return e[0];if(e!=null)return e}function TJ(e){let t=e?.["tls-fingerprint"];if(typeof t!="string")return;let r=t.trim();return r.length>0?r:void 0}function OJ(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 NJ(e,t){if(e)for(let r of["grpc","http2","tls","wss"])e[r]&&(e[r].fingerprint_sha256=t)}function t7(){return{type:"ALL",produce:(r,n)=>n==="internal"?r:JSON.stringify(r,null,2)}}var r7={qx:kp(),QX:kp(),QuantumultX:kp(),surge:ih(),Surge:ih(),SurgeMac:Ip(),Loon:oS(),Clash:e2(),clash:e2(),meta:Hs(),clashmeta:Hs(),"clash.meta":Hs(),"Clash.Meta":Hs(),ClashMeta:Hs(),mihomo:Hs(),Mihomo:Hs(),uri:oh(),URI:oh(),v2:Pp(),v2ray:Pp(),V2Ray:Pp(),json:t7(),JSON:t7(),stash:t2(),Stash:t2(),shadowrocket:Rp(),Shadowrocket:Rp(),ShadowRocket:Rp(),surfboard:a2(),Surfboard:a2(),singbox:l2(),"sing-box":l2(),egern:f2(),Egern:f2()};var abe=B(x());var NEe=B(x()),ux=B(E2());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-parser initializer
{
const proxy = {};
const obfs = {};
const shadowTLS = {};
const xhttpOpts = { mode: "auto" };
let xhttpEnabled = false;
let clientFingerprint;
let echConfig;
const $ = {};
function handleWebsocket() {
if (obfs.type === "ws") {
proxy.network = "ws";
$set(proxy, "ws-opts.path", obfs.path);
$set(proxy, "ws-opts.headers", obfs['ws-headers']);
if (obfs.httpUpgrade) $set(proxy, "ws-opts.v2ray-http-upgrade", true);
if (proxy['ws-opts'] && proxy['ws-opts']['headers'] && proxy['ws-opts']['headers'].Host) {
proxy['ws-opts']['headers'].Host = proxy['ws-opts']['headers'].Host.replace(/^"(.*)"$/, '$1')
}
}
}
function handleShadowTLS() {
if (shadowTLS.password && !shadowTLS.version) {
shadowTLS.version = 2;
}
if (shadowTLS.password) {
if (shadowTLS.version < 2) {
throw new Error("shadow-tls version " + shadowTLS.version + " is not supported");
}
proxy.plugin = "shadow-tls";
proxy["plugin-opts"] = {
host: shadowTLS.host,
password: shadowTLS.password,
version: shadowTLS.version,
};
if (proxy.alpn) {
$set(proxy, "plugin-opts.alpn", proxy.alpn);
delete proxy.alpn;
}
}
}
function stripQuotes(value) {
const trimmed = value.trim();
const quote = trimmed[0];
if (
(quote === '"' || quote === "'") &&
trimmed[trimmed.length - 1] === quote
) {
return trimmed.slice(1, -1);
}
return trimmed;
}
function isQuotedEscape(text, index) {
return text[index] === "\\" &&
(text[index + 1] === '"' || text[index + 1] === "\\");
}
function unescapeQuotedValue(value) {
return value.replace(/\\(["\\])/g, "$1");
}
function readQuotedHeaderKey(text, start) {
const quote = text[start];
const withEscapes = proxy.type === "vless" && quote === '"';
let index = start + 1;
let hasKey = false;
while (index < text.length) {
const char = text[index];
if (withEscapes && isQuotedEscape(text, index)) {
hasKey = true;
index += 2;
continue;
}
if (char === quote) {
return hasKey ? index + 1 : -1;
}
hasKey = true;
index++;
}
return -1;
}
function startsWithQuotedHeaderKey(text) {
const trimmed = text.trim();
if (trimmed[0] !== '"' && trimmed[0] !== "'") return false;
const index = readQuotedHeaderKey(trimmed, 0);
if (index === -1) return false;
let cursor = index;
while (cursor < trimmed.length && /\s/.test(trimmed[cursor])) cursor++;
return trimmed[cursor] === ":";
}
function stripOuterHeadersQuotes(headers) {
const trimmed = headers.trim();
const quote = trimmed[0];
if (
(quote === '"' || quote === "'") &&
trimmed[trimmed.length - 1] === quote &&
!startsWithQuotedHeaderKey(trimmed)
) {
return trimmed.slice(1, -1);
}
return trimmed;
}
function isHeaderKeyStart(text, start) {
let index = start;
while (index < text.length && /\s/.test(text[index])) index++;
if (text[index] === '"' || text[index] === "'") {
index = readQuotedHeaderKey(text, index);
if (index === -1) return false;
} else {
const keyStart = index;
while (
index < text.length &&
/[!#$%&'*+\-.^_|~0-9A-Za-z]/.test(text[index])
)
index++;
if (index === keyStart) return false;
}
while (index < text.length && /\s/.test(text[index])) index++;
return text[index] === ":";
}
function isOptionStart(text, start) {
let index = start;
while (index < text.length && /\s/.test(text[index])) index++;
const keyStart = index;
while (index < text.length && /[0-9A-Za-z-]/.test(text[index])) index++;
if (index === keyStart) return false;
while (index < text.length && /\s/.test(text[index])) index++;
return text[index] === "=";
}
function isHeaderValueQuoteEnd(text, index, pairSeparator, allowCommaEnd, containerQuote) {
let cursor = index + 1;
while (cursor < text.length && /\s/.test(text[cursor])) cursor++;
if (cursor >= text.length) return true;
if (allowCommaEnd && text[cursor] === "," && isOptionStart(text, cursor + 1)) {
return true;
}
if (text[cursor] === pairSeparator && isHeaderKeyStart(text, cursor + 1)) {
return true;
}
if (containerQuote && text[cursor] === containerQuote) {
let next = cursor + 1;
while (next < text.length && /\s/.test(text[next])) next++;
return next >= text.length || text[next] === ",";
}
return false;
}
function findHeaderSeparator(pair) {
let quote = "";
for (let index = 0; index < pair.length; index++) {
const char = pair[index];
if (quote) {
if (char === quote) {
quote = "";
}
continue;
}
if (char === '"' || char === "'") {
quote = char;
continue;
}
if (char === ":") {
return index;
}
}
return -1;
}
function readUnquotedHeadersEnd(text, start, pairSeparator) {
let index = start;
let quote = "";
let quoteRole = "";
let seenSeparator = false;
while (index < text.length) {
const char = text[index];
if (quote) {
if (char === quote) {
if (
quoteRole === "key" ||
isHeaderValueQuoteEnd(text, index, pairSeparator, true)
) {
quote = "";
quoteRole = "";
}
}
index++;
continue;
}
if (char === '"' || char === "'") {
quote = char;
quoteRole = seenSeparator ? "value" : "key";
index++;
continue;
}
if (char === ":" && !seenSeparator) {
seenSeparator = true;
index++;
continue;
}
if (char === pairSeparator && isHeaderKeyStart(text, index + 1)) {
seenSeparator = false;
index++;
continue;
}
if (char === ",") break;
index++;
}
return index;
}
function readQuotedHeadersEnd(text, start, pairSeparator) {
const quote = text[start];
const withEscapes = proxy.type === "vless";
let index = start + 1;
let innerQuote = "";
let quoteRole = "";
let seenSeparator = false;
while (index < text.length) {
const char = text[index];
if (withEscapes && isQuotedEscape(text, index)) {
index += 2;
continue;
}
if (innerQuote) {
if (char === innerQuote) {
if (
quoteRole === "key" ||
isHeaderValueQuoteEnd(text, index, pairSeparator, false, quote)
) {
innerQuote = "";
quoteRole = "";
}
}
index++;
continue;
}
if (char === quote) {
let cursor = index + 1;
while (cursor < text.length && /\s/.test(text[cursor])) cursor++;
if (cursor >= text.length || text[cursor] === ",") {
return index + 1;
}
}
if (char === '"' || char === "'") {
innerQuote = char;
quoteRole = seenSeparator ? "value" : "key";
index++;
continue;
}
if (char === ":" && !seenSeparator) {
seenSeparator = true;
index++;
continue;
}
if (char === pairSeparator && isHeaderKeyStart(text, index + 1)) {
seenSeparator = false;
index++;
continue;
}
index++;
}
return text.length;
}
function readHeadersEnd(text, start, pairSeparator) {
let index = start;
while (index < text.length && /\s/.test(text[index])) index++;
if (
(text[index] === '"' || text[index] === "'") &&
!startsWithQuotedHeaderKey(text.slice(index))
) {
return readQuotedHeadersEnd(text, index, pairSeparator);
}
return readUnquotedHeadersEnd(text, start, pairSeparator);
}
function splitHeaders(headers, pairSeparator, withEscapes) {
const result = [];
let start = 0;
let quote = "";
let quoteRole = "";
let seenSeparator = false;
for (let index = 0; index < headers.length; index++) {
const char = headers[index];
if (withEscapes && isQuotedEscape(headers, index)) {
index++;
continue;
}
if (quote) {
if (char === quote) {
if (
quoteRole === "key" ||
isHeaderValueQuoteEnd(headers, index, pairSeparator, false)
) {
quote = "";
quoteRole = "";
}
}
continue;
}
if (char === '"' || char === "'") {
quote = char;
quoteRole = seenSeparator ? "value" : "key";
continue;
}
if (char === ":" && !seenSeparator) {
seenSeparator = true;
continue;
}
if (char === pairSeparator && isHeaderKeyStart(headers, index + 1)) {
result.push(headers.slice(start, index));
start = index + 1;
seenSeparator = false;
}
}
result.push(headers.slice(start));
return result;
}
function parseHeaders(headers, pairSeparator) {
const result = {};
const trimmed = headers.trim();
const content = stripOuterHeadersQuotes(trimmed);
const withEscapes = proxy.type === "vless" && content !== trimmed;
splitHeaders(content, pairSeparator, withEscapes).forEach((pair) => {
const index = findHeaderSeparator(pair);
if (index === -1) return;
const key = stripQuotes(pair.slice(0, index));
const value = stripQuotes(pair.slice(index + 1));
if (key) {
result[key] = withEscapes ? unescapeQuotedValue(value) : value;
}
});
return result;
}
function normalizeVmessSecurity(security) {
const normalized = String(security || "").trim().toLowerCase();
const supported = ["aes-128-gcm", "chacha20-ietf-poly1305"];
if (!supported.includes(normalized)) return "auto";
return normalized === "chacha20-ietf-poly1305" ? "chacha20-poly1305" : normalized;
}
function parseAlpn(value) {
return stripQuotes(value)
.split(",")
.map((item) => item.trim())
.filter((item) => item !== "");
}
}
start = (masque/anytls/shadowsocks/vmess/vless/trojan/h2_connect/https/http/snell/socks5/socks5_tls/tuic/tuic_v5/wireguard/hysteria2/ssh/trust_tunnel/direct/external) {
if (
["auto", "none", "apple-26", "chromium-155"].includes(clientFingerprint) &&
proxy.network !== "h3" &&
(proxy.tls || proxy.type === "trojan")
) {
proxy._surge_client_fingerprint = clientFingerprint;
if (clientFingerprint === "apple-26") proxy["client-fingerprint"] = "ios";
if (clientFingerprint === "chromium-155") proxy["client-fingerprint"] = "chrome";
}
if (
echConfig !== undefined &&
(proxy.tls || ["trojan", "tuic", "hysteria2"].includes(proxy.type))
) {
if (proxy["reality-opts"]) error("ECH cannot be combined with REALITY");
// Preserve malformed ECH for export validation so another parser cannot discard it.
const config = options.normalizeInlineEchConfigList(echConfig) ?? echConfig;
proxy["ech-opts"] = { enable: true, config };
}
return proxy;
}
shadowsocks = tag equals "ss" address (method/passwordk/obfs/obfs_host/obfs_uri/udp_relay/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/udp_port/proxy_policy_parameter/others)* {
proxy.type = "ss";
// handle obfs
if (obfs.type == "http" || obfs.type === "tls") {
proxy.plugin = "obfs";
$set(proxy, "plugin-opts.mode", obfs.type);
$set(proxy, "plugin-opts.host", obfs.host);
$set(proxy, "plugin-opts.path", obfs.path);
}
handleShadowTLS();
}
vmess = tag equals "vmess" address (vmess_uuid/vmess_aead/ws/ws_http_upgrade/ws_path/ws_headers/vmess_method/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "vmess";
proxy.cipher = proxy.cipher || "auto";
// Surfboard 与 Surge 默认不一致, 不管 Surfboard https://getsurfboard.com/docs/profile-format/proxy/external-proxy/vmess
if (proxy.aead) {
proxy.alterId = 0;
} else {
proxy.alterId = 1;
}
handleWebsocket();
handleShadowTLS();
}
vless = tag equals vless_address (vless_username/vless_option/reality_option/ws/ws_http_upgrade/ws_path/ws_headers/grpc/grpc_service_name/grpc_mode/grpc_authority/xhttp/xhttp_headers/xhttp_option/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy["packet-encoding"] = "xudp";
if (proxy["reality-opts"] && proxy["reality-opts"]["public-key"]) proxy.tls = true;
if (xhttpEnabled) {
proxy.network = "xhttp";
proxy["xhttp-opts"] = xhttpOpts;
} else {
handleWebsocket();
}
handleShadowTLS();
}
vless_address = "vless" address { proxy.type = "vless"; }
trojan = tag equals "trojan" address (passwordk/ws/ws_http_upgrade/ws_path/ws_headers/tls/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "trojan";
handleWebsocket();
handleShadowTLS();
}
https = tag equals "https" address (username password)? (usernamek passwordk)? (headers/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "http";
proxy.tls = true;
handleShadowTLS();
}
h2_connect = tag equals "h2-connect" address (username password)? (usernamek passwordk)? (headers/max_streams/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "h2-connect";
proxy.tls = true;
handleShadowTLS();
}
http = tag equals "http" address (username password)? (usernamek passwordk)? (headers/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "http";
handleShadowTLS();
}
ssh = tag equals "ssh" address (username password)? (usernamek passwordk)? (server_fingerprint/idle_timeout/private_key/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "ssh";
handleShadowTLS();
}
snell = tag equals ("snell"i/"opensnell"i) address (snell_version/snell_mode/snell_psk/obfs/obfs_host/obfs_uri/udp_relay/reuse/alpn/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "snell";
// handle obfs
if (obfs.type == "http" || obfs.type === "tls") {
$set(proxy, "obfs-opts.mode", obfs.type);
$set(proxy, "obfs-opts.host", obfs.host);
$set(proxy, "obfs-opts.path", obfs.path);
}
handleShadowTLS();
}
tuic = tag equals "tuic" address (alpn/token/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/proxy_policy_parameter/others)* {
proxy.type = "tuic";
handleShadowTLS();
}
tuic_v5 = tag equals "tuic-v5" address (alpn/passwordk/uuidk/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/proxy_policy_parameter/others)* {
proxy.type = "tuic";
proxy.version = 5;
handleShadowTLS();
}
wireguard = tag equals "wireguard" (section_name/common_policy_parameter/proxy_only_parameter/ignored_policy_parameter)* {
if (!proxy["section-name"]) error("WireGuard requires section-name");
proxy.type = "wireguard-surge";
}
hysteria2 = tag equals "hysteria2" address (sni/cert_verify_name/alpn/tls_verification/client_cert/ech_config/passwordk/tls_fingerprint/download_bandwidth/shadow_tls_version/shadow_tls_sni/shadow_tls_password/port_hopping/port_hopping_interval/salamander_password/gecko_password/proxy_policy_parameter/others)* {
proxy.type = "hysteria2";
handleShadowTLS();
}
socks5 = tag equals "socks5" address (username password)? (usernamek passwordk)? (udp_relay/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "socks5";
handleShadowTLS();
}
socks5_tls = tag equals "socks5-tls" address (username password)? (usernamek passwordk)? (udp_relay/sni/cert_verify_name/alpn/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/shadow_tls_version/shadow_tls_sni/shadow_tls_password/proxy_policy_parameter/others)* {
proxy.type = "socks5";
proxy.tls = true;
handleShadowTLS();
}
anytls = tag equals "anytls" address (passwordk/reuse/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/proxy_policy_parameter/others)* {
proxy.type = "anytls";
proxy.tls = true;
}
trust_tunnel = tag equals "trust-tunnel" address (usernamek/passwordk/client_random_auth_key/headers/max_streams/reuse/tls_fingerprint/client_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/h3/proxy_policy_parameter/others)* {
proxy.type = "trusttunnel";
proxy.tls = true;
}
masque = tag equals "masque" address (usernamek/passwordk/port_hopping/port_hopping_interval/tls_fingerprint/tls_verification/client_cert/ech_config/sni/cert_verify_name/alpn/udp_relay/proxy_policy_parameter/others)* {
proxy.type = "masque-surge";
proxy.tls = true;
}
direct = tag equals "direct"i (common_policy_parameter/interface_parameter/udp_relay/ignored_policy_parameter)* {
proxy.type = "direct";
}
external = tag equals "external" (external_exec/external_local_port/external_arg/external_address/udp_relay/proxy_policy_parameter/ignored_policy_parameter)* {
proxy.type = "external";
proxy.args = proxy.args || [];
proxy.addresses = proxy.addresses || [];
}
external_exec = comma "exec" equals value:quoted_value { if (proxy.exec === undefined) proxy.exec = value; }
external_local_port = comma "local-port" equals value:quoted_value { if (proxy["local-port"] === undefined) proxy["local-port"] = value; }
external_arg = comma "args" equals value:quoted_value {
proxy.args = proxy.args || [];
proxy.args.push(value);
}
external_address = comma "addresses" equals value:quoted_value {
proxy.addresses = proxy.addresses || [];
proxy.addresses.push(value);
}
proxy_policy_parameter = common_policy_parameter / interface_parameter / proxy_only_parameter
common_policy_parameter = ip_version / hybrid / tfo / fast_open / tos / block_quic / test_url / test_timeout / test_udp
interface_parameter = interface / allow_other_interface / dns_follow_interface
proxy_only_parameter = no_error_alert / ecn / underlying_proxy
ignored_policy_parameter = comma [^=,]+ equals quoted_value
address = comma server:server comma port:port {
proxy.server = server;
proxy.port = port;
}
server = ip/domain
ip = & {
const start = peg$currPos;
let j = start;
while (j < input.length) {
if (input[j] === ",") break;
j++;
}
peg$currPos = j;
$.ip = input.substring(start, j).trim();
return true;
} { return $.ip; }
domain = match:[0-9a-zA-z-_.]+ {
const domain = match.join("");
if (/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain)) {
return domain;
}
}
port = digits:[0-9]+ {
const port = parseInt(digits.join(""), 10);
if (port >= 0 && port <= 65535) {
return port;
}
}
port_hopping = comma "port-hopping" equals value:(
'"' _ list:port_hopping_list _ '"' { return list; }
/ "'" _ list:port_hopping_list _ "'" { return list; }
/ port_hopping_list
) &(_ ("," / !.)) { proxy.ports = value.replace(/\s+/g, "").replace(/;/g, ","); }
port_hopping_list = $(port_hopping_range (_ [,;] _ port_hopping_range)*)
port_hopping_range = [0-9]+ ("-" [0-9]+)?
port_hopping_interval = comma "port-hopping-interval" equals match:$[0-9]+ { proxy["hop-interval"] = parseInt(match.trim()); }
username = & {
let j = peg$currPos;
let start, end;
let first = true;
while (j < input.length) {
if (input[j] === ',') {
if (first) {
start = j + 1;
first = false;
} else {
end = j;
break;
}
}
j++;
}
const match = input.substring(start, end);
if (match.indexOf("=") === -1) {
$.username = match;
peg$currPos = end;
return true;
}
} { proxy.username = $.username.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
password = comma match:[^,]+ { proxy.password = match.join("").replace(/^"(.*)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
tls = comma "tls" equals flag:bool { proxy.tls = flag; }
sni = comma "sni" equals match:[^,]+ {
const sni = match.join("").replace(/^"(.*)"$/, '$1');
if (sni === "off") {
proxy["disable-sni"] = true;
} else {
proxy.sni = sni;
}
}
cert_verify_name = comma "server-cert-verify-name" equals match:[^,]+ { proxy["name-cert-verify"] = stripQuotes(match.join("")); }
tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-verify"] = flag; }
tls_fingerprint = comma "server-cert-fingerprint-sha256" equals tls_fingerprint:$[^,]+ { proxy["tls-fingerprint"] = tls_fingerprint.trim(); }
client_fingerprint = comma "client-fingerprint" equals value:quoted_value { clientFingerprint = value.trim().toLowerCase(); }
client_cert = comma "client-cert" equals match:[^,]+ { proxy["keystore-client-cert"] = stripQuotes(match.join("")); }
ech_config = comma "ech-config" equals value:quoted_value { echConfig = value; }
snell_psk = comma "psk" equals value:quoted_value { proxy.psk = value; }
snell_version = comma "version" equals match:$[0-9]+ { proxy.version = parseInt(match.trim()); }
snell_mode = comma "mode" equals match:[^,]+ {
const mode = stripQuotes(match.join("")).trim();
if (["default", "unshaped", "unsafe-raw"].includes(mode)) {
proxy.mode = mode;
}
}
usernamek = comma "username" equals match:[^,]+ { proxy.username = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
passwordk = comma "password" equals match:[^,]+ { proxy.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
vmess_uuid = comma "username" equals match:[^,]+ { proxy.uuid = match.join(""); }
vmess_aead = comma "vmess-aead" equals flag:bool { proxy.aead = flag; }
// shortcut: keep text IDs as given, convert them to UUIDv5 when a target requires it.
vless_username = comma "username" equals value:quoted_value { proxy.uuid = value.trim(); }
vless_option = comma key:("flow"/"encryption") equals value:quoted_value { proxy[key] = value.trim(); }
reality_option = comma "reality-" key:("public-key"/"short-id") equals value:quoted_value { $set(proxy, "reality-opts." + key, value.trim()); }
client_random_auth_key = comma "client-random-auth-key" equals value:$[^,]* { proxy["client-random-auth-key"] = stripQuotes(value); }
method = comma "encrypt-method" equals cipher:cipher {
proxy.cipher = cipher;
}
vmess_method = comma "encrypt-method" equals cipher:$[^,]+ {
proxy.cipher = normalizeVmessSecurity(cipher);
}
cipher = ("aes-128-cfb"/"aes-128-ctr"/"aes-128-gcm"/"aes-192-cfb"/"aes-192-ctr"/"aes-192-gcm"/"aes-256-cfb"/"aes-256-ctr"/"aes-256-gcm"/"bf-cfb"/"camellia-128-cfb"/"camellia-192-cfb"/"camellia-256-cfb"/"cast5-cfb"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"des-cfb"/"idea-cfb"/"none"/"rc2-cfb"/"rc4-md5"/"rc4"/"salsa20"/"seed-cfb"/"xchacha20-ietf-poly1305"/"2022-blake3-aes-128-gcm"/"2022-blake3-aes-256-gcm");
ws = comma "ws" equals flag:bool { if (flag) obfs.type = "ws"; }
ws_http_upgrade = comma "ws-http-upgrade" equals flag:bool { obfs.httpUpgrade = flag; }
ws_headers = comma "ws-headers" equals value:pipe_headers { obfs["ws-headers"] = value; }
pipe_headers = & {
const start = peg$currPos;
const index = readHeadersEnd(input, start, "|");
$.headers = input.substring(start, index);
peg$currPos = index;
return $.headers.trim().length > 0;
} { return parseHeaders($.headers, "|"); }
ws_path = comma "ws-path" equals path:(vless_quoted_value / value:uri { return stripQuotes(value); }) { obfs.path = path; }
grpc = comma "grpc" equals flag:bool { if (flag) proxy.network = "grpc"; }
grpc_service_name = comma "grpc-service-name" equals value:quoted_value { $set(proxy, "grpc-opts.grpc-service-name", value.trim()); }
grpc_mode = comma "grpc-mode" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-type", value.trim()); }
grpc_authority = comma "grpc-authority" equals value:quoted_value { $set(proxy, "grpc-opts._grpc-authority", value.trim()); }
xhttp = comma "xhttp" equals flag:bool { xhttpEnabled = flag; }
xhttp_headers = comma "xhttp-headers" equals value:pipe_headers {
for (const key of Object.keys(value)) {
if (/^host$/i.test(key)) delete value[key];
}
xhttpOpts.headers = value;
}
xhttp_option = comma "xhttp-" key:$[a-z0-9-]+ equals value:quoted_value {
options.setSurgeXhttpOption(xhttpOpts, key, value.trim());
}
headers = comma "headers" equals & {
const start = peg$currPos;
const index = readHeadersEnd(input, start, ";");
$.headers = input.substring(start, index);
peg$currPos = index;
return $.headers.trim().length > 0;
} { proxy.headers = parseHeaders($.headers, ";"); }
obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; }
obfs_host = comma "obfs-host" equals match:[^,]+ { obfs.host = match.join("").replace(/^"(.*)"$/, '$1'); };
obfs_uri = comma "obfs-uri" equals path:uri { obfs.path = path }
uri = $[^,]+
udp_relay = comma "udp-relay" equals flag:bool { proxy.udp = flag; }
fast_open = comma "fast-open" equals flag:policy_bool { proxy.tfo = flag; }
reuse = comma "reuse" equals flag:bool { proxy.reuse = flag; }
ecn = comma "ecn" equals mode:policy_toggle { if (mode !== undefined) proxy.ecn = mode; }
tfo = comma "tfo" equals flag:policy_bool { proxy.tfo = flag; }
ip_version = comma "ip-version" equals value:quoted_value { proxy["ip-version"] = value.trim(); }
section_name = comma "section-name" equals value:quoted_value { proxy["section-name"] = value.trim(); }
no_error_alert = comma "no-error-alert" equals value:quoted_value { proxy["no-error-alert"] = value.trim(); }
underlying_proxy = comma "underlying-proxy" equals value:quoted_value { proxy["underlying-proxy"] = value.trim(); }
download_bandwidth = comma "download-bandwidth" equals match:[^,]+ { proxy.down = match.join(""); }
test_url = comma "test-url" equals value:quoted_value { proxy["test-url"] = value.trim(); }
test_udp = comma "test-udp" equals value:quoted_value { proxy["test-udp"] = value.trim(); }
test_timeout = comma "test-timeout" equals value:quoted_value {
const seconds = value.trim();
if (/^(?:\d+(?:\.\d*)?|\.\d+)$/.test(seconds)) proxy["test-timeout"] = Number(seconds);
}
max_streams = comma "max-streams" equals match:quoted_integer { proxy["max-streams"] = match; }
quoted_integer = '"' match:$[0-9]+ '"' { return parseInt(match.trim()); } / "'" match:$[0-9]+ "'" { return parseInt(match.trim()); } / match:$[0-9]+ { return parseInt(match.trim()); }
tos = comma "tos" equals value:quoted_value {
const text = value.trim();
proxy.tos = /^(?:\d+|0x[\da-f]+)$/i.test(text) ? Number(text) : text;
}
interface = comma "interface" equals value:quoted_value { proxy.interface = value.trim(); }
allow_other_interface = comma "allow-other-interface" equals flag:policy_bool { proxy["allow-other-interface"] = flag; }
dns_follow_interface = comma "dns-follow-interface" equals flag:policy_bool { proxy["dns-follow-interface"] = flag; }
hybrid = comma "hybrid" equals mode:policy_toggle { if (mode !== undefined) proxy.hybrid = mode; }
policy_bool = value:quoted_value &{ return /^(?:true|false)$/.test(value.trim()); } { return value.trim() === "true"; }
policy_toggle = value:quoted_value {
const mode = value.trim();
if (mode === "true" || mode === "false") return mode === "true";
if (["auto", "on", "off"].includes(mode)) return mode;
}
idle_timeout = comma "idle-timeout" equals match:$[0-9]+ { proxy["idle-timeout"] = parseInt(match.trim()); }
private_key = comma "private-key" equals match:[^,]+ { proxy["keystore-private-key"] = stripQuotes(match.join("")); }
server_fingerprint = comma "server-fingerprint" equals match:[^,]+ { proxy["server-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
block_quic = comma "block-quic" equals value:quoted_value { proxy["block-quic"] = value.trim(); }
udp_port = comma "udp-port" equals match:$[0-9]+ { proxy["udp-port"] = parseInt(match.trim()); }
shadow_tls_version = comma "shadow-tls-version" equals match:$[0-9]+ { shadowTLS.version = parseInt(match.trim()); }
shadow_tls_sni = comma "shadow-tls-sni" equals match:[^,]+ { shadowTLS.host = match.join(""); }
shadow_tls_password = comma "shadow-tls-password" equals match:[^,]+ { shadowTLS.password = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }
token = comma "token" equals match:[^,]+ { proxy.token = match.join(""); }
alpn = comma "alpn" equals match:quoted_value {
const values = parseAlpn(match);
if (values.length > 0) proxy.alpn = values;
}
h3 = comma "h3" equals flag:bool { if (flag) proxy.network = "h3"; }
quoted_value
= '"' value:$(("\\" ('"' / "\\") / [^"])*) '"' &(_ ("," / !.)) { return proxy.type === "vless" ? unescapeQuotedValue(value) : value; }
/ '"' match:$[^"]* '"' { return match; }
/ "'" match:$[^']* "'" { return proxy.type === "vless" ? unescapeQuotedValue(match) : match; }
/ value:uri { return value.trim(); }
vless_quoted_value = &{ return proxy.type === "vless"; } value:quoted_value { return value.trim(); }
uuidk = comma "uuid" equals match:[^,]+ { proxy.uuid = match.join(""); }
salamander_password = comma "salamander-password" equals match:[^,]+ { proxy['obfs-password'] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); proxy.obfs = 'salamander'; }
gecko_password = comma "gecko-password" equals match:[^,]+ { proxy['obfs-password'] = match.join("").replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); proxy.obfs = 'gecko'; }
tag = match:[^=,]* { proxy.name = match.join("").trim(); }
comma = _ "," _
equals = _ "=" _
_ = [ \r\t]*
bool = b:("true"/"false") { return b === "true" }
others = comma [^=,]+ equals [^=,]+
`,TS;function Kr(){if(!TS){let e=ux.default.generate(GQ);TS={parse:t=>e.parse(t,{normalizeInlineEchConfigList:Wg,setSurgeXhttpOption:s9})}}return TS}var HEe=B(x()),cx=B(E2());var zQ=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 [^=,]+)
`,OS;function _s(){if(!OS){let e=cx.default.generate(zQ);OS={parse:t=>e.parse(t,{setLoonXhttpOption:D9})}}return OS}var qEe=B(x()),LS=B(aa()),lx=B(E2());function WQ(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=LS.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 YQ=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" }
`,NS;function pi(){if(!NS){let e=lx.default.generate(YQ);NS={parse(t,r){let n=e.parse(t,{...r,byteLength:LS.Buffer.byteLength}),i=WQ(n["tls-alpn"]);return i&&(n.alpn=i),n}}}return NS}var GEe=B(x());var XQ=new Set(["__proto__","constructor","prototype"]),US;function tu(e,t,r){if(Object(e)!==e)return e;if(Array.isArray(t)||(t=t.toString().match(/[^.[\]]+/g)||[]),t.some(n=>XQ.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 b2(e){if(e!=null)return/(TRUE)|1/i.test(e)}function fx(e){return li(e)!=null}function HS(e){try{return decodeURIComponent(e)}catch{return e}}function ZQ(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=HS(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?HS(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:HS(h.slice(m+1))}if(t["skip-cert-verify"]=b2(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(",")),b2(l.ws)&&(t.network="ws",tu(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");fx(v)&&(d=Ss(d,"ed").path,h?m=v:p=v)}tu(t,`${t.network}-opts.path`,d)}l.host&&tu(t,`${t.network}-opts.headers.Host`,l.host),h?(m=m||(fx(l.ed)?String(l.ed):""),tu(t,"ws-opts.v2ray-http-upgrade",!0),m&&(tu(t,"ws-opts.v2ray-http-upgrade-fast-open",!0),tu(t,"ws-opts._v2ray-http-upgrade-ed",m))):t.network==="ws"&&p&&(tu(t,"ws-opts.max-early-data",li(p)),tu(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&&tu(t,"reality-opts",d)}}return t.udp=b2(l.udp),t.tfo=b2(l.tfo),t}function MS(){return US||(US={parse:ZQ}),US}var VS=B(KS());var qo=B(za());function GS(e){let[t,r,n]=/^(.*?)(?:#(.*?))?$/.exec(e);return{content:r,fragment:n!=null?decodeURIComponent(n):void 0}}function JQ(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 zS(e){return e==null||!/^\d+$/.test(`${e}`)?!1:Number.isSafeInteger(parseInt(`${e}`,10))}function WS(e){let t=vl(e,"ed");return zS(t)?{path:Ss(e,"ed").path,ed:t}:{path:e,ed:""}}function YS(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 XS(e){if(Array.isArray(e))return e.flatMap(r=>XS(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 QQ(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 eee(){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 tee(){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 ree(){return{name:"URI SS Parser",test:n=>/^ss:\/\//.test(n),parse:n=>{let{content:i,fragment:o}=GS(n.split("ss://")[1]),s={type:"ss"},a=i.match(/@([^/?]*)(\/|\?|$)/),u=JQ(i.split("@")[0]),l="";if(a)i.includes("?")&&(l=i.match(/(\?.*)$/)[1]);else{if(i.includes("?")){let w=i.match(/^(.*)(\?.*)$/);i=w[1],l=w[2]}if(i=bt.decode(i),l){if(/(&|\?)v2ray-plugin=/.test(l)){let E=l.match(/(&|\?)v2ray-plugin=(.*?)(&|$)/)[2];E&&(s.plugin="v2ray-plugin",s["plugin-opts"]=JSON.parse(bt.decode(E)))}i=`${i}${l}`}u=i.match(/(^.*)@/)?.[1],a=i.match(/@([^/@]*)(\/|$)/)}let h={};for(let w of l.replace(/^\?/,"").split("&"))if(w){let[E,_]=w.split("="),C=_;C=decodeURIComponent(_),h[E]=C}if(s.tls=h.security&&h.security!=="none",s["skip-cert-verify"]=!!h.allowInsecure,s.sni=h.sni||h.peer,s["client-fingerprint"]=h.fp,s.alpn=h.alpn?decodeURIComponent(h.alpn).split(","):void 0,h.ws&&(s.network="ws",qo.default.set(s,"ws-opts.path",h.wspath)),h.type){let w,E="",_="";if(s.network=h.type,s.network==="httpupgrade"&&(s.network="ws",w=!0),["grpc"].includes(s.network))s[s.network+"-opts"]={"grpc-service-name":h.serviceName,"_grpc-type":h.mode,"_grpc-authority":h.authority};else{if(h.path){let C=h.path;if(s.network==="ws"){let F=WS(C);C=F.path,w?E=F.ed:_=F.ed}qo.default.set(s,s.network+"-opts.path",C)}h.host&&qo.default.set(s,s.network+"-opts.headers.Host",decodeURIComponent(h.host)),w?(E=E||(zS(h.ed)?`${h.ed}`:""),qo.default.set(s,s.network+"-opts.v2ray-http-upgrade",!0),E!==""&&(qo.default.set(s,s.network+"-opts.v2ray-http-upgrade-fast-open",!0),qo.default.set(s,s.network+"-opts._v2ray-http-upgrade-ed",E))):s.network==="ws"&&_!==""&&(qo.default.set(s,s.network+"-opts.max-early-data",YS(_)),qo.default.set(s,s.network+"-opts.early-data-header-name","Sec-WebSocket-Protocol"))}if(["reality"].includes(h.security)){let C={};h.pbk&&(C["public-key"]=h.pbk),h.sid&&(C["short-id"]=h.sid),h.spx&&(C["_spider-x"]=h.spx),h.mode&&(s._mode=h.mode),Object.keys(C).length>0&&qo.default.set(s,h.security+"-opts",C)}h.extra&&(s.network==="xhttp"||h.security==="reality")&&(s._extra=h.extra)}s.udp=![!1,0,"0","false","off"].includes(typeof h.udp=="string"?h.udp.toLowerCase():h.udp);let m=a[1],p=m.lastIndexOf(":");s.server=m.substring(0,p),s.port=`${m.substring(p+1)}`.match(/\d+/)?.[0];let d=u.match(/(^.*?):(.*$)/);s.cipher=d?.[1],s.password=d?.[2];let v=i.match(/[?&]plugin=([^&]+)/),g=i.match(/[?&]shadow-tls=([^&]+)/),y=i.match(/[?&]gost=([^&]+)/);if(v){let w=("plugin="+decodeURIComponent(v[1])).split(";"),E={};for(let _ of w){let C=_.indexOf("=");if(C===-1){_&&(E[_]=!0);continue}let F=_.slice(0,C),H=_.slice(C+1).replace(/\\=/g,"=");F&&(E[F]=H||!0)}switch(E.plugin){case"obfs-local":case"simple-obfs":s.plugin="obfs",s["plugin-opts"]={mode:E.obfs,host:vt(E["obfs-host"])};break;case"v2ray-plugin":s.plugin="v2ray-plugin",s["plugin-opts"]={mode:vt(E.obfs)||vt(E.mode)||"websocket",host:vt(E["obfs-host"])||vt(E.host),path:vt(E.path),tls: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 nee(){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 see(){return{name:"URI VMess Parser",test:n=>/^vmess:\/\//.test(n),parse:n=>{if(/^vmess:\/\/[^/?#]+@/.test(n))return ZS().parse(n,"vmess");let{content:i,fragment:o}=GS(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":wf(u["tls-verification"])?!u["tls-verification"]:void 0};if(wf(u.obfs))if(u.obfs==="ws"||u.obfs==="wss"){l.network="ws",l["ws-opts"].path=(vt(u["obfs-path"])||'"/"').match(/^"(.*)"$/)[1];let h=u["obfs-header"];h&&h.indexOf("Host")!==-1&&(h=h.match(/Host:\s*([a-zA-Z0-9-.]*)/)[1]),qe(h)&&(l["ws-opts"].headers={Host:h})}else throw new Error(`Unsupported obfs: ${u.obfs}`);return qe(o)&&(l.name=o),l}else{let a={};try{a=JSON.parse(s)}catch{let[d,v,g]=/(^[^?]+?)\/?\?(.*)$/.exec(i);s=bt.decode(v);for(let F of g.split("&")){let[H,K]=F.split("="),S=K;S=decodeURIComponent(K),S.indexOf(",")===-1?a[H]=S:a[H]=S.split(",")}let[y,w,E,_,C]=/(^[^:]+?):([^:]+?)@(.*):(\d+)$/.exec(s);a.scy=w,a.id=E,a.port=C,a.add=_}let u=a.add,l=parseInt(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":wf(a.verify_cert)?!a.verify_cert:void 0};!h["skip-cert-verify"]&&wf(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=WS(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=XS(w);E&&(y.host=E)}else y.headers={Host:w};m?(y["v2ray-http-upgrade"]=!0,v=v||(zS(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"]=YS(g),y["early-data-header-name"]="Sec-WebSocket-Protocol"),h[`${h.network}-opts`]=y}else delete h.network}return h["client-fingerprint"]=a.fp??a["client-fingerprint"],h.alpn=a.alpn?a.alpn.split(","):void 0,qe(o)&&(h.name=o),h}}}}function ZS(){return{name:"URI VLESS Parser",test:n=>/^vless:\/\//.test(n),parse:(n,i="vless")=>{let o=P=>{if(!ze(P))return;let M={},Y={maxConnections:"max-connections",maxConcurrency:"max-concurrency",cMaxReuseTimes:"c-max-reuse-times",hMaxRequestTimes:"h-max-request-times",hMaxReusableSecs:"h-max-reusable-secs"};for(let[X,te]of Object.entries(Y)){let ae=Us(P[X]);ae!=null&&(M[te]=typeof ae=="number"?`${ae}`:ae)}let V=Zn(P.hKeepAlivePeriod);return V!=null&&(M["h-keep-alive-period"]=V),Object.keys(M).length>0?M:void 0},s=P=>{if(!ze(P))return;let M={};for(let[Y,V]of Object.entries(P))typeof V=="string"&&(M[Y]=V);return Object.keys(M).length>0?M:void 0},a=P=>{if(Array.isArray(P))return P.map(a);if(ze(P)){let M={};for(let[Y,V]of Object.entries(P))M[Y]=a(V);return M}return P},u=P=>{if(Array.isArray(P))return P.map(u).filter(Y=>Y!==void 0);if(!ze(P))return P;let M={};for(let[Y,V]of Object.entries(P)){let X=u(V);X!==void 0&&(M[Y]=X)}return Object.keys(M).length>0?M:void 0},l=(P,M,Y)=>{let V=u(a(Y));V!==void 0&&(P[M]=V)},h=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))typeof V!="string"&&l(M,Y,V);return u(M)},m=(P,M)=>["maxConnections","maxConcurrency","cMaxReuseTimes","hMaxRequestTimes","hMaxReusableSecs"].includes(P)?Us(M)!=null:P==="hKeepAlivePeriod"?Zn(M)!=null:!1,p=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))m(Y,V)||l(M,Y,V);return u(M)},d=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))switch(Y){case"headers":{let X=h(V);X!==void 0&&(M.headers=X);break}case"noGRPCHeader":case"xPaddingObfsMode":V!==!0&&l(M,Y,V);break;case"xPaddingBytes":rh(V)==null&&l(M,Y,V);break;case"xPaddingKey":case"xPaddingHeader":case"xPaddingPlacement":case"xPaddingMethod":case"uplinkHTTPMethod":case"sessionIDPlacement":case"sessionPlacement":case"sessionIDKey":case"sessionKey":case"seqPlacement":case"seqKey":case"uplinkDataPlacement":case"uplinkDataKey":typeof V!="string"&&l(M,Y,V);break;case"sessionIDTable":typeof V!="string"&&l(M,Y,V);break;case"uplinkChunkSize":Us(V)==null&&l(M,Y,V);break;case"scMaxEachPostBytes":rh(V)==null&&l(M,Y,V);break;case"scMinPostsIntervalMs":Ho(V)==null&&l(M,Y,V);break;case"sessionIDLength":rh(V)==null&&l(M,Y,V);break;case"xmux":{let X=p(V);X!==void 0&&(M.xmux=X);break}default:l(M,Y,V);break}return u(M)},v=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};Object.prototype.hasOwnProperty.call(P,"path")&&!qe(P.path)&&l(M,"path",P.path),Object.prototype.hasOwnProperty.call(P,"host")&&!qe(P.host)&&l(M,"host",P.host),Object.prototype.hasOwnProperty.call(P,"mode")&&!qe(P.mode)&&l(M,"mode",P.mode);let Y={};for(let[X,te]of Object.entries(P))["path","host","mode","extra"].includes(X)||(Y[X]=te);let V=d(Y);if(ze(V)&&Object.assign(M,V),Object.prototype.hasOwnProperty.call(P,"extra")){let X=d(P.extra);X!==void 0&&(M.extra=X)}return u(M)},g=P=>{if(P==null)return;if(!ze(P))return a(P);let M={};for(let[Y,V]of Object.entries(P))switch(Y){case"address":qe(V)||l(M,Y,V);break;case"port":Zn(V,{allowNegative:!1})==null&&l(M,Y,V);break;case"security":{let X=typeof V=="string"?V.toLowerCase():"";["tls","reality"].includes(X)||l(M,Y,V);break}case"tlsSettings":{if(!ze(V)){l(M,Y,V);break}let X={},te=jA(V.echConfigList);for(let[me,he]of Object.entries(V))switch(me){case"serverName":case"fingerprint":qe(he)||l(X,me,he);break;case"echConfigList":jA(he)||l(X,me,he);break;case"echForceQuery":(!te||!Yg(he))&&l(X,me,he);break;case"echSockopt":(!te||!ze(he))&&l(X,me,he);break;case"alpn":Array.isArray(he)&&he.length>0&&he.every(De=>typeof De=="string"&&De!=="")||l(X,me,he);break;case"allowInsecure":he!==!0&&l(X,me,he);break;default:l(X,me,he);break}let ae=u(X);ae!==void 0&&(M.tlsSettings=ae);break}case"realitySettings":{if(!ze(V)){l(M,Y,V);break}let X={};for(let[ae,me]of Object.entries(V))switch(ae){case"publicKey":case"shortId":case"serverName":case"fingerprint":qe(me)||l(X,ae,me);break;default:l(X,ae,me);break}let te=u(X);te!==void 0&&(M.realitySettings=te);break}case"xhttpSettings":{let X=v(V);X!==void 0&&(M.xhttpSettings=X);break}case"network":{let X=typeof V=="string"?V.toLowerCase():"";X!=="xhttp"&&X!=="splithttp"&&l(M,Y,V);break}default:l(M,Y,V);break}return u(M)},y=(P,{parsedDownloadSettings:M}={})=>{if(!ze(P))return;let{downloadSettings:Y,...V}=P,X=d(V)||{};if(Object.prototype.hasOwnProperty.call(P,"downloadSettings")){let te=g(Y);te!==void 0&&(X.downloadSettings=te)}return u(X)},w=(P,M)=>{if(!ze(P)||!ze(M))return;let Y=s(M.headers);if(Y){let De={...P.headers||{}};for(let[Pe,Ie]of Object.entries(Y)){if(/^host$/i.test(Pe)){!Object.prototype.hasOwnProperty.call(De,"Host")&&!Object.prototype.hasOwnProperty.call(De,"host")&&(De.Host=Ie);continue}De[Pe]=Ie}Object.keys(De).length>0&&(P.headers=De)}M.noGRPCHeader===!0&&(P["no-grpc-header"]=!0);let V=rh(M.xPaddingBytes);V!=null&&(P["x-padding-bytes"]=V),M.xPaddingObfsMode===!0&&(P["x-padding-obfs-mode"]=!0),qe(M.xPaddingKey)&&(P["x-padding-key"]=M.xPaddingKey),qe(M.xPaddingHeader)&&(P["x-padding-header"]=M.xPaddingHeader),qe(M.xPaddingPlacement)&&(P["x-padding-placement"]=M.xPaddingPlacement),qe(M.xPaddingMethod)&&(P["x-padding-method"]=M.xPaddingMethod),qe(M.uplinkHTTPMethod)&&(P["uplink-http-method"]=M.uplinkHTTPMethod),qe(M.sessionIDPlacement)?P["session-placement"]=M.sessionIDPlacement:qe(M.sessionPlacement)&&(P["session-placement"]=M.sessionPlacement),qe(M.sessionIDKey)?P["session-key"]=M.sessionIDKey:qe(M.sessionKey)&&(P["session-key"]=M.sessionKey),typeof M.sessionIDTable=="string"&&(P["session-table"]=M.sessionIDTable);let X=rh(M.sessionIDLength);X!=null&&(P["session-length"]=X),qe(M.seqPlacement)&&(P["seq-placement"]=M.seqPlacement),qe(M.seqKey)&&(P["seq-key"]=M.seqKey),qe(M.uplinkDataPlacement)&&(P["uplink-data-placement"]=M.uplinkDataPlacement),qe(M.uplinkDataKey)&&(P["uplink-data-key"]=M.uplinkDataKey);let te=Us(M.uplinkChunkSize);te!=null&&(P["uplink-chunk-size"]=te);let ae=ml(M.scMaxEachPostBytes);ae!=null&&(P["sc-max-each-post-bytes"]=ae);let me=Ho(M.scMinPostsIntervalMs);me!=null&&(P["sc-min-posts-interval-ms"]=me);let he=o(M.xmux);he&&(P["reuse-settings"]=he)},E=P=>{if(!ze(P))return;let M={},Y=typeof P.network=="string"?P.network.toLowerCase():"";(Y==="xhttp"||Y==="splithttp")&&(M.network="xhttp"),qe(P.address)&&(M.server=P.address);let V=Zn(P.port,{allowNegative:!1});V!=null&&(M.port=V);let X=typeof P.security=="string"?P.security.toLowerCase():"";if((X==="tls"||X==="reality")&&(M.tls=!0),ze(P.tlsSettings)){qe(P.tlsSettings.serverName)&&(M.servername=P.tlsSettings.serverName),qe(P.tlsSettings.fingerprint)&&(M["client-fingerprint"]=P.tlsSettings.fingerprint),Array.isArray(P.tlsSettings.alpn)&&P.tlsSettings.alpn.length>0&&P.tlsSettings.alpn.every(me=>typeof me=="string"&&me!=="")&&(M.alpn=P.tlsSettings.alpn),P.tlsSettings.allowInsecure===!0&&(M["skip-cert-verify"]=!0);let ae=Xg({echConfigList:P.tlsSettings.echConfigList,echForceQuery:P.tlsSettings.echForceQuery,echSockopt:P.tlsSettings.echSockopt});ae&&(M["ech-opts"]=ae)}let te;return ze(P.realitySettings)&&(te={},qe(P.realitySettings.publicKey)&&(te["public-key"]=P.realitySettings.publicKey),qe(P.realitySettings.shortId)&&(te["short-id"]=P.realitySettings.shortId),qe(P.realitySettings.serverName)&&(M.servername=P.realitySettings.serverName),qe(P.realitySettings.fingerprint)&&(M["client-fingerprint"]=P.realitySettings.fingerprint)),X==="reality"?M["reality-opts"]=te||{}:te&&Object.keys(te).length>0&&(M["reality-opts"]=te),ze(P.xhttpSettings)&&(qe(P.xhttpSettings.path)&&(M.path=P.xhttpSettings.path),qe(P.xhttpSettings.host)&&(M.host=P.xhttpSettings.host),qe(P.xhttpSettings.mode)&&(M.mode=P.xhttpSettings.mode),w(M,P.xhttpSettings),ze(P.xhttpSettings.extra)&&w(M,P.xhttpSettings.extra)),Object.keys(M).length>0?M:void 0};n=n.split(`${i}://`)[1];let _,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n);if(!C){let[P,M,Y]=/^(.*?)(\?.*?$)/.exec(n);n=`${bt.decode(M)}${Y}`,C=/^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(n),_=!0}let[F,H,K,S,I,q="",L]=C;_&&(H=H.replace(/^.*?:/g,"")),S=parseInt(`${S}`,10),H=decodeURIComponent(H),L!=null&&(L=decodeURIComponent(L));let R={type:i,name:L,server:K,port:S,uuid:H,udp:!0},O={};for(let P of q.split("&"))if(P){let[M,...Y]=P.split("=");O[M]=decodeURIComponent(Y.join("="))}if(R.name=L??O.remarks??O.remark??`${i==="vmess"?"VMess":"VLESS"} ${K}:${S}`,R.tls=O.security&&O.security!=="none",O.pbk&&(O.security="reality"),_&&/TRUE|1/i.test(O.tls)&&(R.tls=!0,O.security=O.security??"reality"),R.sni=O.sni||O.peer,R.flow=O.flow,!R.flow&&_&&O.xtls){let P=[void 0,"xtls-rprx-direct","xtls-rprx-vision"][O.xtls];P&&(R.flow=P)}R["client-fingerprint"]=O.fp??O["client-fingerprint"],R.alpn=O.alpn?O.alpn.split(","):void 0,R["skip-cert-verify"]=/(TRUE)|1/i.test(O.allowInsecure)||i==="vless"&&O.allowInsecure==null&&O.insecure==="1",R._echConfigList=ya(O.ech);let T=Xg({echConfigList:O.ech});switch(T&&(R["ech-opts"]=T),R["tls-fingerprint"]=ya(O.pcs),R._vcn=O.vcn?.split(",").map(P=>P.trim()).filter(Boolean),R["name-cert-verify"]=R._vcn?.[0],R._h2=/(TRUE)|1/i.test(O.h2),`${O.packetEncoding||""}`.trim().toLowerCase()){case"none":R["packet-encoding"]="";break;case"packet":R["packet-encoding"]="packetaddr";break;default:R["packet-encoding"]="xudp";break}if(["reality"].includes(O.security)){let P={};if(O.pbk){P["public-key"]=O.pbk;let M=O["support-x25519mlkem768"];["1","t","T","true","TRUE","True"].includes(M)&&(P["support-x25519mlkem768"]=!0)}O.sid&&(P["short-id"]=O.sid),O.spx&&(P["_spider-x"]=O.spx),Object.keys(P).length>0&&(R[`${O.security}-opts`]=P)}let N=!1;if(R.network=O.type||"tcp",R.network==="tcp"&&O.headerType==="http"?R.network="http":R.network==="http"?R.network="h2":R.network==="httpupgrade"&&(R.network="ws",N=!0),!O.type&&_&&O.obfs&&(R.network=O.obfs,["none"].includes(R.network)&&(R.network="tcp")),["websocket"].includes(R.network)?R.network="ws":i==="vless"&&R.network==="splithttp"&&(R.network="xhttp"),R.network&&!["tcp","none"].includes(R.network)){let P={},M="",Y=O.host??O.obfsParam;if(Y){if(O.obfsParam)try{let te=JSON.parse(Y);P.headers=te}catch{P.headers={Host:Y}}else P.headers={Host:Y};["xhttp"].includes(R.network)&&P.headers?.Host&&(P.host=P.headers.Host,delete P.headers.Host,Object.keys(P.headers).length===0&&delete P.headers);let X=P.headers?.Host??P.headers?.host;["h2"].includes(R.network)&&X&&(P.host=XS(X),delete P.headers.Host,delete P.headers.host,Object.keys(P.headers).length===0&&delete P.headers)}if(O.serviceName?P[`${R.network}-service-name`]=O.serviceName:_&&O.path&&(["ws","http","h2","xhttp"].includes(R.network)||(P[`${R.network}-service-name`]=O.path,delete O.path)),O.path){let X=O.path;if(R.network==="ws"){let te=WS(X);X=te.path,M=te.ed}P.path=X}else R.network==="h2"&&(P.path="/");R.network==="http"&&O.method&&(P.method=O.method),["grpc"].includes(R.network)&&(P["_grpc-type"]=O.mode||"gun",O.authority&&(P["_grpc-authority"]=O.authority)),N&&(P["v2ray-http-upgrade"]=!0);let V=M||O.ed;if(V){let X=YS(V);N?(P["v2ray-http-upgrade-fast-open"]=!0,P["_v2ray-http-upgrade-ed"]=`${V}`):R.network==="ws"&&(P["max-early-data"]=X,P["early-data-header-name"]=O.eh||"Sec-WebSocket-Protocol")}if(O.eh&&(R.network==="ws"||N)&&(P["early-data-header-name"]=O.eh),Object.keys(P).length>0&&(R[`${R.network}-opts`]=P),R.network==="kcp"&&(O.seed&&(R.seed=O.seed),R.headerType=O.headerType||"none"),O.extra&&!["xhttp"].includes(R.network)&&(R._extra=O.extra),["xhttp"].includes(R.network)){let X={},te;try{X=O.extra?JSON.parse(O.extra):{}}catch{Q.error(`Failed to parse extra field as JSON: ${O.extra}`),te=O.extra}let ae={...R[`${R.network}-opts`]||{}};O.mode&&(ae.mode=O.mode),w(ae,X);let me=E(X?.downloadSettings);me&&(ae["download-settings"]=me),Object.keys(ae).length>0&&(R[`${R.network}-opts`]=ae),te!=null&&(R._extra=te);let he=y(X,{parsedDownloadSettings:me});he&&(R._extra_unsupported=he)}else O.mode&&(R._mode=O.mode)}if(i==="vmess"?(R.cipher=jr(O.encryption),R.alterId=0,delete R.flow):O.encryption&&(R.encryption=O.encryption),O.pqv&&(R._pqv=O.pqv),O.fm)try{let P=JSON.parse(O.fm);R._finalmask=ze(P)?P:O.fm}catch{R._finalmask=O.fm}return R}}}function iee(){return{name:"URI AnyTLS Parser",test:n=>/^anytls:\/\//.test(n),parse:n=>{let i=ZS().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 oee(){return{name:"URI Mieru Parser",test:n=>/^mierus:\/\//i.test(n),parse:n=>{let{content:i,fragment:o}=GS(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}=Qg(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 aee(){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=xd(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=Xg({echConfigList:E.ech});return F&&(w["ech-opts"]=F),w}}}function uee(){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 cee(){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 lee(){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 _=QQ(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 fee(){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=MS().parse(i);if(qe(o))try{l.name=decodeURIComponent(o)}catch(h){console.log(h)}return l}}}function hee(){return{name:"Clash Parser",test:n=>{let i;try{i=VS.default.parse(n)}catch{i=Rs.parse(n)}return!!i?.type},parse:n=>{let i;try{i=VS.default.parse(n)}catch{i=Rs.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 dee(){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 pee(){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 mee(){return{name:"QX VMess Parser",test:n=>/^vmess\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function gee(){return{name:"QX VLESS Parser",test:n=>/^vless\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function vee(){return{name:"QX AnyTLS Parser",test:n=>/^anytls\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function wee(){return{name:"QX Mieru Parser",test:n=>/^mieru\s*=/.test(n),parse:n=>pi().parse(n)}}function yee(){return{name:"QX Hysteria2 Parser",test:n=>/^hysteria2\s*=/.test(n),parse:n=>pi().parse(n)}}function Eee(){return{name:"QX Trojan Parser",test:n=>/^trojan\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function bee(){return{name:"QX HTTP Parser",test:n=>/^http\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function Aee(){return{name:"QX Socks5 Parser",test:n=>/^socks5\s*=/.test(n.split(",")[0].trim()),parse:n=>pi().parse(n)}}function See(){return{name:"Loon SS Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocks",parse:n=>_s().parse(n)}}function _ee(){return{name:"Loon SSR Parser",test:n=>n.split(",")[0].split("=")[1].trim().toLowerCase()==="shadowsocksr",parse:n=>_s().parse(n)}}var hx=/^[^=,]*=\s*vmess\s*,[^,]*,[^,]*,[^,]*,\s*"/i;function Cee(){return{name:"Loon VMess Parser",test:n=>hx.test(n),parse:n=>_s().parse(n)}}function Dee(){return{name:"Loon Vless Parser",test:n=>/^.*=\s*vless/i.test(n.split(",")[0]),parse:n=>_s().parse(n)}}function Fee(){return{name:"Loon Trojan Parser",test:n=>/^.*=\s*trojan/i.test(n.split(",")[0]),parse:n=>_s().parse(n)}}function Bee(){return{name:"Loon AnyTLS Parser",test:n=>/^.*=\s*anytls/i.test(n.split(",")[0]),parse:n=>_s().parse(n)}}function Iee(){return{name:"Loon Hysteria2 Parser",test:n=>/^.*=\s*Hysteria2/i.test(n.split(",")[0]),parse:n=>_s().parse(n)}}function xee(){return{name:"Loon HTTP Parser",test:n=>/^.*=\s*http/i.test(n.split(",")[0]),parse:n=>_s().parse(n)}}function $ee(){return{name:"Loon SOCKS5 Parser",test:n=>/^.*=\s*socks5/i.test(n.split(",")[0]),parse:n=>_s().parse(n)}}function Pee(){return{name:"Loon Tailscale Parser",test:n=>/^[^=,]*=\s*tailscale\s*(?:,|$)/i.test(n),parse:n=>_s().parse(n)}}function kee(){return{name:"Loon Mieru Parser",test:n=>/^[^=,]*=\s*mieru\s*,/i.test(n),parse:n=>_s().parse(n)}}function Ree(){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 Tee(){return{name:"Surge Direct Parser",test:n=>/^[^=,]*=\s*direct\s*$/i.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Oee(){return{name:"Surge AnyTLS Parser",test:n=>/^.*=\s*anytls/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Nee(){return{name:"Surge TrustTunnel Parser",test:n=>/^.*=\s*trust-tunnel/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Lee(){return{name:"Surge MASQUE Parser",test:n=>/^.*=\s*masque/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Uee(){return{name:"Surge HTTP/2 CONNECT Parser",test:n=>/^.*=\s*h2-connect/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Hee(){return{name:"Surge SSH Parser",test:n=>/^.*=\s*ssh/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Mee(){return{name:"Surge SS Parser",test:n=>/^.*=\s*ss/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function qee(){return{name:"Surge VMess Parser",test:n=>/^.*=\s*vmess/.test(n.split(",")[0])&&n.indexOf("username")!==-1&&!hx.test(n),parse:n=>Kr().parse(n)}}function jee(){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 Kee(){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 dx=/(^|,)\s*(fast-open|over-tls|tls-name|ip-mode|tls-cert-sha256|tls-pubkey-sha256|server-dns)\s*=/i;function Vee(){return{name:"Surge HTTP Parser",test:n=>/^.*=\s*https?/.test(n.split(",")[0])&&!dx.test(n),parse:n=>Kr().parse(n)}}function Gee(){return{name:"Surge Socks5 Parser",test:n=>/^.*=\s*socks5(-tls)?/.test(n.split(",")[0])&&!dx.test(n),parse:n=>Kr().parse(n)}}function zee(){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(Jee),i}}}function Wee(){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()))?_s():Kr()).parse(n)}}}function Yee(){return{name:"Surge Tuic Parser",test:n=>/^.*=\s*tuic(-v5)?/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Xee(){return{name:"Surge WireGuard Parser",test:n=>/^.*=\s*wireguard/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Zee(){return{name:"Surge Hysteria2 Parser",test:n=>/^.*=\s*hysteria2/.test(n.split(",")[0]),parse:n=>Kr().parse(n)}}function Jee(e){return _r(e)||Xt(e)}var px=[eee(),tee(),ree(),nee(),see(),ZS(),cee(),lee(),uee(),aee(),fee(),iee(),oee(),hee(),Tee(),Oee(),Nee(),Lee(),Uee(),Hee(),Mee(),qee(),jee(),Kee(),Vee(),Wee(),Yee(),Xee(),Zee(),Gee(),zee(),See(),_ee(),Cee(),Dee(),Iee(),Fee(),Bee(),xee(),$ee(),Ree(),Pee(),kee(),dee(),pee(),mee(),gee(),vee(),wee(),yee(),Eee(),bee(),Aee()];var yx=B(KS());var Qee={encrypt:oA,decrypt:Vf,derivePublicKey:lI};function ete(e){for(let t of Rg)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 tte(e){e=ete(e);let t=e.split(`
`),r=[],n=o=>{for(let s of Array.isArray(o)?o:[o])r.push(lte(s))},i;for(let o of t){if(o=o.trim(),o.length===0)continue;let s=!1;if(i){let[a,u]=vx(i,o);u||(n(a),s=!0)}if(!s)for(let a of px){let[u,l]=vx(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))bm(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 Ex(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 rte(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(NA(u.type)){Q.log(`Skipping response transformer during proxy/file processing: "${u.type}" with arguments:
>>> ${JSON.stringify(u.args,null,2)||"None"}`);continue}if(Ex(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 bx(u,s)),!Cp[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=Cp[u.type](l,r,h,n,i,a):m=Cp[u.type](u.args||{},s),e=await WI(m,e)}return e}async function nte(e,t=[],r,n,i,o={}){let s={},a=mx(e);for(let u of t){if(!NA(u.type))continue;if(Ex(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 bx(u,o);Q.log(`Applying "${u.type}" with arguments:
>>> ${JSON.stringify(u.args,null,2)||"None"}`);let m=Cp[u.type](l,r,h,n,i,s);a=mx(await zI(m,a))}return a}async function bx(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"?am:$c,s=ni(Q.read(o),i);if(!s)throw new Error(`\u627E\u4E0D\u5230 ${n}: ${i}`);n==="module"?script=s.content:script=await Oa({type:"file",name:i,noFlow:executionContext.noFlow})}catch(i){throw Q.error(`Error when loading ${n}: ${item.args.content}.
Reason: ${i}`),new Error(`\u65E0\u6CD5\u52A0\u8F7D ${n}: ${e}`)}}else if(e?.startsWith("/"))try{script=mo().readFileSync(e.split("#")[0],"utf8")}catch(n){throw Q.error(`Error when reading local script: ${item.args.content}.
Reason: ${n}`),new Error(`\u65E0\u6CD5\u4ECE\u8BE5\u8DEF\u5F84\u8BFB\u53D6\u811A\u672C\u6587\u4EF6: ${e}`)}else try{script=await Yn(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 mx(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 gx(e){return e.replace(/[=,]/g,"").replace(/(^|\s)(?:[#;]|\/\/)+/g,"$1").trim()}function ste(e,t,r,n={}){let i=r7[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(!Gg(a,t))return!1;let u=n["include-unsupported-proxy"];if(!u&&a.supported&&a.supported[t]===!1)return!1;if(!u&&ite(a)&&ote(a)&&!ate(a,t))return Q.error(`Target platform ${t} does not support headers for ${ute(a)} proxy ${a.name||`${a.server}:${a.port}`}. Proxy has been filtered.`),!1;if(!u&&eh(a)&&!["qx","quantumultx","shadowrocket"].includes(o))return!1;if(["vless","vmess"].includes(a.type)){bm(a.uuid)||Q.warn(`UUID may be invalid: ${a.name} ${a.uuid}`);let h=a.type==="vless",m=h?[["reality-opts",a["reality-opts"]],["xhttp download-settings reality-opts",a["xhttp-opts"]?.["download-settings"]?.["reality-opts"]]]:[];for(let[d,v]of m)if(v&&!qe(v["public-key"])){if(d==="xhttp download-settings reality-opts"&&qe(a["reality-opts"]?.["public-key"])&&v["public-key"]==="")continue;return Q.error(`Skipping VLESS Reality proxy ${a.name}: empty ${d}.public-key`),!1}let p=a["xhttp-opts"];if(h&&a.network==="xhttp"&&p?.mode==="stream-one"&&p["download-settings"])return Q.error(`Skipping VLESS xhttp proxy ${a.name}: mode "stream-one" cannot be used with download-settings`),!1}return!0}),e=e.map(a=>(a._resolved=a.resolved,s&&typeof a.name=="string"&&(a.name=gx(a.name)),qe(a.name)||(a.name=`${a.type} ${a.server}:${a.port}`),a["disable-sni"]&&(["surge","surgemac","shadowrocket"].includes(o)||o==="surfboard"&&a.type==="vless"?a.sni="off":!["tuic"].includes(a.type)&&!["sing-box","singbox"].includes(o)&&(Q.error(`Target platform ${t} does not support sni off. As a workaround for mihomo, proxy ${a.name} sni will be set to IP instead`),a.sni=S2(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=xd(a.ports))),a.type==="wireguard"&&Fp(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(Ip().produce({name:gx(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 ite(e){return e?.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0}function ote(e){return["http","h2-connect","trusttunnel"].includes(e?.type)}function ate(e,t){let r=`${t}`.toLowerCase();return r.startsWith("surge")?["http","h2-connect","trusttunnel"].includes(e.type):r==="egern"||["clashmeta","clash.meta","meta","mihomo"].includes(r)||["singbox","sing-box"].includes(r)?e.type==="http":r==="json"?["http","h2-connect","trusttunnel"].includes(e.type):!1}function ute(e){return e.type==="http"?e.tls?"HTTPS":"HTTP":e.type==="h2-connect"?"HTTP/2 CONNECT":e.type==="trusttunnel"?"TrustTunnel":e.type}var Rt={parse:tte,process:rte,processResponse:nte,produce:ste,age:Qee,ipAddress:Em,getRandomPort:xd,isIPv4:_r,isIPv6:Xt,isIP:S2,yaml:Rs,getFlag:Wf,removeFlag:Ep,getISO:AI,MMDB:Ng,Gist:bf,download:Yn,downloadFile:bI,isValidUUID:bm,doh:PA,Buffer:A2.Buffer,Base64:bt,JSON5:yx.default,hex_md5:Ur};function vx(e,t){if(!cte(e,t))return[null,new Error("Parser mismatch")];try{return[e.parse(t),null]}catch(r){return[null,r]}}function cte(e,t){try{return e.test(t)}catch{return!1}}function wx(e){if(typeof e=="string"||typeof e=="number"){if(e=String(e).trim(),e==="")return"/";if(!e.startsWith("/"))return"/"+e}return e}function lte(e){let t=(a,u)=>Object.prototype.hasOwnProperty.call(a,u),r=a=>{if(!(!a||typeof a!="object"||Array.isArray(a)))for(let u of Object.keys(a)){let l=u.toLowerCase();u!==l&&(t(a,l)||(a[l]=a[u]),delete a[u])}};for(let a of Object.keys(e)){let u=a.toLowerCase();u.endsWith("-opts")&&(a!==u&&(t(e,u)||(e[u]=e[a]),delete e[a]),r(e[u]))}let n=a=>{let u=a?.["reality-opts"];qe(u?.["public-key"])&&!t(u,"support-x25519mlkem768")&&["safari-ios-26","chrome147"].includes(`${a._loon_tls_profile||""}`.trim())&&(u["support-x25519mlkem768"]=!0)};if(n(e),e.network==="xhttp"&&n(e["xhttp-opts"]?.["download-settings"]),e.udp=![!1,0,"0","false","off"].includes(typeof e.udp=="string"?e.udp.toLowerCase():e.udp),typeof e.cipher=="string"&&(e.cipher=e.cipher.toLowerCase()),typeof e.password=="number"&&(e.password=J8(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),Z8(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=>wx(a)):o!=null&&(e[`${e.network}-opts`].path=wx(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&&!S2(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&&!S2(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=A2.Buffer.from(e.name.data).toString("utf8"):e.name=A2.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"]=IC.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)),Fp(e)),e}function S2(e){return _r(e)||Xt(e)}var jo="",_2=typeof $resource<"u"?$resource:"",Ax=typeof $resourceType<"u"?$resourceType:"",ch=typeof $resourceUrl<"u"?$resourceUrl:"";(async()=>{console.log(`
\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505
Sub-Store -- v${Mg}
Loon -- ${$loon}
\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505\u2505
`);let e;typeof $argument<"u"?typeof $argument=="string"?e=Object.fromEntries($argument.split("&").map(o=>o.split("="))):e=$argument:e={},console.log(`arg: ${uA(JSON.stringify(e))}`);let t=e?.[Kf],r=t?{[Kf]:t}:void 0,n=async o=>t?await Vf(o,t):o,i={PROXY:1,RULE:2};if(e.resourceUrlOnly||(jo=t&&aA(_2)?"":_2),Ax===i.PROXY){if(!e.resourceUrlOnly)try{let o=await n(_2),s=Rt.parse(o);jo=Rt.produce(s,"Loon",void 0,{"include-unsupported-proxy":e?.includeUnsupportedProxy})}catch(o){console.log("\u89E3\u6790\u5668: \u4F7F\u7528 resource \u51FA\u73B0\u9519\u8BEF"),console.log(o.message??o)}if((!jo||/^\s*$/.test(jo))&&ch){console.log(`\u89E3\u6790\u5668: \u5C1D\u8BD5\u4ECE ${ch} \u83B7\u53D6\u8BA2\u9605`);try{let o=await Yn(ch,e?.ua,e?.timeout,void 0,void 0,void 0,e?.noCache,!0,r),s=Rt.parse(o);jo=Rt.produce(s,"Loon",void 0,{"include-unsupported-proxy":e?.includeUnsupportedProxy})}catch(o){console.log(o.message??o)}}}else if(Ax===i.RULE){if(!e.resourceUrlOnly)try{let o=await n(_2),s=Aa.parse(o);jo=Aa.produce(s,"Loon")}catch(o){console.log(o.message??o)}if((!jo||/^\s*$/.test(jo))&&ch){console.log(`\u89E3\u6790\u5668: \u5C1D\u8BD5\u4ECE ${ch} \u83B7\u53D6\u89C4\u5219`);try{let o=await Yn(ch,e?.ua,e?.timeout,void 0,void 0,void 0,void 0,void 0,r),s=Aa.parse(o);jo=Aa.produce(s,"Loon")}catch(o){console.log(o.message??o)}}}})().catch(async e=>{console.log("\u89E3\u6790\u5668: \u51FA\u73B0\u9519\u8BEF"),console.log(e.message??e)}).finally(()=>{$done(jo||"")});})();
/*! 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) *)
*/